Skip to content

chore: hide locator(':root') in Steps for toHaveTitle/URL #36213

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 2 commits into from
Jun 16, 2025

Conversation

mxschmitt
Copy link
Member

@mxschmitt mxschmitt commented Jun 5, 2025

Before it looked like:

Screenshot 2025-06-05 at 14 41 27

Now it looks like:

Screenshot 2025-06-05 at 14 41 13

This comment has been minimized.

This comment has been minimized.

@mxschmitt mxschmitt force-pushed the steps-page-assertions branch from 52f8658 to 8ae5354 Compare June 6, 2025 19:32

This comment has been minimized.

@mxschmitt mxschmitt force-pushed the steps-page-assertions branch 2 times, most recently from c291c5b to 5481c54 Compare June 9, 2025 17:59

This comment has been minimized.

This comment has been minimized.

@mxschmitt mxschmitt force-pushed the steps-page-assertions branch from 5481c54 to 134fcce Compare June 9, 2025 18:54

This comment has been minimized.

let header = state.utils.matcherHint(matcherName, expression, actual, matcherOptions).replace(/ \/\/ deep equality/, '') + '\n\n';
if (timeout)
header = colors.red(`Timed out ${timeout}ms waiting for `) + header;
if (locator)
header += `Locator: ${String(locator)}\n`;
if (locatorOrPage)
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't see this new suffix in any tests, and so I think we don't need it :)

Copy link
Member Author

Choose a reason for hiding this comment

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

We test it here:

Locator: locator('#node')


export async function toMatchText(
this: ExpectMatcherState,
matcherName: string,
receiver: Locator,
receiver: Locator | Page,
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we should pass receiverLabel: 'page' whenever we pass a page, or better yet auto-detect it here? Perhaps default to receiverType.toLowerCase()?

@mxschmitt mxschmitt force-pushed the steps-page-assertions branch from 134fcce to 60314ca Compare June 12, 2025 22:21

This comment has been minimized.

This comment has been minimized.

@mxschmitt mxschmitt force-pushed the steps-page-assertions branch from c3aaeac to 2e32732 Compare June 16, 2025 14:33
Copy link
Contributor

Test results for "tests 1"

6 flaky ⚠️ [chromium-library] › library/popup.spec.ts:258:3 › should not throw when click closes popup @chromium-ubuntu-22.04-node18
⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:986:7 › cli codegen › should not throw csp directive violation errors @firefox-ubuntu-22.04-node18
⚠️ [webkit-library] › library/browsercontext-viewport-mobile.spec.ts:97:5 › mobile viewport › should fire orientationchange event @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › library/video.spec.ts:475:5 › screencast › should scale frames down to the requested size @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › page/page-screenshot.spec.ts:345:5 › page screenshot › should work while navigating @webkit-ubuntu-22.04-node18
⚠️ [playwright-test] › ui-mode-test-watch.spec.ts:145:5 › should watch all @windows-latest-node18-1

39401 passed, 822 skipped
✔️✔️✔️

Merge workflow run.

@mxschmitt mxschmitt merged commit 764deda into microsoft:main Jun 16, 2025
29 checks passed
@mxschmitt mxschmitt deleted the steps-page-assertions branch June 16, 2025 15:27
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.

2 participants