-
Notifications
You must be signed in to change notification settings - Fork 2
TIDY-432 #520
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
TIDY-432 #520
Changes from 2 commits
3320b48
54f2ed5
d2464e9
8b2a8ce
c8b0b40
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,221 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { test, expect } from "@playwright/test"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ensureInAppOnHome, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| openLibraryAndTab, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LibraryTab, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| selectFirstTwoViaContextMenu, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| createTwoCollections, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getBulkEditBar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from "../../utils/helpers"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const runtimeEnv = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| globalThis as { process?: { env?: Record<string, string | undefined> } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).process?.env; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test.skip( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runtimeEnv?.SKIP_E2E === "1", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "E2E suite disabled by environment" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test.describe("collection - bulk editor @regression", () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test.beforeEach(async ({ page }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.route("**/*", (route) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const reqUrl = route.request().url(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (/accounts\.google\.com/i.test(reqUrl)) route.abort(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else route.continue(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test("select multiple collections via context menu - bulk edit bar appears and shows count", async ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test.setTimeout(90_000); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await ensureInAppOnHome(page); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await createTwoCollections(page); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await openLibraryAndTab(page, LibraryTab.Collections); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await selectFirstTwoViaContextMenu(page, "records-container"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.getByText(/Selected: 2 collections?/i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toBeVisible({ timeout: 10_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const bar = getBulkEditBar(page); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(bar).toBeVisible({ timeout: 5_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(bar.getByRole("button", { name: /^Star$/i })).toBeVisible(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(bar.getByRole("button", { name: /^Archive$/i })).toBeVisible(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(bar.getByRole("button", { name: /^Delete$/i })).toBeVisible(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test("select multiple collections - clear selection hides bulk edit bar", async ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test.setTimeout(90_000); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await ensureInAppOnHome(page); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await createTwoCollections(page); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await openLibraryAndTab(page, LibraryTab.Collections); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await selectFirstTwoViaContextMenu(page, "records-container"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.getByText(/Selected: 2 collections?/i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toBeVisible({ timeout: 10_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await getBulkEditBar(page) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .getByRole("button", { name: /Clear selection/i }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .click({ timeout: 5_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.getByText(/Selected: 2 collections?/i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toBeHidden({ timeout: 5_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+65
to
+67
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests should assert the bar disappears, not only the old label. Each of these paths only waits for Also applies to: 103-105, 182-184, 218-220 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test("select multiple collections - Star shows success toast, clears selection, and collections are starred", async ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test.setTimeout(90_000); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await ensureInAppOnHome(page); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await createTwoCollections(page); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await openLibraryAndTab(page, LibraryTab.Collections); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const urlStarred = new URL(page.url()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| urlStarred.searchParams.set("starred", "1"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.goto(urlStarred.toString(), { waitUntil: "domcontentloaded" }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.waitForTimeout(1_500); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const starredThumbnailsBefore = page.locator( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "#records-container div[id^='thumbnail-']" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.locator("#records-container").waitFor({ state: "visible", timeout: 10_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const starredCountBefore = await starredThumbnailsBefore.count(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const urlCollections = new URL(page.url()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| urlCollections.searchParams.delete("starred"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.goto(urlCollections.toString(), { waitUntil: "domcontentloaded" }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.waitForTimeout(1_500); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await selectFirstTwoViaContextMenu(page, "records-container"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.getByText(/Selected: 2 collections?/i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toBeVisible({ timeout: 10_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await getBulkEditBar(page) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .getByRole("button", { name: /^Star$/i }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .click({ timeout: 5_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.getByText(/Starred 2 collections? successfully/i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toBeVisible({ timeout: 10_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.getByText(/Selected: 2 collections?/i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toBeHidden({ timeout: 5_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.goto(urlStarred.toString(), { waitUntil: "domcontentloaded" }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.waitForTimeout(1_500); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const thumbnails = page.locator("#records-container div[id^='thumbnail-']"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(thumbnails.first()).toBeVisible({ timeout: 10_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(thumbnails).toHaveCount(starredCountBefore + 2, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| timeout: 5_000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const starIconsInStarredView = page.locator( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "#records-container div[id^='thumbnail-'] .text-yellow-400" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(starIconsInStarredView).toHaveCount(starredCountBefore + 2, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| timeout: 5_000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test("select multiple collections - Select all keeps bar visible with count", async ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test.setTimeout(90_000); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await ensureInAppOnHome(page); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await createTwoCollections(page); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await openLibraryAndTab(page, LibraryTab.Collections); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await selectFirstTwoViaContextMenu(page, "records-container"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.getByText(/Selected: 2 collections?/i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toBeVisible({ timeout: 10_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await getBulkEditBar(page) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .getByRole("button", { name: /Select all/i }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .click({ timeout: 5_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.getByText(/Selected: \d+ collections?/i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cubic-dev-ai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toBeVisible({ timeout: 5_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+131
to
+146
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In a clean library Suggested tightening const container = page.locator("#records-container");
const thumbnails = container.locator('div[id^="thumbnail-"]');
await expect(thumbnails.first()).toBeVisible({ timeout: 10_000 });
const totalCount = await thumbnails.count();
+ expect(totalCount).toBeGreaterThan(2);
await selectFirstTwoViaContextMenu(page, "records-container");
await expect(
page.getByText(/Selected: 2 collections?/i)
).toBeVisible({ timeout: 10_000 });
await getBulkEditBar(page)
.getByRole("button", { name: /Select all/i })
.click({ timeout: 5_000 });
- await expect(
- page.getByText(new RegExp(`Selected: ${totalCount} collections?`, "i"))
- ).toBeVisible({ timeout: 5_000 });
+ await expect(getBulkEditBar(page)).toContainText(`Selected: ${totalCount}`);📝 Committable suggestion
Suggested change
🧰 Tools🪛 ast-grep (0.41.0)[warning] 144-144: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns. (regexp-from-variable) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test("select multiple collections - Archive shows success toast, clears selection, and collections are archived", async ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test.setTimeout(90_000); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await ensureInAppOnHome(page); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await createTwoCollections(page); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await openLibraryAndTab(page, LibraryTab.Collections); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const urlArchived = new URL(page.url()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| urlArchived.searchParams.set("archived", "1"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.goto(urlArchived.toString(), { waitUntil: "domcontentloaded" }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.waitForTimeout(1_500); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const archivedThumbnailsBefore = page.locator( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "#records-container div[id^='thumbnail-']" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.locator("#records-container").waitFor({ state: "visible", timeout: 10_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const archivedCountBefore = await archivedThumbnailsBefore.count(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const urlCollections = new URL(page.url()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| urlCollections.searchParams.delete("archived"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.goto(urlCollections.toString(), { waitUntil: "domcontentloaded" }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.waitForTimeout(1_500); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await selectFirstTwoViaContextMenu(page, "records-container"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.getByText(/Selected: 2 collections?/i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toBeVisible({ timeout: 10_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await getBulkEditBar(page) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .getByRole("button", { name: /^Archive$/i }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .click({ timeout: 5_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.getByText(/Archived 2 collections? successfully/i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toBeVisible({ timeout: 10_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.getByText(/Selected: 2 collections?/i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toBeHidden({ timeout: 5_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.goto(urlArchived.toString(), { waitUntil: "domcontentloaded" }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.waitForTimeout(1_500); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const thumbnails = page.locator("#records-container div[id^='thumbnail-']"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(thumbnails.first()).toBeVisible({ timeout: 10_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(thumbnails).toHaveCount(archivedCountBefore + 2, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| timeout: 5_000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test("select multiple collections - Delete shows success toast and clears selection", async ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test.setTimeout(90_000); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await ensureInAppOnHome(page); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await createTwoCollections(page); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await openLibraryAndTab(page, LibraryTab.Collections); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const recordsContainer = page.locator("#records-container"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const thumbnailsBefore = recordsContainer.locator("div[id^='thumbnail-']"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const countBefore = await thumbnailsBefore.count(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await selectFirstTwoViaContextMenu(page, "records-container"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.getByText(/Selected: 2 collections?/i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toBeVisible({ timeout: 10_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await getBulkEditBar(page) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .getByRole("button", { name: /^Delete$/i }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .click({ timeout: 5_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.getByText(/Deleted 2 collections? successfully/i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toBeVisible({ timeout: 10_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| page.getByText(/Selected: 2 collections?/i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toBeHidden({ timeout: 5_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.waitForTimeout(1_500); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const thumbnailsAfter = recordsContainer.locator("div[id^='thumbnail-']"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(thumbnailsAfter).toHaveCount(countBefore - 2, { timeout: 10_000 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,12 @@ | ||
| import { test } from "@playwright/test"; | ||
| import { ensureInAppOnHome } from "../../../utils/helpers"; | ||
| import { test, expect } from "@playwright/test"; | ||
| import { | ||
| ensureInAppOnHome, | ||
| openLibraryAndTab, | ||
| LibraryTab, | ||
| selectFirstTwoViaContextMenu, | ||
| createTwoGoals, | ||
| getBulkEditBar | ||
| } from "../../../utils/helpers"; | ||
|
|
||
| const runtimeEnv = ( | ||
| globalThis as { process?: { env?: Record<string, string | undefined> } } | ||
|
|
@@ -19,8 +26,84 @@ test.describe("goal - bulk editor @regression", () => { | |
| }); | ||
| }); | ||
|
|
||
| test.skip("bulk edit goals (select multiple, apply action)", async ({ page }) => { | ||
| test("select multiple goals via context menu - bulk edit bar appears and shows count", async ({ | ||
| page | ||
| }) => { | ||
| test.setTimeout(90_000); | ||
| await ensureInAppOnHome(page); | ||
| // TODO: select multiple goals in library, open bulk editor, apply action and assert | ||
| await createTwoGoals(page); | ||
| await openLibraryAndTab(page, LibraryTab.Goals); | ||
|
|
||
| await selectFirstTwoViaContextMenu(page, "records-container"); | ||
|
|
||
| await expect( | ||
| page.getByText(/Selected: 2 goals?/i) | ||
| ).toBeVisible({ timeout: 10_000 }); | ||
| }); | ||
|
|
||
| test("select multiple goals - clear selection hides bulk edit bar", async ({ | ||
| page | ||
| }) => { | ||
| test.setTimeout(90_000); | ||
| await ensureInAppOnHome(page); | ||
| await createTwoGoals(page); | ||
| await openLibraryAndTab(page, LibraryTab.Goals); | ||
|
|
||
| await selectFirstTwoViaContextMenu(page, "records-container"); | ||
| await expect( | ||
| page.getByText(/Selected: 2 goals?/i) | ||
| ).toBeVisible({ timeout: 10_000 }); | ||
|
|
||
| await getBulkEditBar(page) | ||
| .getByRole("button", { name: /Clear selection/i }) | ||
| .click({ timeout: 5_000 }); | ||
| await expect(page.getByText(/Selected: 2 goals?/i)).toBeHidden({ | ||
| timeout: 5_000 | ||
| }); | ||
|
Comment on lines
+57
to
+62
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assert the bulk-edit bar is hidden after the action. These checks only prove the Also applies to: 84-86 🤖 Prompt for AI Agents |
||
| }); | ||
|
|
||
| test("select multiple goals - Star shows success toast and clears selection", async ({ | ||
| page | ||
| }) => { | ||
| test.setTimeout(90_000); | ||
| await ensureInAppOnHome(page); | ||
| await createTwoGoals(page); | ||
| await openLibraryAndTab(page, LibraryTab.Goals); | ||
|
|
||
| await selectFirstTwoViaContextMenu(page, "records-container"); | ||
| await expect( | ||
| page.getByText(/Selected: 2 goals?/i) | ||
| ).toBeVisible({ timeout: 10_000 }); | ||
|
|
||
| await getBulkEditBar(page) | ||
| .getByRole("button", { name: /^Star$/i }) | ||
| .click({ timeout: 5_000 }); | ||
| await expect( | ||
| page.getByText(/Starred 2 goals? successfully/i) | ||
| ).toBeVisible({ timeout: 10_000 }); | ||
| await expect(page.getByText(/Selected: 2 goals?/i)).toBeHidden({ | ||
| timeout: 5_000 | ||
| }); | ||
| }); | ||
|
|
||
| test("select multiple goals - Select all keeps bar visible with count", async ({ | ||
| page | ||
| }) => { | ||
| test.setTimeout(90_000); | ||
| await ensureInAppOnHome(page); | ||
| await createTwoGoals(page); | ||
| await openLibraryAndTab(page, LibraryTab.Goals); | ||
|
|
||
| await selectFirstTwoViaContextMenu(page, "records-container"); | ||
| await expect( | ||
| page.getByText(/Selected: 2 goals?/i) | ||
| ).toBeVisible({ timeout: 10_000 }); | ||
|
|
||
| await getBulkEditBar(page) | ||
| .getByRole("button", { name: /Select all/i }) | ||
| .click({ timeout: 5_000 }); | ||
| await expect(page.getByText(/Selected: \d+ goals?/i)).toBeVisible({ | ||
| timeout: 5_000 | ||
| }); | ||
|
||
| }); | ||
| }); | ||
Uh oh!
There was an error while loading. Please reload this page.