forked from opendatahub-io/odh-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into cypress-RHOAIENG-16748
- Loading branch information
Showing
4 changed files
with
155 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...end/src/__tests__/cypress/cypress/fixtures/e2e/dashboardNavigation/testManifestLinks.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# testManifestLinks.cy.ts Test Data # | ||
excludedSubstrings: | ||
- my-project-s2i-python-service | ||
- clusterip/ | ||
- ClusterIP | ||
- s2i-python-service | ||
- user-dev-rhoam-quarkus | ||
- project-simple | ||
- example.apps | ||
- localhost | ||
- console-openshift-console.apps.test-cluster.example.com/ | ||
- console-openshift-console.apps.test-cluster.example.com | ||
- repo.anaconda.cloud/repo/t/$ |
44 changes: 44 additions & 0 deletions
44
frontend/src/__tests__/cypress/cypress/tests/e2e/dashboardNavigation/testManifestLinks.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import * as yaml from 'js-yaml'; | ||
import { isUrlExcluded } from '~/__tests__/cypress/cypress/utils/urlExtractor'; | ||
|
||
describe('Verify that all the URLs referenced in the Manifest directory are operational', () => { | ||
let excludedSubstrings: string[]; | ||
|
||
// Setup: Load test data | ||
before(() => { | ||
cy.fixture('e2e/dashboardNavigation/testManifestLinks.yaml', 'utf8').then((yamlString) => { | ||
const yamlData = yaml.load(yamlString) as { excludedSubstrings: string[] }; | ||
excludedSubstrings = yamlData.excludedSubstrings; | ||
}); | ||
}); | ||
|
||
it('Reads the manifest directory, filters out test/sample URLs and validates the remaining URLs', () => { | ||
const manifestsDir = '../../../../manifests'; | ||
cy.log(`Resolved manifests directory: ${manifestsDir}`); | ||
|
||
// Extract URLs from the manifests directory using the registered task | ||
cy.task<string[]>('extractHttpsUrls', manifestsDir).then((urls) => { | ||
// Filter out Sample/Test URLs | ||
const filteredUrls = urls.filter((url) => !isUrlExcluded(url, excludedSubstrings)); | ||
|
||
// Log filtered URLs for debugging | ||
filteredUrls.forEach((url) => { | ||
cy.log(url); | ||
}); | ||
|
||
// Verify that each remaining URL is accessible and returns a 200 status code | ||
cy.step( | ||
'Verify that each filtered URL is accessible and that a 200 is returned - currently failing due to issues linked RHOAIENG-9235', | ||
); | ||
filteredUrls.forEach((url) => { | ||
cy.request(url).then((response) => { | ||
const { status } = response; | ||
const logMessage = | ||
status === 200 ? `✅ ${url} - Status: ${status}` : `❌ ${url} - Status: ${status}`; | ||
cy.log(logMessage); | ||
expect(status).to.eq(200); // Assert that the response status is 200 | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters