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

stub extension search in UI test #12714

Merged
merged 2 commits into from Jun 21, 2022

Conversation

dlqqq
Copy link
Contributor

@dlqqq dlqqq commented Jun 17, 2022

References

Fixes #12340. Lays groundwork for further stubbing (if necessary) in the extension manager UI tests.

Code changes

Adds stub for extension search. To stub the GH avatars in the search results, I decided to use the Jupyter logo since the avatars in the original snapshot were those of QuantStack and another GitHub user (deathbeds@). Wanted to avoid copyright/trademark/legal/privacy issues.

Open to feedback regarding the stub data I've used. Now is the time to change it if we want to.

User-facing changes

None.

Backwards-incompatible changes

None known.

@jupyterlab-probot
Copy link

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

@@ -81,6 +86,8 @@ test.describe('Extension Manager', () => {
expect(
await page.screenshot({ clip: { y: 31, x: 0, width: 283, height: 600 } })
).toMatchSnapshot('extensions_search.png');

await unstubExtensionsSearch(page);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it turns out page.route doesn't remove the route stub after a test completes, so it's required to call page.unroute manually after each test. If anybody knows an alternative to this (that doesn't make it so easy for devs to accidentally share stubs across tests), please LMK!

Copy link
Member

Choose a reason for hiding this comment

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

@dlqqq how did you come to that conclusion? The .route is linked to the page object that is unique for each test (except when using some specific describe block). So I'm a bit surprised it needs to be undone explicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed this when adding page.route caused the other snapshot tests to fail. I'm also surprised, since I also assumed that the page object is unique per test. This probably warrants further investigation since ideally page routings shouldn't get shared across tests.

@dlqqq dlqqq mentioned this pull request Jun 17, 2022
@fcollonval fcollonval added this to the 4.0.0 milestone Jun 18, 2022
@fcollonval
Copy link
Member

Thanks a lot for working on this @dlqqq

Copy link
Member

@jtpio jtpio left a comment

Choose a reason for hiding this comment

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

Thanks!

@jtpio jtpio merged commit 7cf9662 into jupyterlab:master Jun 21, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More robust UI tests
3 participants