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

[Files] Change to dark theme and go back to light theme test #2162

Merged
merged 7 commits into from
Jun 3, 2022

Conversation

juans-chainsafe
Copy link
Contributor

closes #2141

@juans-chainsafe juans-chainsafe added the Type: Maintenance Added to issues and PRs when a change is for repository maintenance , such as CI or linter changes. label Jun 1, 2022
@juans-chainsafe juans-chainsafe self-assigned this Jun 1, 2022
@render
Copy link

render bot commented Jun 1, 2022

@juans-chainsafe juans-chainsafe changed the title [Files] Change to dark theme and go bakc to light theme test [Files] Change to dark theme and go back to light theme test Jun 1, 2022
@render
Copy link

render bot commented Jun 1, 2022

@render
Copy link

render bot commented Jun 1, 2022

Copy link
Collaborator

@Tbaut Tbaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test checks whether the local storage string is set or not, but whether or not this actually reflect on the UI, and that it does switch to dark/light mode is not tested. I didn't look in details how to do this, but I'm pretty sure we could check things like the background color of a div for instance.

@juans-chainsafe
Copy link
Contributor Author

This test checks whether the local storage string is set or not, but whether or not this actually reflect on the UI, and that it does switch to dark/light mode is not tested. I didn't look in details how to do this, but I'm pretty sure we could check things like the background color of a div for instance.

yes, you are right, and we do this validation as well:
settingsPage.darkThemeLabel().get("div").should("have.class", "checked")
to check that the div of the dark theme has the class "checked"

But we don't really check the UI (we though with Andrew of checking a background color but if that changes, the test will fail, but well, maybe those color hardly ever change) I will add that validation

@Tbaut
Copy link
Collaborator

Tbaut commented Jun 2, 2022

yup, if the test fails, then we'll fix it, it should be easy enough

@juans-chainsafe
Copy link
Contributor Author

juans-chainsafe commented Jun 2, 2022

yup, if the test fails, then we'll fix it, it should be easy enough

changes uploaded! I validated the change of color in the display header

      //this is when it change to dark
      settingsPage.displayTabHeader().should("have.css", "color", "rgb(219, 219, 219)")
      
      //this is when it change to light
      settingsPage.displayTabHeader().should("have.css", "color", "rgb(15, 15, 15)")

@@ -24,6 +24,12 @@ export const settingsPage = {
setUsernameButton: () => cy.get("[data-cy=button-set-username]"),
usernamePresentInput: () => cy.get("[data-cy=input-profile-username-present]"),

// display tab
displayTabButton: () => cy.get("[data-testid=tab-display]"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going by what @Tbaut mentioned here: #2122 (comment)

We should use data-cy instead of testid on elements like buttons and only use testid if data-cy doesn't work. Data-cy should work for this button.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly didn't work with data-cy :(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, well that's fair enough then. It's valid usage 👍

displayTabButton: () => cy.get("[data-testid=tab-display]"),
displayTabHeader: () => cy.get("[data-cy=label-display-header]"),
darkThemeLabel: () => cy.get("[data-testid=radio-input-dark-theme]"),
lightThemeLabel: () => cy.get("[data-testid=radio-input-light-theme]"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 These ones make sense though as I've never successfully got data-cy working with radio inputs

Copy link
Member

@asnaith asnaith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome Juan, nice to have test coverage for this functionality :)

Copy link
Collaborator

@Tbaut Tbaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great one 🏴

@Tbaut Tbaut merged commit 4235479 into dev Jun 3, 2022
@Tbaut Tbaut deleted the mnt/add-change-to-dark-theme-test-2141 branch June 3, 2022 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Maintenance Added to issues and PRs when a change is for repository maintenance , such as CI or linter changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Files] Add change to dark theme test
4 participants