Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(core): add test to ensures that only one listener is open when navigating list #6569

Merged
merged 1 commit into from
May 6, 2024

Conversation

binoy14
Copy link
Contributor

@binoy14 binoy14 commented May 3, 2024

Description

Adds a test that only one listener is open when navigating document lists

What to review

Changes makes sense

Testing

I did write a test to assert that only one connection is kept open but it is not very ideal way but this is a limitation of playwright that it does not support connection close event for long polling request. Fortunately they get marked as failed requests when they get closed which helps us write some assertions around it.

Notes for release

  • N/A

Copy link

vercel bot commented May 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
performance-studio ✅ Ready (Inspect) Visit Preview May 6, 2024 2:45pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2024 2:45pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2024 2:45pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview May 6, 2024 2:45pm

Copy link
Contributor Author

binoy14 commented May 3, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @binoy14 and the rest of your teammates on Graphite Graphite

Copy link
Contributor

github-actions bot commented May 3, 2024

No changes to documentation

Copy link
Contributor

github-actions bot commented May 3, 2024

Component Testing Report Updated May 6, 2024 2:50 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 34s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 6s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 20s 6 3 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 36s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 2s 14 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 3s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 7s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 20s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 15s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 22s 9 0 0

@binoy14 binoy14 marked this pull request as ready for review May 3, 2024 18:41
@binoy14 binoy14 requested a review from a team as a code owner May 3, 2024 18:41
@binoy14 binoy14 requested review from ricokahler, rexxars and bjoerge and removed request for a team May 3, 2024 18:41

// We change the sort order to not be default, to ensure that the listener is not re-created
await page.getByTestId('pane-context-menu-button').click()
await page.getByRole('menuitem', {name: 'Sort by Name'}).click()
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: do we have ids that we can use instead of names? just worry about maintenance of this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't currently exists and it's probably little bit out of scope to do it as part of this PR, there is another task to add tests for this menu in general and it's probably better to refactor it part of that.

The only thing I would also say is when using getByRole vs getByTestId is that the role ensures that in future changes the a11y rules of a menu are not broken which will get obfuscated by using testid. Since these are default sort options and chances of them changing is less, IMO it's a balance of when to use testId vs using helpers that test functionality as well other HTML spec rules

@binoy14 binoy14 changed the title fix(core): ensures that only one listener is open when navigating list test(core): add test to ensures that only one listener is open when navigating list May 6, 2024
@binoy14 binoy14 requested a review from jtpetty May 6, 2024 14:52
Copy link
Contributor

@jtpetty jtpetty left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@binoy14 binoy14 added this pull request to the merge queue May 6, 2024
Merged via the queue into next with commit 161b926 May 6, 2024
65 checks passed
@binoy14 binoy14 deleted the sdx-1314 branch May 6, 2024 14:59
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.

None yet

2 participants