Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: add e2e test for updating theme #16897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions site/e2e/tests/users/userSettings.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { expect, test } from "@playwright/test";
import { users } from "../../constants";
import { login } from "../../helpers";
import { beforeCoderTest } from "../../hooks";

test.beforeEach(({ page }) => {
beforeCoderTest(page);
});

test("adjust user theme preference", async ({ page }) => {
await login(page, users.member);

await page.goto("/settings/appearance", { waitUntil: "domcontentloaded" });

await page.getByText("Light", { exact: true }).click();
await expect(page.getByLabel("Light")).toBeChecked();

// Make sure the page is actually updated to use the light theme
const [root] = await page.$$("html");
expect(await root.evaluate((it) => it.className)).toContain("light");

await page.goto("/", { waitUntil: "domcontentloaded" });

// Make sure the page is still using the light theme after reloading and
// navigating away from the settings page.
const [homeRoot] = await page.$$("html");
expect(await homeRoot.evaluate((it) => it.className)).toContain("light");
});
10 changes: 3 additions & 7 deletions site/e2e/tests/workspaces/createWorkspace.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import {
createTemplate,
createWorkspace,
echoResponsesWithParameters,
login,
openTerminalWindow,
requireTerraformProvisioner,
verifyParameters,
} from "../../helpers";
import { login } from "../../helpers";
import { beforeCoderTest } from "../../hooks";
import {
fifthParameter,
Expand Down Expand Up @@ -150,9 +150,7 @@ test("create workspace with disable_param search params", async ({ page }) => {
await login(page, users.member);
await page.goto(
`/templates/${templateName}/workspace?disable_params=first_parameter,second_parameter`,
{
waitUntil: "domcontentloaded",
},
{ waitUntil: "domcontentloaded" },
);

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

// Wait for the terminal button to be visible, and click it.
Expand Down
Loading