Skip to content

test: add E2E tests for assignAllTeamMembers with attribute segment filters#27680

Merged
hariombalhara merged 6 commits intomainfrom
devin/1770317348-e2e-assign-all-members-attribute-filter
Feb 9, 2026
Merged

test: add E2E tests for assignAllTeamMembers with attribute segment filters#27680
hariombalhara merged 6 commits intomainfrom
devin/1770317348-e2e-assign-all-members-attribute-filter

Conversation

@joeauyeung
Copy link
Copy Markdown
Contributor

@joeauyeung joeauyeung commented Feb 5, 2026

What does this PR do?

Adds E2E test coverage for event types configured with assignAllTeamMembers=true combined with attribute-based segment filtering (assignRRMembersUsingSegment=true + rrSegmentQueryValue). Previously there were zero E2E tests exercising this feature path, including the booking flow.

The new test file covers all 4 attribute types with a full booking flow, exclusion tests where teammates have no attribute assigned, negation operator tests verifying unassigned members match negation filters, plus edge cases — 15 tests total:

Test Attribute Type Operator Assertion
SINGLE_SELECT Department select_equals Booking assigned to matching member only
MULTI_SELECT Skills multiselect_some_in Booking assigned to matching member only
TEXT Region equal Booking assigned to matching member only
NUMBER Experience equal Booking assigned to matching member only
Unassigned: SINGLE_SELECT Department select_equals Members without attribute excluded
Unassigned: MULTI_SELECT Skills multiselect_some_in Members without attribute excluded
Unassigned: TEXT Region equal Members without attribute excluded
Unassigned: NUMBER Experience equal Members without attribute excluded
Negation: SINGLE_SELECT Department select_not_any_in Unassigned members match negation
Negation: MULTI_SELECT Skills multiselect_not_some_in Unassigned members match negation
Negation: TEXT Region not_equal Unassigned members match negation
Negation: NUMBER Experience not_equal Unassigned members match negation
Edge: no members assigned SINGLE_SELECT select_equals No available time slots shown
Edge: no match SINGLE_SELECT select_equals (unmatched value) No available time slots shown
Edge: all match SINGLE_SELECT select_equals (all members match) Booking succeeds, host is any team member

Two test-local helpers were added:

  • ensureOrgMemberships() — teammates created via the user fixture don't automatically get org memberships, which createAttributes() requires to assign attributes
  • getOrgMemberIndex() — resolves the correct memberIndex for each user since prisma.membership.findMany returns results in non-deterministic order

All 15 tests pass locally (PLAYWRIGHT_HEADLESS=1 yarn e2e organization/assign-all-members-segment-filter.e2e.ts → 15 passed in ~56s).

Link to Devin run: https://app.devin.ai/sessions/da665ab0b991430b9333a84da9a3907e
Requested by: @joeauyeung

Revision history

  1. Replaced flaky page.waitForTimeout(2000) + manual count check in "no match" edge case with Playwright's auto-retrying toHaveCount(0, { timeout: 15000 }).
  2. Added 4 "Members without attribute assigned are excluded" tests (one per attribute type).
  3. Restructured exclusion tests: Matching attribute is now assigned to teammate-1 (not owner), so if unassigned members aren't properly excluded, round-robin could pick the owner and the test fails.
  4. Added 4 negation operator tests (select_not_any_in, multiselect_not_some_in, not_equal for TEXT/NUMBER) to verify unassigned members match negation filters.
  5. Added edge case: "No members have attribute assigned" → no available time slots.
  6. Merged main with the negation operator bug fix — all 15 tests now pass normally.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A — test-only change.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Environment variables required: ORGANIZATIONS_ENABLED=1 and NEXT_PUBLIC_IS_E2E=1 must be set in .env
  2. Run tests:
    PLAYWRIGHT_HEADLESS=1 yarn e2e organization/assign-all-members-segment-filter.e2e.ts
  3. Expected: All 15 tests pass.

Human Review Checklist

These are the areas most worth reviewer attention:

  • PR size: 1362 lines in 1 file exceeds the 500-line guideline. Consider whether this should be split or if test files are acceptable at this size.
  • Non-null assertions: ~54 uses of ! (e.g., attributes!.find(...)!). Acceptable for test code?
  • ensureOrgMemberships workaround: Is this the right pattern, or should the user fixture be updated to create org memberships for teammates?
  • Negation test design: Each negation test has owner with attribute A, teammate-1 with no attribute. Filter is "NOT A". If unassigned members weren't matched, no one would be available → booking fails → test fails. Verify this logic is sound.

Checklist

  • I have read the contributing guide
  • My code follows the style guidelines of this project
  • I have checked if my changes generate no new warnings
  • My PR is not too large (1362 lines, 1 file — test file only, exceeds 500-line guideline)

…ilters

Cover all 4 attribute types (SINGLE_SELECT, MULTI_SELECT, TEXT, NUMBER)
with booking flow verification plus edge cases (no match, all match).

Co-Authored-By: [email protected] <[email protected]>
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 5, 2026

E2E results are ready!

devin-ai-integration bot and others added 3 commits February 5, 2026 19:47
Replace flaky waitForTimeout(2000) + count check with Playwright's
toHaveCount(0, { timeout: 15000 }) which retries until availability
settles, preventing CI timing issues.

Co-Authored-By: [email protected] <[email protected]>
Add 4 new E2E tests covering the case where team members have no
attribute assigned at all (not just a different value). Each attribute
type (SINGLE_SELECT, MULTI_SELECT, TEXT, NUMBER) is tested to verify
that members without the attribute are excluded from the booking pool.

Co-Authored-By: [email protected] <[email protected]>
- Restructure 'Members without attribute assigned' tests: assign
  matching attribute to teammate-1 (not owner) so round-robin can't
  coincidentally pass when the bug exists
- Add 4 negation operator tests (select_not_any_in, multiselect_not_some_in,
  not_equal for TEXT and NUMBER) that verify unassigned members should
  match negation filters. Marked with test.fail() as they confirm a
  known bug where getLogicResultForAllMembers skips members without
  attribute assignments entirely.
- Add edge case: no members have attribute assigned -> no available slots

Co-Authored-By: [email protected] <[email protected]>
@joeauyeung joeauyeung marked this pull request as ready for review February 6, 2026 15:03
@graphite-app graphite-app bot added core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO labels Feb 6, 2026
@graphite-app graphite-app bot requested a review from a team February 6, 2026 15:03
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Copy link
Copy Markdown
Member

@hariombalhara hariombalhara left a comment

Choose a reason for hiding this comment

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

My only concern is that these e2e tests could potentially slow down our CI. Maybe we could test 1-2 happy paths e2e and then we have integration tests.

But it is better to reduce tests later when really needed instead of avoiding them now.

@hariombalhara hariombalhara merged commit b6916df into main Feb 9, 2026
64 checks passed
@hariombalhara hariombalhara deleted the devin/1770317348-e2e-assign-all-members-attribute-filter branch February 9, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO ready-for-e2e size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants