Skip to content

feat(recorder): display primary page URL in recorder title#34637

Merged
agg23 merged 2 commits intomicrosoft:mainfrom
agg23:recorder-url-title
Feb 7, 2025
Merged

feat(recorder): display primary page URL in recorder title#34637
agg23 merged 2 commits intomicrosoft:mainfrom
agg23:recorder-url-title

Conversation

@agg23
Copy link
Contributor

@agg23 agg23 commented Feb 5, 2025

Screenshot 2025-02-05 at 10 39 42 AM

Closes #34549. It is difficult to identify what recorder instance corresponds to a given browser session. This updates our title to roughly match how Chrome DevTools displays in the same scenario.

Note a given BrowserContext can have multiple pages, and thus multiple URLs. We take and maintain the first one (so your first tab) as the source of this URL.

@agg23 agg23 requested a review from pavelfeldman February 5, 2025 18:41

import { test, expect } from './inspectorTest';

test('should reflect formatted URL of the page', async ({ openRecorder, server }) => {
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'm not sure if a new file is the best place for these tests. It seemed like there aren't any tests of the actual Recorder UI itself, only of specific code gen functionality.

@github-actions

This comment has been minimized.

window.playwrightSetSources = React.useCallback((sources: Source[]) => {
setSources(sources);
window.playwrightSourcesEchoForTest = sources;
React.useLayoutEffect(() => {
Copy link
Member

Choose a reason for hiding this comment

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

why blocking effect?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the way these side effects are supposed to be triggered in React (though ideally it would be useEffect, but I figured people would complain about it potentially being delayed too long). Prior to this change, they were being set on each render of the main component (which happens quite often since it receives the data from the bridge). Unnecessarily inefficient, and for no gain.

@agg23 agg23 force-pushed the recorder-url-title branch from dd8797c to 2c707de Compare February 7, 2025 17:37
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@agg23 agg23 merged commit 4bc8cf0 into microsoft:main Feb 7, 2025
28 of 29 checks passed
@yury-s
Copy link
Member

yury-s commented Feb 8, 2025

One of the new tests is failing across all platforms:

Error: Timed out 10000ms waiting for expect(locator).toHaveTitle(expected)

Locator: locator(':root')
Expected string: "Playwright Inspector - http://localhost:8919/grid.html"
Received string: "Playwright Inspector - http://localhost:8919/dom.html"
Call log:
  - locator._expect with timeout 10000ms
  - waiting for locator(':root')
    14 × locator resolved to <html lang="en">…</html>
       - unexpected value "Playwright Inspector - http://localhost:8919/dom.html"

    at /home/runner/work/playwright/playwright/tests/library/inspector/title.spec.ts:80:39

@github-actions
Copy link
Contributor

Test results for "tests 1"

1 failed
❌ [webkit-library] › tests/library/inspector/title.spec.ts:35:5 › should update primary page URL when original primary closes @webkit-ubuntu-22.04-node18

11 flaky ⚠️ [firefox-page] › tests/page/page-evaluate.spec.ts:403:3 › should throw for too deep reference chain @firefox-ubuntu-22.04-node18
⚠️ [playwright-test] › tests/ui-mode-test-setup.spec.ts:98:5 › should show errors in config @macos-latest-node18-1
⚠️ [installation tests] › tests/playwright-electron-should-work.spec.ts:44:5 › should work when wrapped inside @playwright/test and trace is enabled @package-installations-macos-latest
⚠️ [webkit-library] › tests/library/browsercontext-clearcookies.spec.ts:72:3 › should remove cookies by name regex @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › tests/library/browsercontext-viewport-mobile.spec.ts:157:5 › mobile viewport › mouse should work with mobile viewports and cross process navigations @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › tests/library/browsertype-connect.spec.ts:142:5 › launchServer › should be able to reconnect to a browser @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › tests/library/video.spec.ts:475:5 › screencast › should scale frames down to the requested size @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › tests/page/page-leaks.spec.ts:107:5 › fill should not leak @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › tests/page/page-screenshot.spec.ts:345:5 › page screenshot › should work while navigating @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › tests/page/page-set-input-files.spec.ts:147:3 › should upload large file @webkit-ubuntu-22.04-node18
⚠️ [playwright-test] › tests/ui-mode-test-watch.spec.ts:145:5 › should watch all @windows-latest-node18-1

37822 passed, 655 skipped
✔️✔️✔️

Merge workflow run.

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.

[Feature]: Make it easy to identify what Inspector is associated to what window

4 participants