cypress best practices updated

This commit is contained in:
Owen Rees
2023-06-20 08:42:03 +02:00
parent ffbc8db21d
commit f1ef7cd3f2
13 changed files with 60 additions and 91 deletions
+5 -5
View File
@@ -10,17 +10,17 @@ describe("ThemeSwitcher component", () => {
cy.wait(100);
// checking that the toggle is there and light mode is active
cy.get(".toggle").should("exist");
cy.get(".toggle").should(($toggle) => {
cy.get("[data-cy='toggle']").should("exist");
cy.get("[data-cy='toggle']").should(($toggle) => {
const backgroundImage = $toggle.css("background-image");
expect(backgroundImage).to.include(
"linear-gradient(rgb(0, 255, 255), rgb(135, 206, 235)"
);
});
// checking that the toggle is clickable and dark mode is active
cy.get(".toggle").click();
cy.get(".toggle-dark").should("exist");
cy.get(".toggle-dark").should(($toggle) => {
cy.get("[data-cy='toggle']").click();
cy.get("[data-cy='toggle-dark']").should("exist");
cy.get("[data-cy='toggle-dark']").should(($toggle) => {
const backgroundImage = $toggle.css("background-image");
expect(backgroundImage).to.include(
"linear-gradient(rgb(25, 25, 112), rgb(102, 51, 153)"