Skip to content

Commit 673294d

Browse files
authored
chore: add e2e test for updating theme (#16897)
1 parent 564b387 commit 673294d

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { expect, test } from "@playwright/test";
2+
import { users } from "../../constants";
3+
import { login } from "../../helpers";
4+
import { beforeCoderTest } from "../../hooks";
5+
6+
test.beforeEach(({ page }) => {
7+
beforeCoderTest(page);
8+
});
9+
10+
test("adjust user theme preference", async ({ page }) => {
11+
await login(page, users.member);
12+
13+
await page.goto("/settings/appearance", { waitUntil: "domcontentloaded" });
14+
15+
await page.getByText("Light", { exact: true }).click();
16+
await expect(page.getByLabel("Light")).toBeChecked();
17+
18+
// Make sure the page is actually updated to use the light theme
19+
const [root] = await page.$$("html");
20+
expect(await root.evaluate((it) => it.className)).toContain("light");
21+
22+
await page.goto("/", { waitUntil: "domcontentloaded" });
23+
24+
// Make sure the page is still using the light theme after reloading and
25+
// navigating away from the settings page.
26+
const [homeRoot] = await page.$$("html");
27+
expect(await homeRoot.evaluate((it) => it.className)).toContain("light");
28+
});

site/e2e/tests/workspaces/createWorkspace.spec.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import {
55
createTemplate,
66
createWorkspace,
77
echoResponsesWithParameters,
8+
login,
89
openTerminalWindow,
910
requireTerraformProvisioner,
1011
verifyParameters,
1112
} from "../../helpers";
12-
import { login } from "../../helpers";
1313
import { beforeCoderTest } from "../../hooks";
1414
import {
1515
fifthParameter,
@@ -150,9 +150,7 @@ test("create workspace with disable_param search params", async ({ page }) => {
150150
await login(page, users.member);
151151
await page.goto(
152152
`/templates/${templateName}/workspace?disable_params=first_parameter,second_parameter`,
153-
{
154-
waitUntil: "domcontentloaded",
155-
},
153+
{ waitUntil: "domcontentloaded" },
156154
);
157155

158156
await expect(page.getByLabel(/First parameter/i)).toBeDisabled();
@@ -173,9 +171,7 @@ test.skip("create docker workspace", async ({ context, page }) => {
173171
// The workspace agents must be ready before we try to interact with the workspace.
174172
await page.waitForSelector(
175173
`//div[@role="status"][@data-testid="agent-status-ready"]`,
176-
{
177-
state: "visible",
178-
},
174+
{ state: "visible" },
179175
);
180176

181177
// Wait for the terminal button to be visible, and click it.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy