Skip to content

test: fix url checks in e2e tests #12881

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 8 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
🤪
  • Loading branch information
aslilac committed Apr 11, 2024
commit 3b4c28f421718bc6e4ab1ebdb7f323cb2ede6aeb
3 changes: 2 additions & 1 deletion site/e2e/global.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect, test } from "@playwright/test";
import { Language } from "pages/CreateUserPage/CreateUserForm";
import * as constants from "./constants";
import { storageState } from "./playwright.config";
import { expectUrl } from "./expectUrl";

test("setup deployment", async ({ page }) => {
await page.goto("/", { waitUntil: "domcontentloaded" });
Expand All @@ -12,7 +13,7 @@ test("setup deployment", async ({ page }) => {
await page.getByLabel(Language.passwordLabel).fill(constants.password);
await page.getByTestId("create").click();

await expect(page).toHaveURL(/\/workspaces.*/);
await expectUrl(page).toHavePathName("/workspaces");
await page.context().storageState({ path: storageState });

await page.getByTestId("button-select-template").isVisible();
Expand Down
5 changes: 3 additions & 2 deletions site/e2e/tests/updateTemplate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
requiresEnterpriseLicense,
updateTemplateSettings,
} from "../helpers";
import { expectUrl } from "../expectUrl";

test("template update with new name redirects on successful submit", async ({
page,
Expand All @@ -25,7 +26,7 @@ test("add and remove a group", async ({ page }) => {
await page.goto(`/templates/${templateName}/settings/permissions`, {
waitUntil: "domcontentloaded",
});
await expect(page).toHaveURL(
await expectUrl(page).toHavePathName(
`/templates/${templateName}/settings/permissions`,
);

Expand Down Expand Up @@ -55,7 +56,7 @@ test("require latest version", async ({ page }) => {
await page.goto(`/templates/${templateName}/settings`, {
waitUntil: "domcontentloaded",
});
await expect(page).toHaveURL(`/templates/${templateName}/settings`);
await expectUrl(page).toHavePathName(`/templates/${templateName}/settings`);
let checkbox = await page.waitForSelector("#require_active_version");
await checkbox.click();
await page.getByTestId("form-submit").click();
Expand Down
1 change: 1 addition & 0 deletions site/src/pages/CreateTokenPage/CreateTokenForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export const CreateTokenForm: FC<CreateTokenFormProps> = ({

{lifetimeDays === "custom" && (
<TextField
data-chromatic="ignore"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this is 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

someone let a leaky date sneak in to chromatic again, so I'm muting it 😅

type="date"
label="Expires on"
defaultValue={dayjs().add(expDays, "day").format("YYYY-MM-DD")}
Expand Down