some fixes and refactors
This commit is contained in:
parent
ead8a566d0
commit
75cfc6c928
16 changed files with 381 additions and 425 deletions
|
|
@ -100,7 +100,10 @@ test.describe("Counter - Authenticated", () => {
|
|||
|
||||
// Second user increments
|
||||
await page2.click("text=Increment");
|
||||
await expect(page2.locator("h1")).toHaveText(String(page2InitialValue + 1));
|
||||
// Wait for counter to update - use >= because parallel tests may also increment
|
||||
await expect(page2.locator("h1")).not.toHaveText(String(page2InitialValue));
|
||||
const page2AfterIncrement = Number(await page2.locator("h1").textContent());
|
||||
expect(page2AfterIncrement).toBeGreaterThanOrEqual(page2InitialValue + 1);
|
||||
|
||||
// First user reloads and sees the increment (value should be >= what page2 has)
|
||||
await page.reload();
|
||||
|
|
|
|||
|
|
@ -237,17 +237,17 @@ test.describe("Profile - Validation", () => {
|
|||
await expect(page.locator("#telegram")).toHaveValue("@testhandle");
|
||||
});
|
||||
|
||||
test("shows error for telegram handle that is too short", async ({ page }) => {
|
||||
test("shows error for telegram handle with no characters after @", async ({ page }) => {
|
||||
await page.goto("/profile");
|
||||
|
||||
// Enter telegram with @ but too short (needs 5+ chars)
|
||||
await page.fill("#telegram", "@ab");
|
||||
// Enter telegram with @ but nothing after (needs at least 1 char)
|
||||
await page.fill("#telegram", "@");
|
||||
|
||||
// Wait for debounced validation
|
||||
await page.waitForTimeout(600);
|
||||
|
||||
// Should show error about length
|
||||
await expect(page.getByText(/at least 5 characters/i)).toBeVisible();
|
||||
// Should show error about needing at least one character
|
||||
await expect(page.getByText(/at least one character after @/i)).toBeVisible();
|
||||
|
||||
// Save button should be disabled
|
||||
const saveButton = page.getByRole("button", { name: /save changes/i });
|
||||
|
|
@ -271,15 +271,22 @@ test.describe("Profile - Validation", () => {
|
|||
test("can fix validation error and save", async ({ page }) => {
|
||||
await page.goto("/profile");
|
||||
|
||||
// Enter invalid telegram
|
||||
await page.fill("#telegram", "noat");
|
||||
await expect(page.getByText(/must start with @/i)).toBeVisible();
|
||||
// Enter invalid telegram (just @ with no handle)
|
||||
await page.fill("#telegram", "@");
|
||||
|
||||
// Wait for debounced validation
|
||||
await page.waitForTimeout(600);
|
||||
|
||||
await expect(page.getByText(/at least one character after @/i)).toBeVisible();
|
||||
|
||||
// Fix it
|
||||
await page.fill("#telegram", "@validhandle");
|
||||
|
||||
// Wait for debounced validation
|
||||
await page.waitForTimeout(600);
|
||||
|
||||
// Error should disappear
|
||||
await expect(page.getByText(/must start with @/i)).not.toBeVisible();
|
||||
await expect(page.getByText(/at least one character after @/i)).not.toBeVisible();
|
||||
|
||||
// Should be able to save
|
||||
const saveButton = page.getByRole("button", { name: /save changes/i });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue