Skip to content

[Doc update] Udated testing.md#56

Merged
MartinBraquet merged 4 commits into
CompassConnections:mainfrom
O-Bots:main
Jun 10, 2026
Merged

[Doc update] Udated testing.md#56
MartinBraquet merged 4 commits into
CompassConnections:mainfrom
O-Bots:main

Conversation

@O-Bots

@O-Bots O-Bots commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Description

  • Updated testing.db

Summary by CodeRabbit

  • Documentation

    • Enhanced Jest and Playwright testing guides with improved examples and clearer conventions
    • Expanded E2E testing best practices and added troubleshooting guidance
    • Updated test naming conventions and file structure examples for consistency
  • Tests

    • Refactored test structure for sign-in and profile filtering flows

@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@O-Bots O-Bots requested a review from MartinBraquet June 10, 2026 13:58
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This PR updates testing documentation to formalize a new Page Object Model pattern with an App wrapper class, revises Playwright E2E conventions to use *.spec.ts naming for an isolated local stack, and refactors 14 sign-in and profile filtering tests to use pre-signed-in fixtures instead of performing per-test authentication.

Changes

Testing Documentation Updates

Layer / File(s) Summary
Jest unit testing guide refinements
docs/testing.md
Jest unit section intro and module-mocking example snippet are reworded and reformatted for consistency.
Playwright E2E guide and test conventions
docs/testing.md
E2E section redesigned to describe an isolated local stack (Supabase, Firebase, Backend, Next.js), adds a numbered Best Practices list, changes test naming convention to *.spec.ts, updates dev workflow UI instructions with npx playwright test --ui alternative, and refreshes the example folder structure.
Page Object Model pattern and fixtures
docs/testing.md
Page Object Model section replaced with explicit ProfilePage and SettingsPage classes plus an App aggregator wrapper, example test interactions updated to use app.* method calls, and fixture and test data setup sections revised to reflect the new app-based workflow.
Test examples and troubleshooting
docs/testing.md
New "Example test" scaffold section shows Playwright test structure with a login flow entry, cleanup guidance reworded to emphasize per-test fixture tracking, and new "Supabase emulator not working" troubleshooting subsection added with a workaround sequence using remote DB plus local Firebase emulator.

E2E Sign-in Test Refactoring

Layer / File(s) Summary
Import path and systematic fixture refactoring
tests/e2e/web/specs/signIn.spec.ts
Sleep import path updated from common/util/time to common/src/util/time. Fourteen tests refactored to accept signedInAccount directly, removing per-test app.signinWithEmail(...) calls across profile filtering tests (count, age, gender, education, diet, smoking, psychedelics, cannabis, political, religion) and hide-profile feature tests (hide, undo, manage-hidden-profiles).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • CompassConnections/Compass#42: Introduced auth and Google login test infrastructure with new fixtures and account handling that the sign-in test changes now build upon.
  • CompassConnections/Compass#47: Refactored sign-in tests to use the new app and Page Object Model helpers, which this PR extends with further fixture parameterization adjustments.

Suggested reviewers

  • MartinBraquet
🚥 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 mentions updating testing.md, which aligns with the primary changes (documentation updates). However, it contains a typo ('Udated' instead of 'Updated') and is somewhat vague about the specific improvements made.
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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

Actionable comments posted: 3

Caution

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

⚠️ Outside diff range comments (1)
docs/testing.md (1)

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

Update E2E naming convention to match the rest of the document.

This line still references the old *.e2e.spec.ts naming convention, but line 498 and the examples throughout the document use the updated *.spec.ts convention. This inconsistency could confuse readers.

📝 Proposed fix
-  - Naming: `*.e2e.spec.ts`.
+  - Naming: `*.spec.ts`.
🤖 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 `@docs/testing.md` at line 48, The documentation contains an inconsistent E2E
test file naming reference: update the remaining occurrence of the old pattern
`*.e2e.spec.ts` to the current convention `*.spec.ts` so it matches the examples
and line 498; locate the string `*.e2e.spec.ts` in the document and replace it
with `*.spec.ts`, and run a quick grep/search for any other stray
`*.e2e.spec.ts` instances to ensure consistency across the doc.
🧹 Nitpick comments (1)
docs/testing.md (1)

986-1005: ⚖️ Poor tradeoff

Consider revising or removing the Supabase emulator workaround.

This troubleshooting section has several concerns:

  1. Manual code modification: Requiring developers to comment out code in playwright.config.ts is error-prone and conflicts with version control.
  2. External dependencies: Requiring DBeaver and "contact the main maintainer" for DB credentials creates onboarding friction.
  3. Contradicts local-first approach: Using a remote DB contradicts the "fully isolated local stack" principle described at lines 498-503.
  4. Scalability: New contributors can't self-serve without maintainer intervention.

Consider either:

  • Documenting a proper fix for the Supabase compatibility issue
  • Providing environment-specific configuration rather than code comments
  • Adding a note that this is a temporary workaround with a link to track the underlying issue
🤖 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 `@docs/testing.md` around lines 986 - 1005, The Supabase emulator workaround in
docs/testing.md should be revised to avoid recommending manual code edits and
reliance on external maintainer credentials: replace the instruction to "comment
out Object.assign(process.env, supabaseEnv)" in playwright.config.ts with an
environment-aware approach (e.g., use an env var or PLAYWRIGHT_SUPABASE_EMULATOR
flag checked by the existing playwright.config.ts code paths) or document a
temporary workaround clearly marked as such with a link to an issue tracker;
remove the DBeaver/maintainer step and instead document how to configure a local
or test Postgres connection via environment files or a sample .env.local.example
so contributors can self-serve, and add a short note under the Supabase emulator
section pointing to the issue and expected timeline for a proper fix.
🤖 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 `@docs/testing.md`:
- Line 740: Update the example filenames and corresponding class names from
camelCase to PascalCase: rename profilePage.ts -> ProfilePage.ts,
settingsPage.ts -> SettingsPage.ts, app.ts -> App.ts and update any example
class declarations (e.g., class profilePage -> class ProfilePage) and all
references to those symbols in the document (including the other mentioned
occurrences) so examples follow the "File and class names must use PascalCase"
guideline.
- Line 509: The markdown link fragment "###component-selection-hierarchy" is
invalid; replace it with a proper internal link fragment using a single '#' and
the correct heading slug (e.g., "`#component-selection-hierarchy`"), and verify
the heading named "Component Selection Hierarchy" is converted to the matching
kebab-case lowercase slug so the anchor works.
- Line 830: Typo: change the word "implimentation" to "implementation" in the
sentence "To further improve readability, and simplify the
creation/implimentation of tests, fixtures are used for test case setup and
teardown where appropriate." Locate that sentence in docs/testing.md (the line
that contains "creation/implimentation of tests") and replace "implimentation"
with "implementation" to correct spelling.

---

Outside diff comments:
In `@docs/testing.md`:
- Line 48: The documentation contains an inconsistent E2E test file naming
reference: update the remaining occurrence of the old pattern `*.e2e.spec.ts` to
the current convention `*.spec.ts` so it matches the examples and line 498;
locate the string `*.e2e.spec.ts` in the document and replace it with
`*.spec.ts`, and run a quick grep/search for any other stray `*.e2e.spec.ts`
instances to ensure consistency across the doc.

---

Nitpick comments:
In `@docs/testing.md`:
- Around line 986-1005: The Supabase emulator workaround in docs/testing.md
should be revised to avoid recommending manual code edits and reliance on
external maintainer credentials: replace the instruction to "comment out
Object.assign(process.env, supabaseEnv)" in playwright.config.ts with an
environment-aware approach (e.g., use an env var or PLAYWRIGHT_SUPABASE_EMULATOR
flag checked by the existing playwright.config.ts code paths) or document a
temporary workaround clearly marked as such with a link to an issue tracker;
remove the DBeaver/maintainer step and instead document how to configure a local
or test Postgres connection via environment files or a sample .env.local.example
so contributors can self-serve, and add a short note under the Supabase emulator
section pointing to the issue and expected timeline for a proper fix.
🪄 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: 5890b698-b6c7-4965-ad9a-81909feba36f

📥 Commits

Reviewing files that changed from the base of the PR and between 82eab67 and 205eed6.

📒 Files selected for processing (2)
  • docs/testing.md
  • tests/e2e/web/specs/signIn.spec.ts

Comment thread docs/testing.md

1. Test one scenario per test - Each test should verify a single behavior.
2. Keep tests independent - Each test should be fully independent.
3. Use locators that reflect how users will interact with the application - Outlined in the [Component Selection Hierarchy](###component-selection-hierarchy) below.

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

Fix invalid markdown link fragment.

The link uses ### in the fragment, but markdown internal links should use a single # followed by the heading slug.

🔗 Proposed fix
-3. Use locators that reflect how users will interact with the application - Outlined in the [Component Selection Hierarchy](###component-selection-hierarchy) below.
+3. Use locators that reflect how users will interact with the application - Outlined in the [Component Selection Hierarchy](`#component-selection-hierarchy`) below.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
3. Use locators that reflect how users will interact with the application - Outlined in the [Component Selection Hierarchy](###component-selection-hierarchy) below.
3. Use locators that reflect how users will interact with the application - Outlined in the [Component Selection Hierarchy](`#component-selection-hierarchy`) below.
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 509-509: Link fragments should be valid

(MD051, link-fragments)

🤖 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 `@docs/testing.md` at line 509, The markdown link fragment
"###component-selection-hierarchy" is invalid; replace it with a proper internal
link fragment using a single '#' and the correct heading slug (e.g.,
"`#component-selection-hierarchy`"), and verify the heading named "Component
Selection Hierarchy" is converted to the matching kebab-case lowercase slug so
the anchor works.

Comment thread docs/testing.md
```typescript
class ProfilePage {
constructor(private page: Page) {}
//profilePage.ts

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

Use PascalCase for page object filenames to match coding guidelines.

The example filenames use camelCase (profilePage.ts, settingsPage.ts, app.ts), but the coding guidelines require PascalCase: "File and class names must use PascalCase (e.g., CompatibilityPage.ts / class CompatibilityPage)".

📝 Proposed fix
-//profilePage.ts
+//ProfilePage.ts
 import {expect, Locator, Page} from '`@playwright/test`'
 
 export class ProfilePage {
-//settingsPage.ts
+//SettingsPage.ts
 import {expect, Locator, Page} from '`@playwright/test`'
 
 export class SettingsPage {
-//app.ts
-import {ProfilePage} from './profilePage'
-import {SettingsPage} from './settingsPage'
+//App.ts
+import {ProfilePage} from './ProfilePage'
+import {SettingsPage} from './SettingsPage'
 
 export class App {

As per coding guidelines, Playwright E2E test guidelines specify: "File and class names must use PascalCase (e.g., CompatibilityPage.ts / class CompatibilityPage)."

Also applies to: 756-756, 772-772

🤖 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 `@docs/testing.md` at line 740, Update the example filenames and corresponding
class names from camelCase to PascalCase: rename profilePage.ts ->
ProfilePage.ts, settingsPage.ts -> SettingsPage.ts, app.ts -> App.ts and update
any example class declarations (e.g., class profilePage -> class ProfilePage)
and all references to those symbols in the document (including the other
mentioned occurrences) so examples follow the "File and class names must use
PascalCase" guideline.

Source: Coding guidelines

Comment thread docs/testing.md

### Fixtures

To further improve readability, and simplify the creation/implimentation of tests, fixtures are used for test case setup and teardown where appropriate.

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

Fix typo.

"implimentation" should be "implementation".

✏️ Proposed fix
-To further improve readability, and simplify the creation/implimentation of tests, fixtures are used for test case setup and teardown where appropriate.
+To further improve readability, and simplify the creation/implementation of tests, fixtures are used for test case setup and teardown where appropriate.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
To further improve readability, and simplify the creation/implimentation of tests, fixtures are used for test case setup and teardown where appropriate.
To further improve readability, and simplify the creation/implementation of tests, fixtures are used for test case setup and teardown where appropriate.
🧰 Tools
🪛 LanguageTool

[grammar] ~830-~830: Ensure spelling is correct
Context: ... readability, and simplify the creation/implimentation of tests, fixtures are used for test ca...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🤖 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 `@docs/testing.md` at line 830, Typo: change the word "implimentation" to
"implementation" in the sentence "To further improve readability, and simplify
the creation/implimentation of tests, fixtures are used for test case setup and
teardown where appropriate." Locate that sentence in docs/testing.md (the line
that contains "creation/implimentation of tests") and replace "implimentation"
with "implementation" to correct spelling.

@MartinBraquet MartinBraquet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, so much cleaner!

@MartinBraquet MartinBraquet merged commit dfd0dc9 into CompassConnections:main Jun 10, 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