Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -6,7 +6,6 @@ import { escapeRegExp, interceptCurrentRoutePost, postDataIncludesField } from "
|
||||
const forgotForm = '[data-ui-id="ui.auth.forgot.form"], form';
|
||||
const forgotEmailInput = '[data-ui-id="ui.auth.forgot.email"], input[name="email"]';
|
||||
const forgotResetButton = '[data-ui-id="ui.auth.forgot.submit"], button[name="mode"][value="reset"]';
|
||||
const forgotMagicLinkButton = '[data-ui-id="ui.auth.forgot.magicLinkSubmit"], button[name="mode"][value="magic"]';
|
||||
const resetForm = '[data-ui-id="ui.auth.reset.form"], form';
|
||||
const resetEmailInput = '[data-ui-id="ui.auth.reset.email"], input[type="email"], input[name="email"], input#email';
|
||||
const resetPasswordInput = '[data-ui-id="ui.auth.reset.password"], input[name="password"]';
|
||||
@@ -21,7 +20,7 @@ test.describe("forgot-password page a11y", () => {
|
||||
});
|
||||
}
|
||||
|
||||
test("submits reset and magic-link requests without account enumeration", async ({ page }) => {
|
||||
test("submits reset requests without account enumeration", async ({ page }) => {
|
||||
await page.goto("/forgot-password", { waitUntil: "domcontentloaded" });
|
||||
|
||||
const form = page.locator(forgotForm).first();
|
||||
@@ -33,10 +32,6 @@ test.describe("forgot-password page a11y", () => {
|
||||
await form.locator(forgotEmailInput).fill("unknown-e2e-user@example.invalid");
|
||||
await form.locator(forgotResetButton).click();
|
||||
await expect(page.getByText(/if an account exists|wenn es ein konto/iu)).toBeVisible({ timeout: 5_000 });
|
||||
|
||||
await form.locator(forgotEmailInput).fill("unknown-e2e-magic@example.invalid");
|
||||
await form.locator(forgotMagicLinkButton).click();
|
||||
await expect(page.getByText(/if an account exists|wenn es ein konto/iu)).toBeVisible({ timeout: 5_000 });
|
||||
});
|
||||
|
||||
test("submits reset-token form with csrf and token fields without mutating data", async ({ page }) => {
|
||||
@@ -58,35 +53,18 @@ test.describe("forgot-password page a11y", () => {
|
||||
await expect(confirmInput).toBeEditable();
|
||||
await expect(submit).toBeEnabled();
|
||||
|
||||
let resolveSubmitted!: (formData: URLSearchParams) => void;
|
||||
const submitted = new Promise<URLSearchParams>((resolve) => {
|
||||
resolveSubmitted = resolve;
|
||||
});
|
||||
await page.route("**/*", async (route) => {
|
||||
const request = route.request();
|
||||
const requestUrl = new URL(request.url());
|
||||
if (request.method() !== "POST" || requestUrl.pathname !== "/reset") {
|
||||
await route.continue();
|
||||
return;
|
||||
}
|
||||
|
||||
resolveSubmitted(new URLSearchParams(request.postData() ?? ""));
|
||||
await route.fulfill({
|
||||
status: 204,
|
||||
body: "",
|
||||
});
|
||||
});
|
||||
const submitted = await interceptCurrentRoutePost(page, { status: 204 });
|
||||
|
||||
await passwordInput.fill("LongEnough1!");
|
||||
await confirmInput.fill("LongEnough1!");
|
||||
await submit.click();
|
||||
|
||||
const formData = await submitted;
|
||||
expect(formData.get("csrf") ?? "").not.toBe("");
|
||||
expect(formData.get("verify-token")).toBe("dummy-token");
|
||||
expect(formData.get("email")).toBe("contract@example.test");
|
||||
expect(formData.get("password")).toBe("LongEnough1!");
|
||||
expect(formData.get("password-confirm")).toBe("LongEnough1!");
|
||||
await expect.poll(() => submitted.value, { timeout: 5_000 }).not.toBeNull();
|
||||
expect(postDataIncludesField(submitted.value, "csrf", /.+/u)).toBe(true);
|
||||
expect(postDataIncludesField(submitted.value, "verify-token", /^dummy-token$/u)).toBe(true);
|
||||
expect(postDataIncludesField(submitted.value, "email", /^contract@example\.test$/u)).toBe(true);
|
||||
expect(postDataIncludesField(submitted.value, "password", /^LongEnough1!$/u)).toBe(true);
|
||||
expect(postDataIncludesField(submitted.value, "password-confirm", /^LongEnough1!$/u)).toBe(true);
|
||||
});
|
||||
|
||||
test("shows an accessible error for an invalid reset token without losing context", async ({ page }) => {
|
||||
@@ -110,36 +88,32 @@ test.describe("forgot-password page a11y", () => {
|
||||
test.describe("forgot-password mobile contract a11y", () => {
|
||||
test.use({ viewport: narrowMobileViewport, isMobile: true, hasTouch: true });
|
||||
|
||||
test("posts reset and magic-link contracts on mobile without sending mail", async ({ page }) => {
|
||||
for (const mode of [
|
||||
{ button: forgotResetButton, email: "mobile-reset-contract@example.invalid", value: "reset" },
|
||||
{ button: forgotMagicLinkButton, email: "mobile-magic-contract@example.invalid", value: "magic" },
|
||||
] as const) {
|
||||
await page.goto("/forgot-password", { waitUntil: "domcontentloaded" });
|
||||
test("posts the reset contract on mobile without sending mail", async ({ page }) => {
|
||||
const email = "mobile-reset-contract@example.invalid";
|
||||
await page.goto("/forgot-password", { waitUntil: "domcontentloaded" });
|
||||
|
||||
const form = page.locator(forgotForm).first();
|
||||
const emailInput = form.locator(forgotEmailInput).first();
|
||||
const submitButton = form.locator(mode.button).first();
|
||||
await expect(form).toBeVisible();
|
||||
await expect(emailInput).toBeVisible();
|
||||
await expect(submitButton).toBeVisible();
|
||||
const form = page.locator(forgotForm).first();
|
||||
const emailInput = form.locator(forgotEmailInput).first();
|
||||
const submitButton = form.locator(forgotResetButton).first();
|
||||
await expect(form).toBeVisible();
|
||||
await expect(emailInput).toBeVisible();
|
||||
await expect(submitButton).toBeVisible();
|
||||
|
||||
await emailInput.fill(mode.email);
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
await emailInput.fill(email);
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
|
||||
const submitted = await interceptCurrentRoutePost(page, {
|
||||
status: 200,
|
||||
body: "<!doctype html><title>Forgot password intercepted</title>",
|
||||
contentType: "text/html",
|
||||
});
|
||||
await submitButton.click();
|
||||
await expect.poll(() => submitted.value, { timeout: 5_000 }).not.toBeNull();
|
||||
const submitted = await interceptCurrentRoutePost(page, {
|
||||
status: 200,
|
||||
body: "<!doctype html><title>Forgot password intercepted</title>",
|
||||
contentType: "text/html",
|
||||
});
|
||||
await submitButton.click();
|
||||
await expect.poll(() => submitted.value, { timeout: 5_000 }).not.toBeNull();
|
||||
|
||||
expect(postDataIncludesField(submitted.value, "csrf", /.+/u)).toBe(true);
|
||||
expect(postDataIncludesField(submitted.value, "email", new RegExp(`^${escapeRegExp(mode.email)}$`, "u"))).toBe(true);
|
||||
expect(postDataIncludesField(submitted.value, "mode", new RegExp(`^${mode.value}$`, "u"))).toBe(true);
|
||||
await page.unroute("**/*");
|
||||
}
|
||||
expect(postDataIncludesField(submitted.value, "csrf", /.+/u)).toBe(true);
|
||||
expect(postDataIncludesField(submitted.value, "email", new RegExp(`^${escapeRegExp(email)}$`, "u"))).toBe(true);
|
||||
expect(postDataIncludesField(submitted.value, "mode", /^reset$/u)).toBe(true);
|
||||
await page.unroute("**/*");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user