Skip to content

refactor: move visitor creation to before/after blocks in livechat room tests#39289

Open
Copilot wants to merge 10 commits intodevelopfrom
copilot/create-visitor-in-before-block
Open

refactor: move visitor creation to before/after blocks in livechat room tests#39289
Copilot wants to merge 10 commits intodevelopfrom
copilot/create-visitor-in-before-block

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

  • Restructure describe('livechat/room') into two sub-blocks
  • Create shared before/after hooks for visitor lifecycle
  • Add roomsToClose Set mechanism to collect room IDs for cleanup
  • Move roomsToClose.add() calls before expect statements to ensure cleanup happens even if assertions fail
  • Remove room IDs from the set after successfully closing them
  • Remove TODO comments requesting this refactoring
Original prompt

This section details on the original issue you should resolve

<issue_title>this visitor should be created on before block and deleted on after block</issue_title>
<issue_description>

📝 Found in apps/meteor/tests/end-to-end/api/livechat/00-rooms.ts#L156

Commit: d9bceb4</issue_description>

Comments on the Issue (you are @copilot in this section)

Custom agent used: Refactor Agent
A disciplined agent that performs code refactoring with a focus on improving code quality,
maintainability, and readability without changing external behavior. It ensures all tests
pass before and after changes, and creates incremental, reviewable PRs.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Mar 3, 2026

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Mar 3, 2026

⚠️ No Changeset found

Latest commit: fd4dcc1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI and others added 2 commits March 3, 2026 14:07
…om tests

Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
…solation

Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
Copy link
Member

@ggazzo ggazzo left a comment

Choose a reason for hiding this comment

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

@copilot you can share the same before/after among the ones that makes sense

Copilot AI changed the title [WIP] Create visitor in before block and delete in after block refactor: move visitor creation to before/after blocks in livechat room tests Mar 3, 2026
…block

Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot you can share the same before/after among the ones that makes sense

Done in 9881835. Consolidated all tests using a standard visitor into a single describe('with a valid visitor') block with shared before/after hooks. The EE-only test remains separate since it requires a visitor with a special name.

Copy link
Member

@ggazzo ggazzo left a comment

Choose a reason for hiding this comment

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

Could you create a mechanism that adds the rooms to an array and then removes them in the after event, to prevent the room removal process from failing?

Copilot AI and others added 2 commits March 3, 2026 14:23
Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

Could you create a mechanism that adds the rooms to an array and then removes them in the after event, to prevent the room removal process from failing?

Done in 7a88808. Added a roomsToClose Set that collects room IDs during tests and closes them all in the after block. Using Set to handle duplicate IDs gracefully, and .catch(() => {}) to prevent cleanup failures from blocking other tests.

Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.91%. Comparing base (d9bceb4) to head (fd4dcc1).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #39289      +/-   ##
===========================================
+ Coverage    70.89%   70.91%   +0.01%     
===========================================
  Files         3208     3208              
  Lines       113431   113431              
  Branches     20569    20555      -14     
===========================================
+ Hits         80416    80434      +18     
+ Misses       30961    30948      -13     
+ Partials      2054     2049       -5     
Flag Coverage Δ
unit 71.60% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ggazzo
Copy link
Member

ggazzo commented Mar 3, 2026

/jira ARCH-1464

@ggazzo ggazzo added this to the 8.3.0 milestone Mar 3, 2026
@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Mar 3, 2026
@ggazzo ggazzo marked this pull request as ready for review March 3, 2026 16:58
@ggazzo ggazzo requested a review from a team as a code owner March 3, 2026 16:58
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Mar 3, 2026
@dionisio-bot dionisio-bot bot enabled auto-merge March 3, 2026 16:58
KevLehman
KevLehman previously approved these changes Mar 3, 2026
Copy link
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

this visitor should be created on before block and deleted on after block

3 participants