-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve cypress branding tests #2085
base: main
Are you sure you want to change the base?
Conversation
- Many tests now ensure that branding logo images are displayed to the user in various stages of the branding flows - Added support for calling the API and clearing cache keys - Reimplemented pre-existing tests for the review-pool page that were blocked due to not having a reliable, non-hacky way of clearing redis cache keys. - Removed the ClearCachePage as it is no longer needed
🧪 Review environmenthttps://q7blrjmipelk3eljgurpnhe3me0pppej.lambda-url.ca-central-1.on.aws/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general these tests look great. A few issues with the state of the service/org not being what the tests expect though. And I'm pretty sure we're missing a couple of values in the .env.json (see below)
TemplatePreview: () => cy.getByTestId("template-preview").shadow().find('img'), | ||
BrandPreviewImage: () => cy.getByTestId('template-preview').shadow().find('img'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BrandPreviewImage
seems to be the same thing as TemplatePreview
- was that on purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely not, thanks for catching my clearly degrading attention to detail.
CreateCacheClearJWT: () => { | ||
const jwt = require('jsrsasign'); | ||
const claims = { | ||
'iss': Cypress.env('CACHE_CLEAR_USER_NAME'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the following are missing from the cypress.env.json
during github CI:
CACHE_CLEAR_USER_NAME
CACHE_CLEAR_CLIENT_SECRET
context("General page functionality", () => { | ||
it("Loads review pool page", () => { | ||
cy.contains("h1", "Select another logo").should("be.visible"); | ||
ReviewPoolPage.Components.AvailableLogos().each((element) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test presupposes that some custom logos are already there. In my setup, I don't have any and this fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea you're right, I didn't consider differences in DB state per dev. I went purely off of the service/org/branding relationships that we have in staging. I'm not sure how we rectify this without migration scripts to keep the cypress data consistent across our environments.
// BrandingSettings.Components.StatusBanner().should("be.visible"); | ||
// }); | ||
// }); | ||
context("Service's org has no custom branding", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test fails for me but I probably don't have something setup as expected, not sure exactly yet though.
); | ||
}); | ||
|
||
it("Displays a list of available logos", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test fails for me but I probably don't have something setup as expected, not sure exactly yet though.
- Change default org to one with custom branding
Summary | Résumé
This PR improves our cypress branding tests, particularly around checking for logo images.
Test instructions | Instructions pour tester la modification
Tests pass