2022-03-04 21:07:35 +03:00
|
|
|
context("cookies", () => {
|
|
|
|
it("shows no preference message when no cookie", () => {
|
|
|
|
cy.clearCookies();
|
|
|
|
cy.visit("/cookie-test");
|
|
|
|
cy.contains("No dark mode preference set");
|
|
|
|
});
|
|
|
|
|
|
|
|
it("saves session cookie", () => {
|
|
|
|
cy.setCookie("dark-mode", "true");
|
|
|
|
cy.visit("/cookie-test");
|
|
|
|
cy.contains("Dark mode: true");
|
|
|
|
});
|
2022-10-07 19:54:11 +03:00
|
|
|
|
|
|
|
it("gives error when route doesn't match", () => {
|
|
|
|
cy.clearCookies();
|
|
|
|
cy.visit("http://localhost:1234/dark-mode");
|
|
|
|
cy.contains("Current mode: Light Mode");
|
|
|
|
cy.get('button').click()
|
|
|
|
cy.contains("Current mode: Dark Mode");
|
|
|
|
});
|
2022-03-04 21:07:35 +03:00
|
|
|
});
|