adding visual tests coverage on cloud credential #16322
adding visual tests coverage on cloud credential #16322a-arias merged 1 commit intorancher:masterfrom
Conversation
|
These should be atomic, both the |
|
Another possibility would be adding a helper method to the cloud credential page object and call that. |
I agree with @izaac. setUserPreference and percySnapshot should be atomic, each in its own it block. I think we need to be more consistent with these Percy tests. In some cases, the Percy tests are embedded within other tests, and others have their own describe/it block. In my opinion, each visual test should be in its own it block within a dedicated describe block (e.g., describe('Visual Testing', ...)). Good pattern (isolated): Not so good pattern (embedded in other tests): |
@izaac i like this idea but I think a custom command would be better than a page object method because it would be easier to maintain and update across all visual tests |
|
I'm inclined to less maintenance too. |
e913cf5 to
b468cf6
Compare
|
@yonasberhe23 @izaac I added the own describe blocks for the percy visual test for cloud credentials, please review again |
| cy.hideElementBySelector('[data-testid="nav_header_showUserMenu"]'); | ||
| // Ignoring the side navbar counters | ||
| cy.hideElementBySelector("[data-testid='type-count']"); | ||
| // Ignoring the side cluster menu | ||
| cy.hideElementBySelector("[ data-testid='top-level-menu-cluster-1']"); | ||
| // takes percy snapshot. | ||
| cy.percySnapshot('empty cloud credential creation page'); |
There was a problem hiding this comment.
@a-arias could you follow up on what's proposed in this comment? #16322 (comment)
Encapsulating this in a custom command would be preferable than inline invocation.
| before(() => { | ||
| cy.login(); | ||
| // Clean up any orphaned Amazon cloud credentials from previous test runs to ensure tests start with a clean state | ||
| cy.getRancherResource('v3', 'cloudcredentials', null, null).then((resp: Cypress.Response<any>) => { | ||
| const body = resp.body; | ||
|
|
||
| if (body.pagination['total'] > 0) { | ||
| body.data.forEach((item: any) => { | ||
| if (item.amazonec2credentialConfig) { | ||
| const id = item.id; | ||
|
|
||
| cy.deleteRancherResource('v3', 'cloudcredentials', id, false); | ||
| } else { | ||
| cy.log('There are no existing amazon cloud credentials to delete'); | ||
| } | ||
| }); | ||
| } | ||
| }); | ||
| }); |
There was a problem hiding this comment.
I dont think we need this here
| after(() => { | ||
| for (let i = 0; i < doCreatedCloudCredsIds.length; i++) { | ||
| cy.deleteRancherResource('v3', `cloudcredentials`, doCreatedCloudCredsIds[i]); | ||
| } | ||
|
|
||
| for (let i = 0; i < azCreatedCloudCredsIds.length; i++) { | ||
| cy.deleteRancherResource('v3', `cloudcredentials`, azCreatedCloudCredsIds[i]); | ||
| } | ||
| }); |
There was a problem hiding this comment.
I dont think we need this here
09bc0cd to
ce5ada5
Compare
| }); | ||
| Cypress.Commands.add('hideElementBySelector', (selector:string) => { | ||
| cy.get(selector).invoke('css', 'opacity', '0'); | ||
| Cypress.Commands.add('hideElementBySelector', (...selectors: string[]) => { |
Summary
Fixes #1825
Fixes rancher/qa-tasks#1825
Occurred changes and/or fixed issues
Technical notes summary
Areas or cases that should be tested
Areas which could experience regressions
Screenshot/Video
Checklist
Admin,Standard UserandUser Base