From 6a7bfe63a1d3df5352e3ac5f3808a2f35b898bcd Mon Sep 17 00:00:00 2001 From: Playwright Service <89237858+playwrightmachine@users.noreply.github.com> Date: Wed, 12 Jun 2024 07:06:47 -0700 Subject: [PATCH 01/46] feat(webkit): roll to r2031 (#31272) --- packages/playwright-core/browsers.json | 2 +- packages/playwright-core/src/server/webkit/wkPage.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/playwright-core/browsers.json b/packages/playwright-core/browsers.json index 5234f96102..a45f862d15 100644 --- a/packages/playwright-core/browsers.json +++ b/packages/playwright-core/browsers.json @@ -27,7 +27,7 @@ }, { "name": "webkit", - "revision": "2029", + "revision": "2031", "installByDefault": true, "revisionOverrides": { "mac10.14": "1446", diff --git a/packages/playwright-core/src/server/webkit/wkPage.ts b/packages/playwright-core/src/server/webkit/wkPage.ts index 8d441240bc..a495244b6b 100644 --- a/packages/playwright-core/src/server/webkit/wkPage.ts +++ b/packages/playwright-core/src/server/webkit/wkPage.ts @@ -716,7 +716,10 @@ export class WKPage implements PageDelegate { const angle = viewportSize.width > viewportSize.height ? 90 : 0; // Special handling for macOS 12. const useLegacySetOrientationOverrideMethod = os.platform() === 'darwin' && parseInt(os.release().split('.')[0], 10) <= 21; - promises.push(this._pageProxySession.send(useLegacySetOrientationOverrideMethod ? 'Page.setOrientationOverride' as any : 'Emulation.setOrientationOverride', { angle })); + if (useLegacySetOrientationOverrideMethod) + promises.push(this._session.send('Page.setOrientationOverride' as any, { angle })); + else + promises.push(this._pageProxySession.send('Emulation.setOrientationOverride', { angle })); } await Promise.all(promises); } From f1475fa6442dd645441acbd57dd3b544ff99116a Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Wed, 12 Jun 2024 08:24:12 -0700 Subject: [PATCH 02/46] chore: trim multiline step titles to first line (#31269) Fixes https://github.com/microsoft/playwright/issues/31266 --- packages/playwright/src/reporters/base.ts | 2 +- tests/playwright-test/reporter-line.spec.ts | 22 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/packages/playwright/src/reporters/base.ts b/packages/playwright/src/reporters/base.ts index f418baeea4..e4575a8627 100644 --- a/packages/playwright/src/reporters/base.ts +++ b/packages/playwright/src/reporters/base.ts @@ -414,7 +414,7 @@ function relativeTestPath(config: FullConfig, test: TestCase): string { export function stepSuffix(step: TestStep | undefined) { const stepTitles = step ? step.titlePath() : []; - return stepTitles.map(t => ' › ' + t).join(''); + return stepTitles.map(t => t.split('\n')[0]).map(t => ' › ' + t).join(''); } export function formatTestTitle(config: FullConfig, test: TestCase, step?: TestStep, omitLocation: boolean = false): string { diff --git a/tests/playwright-test/reporter-line.spec.ts b/tests/playwright-test/reporter-line.spec.ts index 5e591b191d..14959877b5 100644 --- a/tests/playwright-test/reporter-line.spec.ts +++ b/tests/playwright-test/reporter-line.spec.ts @@ -109,6 +109,28 @@ for (const useIntermediateMergeReport of [false, true] as const) { ].join('\n')); }); + test('should trim multiline step titles to first line', { + annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/31266' } + }, async ({ runInlineTest }) => { + const result = await runInlineTest({ + 'a.test.ts': ` + import { test, expect } from '@playwright/test'; + test('passes', async ({}) => { + await test.step(\`outer + 1.0\`, async () => { + await test.step(\`inner + 1.1\`, async () => { + expect(1).toBe(1); + }); + }); + }); + `, + }, { reporter: 'line' }); + const text = result.output; + expect(text).toContain('[1/1] a.test.ts:6:26 › passes › outer › inner'); + expect(result.exitCode).toBe(0); + }); + test('should render failed test steps', async ({ runInlineTest }) => { const result = await runInlineTest({ 'a.test.ts': ` From 751a41f9ee50e24661eeb0dc743c30424ddc9bd2 Mon Sep 17 00:00:00 2001 From: Debbie O'Brien Date: Wed, 12 Jun 2024 18:12:05 +0200 Subject: [PATCH 03/46] docs: update how network and console work (#31278) --- docs/src/trace-viewer.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/src/trace-viewer.md b/docs/src/trace-viewer.md index 556b22729a..8a59c3e35f 100644 --- a/docs/src/trace-viewer.md +++ b/docs/src/trace-viewer.md @@ -31,7 +31,7 @@ In the Actions tab you can see what locator was used for every action and how lo ### Screenshots -When tracing with the [`option: screenshots`] option turned on, each trace records a screencast and renders it as a film strip. You can hover over the film strip to see a magnified image of for each action and state which helps you easily find the action you want to inspect. +When tracing with the [`option: screenshots`] option turned on (default), each trace records a screencast and renders it as a film strip. You can hover over the film strip to see a magnified image of for each action and state which helps you easily find the action you want to inspect. Double click on an action to see the time range for that action. You can use the slider in the timeline to increase the actions selected and these will be shown in the Actions tab and all console logs and network logs will be filtered to only show the logs for the actions selected. @@ -58,7 +58,7 @@ Notice how it highlights both, the DOM Node as well as the exact click position. ### Source -As you hover over each action of your test the line of code for that action is highlighted in the source panel. +When you click on an action in the sidebar, the line of code for that action is highlighted in the source panel. ![showing source code tab in trace viewer](https://github.com/microsoft/playwright/assets/13063165/daa8845d-c250-4923-aa7a-5d040da9adc5) @@ -86,6 +86,10 @@ See console logs from the browser as well as from your test. Different icons are ![showing log of tests in trace viewer](https://github.com/microsoft/playwright/assets/13063165/4107c08d-1eaf-421c-bdd4-9dd2aa641d4a) +Double click on an action from your test in the actions sidebar. This will filter the console to only show the logs that were made during that action. Click the *Show all* button to see all console logs again. + +Use the timeline to filter actions, by clicking a start point and dragging to an ending point. The console tab will also be filtered to only show the logs that were made during the actions selected. + ### Network @@ -93,6 +97,10 @@ The Network tab shows you all the network requests that were made during your te ![network requests tab in trace viewer](https://github.com/microsoft/playwright/assets/13063165/0a3d1671-8ccd-4f7a-a844-35f5eb37f236) +Double click on an action from your test in the actions sidebar. This will filter the network requests to only show the requests that were made during that action. Click the *Show all* button to see all network requests again. + +Use the timeline to filter actions, by clicking a start point and dragging to an ending point. The network tab will also be filtered to only show the network requests that were made during the actions selected. + ### Metadata Next to the Actions tab you will find the Metadata tab which will show you more information on your test such as the Browser, viewport size, test duration and more. From dcf4e4e0542bd94d33d5ff8ac75d2101c220206f Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Wed, 12 Jun 2024 22:20:18 +0200 Subject: [PATCH 04/46] feat: allow folder uploads (#31165) --- docs/src/api/class-elementhandle.md | 1 + docs/src/api/class-locator.md | 1 + docs/src/api/class-page.md | 1 + .../src/client/elementHandle.ts | 55 +++++++++++--- .../playwright-core/src/protocol/validator.ts | 18 +++-- .../dispatchers/browserContextDispatcher.ts | 15 +++- .../dispatchers/writableStreamDispatcher.ts | 18 +++-- packages/playwright-core/src/server/dom.ts | 26 +++++-- .../src/server/fileUploadUtils.ts | 11 ++- .../src/server/webkit/wkPage.ts | 12 +-- packages/playwright-core/types/types.d.ts | 9 ++- packages/protocol/src/channels.ts | 28 +++++-- packages/protocol/src/protocol.yml | 21 +++++- tests/assets/input/folderupload.html | 12 +++ tests/electron/playwright.config.ts | 2 + tests/page/page-set-input-files.spec.ts | 73 ++++++++++++++++++- tests/webview2/playwright.config.ts | 1 + 17 files changed, 245 insertions(+), 59 deletions(-) create mode 100644 tests/assets/input/folderupload.html diff --git a/docs/src/api/class-elementhandle.md b/docs/src/api/class-elementhandle.md index dbf99eb3a2..24b8bb2b6f 100644 --- a/docs/src/api/class-elementhandle.md +++ b/docs/src/api/class-elementhandle.md @@ -953,6 +953,7 @@ When all steps combined have not finished during the specified [`option: timeout Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they are resolved relative to the current working directory. For empty array, clears the selected files. +For inputs with a `[webkitdirectory]` attribute, only a single directory path is supported. This method expects [ElementHandle] to point to an [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input). However, if the element is inside the `