Skip to content

Fix unassigned variable#52

Merged
MartinBraquet merged 39 commits into
CompassConnections:mainfrom
O-Bots:main
May 21, 2026
Merged

Fix unassigned variable#52
MartinBraquet merged 39 commits into
CompassConnections:mainfrom
O-Bots:main

Conversation

@MartinBraquet
Copy link
Copy Markdown
Member

@MartinBraquet MartinBraquet commented May 21, 2026

Bug I introduce in PR #51

Summary by CodeRabbit

  • Tests
    • Fixed profile count verification to correctly read and validate displayed counts, improving test reliability.
    • Corrected test file structure/closing blocks to prevent accidental test termination and reduce flakiness during runs.

Review Change Stack

O-Bots and others added 30 commits May 21, 2026 16:24
Added more compatibility questions
Added compatibility question tests and verifications
Updated tests to cover Keywords and Headline changes recently made
Updated tests to cover all of the big5 personality traits
Updated signUp.spec.ts to use new fixture
Updated Account information variable names
Deleted "deleteUserFixture.ts" as it was incorporated into the "base.ts" file
Updated seedDatabase.ts to throw an error if the user already exists, to also add display names and usernames so they seedUser func acts like a normal basic user
Some organising of the google auth code
@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

@O-Bots is attempting to deploy a commit to the Compass Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1079aa4f-ff36-4baa-9994-877d64821faa

📥 Commits

Reviewing files that changed from the base of the PR and between 07c0eca and 410f2a1.

📒 Files selected for processing (2)
  • tests/e2e/web/specs/signIn.spec.ts
  • tests/e2e/web/specs/signUp.spec.ts
✅ Files skipped from review due to trivial changes (2)
  • tests/e2e/web/specs/signUp.spec.ts
  • tests/e2e/web/specs/signIn.spec.ts

Walkthrough

Fixes: (1) peoplePage.verifyNumberOfMatchingProfiles now reads and parses profile-count text content and asserts equality; (2) corrected final closing test.describe terminators in signIn.spec.ts and signUp.spec.ts.

Changes

Test Utility Verification

Layer / File(s) Summary
Profile count verification bug fix
tests/e2e/web/pages/peoplePage.ts
verifyNumberOfMatchingProfiles now derives actualCount from this.profileCount.textContent(), returns early if empty, parses it with parseInt, and asserts strict equality to the provided count, replacing prior references to undefined variables.
Spec describe-block terminator fixes
tests/e2e/web/specs/signIn.spec.ts, tests/e2e/web/specs/signUp.spec.ts
Adjusted the final closing test.describe(...) block terminators in both spec files (single-line structural changes); no test logic or assertions were modified.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix unassigned variable' is specific and directly related to the main fix in the changeset—correcting undefined variables in the verifyNumberOfMatchingProfiles function.
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

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/e2e/web/pages/peoplePage.ts`:
- Around line 428-433: The current verifyNumberOfMatchingProfiles silently
returns when textContent() is falsy and uses textContent() which doesn't
auto-wait; instead remove the silent early return and replace the manual
read+parse with Playwright's auto-waiting assertion on the locator
(this.profileCount) — e.g. use
expect(this.profileCount).toHaveText(count.toString()) or, if the element
contains extra text, expect(this.profileCount).toHaveText(new
RegExp(`\\b${count}\\b`)); keep or drop the explicit visibility check as desired
but do not use textContent() nor an early return in
verifyNumberOfMatchingProfiles so failures surface reliably.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 30b37b49-e4d1-46b7-80a8-5a4864325f39

📥 Commits

Reviewing files that changed from the base of the PR and between 00c6f25 and 07c0eca.

📒 Files selected for processing (1)
  • tests/e2e/web/pages/peoplePage.ts

Comment on lines 428 to 433
async verifyNumberOfMatchingProfiles(count: number) {
await expect(this.profileCount).toBeVisible()
const test = await this.profileCount.textContent()
if (!test) return
expect(actual).toStrictEqual(expected)
const actualCount = await this.profileCount.textContent()
if (!actualCount) return
expect(parseInt(actualCount)).toStrictEqual(count)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Silent early return masks failures and textContent() skips Playwright auto-waiting.

Two concerns with the new assertion logic:

  1. if (!actualCount) return turns a missing/empty profile-count element into a silent pass. A verification method should fail loudly when the value under test cannot be read — otherwise a regression that empties the count element will go undetected.
  2. textContent() is a one-shot DOM read with no retry. If the count updates asynchronously after applying filters, the assertion can race the UI. Prefer expect(locator).toHaveText(...), which auto-waits/retries until the timeout, eliminating the need to manually parse and guard.
♻️ Suggested refactor
   async verifyNumberOfMatchingProfiles(count: number) {
     await expect(this.profileCount).toBeVisible()
-    const actualCount = await this.profileCount.textContent()
-    if (!actualCount) return
-    expect(parseInt(actualCount)).toStrictEqual(count)
+    await expect(this.profileCount).toHaveText(String(count))
   }

If the element contains additional text around the number (e.g. "42 profiles"), use a regex variant instead:

await expect(this.profileCount).toHaveText(new RegExp(`\\b${count}\\b`))
🤖 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/e2e/web/pages/peoplePage.ts` around lines 428 - 433, The current
verifyNumberOfMatchingProfiles silently returns when textContent() is falsy and
uses textContent() which doesn't auto-wait; instead remove the silent early
return and replace the manual read+parse with Playwright's auto-waiting
assertion on the locator (this.profileCount) — e.g. use
expect(this.profileCount).toHaveText(count.toString()) or, if the element
contains extra text, expect(this.profileCount).toHaveText(new
RegExp(`\\b${count}\\b`)); keep or drop the explicit visibility check as desired
but do not use textContent() nor an early return in
verifyNumberOfMatchingProfiles so failures surface reliably.

@MartinBraquet MartinBraquet merged commit 8e921e0 into CompassConnections:main May 21, 2026
4 of 5 checks passed
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