Thanks to visit codestin.com
Credit goes to github.com

Skip to content

test: fix url checks in e2e tests #12881

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

Merged
merged 8 commits into from
Apr 11, 2024
Merged

test: fix url checks in e2e tests #12881

merged 8 commits into from
Apr 11, 2024

Conversation

aslilac
Copy link
Member

@aslilac aslilac commented Apr 5, 2024

Prevents flakes on pages like WorkspacePage, where query params are added after it has loaded. If they get added between polls, toHaveURL will fail, because it matches the full URL.

@aslilac aslilac requested review from Emyrk and Parkreiner April 11, 2024 19:15
@aslilac aslilac marked this pull request as ready for review April 11, 2024 19:15
Copy link
Member

@Emyrk Emyrk left a comment

Choose a reason for hiding this comment

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

The toHaveURL takes a string or a regex. I would guess the regex option would pass, and I guess the string option does not act like a regex match?? Kinda ridiculous imo the behavior is so different based on if you passed in a regex string or just a string.

Would be nice if we could add a linter or remove the toHaveURL somehow to prevent misuse.


type PollingOptions = { timeout?: number; intervals?: number[] };

export const expectUrl = expect.extend({
Copy link
Member

Choose a reason for hiding this comment

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

This is so interesting. Can we keep a set of extensions and just make it some generic "expectCoder" or something?

I just wonder if we'll build up a set of these.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think having several of them would be a fine outcome personally. This sort of "scoped custom expects" is what the Playwright documentation suggests.

@@ -116,6 +116,7 @@ export const CreateTokenForm: FC<CreateTokenFormProps> = ({

{lifetimeDays === "custom" && (
<TextField
data-chromatic="ignore"
Copy link
Member

Choose a reason for hiding this comment

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

Not sure what this is 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

someone let a leaky date sneak in to chromatic again, so I'm muting it 😅

@aslilac
Copy link
Member Author

aslilac commented Apr 11, 2024

Would be nice if we could add a linter or remove the toHaveURL somehow to prevent misuse.

yeah, in the mean time I'm hoping people will mostly copy-paste from other tests that do the correct thing. :p

@aslilac aslilac merged commit c5367c2 into main Apr 11, 2024
25 checks passed
@aslilac aslilac deleted the fix-e2e-url-checks branch April 11, 2024 21:48
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants