E2E fixtures (#2747)

This commit is contained in:
Omar López authored and GitHub committed 2022-05-13 21:02:10 -06:00
1 parent 68e275ab07
commit 2bb6f33112
21 files changed
+491 -428

No files matched your search

@@ -1,11 +1,16 @@
import { expect, test } from "@playwright/test";
import { expect } from "@playwright/test";
test("Can reset forgotten password", async ({ page }) => {
import { test } from "../lib/fixtures";
test("Can reset forgotten password", async ({ page, users }) => {
const user = await users.create();
const newPassword = `${user.username!}-123`;
// Got to reset password flow
await page.goto("/auth/forgot-password");
await page.waitForSelector("text=Forgot Password");
// Fill [placeholder="[email protected]"]
await page.fill('input[name="email"]', "pro@example.com");
await page.fill('input[name="email"]', `${user.username}@example.com`);
// Press Enter
await Promise.all([
@@ -18,7 +23,7 @@ test("Can reset forgotten password", async ({ page }) => {
// Wait for page to fully load
await page.waitForSelector("text=Reset Password");
// Fill input[name="password"]
await page.fill('input[name="password"]', "pro");
await page.fill('input[name="password"]', newPassword);
// Click text=Submit
await page.click('button[type="submit"]');
@@ -33,10 +38,12 @@ test("Can reset forgotten password", async ({ page }) => {
await Promise.all([page.waitForNavigation({ url: "/auth/login" }), page.click('button:has-text("Login")')]);
// Fill input[name="email"]
await page.fill('input[name="email"]', "pro@example.com");
await page.fill('input[name="password"]', "pro");
await page.fill('input[name="email"]', `${user.username}@example.com`);
await page.fill('input[name="password"]', newPassword);
await page.press('input[name="password"]', "Enter");
await page.waitForSelector("[data-testid=dashboard-shell]");
await expect(page.locator("[data-testid=dashboard-shell]")).toBeVisible();
await users.deleteAll();
});