-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cypress e2e Test - Verify links in the Manifest Directory (#3570)
* Initial WIP version of resource creation test * Experimental changes to poll the UI for updates * Working version if resource is present * increase card timeout and delete active wait * Added changes to find namespace from variables * Final changes to read variables, cleaned up utils * Small change to a comment * Dummy change to trigger mocks * Save changes on cypress-RHOAIENG-12649 * Changed file directories and names as requested on a PR comment * Saving changes to current branch * Additional directory/file name changes * Additional changes to save * Resolving timeout issue breaking mock tests, also resolved latest PR comments * Further changes for this test * Changes to revert the exist method appended to getCardView. * Fixed linting * Linting fixes * Final comments added * Fixed merge conflict * Small change to page object name * dummy commit * Removed RHOAI bug workaround * Removed comments * Last comment change * initial working commit, manifest dir is read but error in validating * additional debugging stuff * Comitting working version of the test which contains exclusions. Note, these wil be removed in the next commit * Draft commit * Committing working test - second version. Expanded the grep to find http and also nested elements * Removed commented URLs that were excluded. Raised bugs and linked to https://issues.redhat.com/browse/RHOAIENG-9235 * Fixed hardcoded local path * Making changes requested to pull excluded URLs from fixtures and extract a function to utils * Dummy change to kick off mocks * Dummy change to kick off Mock tests --------- Co-authored-by: Fede Alonso <[email protected]>
- Loading branch information
1 parent
5331d69
commit 4510b81
Showing
5 changed files
with
157 additions
and
2 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/$ |
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
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