From 6ef3da9abd0ac4976c8f8b0ba1962e58204c7e3e Mon Sep 17 00:00:00 2001 From: Amir Raminfar Date: Mon, 15 Aug 2022 13:00:49 -0700 Subject: [PATCH] Adds dark mode --- e2e/cypress/e2e/dozzle_dark.cy.js | 16 ++++------------ e2e/cypress/plugins/index.js | 26 -------------------------- 2 files changed, 4 insertions(+), 38 deletions(-) delete mode 100644 e2e/cypress/plugins/index.js diff --git a/e2e/cypress/e2e/dozzle_dark.cy.js b/e2e/cypress/e2e/dozzle_dark.cy.js index 30f090e3..34340488 100644 --- a/e2e/cypress/e2e/dozzle_dark.cy.js +++ b/e2e/cypress/e2e/dozzle_dark.cy.js @@ -1,20 +1,12 @@ /// -context.skip("Dozzle dark mode", { baseUrl: Cypress.env("DOZZLE_DEFAULT") }, () => { +context("Dozzle dark mode", { baseUrl: Cypress.env("DOZZLE_DEFAULT") }, () => { beforeEach(() => { - Cypress.on("window:before:load", (win) => { - cy.stub(win, "matchMedia") - .withArgs("(prefers-color-scheme: dark)") - .returns({ - matches: true, - }) - .as("dark-media-query"); - }); - - cy.visit("/", {}); + cy.visit("/"); + cy.window().then((win) => win.document.documentElement.setAttribute("data-theme", "dark")); }); it("home screen", () => { - cy.get("li.running", { timeout: 10000 }).removeDates().matchImage(); + cy.get("li.running", { timeout: 10000 }).removeDates().replaceSkippedElements().matchImage(); }); }); diff --git a/e2e/cypress/plugins/index.js b/e2e/cypress/plugins/index.js deleted file mode 100644 index a5d22241..00000000 --- a/e2e/cypress/plugins/index.js +++ /dev/null @@ -1,26 +0,0 @@ -/// -// *********************************************************** -// This example plugins/index.js can be used to load plugins -// -// You can change the location of this file or turn off loading -// the plugins file with the 'pluginsFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/plugins-guide -// *********************************************************** - -// This function is called when a project is opened or re-opened (e.g. due to -// the project's config changing) - -const { addMatchImageSnapshotPlugin } = require("cypress-image-snapshot/plugin"); - -/** - * @type {Cypress.PluginConfig} - */ -// eslint-disable-next-line no-unused-vars -module.exports = (on, config) => { - // `on` is used to hook into various events Cypress emits - // `config` is the resolved Cypress config - - addMatchImageSnapshotPlugin(on, config); -};