Skip to content

Commit

Permalink
test: enable mixed dashboards test
Browse files Browse the repository at this point in the history
  • Loading branch information
Zanna_37 committed Feb 22, 2023
1 parent 9ff0417 commit 6a3bf3b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions tests/dashboards/mixed-dashboards.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { test, expect } from "@playwright/test";
import { SwipeHelper } from "../helpers/touchHelpers";

test.skip("should update config", async ({ page }) => {
// TODO solve this
test.fail(true, "Bug https://github.com/zanna-37/hass-swipe-navigation/issues/12");
test("should update config", async ({ page, isMobile }) => {
test.skip(isMobile ?? false, 'Sidebar is hidden on mobile, can\'t click easily');

// Use default config
await page.goto("/default-values");
await expect(page).toHaveURL("/default-values/0");

const consoleLogs: string[] = [];
page.on("console", (message) => {
consoleLogs.push(message.text());
});

// Change page
await page.getByText(/No wrap/).click();

Expand All @@ -22,5 +26,10 @@ test.skip("should update config", async ({ page }) => {
await SwipeHelper.swipeRight(haAppLayout);
await expect(page).toHaveURL(dashboardPath + "/0");

// TODO test if the console prints "Configuration read"
let matches = 0;
const regexp = /.*Config values have changed.*/;
for (const log of consoleLogs) {
if (regexp.test(log)) { matches++; }
}
expect(matches).toBe(1);
});

0 comments on commit 6a3bf3b

Please sign in to comment.