Skip to content
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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

whabanks
Copy link
Contributor

Summary | Résumé

This PR improves our cypress branding tests, particularly around checking for logo images.

  • 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

Test instructions | Instructions pour tester la modification

Tests pass

- 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
Copy link

Copy link
Member

@andrewleith andrewleith left a 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)

Comment on lines 4 to 5
TemplatePreview: () => cy.getByTestId("template-preview").shadow().find('img'),
BrandPreviewImage: () => cy.getByTestId('template-preview').shadow().find('img'),
Copy link
Member

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?

Copy link
Contributor Author

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'),
Copy link
Member

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) => {
Copy link
Member

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.

Copy link
Contributor Author

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", () => {
Copy link
Member

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", () => {
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants