Skip to content

Commit

Permalink
safer cypress code
Browse files Browse the repository at this point in the history
  • Loading branch information
a2937 authored and raisedadead committed Aug 20, 2024
1 parent dc008d8 commit fa7fccb
Showing 1 changed file with 13 additions and 31 deletions.
44 changes: 13 additions & 31 deletions cypress/e2e/english/landing/landing.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,40 +38,22 @@ describe('Landing', () => {
});

it('Clicking the menu button should open the menu', function () {
cy.get(selectors.menuButton)
.should('be.visible')
.click()
.then(() => {
cy.get(selectors.menu).should('be.visible');
});
cy.get(selectors.menuButton).should('be.visible').click();
cy.get(selectors.menu).should('be.visible');
});

it('The menu should be able to change the theme', function () {
cy.get(selectors.menuButton)
.click()
.then(() => {
cy.get(selectors.menu).should('be.visible');
cy.get(selectors.darkModeButton)
.click()
.then(() => {
cy.get('body').should('have.class', 'dark-mode');
cy.get(selectors.siteNavLogo)
.click()
.then(() => {
cy.get(selectors.menu).should('not.be.visible');
cy.get(selectors.menuButton)
.click()
.then(() => {
cy.get(selectors.menu).should('be.visible');
cy.get(selectors.darkModeButton)
.click()
.then(() => {
cy.get('body').should('not.have.class', 'dark-mode');
});
});
});
});
});
cy.get(selectors.menuButton).click();
cy.get(selectors.menu).should('be.visible');
cy.get(selectors.darkModeButton).click();

cy.get('body').should('have.class', 'dark-mode');
cy.get(selectors.siteNavLogo).click();
cy.get(selectors.menu).should('not.be.visible');
cy.get(selectors.menuButton).click();
cy.get(selectors.menu).should('be.visible');
cy.get(selectors.darkModeButton).click();
cy.get('body').should('not.have.class', 'dark-mode');
});

it("should show the author's profile image", () => {
Expand Down

0 comments on commit fa7fccb

Please sign in to comment.