Skip to content

fix: e2e tests#348

Merged
Producdevity merged 39 commits into
stagingfrom
fix/e2e-tests
May 10, 2026
Merged

fix: e2e tests#348
Producdevity merged 39 commits into
stagingfrom
fix/e2e-tests

Conversation

@Producdevity

@Producdevity Producdevity commented May 8, 2026

Copy link
Copy Markdown
Owner

Description

Fixes # (issue)

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactor
  • Other (please describe):

How Has This Been Tested?

  • Local build
  • Lint
  • Typecheck
  • Unit tests
  • Manual testing

Screenshots (if applicable)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • I have checked that all checks (lint, typecheck, test) pass

Notes for reviewers

Summary by CodeRabbit

  • New Features

    • Escape closes multi-select dropdown, clears search, and returns focus to the trigger.
    • Success-rate visuals expose ARIA progress info for improved screen-reader support.
  • Tests

    • Central shared test fixtures added; many end-to-end tests now use them.
    • New tests for multi-select Escape behavior and a cookie-consent test helper.
  • Chores

    • Test runner loads local env overrides earlier and CI test script adjusted.
    • Seeders updated to reconcile users/games; removed unused test config constant.

@vercel

vercel Bot commented May 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
emuready Error Error May 9, 2026 8:58pm

Request Review

@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This PR centralizes Playwright cookie-consent into a helper and fixtures module, loads .env.local earlier in Playwright config, migrates tests to shared fixtures, refactors helpers/data flows and page objects, adds MultiSelect Escape handling and tests, improves progressbar ARIA, and reconciles seeders and related tests.

Changes

Playwright Test Infrastructure Consolidation

Layer / File(s) Summary
Configuration & Environment
playwright.config.ts
Loads .env.local before .env.test.local to ensure local environment overrides are available during configuration.
Cookie-Consent Helper
tests/helpers/cookie-consent.ts
New helper module exports registerCookieConsent() that sets localStorage consent flags and hides consent UI via CSS injection and MutationObserver; requires NEXT_PUBLIC_LOCAL_STORAGE_PREFIX.
Shared Fixtures Module
tests/fixtures.ts
Extends Playwright's test with a page fixture that auto-registers cookie-consent before each test; re-exports expect.
Auth Setup & Page Objects
tests/auth.setup.ts, tests/pages/BasePage.ts, tests/pages/AuthPage.ts
Auth setup now calls registerCookieConsent(page.context()); BasePage no longer injects cookie-consent init script and only stores the Playwright Page; consolidated imports updated.
Helpers & Data Factory
tests/helpers/data-factory.ts, tests/helpers/test-config.ts
Replaces inline cookie-consent initScript with registerCookieConsent(ctx) in helpers; createPcListing uses candidate-driven creation, returns created listing URL; OS selection targets select[name="Operating System"]; removed exported TEST_CONFIG.
Test Import Migration
tests/*.spec.ts (many files)
Migrates numerous Playwright test files to import test and expect from ./fixtures instead of @playwright/test.
Filtering & Misc Test Updates
tests/filtering.spec.ts, various specs
selectFirstFilterOption now dismisses the filter dropdown after selection; adds Escape key dismissal test and other minor assertion/locator updates.
Component Keyboard & Tests
src/components/ui/form/MultiSelect.tsx, src/components/ui/form/MultiSelect.test.tsx
Adds closeDropdown and handleDropdownKeyDown to close dropdown on Escape (clears search and focuses trigger) and adds Vitest tests asserting Escape behavior and focus restoration.
Accessibility: Progress bars
src/components/ui/SuccessRateBar.tsx, src/components/ui/VoteButtons.tsx
Adds role="progressbar" and ARIA attributes (aria-label, aria-valuenow, aria-valuemin, aria-valuemax, aria-valuetext) to expose success-rate to assistive tech.
PC Voting & Trust Tests
tests/pc-voting.spec.ts, tests/trust-integration.spec.ts, tests/voting.spec.ts
Tests now assert progressbar numeric aria-valuenow range and apply conditional aria-pressed logic; trust integration uses ensureApprovedPcListing to obtain a direct listing URL.
Seeder & Test Data
prisma/seeders/usersSeeder.ts, prisma/seeders/gamesSeeder.ts, src/server/api/routers/pcListings.test.ts
Users seeder reconciles Clerk and DB using upsert with unified error handling and reconciliation logs; games seeder adds normalizedTitle for approved games and expands seeded submitter emails; pcListings test imports PcOs and uses PcOs.WINDOWS.
Data-setup Changes
tests/data-setup.spec.ts
Data-setup tests use ensureApprovedPcListing helper; data-factory helpers updated accordingly to return listing URL used by tests.
CI & Scripts
.github/workflows/e2e-tests.yml, package.json
Removes DEBUG env from E2E workflow step; updates test:e2e:ci to include DISABLE_RATE_LIMIT=true.
Misc Cleanup
tests/pages/*, various specs
Small comment removals, helper renames (desktopPaginationControls), and small assertion/locator cleanups across tests and page objects.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through test corridors bright,
Registering consent and fixtures just right,
Escape closes menus and focus returns,
Seeders reconcile while the test runner learns —
Hooray for tidy tests and fewer late-night frights.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description follows the template structure but leaves critical sections largely unchecked and empty, with no concrete issue reference, testing confirmation, or reviewer notes. Complete the description by: checking which items were tested, providing specific issue number(s) if applicable, confirming all CI checks pass, and adding notes explaining the refactoring scope and cookie consent consolidation strategy.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title "fix: e2e tests" is vague and does not convey specific information about the primary changes in this comprehensive refactoring. Consider using a more specific title that highlights the main focus, such as "fix: centralize cookie consent setup and refactor e2e test fixtures" or "refactor: consolidate e2e test infrastructure and cookie consent handling".
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/e2e-tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/voting.spec.ts (1)

98-109: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

should display progress bar for success rate is now a duplicate of should display success rate percentage and voter count.

After this change, both tests make exactly the same two assertions (/\d+%/ visible and /verified by \d+ users/i visible) but with different names. The "progress bar" test no longer verifies the progress bar element itself.

Either restore the structural assertion (e.g. a role="progressbar" or width-bearing element), or remove the redundant test to avoid false confidence in coverage.

♻️ Suggested fix — restore the progress bar element assertion
  test('should display progress bar for success rate', async ({ page }) => {
    const listingsPage = new ListingsPage(page)
    await listingsPage.goto()

    await expect(listingsPage.listingItems.first()).toBeVisible()

    await listingsPage.clickFirstListing()
    await page.waitForLoadState('domcontentloaded')

-   await expect(page.getByText(/\d+%/)).toBeVisible()
-   await expect(page.getByText(/verified by \d+ users/i)).toBeVisible()
+   const progressBar = page.locator('[role="progressbar"]')
+   await expect(progressBar).toBeVisible()
  })
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/voting.spec.ts` around lines 98 - 109, The test "should display
progress bar for success rate" duplicates "should display success rate
percentage and voter count" by only asserting the percentage and voter count;
update the test in tests/voting.spec.ts to either remove it or, preferably,
restore a structural assertion for the progress bar: after navigating with
ListingsPage and clickFirstListing (and the existing expect on percentage and
voter count), add an assertion targeting the progress bar element (e.g.,
getByRole('progressbar') or a selector for the progress-bar element /
width-bearing element) to verify it exists and/or has a non-zero width/style
reflecting the percentage; keep the existing ListingsPage/listingItems usage and
page.waitForLoadState calls intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@tests/voting.spec.ts`:
- Around line 98-109: The test "should display progress bar for success rate"
duplicates "should display success rate percentage and voter count" by only
asserting the percentage and voter count; update the test in
tests/voting.spec.ts to either remove it or, preferably, restore a structural
assertion for the progress bar: after navigating with ListingsPage and
clickFirstListing (and the existing expect on percentage and voter count), add
an assertion targeting the progress bar element (e.g., getByRole('progressbar')
or a selector for the progress-bar element / width-bearing element) to verify it
exists and/or has a non-zero width/style reflecting the percentage; keep the
existing ListingsPage/listingItems usage and page.waitForLoadState calls intact.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 855596ed-ef94-47c0-b3ce-c88ecb9f3ade

📥 Commits

Reviewing files that changed from the base of the PR and between 590b95d and 6112f35.

📒 Files selected for processing (40)
  • playwright.config.ts
  • src/components/ui/form/MultiSelect.tsx
  • tests/accessibility.spec.ts
  • tests/admin-dashboard.spec.ts
  • tests/admin-permissions.spec.ts
  • tests/admin-reports.spec.ts
  • tests/admin-users.spec.ts
  • tests/android-downloads.spec.ts
  • tests/auth.setup.ts
  • tests/auth.spec.ts
  • tests/badge-system.spec.ts
  • tests/browsing.spec.ts
  • tests/commenting.spec.ts
  • tests/custom-fields.spec.ts
  • tests/error-handling.spec.ts
  • tests/filtering.spec.ts
  • tests/fixtures.ts
  • tests/forms.spec.ts
  • tests/full-listing-flow.spec.ts
  • tests/game-management.spec.ts
  • tests/helpers/cookie-consent.ts
  • tests/helpers/data-factory.ts
  • tests/helpers/test-config.ts
  • tests/igdb-search.spec.ts
  • tests/listing-approval.spec.ts
  • tests/listings-success-rate-sorting.spec.ts
  • tests/navigation.spec.ts
  • tests/notification-system.spec.ts
  • tests/pages/BasePage.ts
  • tests/pagination.spec.ts
  • tests/pc-listings.spec.ts
  • tests/pc-voting.spec.ts
  • tests/performance.spec.ts
  • tests/router-coverage.spec.ts
  • tests/search.spec.ts
  • tests/trust-integration.spec.ts
  • tests/trust-system.spec.ts
  • tests/user-flows.spec.ts
  • tests/user-moderation.spec.ts
  • tests/voting.spec.ts
💤 Files with no reviewable changes (2)
  • tests/helpers/test-config.ts
  • tests/pages/BasePage.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
prisma/seeders/usersSeeder.ts (1)

159-167: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fail the seeder if any user cannot be synchronized.

This catch only logs and continues, so the script can finish with missing seed users and still print Users seeding completed. In e2e setup that turns a deterministic seeding failure into a much harder-to-diagnose test failure later.

Suggested fix
+  const failedUsers: string[] = []
+
   for (const userData of users) {
     try {
       // ...
     } catch (error) {
+      failedUsers.push(userData.email)
       console.error(`❌ Failed to seed user ${userData.email}:`, error)
     }
   }
+
+  if (failedUsers.length > 0) {
+    throw new Error(`Failed to seed users: ${failedUsers.join(', ')}`)
+  }
 
   console.info('✅ Users seeding completed')
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@prisma/seeders/usersSeeder.ts` around lines 159 - 167, The seeder currently
swallows errors in the catch block that prints "❌ Failed to seed user ..." so
the script can falsely report completion; modify the catch inside the user
seeding loop (the try/catch that logs `console.error(\`❌ Failed to seed user
${userData.email}:\`, error)`) to re-throw the error or call process.exit(1)
after logging so the seeding process fails fast when any user synchronization
fails, ensuring the script does not proceed to the "Users seeding completed"
messages on error.
🧹 Nitpick comments (1)
src/components/ui/form/MultiSelect.tsx (1)

165-167: ⚡ Quick win

Toggle-button close path skips closeDropdown, leaving a stale search query.

onClick={() => setIsOpen(!isOpen)} does not clear searchQuery when closing, so if the user types a search and then clicks the trigger to dismiss, the filter persists. The next open will render the pre-filtered list. handleClickOutside and the new closeDropdown (Escape) both clear the query — this is the only path that doesn't.

♻️ Proposed fix
-          onClick={() => setIsOpen(!isOpen)}
+          onClick={() => (isOpen ? closeDropdown() : setIsOpen(true))}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/ui/form/MultiSelect.tsx` around lines 165 - 167, The toggle
button's onClick only flips isOpen and misses clearing searchQuery; update the
handler so that when the dropdown is open it calls closeDropdown() (which clears
the query and handles Escape/outside-close behavior) and when closed it opens
via setIsOpen(true); replace the existing onClick={() => setIsOpen(!isOpen)}
with logic that invokes closeDropdown() on the close path and setIsOpen(true) on
the open path so searchQuery is not left stale.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@prisma/seeders/usersSeeder.ts`:
- Line 104: Remove the sensitive console.info that prints DEFAULT_SEED_PASSWORD;
instead log a non-sensitive message (or nothing) indicating that seed users were
created. Locate the console.info call referencing DEFAULT_SEED_PASSWORD in
usersSeeder (the line that prints "🔑 Default password for all seed users:
${DEFAULT_SEED_PASSWORD}") and replace it with a generic informational message
(e.g., "Default seed users created") or remove the log entirely so the actual
password is not written to logs.
- Around line 129-137: When reconciling existing users, update all mutable Clerk
fields in the single clerk.users.updateUser call (include username, firstName,
lastName, password, skipPasswordChecks and publicMetadata.role) instead of only
password, and ensure username uniqueness is respected; remove or consolidate the
separate clerk.users.updateUserMetadata call. Also make the Prisma update
operation for the existing user include profileImage (matching the create
branch) so Prisma stays consistent with Clerk. Target symbols:
clerk.users.updateUser, clerk.users.updateUserMetadata (remove/merge),
DEFAULT_SEED_PASSWORD, and the Prisma update block that currently omits
profileImage.

---

Outside diff comments:
In `@prisma/seeders/usersSeeder.ts`:
- Around line 159-167: The seeder currently swallows errors in the catch block
that prints "❌ Failed to seed user ..." so the script can falsely report
completion; modify the catch inside the user seeding loop (the try/catch that
logs `console.error(\`❌ Failed to seed user ${userData.email}:\`, error)`) to
re-throw the error or call process.exit(1) after logging so the seeding process
fails fast when any user synchronization fails, ensuring the script does not
proceed to the "Users seeding completed" messages on error.

---

Nitpick comments:
In `@src/components/ui/form/MultiSelect.tsx`:
- Around line 165-167: The toggle button's onClick only flips isOpen and misses
clearing searchQuery; update the handler so that when the dropdown is open it
calls closeDropdown() (which clears the query and handles Escape/outside-close
behavior) and when closed it opens via setIsOpen(true); replace the existing
onClick={() => setIsOpen(!isOpen)} with logic that invokes closeDropdown() on
the close path and setIsOpen(true) on the open path so searchQuery is not left
stale.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9bda30de-b0be-494a-a64c-2077ae30dada

📥 Commits

Reviewing files that changed from the base of the PR and between 6112f35 and fdcc86e.

📒 Files selected for processing (5)
  • prisma/seeders/usersSeeder.ts
  • src/components/ui/form/MultiSelect.test.tsx
  • src/components/ui/form/MultiSelect.tsx
  • src/server/api/routers/pcListings.test.ts
  • tests/filtering.spec.ts

Comment thread prisma/seeders/usersSeeder.ts Outdated
Comment thread prisma/seeders/usersSeeder.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/filtering.spec.ts (1)

10-11: ⚡ Quick win

Consider testing keyboard-based dropdown dismissal.

The function now explicitly closes the dropdown by re-clicking the filter button and verifies it closes. While this tests the click-to-close path effectively, the PR summary mentions "MultiSelect Escape handling" but this helper doesn't verify keyboard-based dismissal (e.g., pressing Escape).

Consider adding a complementary test helper or test case that verifies dropdown closing via the Escape key to ensure both interaction patterns work correctly.

Optional: Example keyboard-based dismissal test
async function selectFirstFilterOptionWithKeyboard(page: Page, filterButton: Locator) {
  await filterButton.click()
  const firstOption = page.locator('label:has(input[type="checkbox"])').first()
  await expect(firstOption).toBeVisible()
  await firstOption.click()
  await page.keyboard.press('Escape')
  await expect(firstOption).toBeHidden()
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/filtering.spec.ts` around lines 10 - 11, Add a complementary
keyboard-dismissal test helper that mirrors the click-to-close flow but presses
Escape to close: in the tests use the same filterButton and firstOption locators
(e.g., create a helper named selectFirstFilterOptionWithKeyboard or a test case)
to click filterButton, assert firstOption is visible, select the option, call
page.keyboard.press('Escape'), then assert firstOption is hidden; this verifies
MultiSelect Escape handling in addition to the existing click-to-close check.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/helpers/data-factory.ts`:
- Around line 208-210: ensureApprovedPcListing currently uses
approveFirstPendingListing which can approve an unrelated row; replace that flow
with a targeted approver that finds the row by the created listing's path (e.g.,
implement approvePendingPcListingByPath) and use it from
ensureApprovedPcListing: navigate to the approvals page, wait for loading to
finish, locate the specific tbody tr that contains the listing's path/slug (use
the last path segment from detailUrl), assert the row is visible, click its
approve button, confirm the dialog and wait for it to close so the exact listing
is approved before returning detailUrl.

---

Nitpick comments:
In `@tests/filtering.spec.ts`:
- Around line 10-11: Add a complementary keyboard-dismissal test helper that
mirrors the click-to-close flow but presses Escape to close: in the tests use
the same filterButton and firstOption locators (e.g., create a helper named
selectFirstFilterOptionWithKeyboard or a test case) to click filterButton,
assert firstOption is visible, select the option, call
page.keyboard.press('Escape'), then assert firstOption is hidden; this verifies
MultiSelect Escape handling in addition to the existing click-to-close check.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f7ed8a3e-b2df-400e-b437-b121517b2a81

📥 Commits

Reviewing files that changed from the base of the PR and between 7a16a74 and d7627e9.

📒 Files selected for processing (12)
  • src/components/ui/SuccessRateBar.tsx
  • src/components/ui/VoteButtons.tsx
  • tests/data-setup.spec.ts
  • tests/filtering.spec.ts
  • tests/fixtures.ts
  • tests/helpers/data-factory.ts
  • tests/notification-system.spec.ts
  • tests/pages/AuthPage.ts
  • tests/pagination.spec.ts
  • tests/pc-voting.spec.ts
  • tests/trust-integration.spec.ts
  • tests/voting.spec.ts
✅ Files skipped from review due to trivial changes (4)
  • src/components/ui/SuccessRateBar.tsx
  • tests/pages/AuthPage.ts
  • src/components/ui/VoteButtons.tsx
  • tests/notification-system.spec.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/fixtures.ts
  • tests/pagination.spec.ts

Comment thread tests/helpers/data-factory.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/trust-integration.spec.ts (1)

108-125: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use a fresh approved PC listing for the upvote-path test.

ensureApprovedPcListing(browser) can return an older approved listing that user.json has already voted on. In that case, the click here removes the vote instead of creating an upvote, so this test no longer guarantees the UPVOTE action it asserts.

Suggested fix
 test('voting on a PC listing records UPVOTE trust action', async ({ browser }) => {
-  const pcListingUrl = await ensureApprovedPcListing(browser)
+  let pcListingUrl = ''
+
+  await withContext(browser, 'tests/.auth/user.json', async (page) => {
+    pcListingUrl = await createPcListing(page)
+  })
+
+  await withContext(browser, 'tests/.auth/super_admin.json', async (page) => {
+    await approvePendingPcListingByUrl(page, pcListingUrl)
+  })

   await withContext(browser, 'tests/.auth/user.json', async (page) => {
     await page.goto(pcListingUrl)
     await page.waitForLoadState('domcontentloaded')

     const confirmButton = page.getByRole('button', { name: /confirm/i })
     await expect(confirmButton).toBeVisible()

-    const wasPressed = await confirmButton.getAttribute('aria-pressed')
-    await confirmButton.click()
-
-    await expect(confirmButton).toHaveAttribute(
-      'aria-pressed',
-      wasPressed === 'true' ? 'false' : 'true',
-    )
+    await confirmButton.click()
+    await expect(confirmButton).toHaveAttribute('aria-pressed', 'true')
   })
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/trust-integration.spec.ts` around lines 108 - 125, The test "voting on
a PC listing records UPVOTE trust action" uses ensureApprovedPcListing(browser)
which can return a listing the test user has already voted on, so the click may
remove a vote instead of creating an UPVOTE; change the test to use a fresh,
unvoted approved listing (either by adding a new helper like
ensureUnvotedApprovedPcListing or adding a "fresh" flag to
ensureApprovedPcListing) that creates a new listing, approves it, and returns
its URL, or alternatively assert and reset the initial state by ensuring
confirmButton has aria-pressed === 'false' before clicking; update the call in
this test to use the new helper or state-reset logic so the click always creates
an UPVOTE.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/listings-success-rate-sorting.spec.ts`:
- Around line 13-15: The current dismissal logic masks real locator/strictness
errors by using .catch(() => false) on the isVisible check; update the
dismissBanner locator (the variable dismissBanner defined earlier) to use
.first() so it targets a single element, then remove the .catch(() => false) and
keep the conditional as if (await dismissBanner.isVisible({ timeout: 1000 })) {
await dismissBanner.click() } so strict-mode locator issues will surface while
still safely handling an optional banner.

---

Outside diff comments:
In `@tests/trust-integration.spec.ts`:
- Around line 108-125: The test "voting on a PC listing records UPVOTE trust
action" uses ensureApprovedPcListing(browser) which can return a listing the
test user has already voted on, so the click may remove a vote instead of
creating an UPVOTE; change the test to use a fresh, unvoted approved listing
(either by adding a new helper like ensureUnvotedApprovedPcListing or adding a
"fresh" flag to ensureApprovedPcListing) that creates a new listing, approves
it, and returns its URL, or alternatively assert and reset the initial state by
ensuring confirmButton has aria-pressed === 'false' before clicking; update the
call in this test to use the new helper or state-reset logic so the click always
creates an UPVOTE.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d5cb86cd-ed05-406c-b913-b0d9d9ce2d08

📥 Commits

Reviewing files that changed from the base of the PR and between d7627e9 and df25784.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (23)
  • .github/workflows/e2e-tests.yml
  • package.json
  • prisma/seeders/usersSeeder.ts
  • src/components/ui/form/MultiSelect.test.tsx
  • tests/admin-reports.spec.ts
  • tests/admin-users.spec.ts
  • tests/auth.setup.ts
  • tests/browsing.spec.ts
  • tests/commenting.spec.ts
  • tests/data-setup.spec.ts
  • tests/error-handling.spec.ts
  • tests/filtering.spec.ts
  • tests/fixtures.ts
  • tests/global.setup.ts
  • tests/helpers/data-factory.ts
  • tests/listings-success-rate-sorting.spec.ts
  • tests/notification-system.spec.ts
  • tests/pages/AuthPage.ts
  • tests/pages/GamesPage.ts
  • tests/pages/ListingsPage.ts
  • tests/pagination.spec.ts
  • tests/router-coverage.spec.ts
  • tests/trust-integration.spec.ts
💤 Files with no reviewable changes (4)
  • tests/global.setup.ts
  • tests/pages/ListingsPage.ts
  • .github/workflows/e2e-tests.yml
  • tests/pages/GamesPage.ts
✅ Files skipped from review due to trivial changes (3)
  • tests/error-handling.spec.ts
  • tests/router-coverage.spec.ts
  • tests/pages/AuthPage.ts
🚧 Files skipped from review as they are similar to previous changes (10)
  • tests/browsing.spec.ts
  • tests/commenting.spec.ts
  • tests/auth.setup.ts
  • tests/fixtures.ts
  • tests/notification-system.spec.ts
  • tests/pagination.spec.ts
  • tests/admin-users.spec.ts
  • tests/admin-reports.spec.ts
  • src/components/ui/form/MultiSelect.test.tsx
  • prisma/seeders/usersSeeder.ts

Comment thread tests/listings-success-rate-sorting.spec.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants