Files
multica/e2e/settings.spec.ts
DimaS 2f24057bc2 feat(issues): add date filter (#4129)
Co-authored-by: “646826” <“646826@gmail.com”>
2026-06-16 08:38:53 +08:00

41 lines
1.6 KiB
TypeScript

import { test, expect } from "@playwright/test";
import { loginAsDefault, waitForPageText } from "./helpers";
test.describe("Settings", () => {
test("updating workspace name reflects in sidebar immediately", async ({
page,
}) => {
const workspaceSlug = await loginAsDefault(page);
// Read the current workspace name from the sidebar
const sidebarName = page.getByRole("button", { name: /E2E Workspace/ }).first();
const originalName = (await sidebarName.innerText()).split("\n").pop()?.trim() ?? "E2E Workspace";
await page.goto(`/${workspaceSlug}/settings?tab=workspace`, { waitUntil: "domcontentloaded" });
await waitForPageText(page, "General");
// Change workspace name
const nameInput = page
.locator('input[type="text"]')
.first();
await nameInput.clear();
const newName = "Renamed WS " + Date.now();
await nameInput.fill(newName);
// Save
await page.locator("button", { hasText: "Save" }).click();
await expect(page.getByText("Workspace settings saved").first()).toBeVisible({ timeout: 5000 });
// Sidebar should reflect the new name WITHOUT page refresh
await expect(page.getByRole("button", { name: new RegExp(newName) }).first()).toBeVisible();
// Restore original name so other tests aren't affected
await nameInput.clear();
await nameInput.fill(originalName.trim());
await page.locator("button", { hasText: "Save" }).click();
await expect(page.getByText("Workspace settings saved").first()).toBeVisible({ timeout: 5000 });
await expect(page.getByRole("button", { name: new RegExp(originalName) }).first()).toBeVisible();
});
});