-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
chore: add pageSnapshot option #34669
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
packages/playwright/src/index.ts
Outdated
@@ -640,7 +640,7 @@ class ArtifactsRecorder { | |||
await page.screenshot({ ...screenshotOptions, timeout: 5000, path, caret: 'initial' }); | |||
}); | |||
|
|||
this._pageSnapshotRecorder = new SnapshotRecorder(this, pageSnapshot, 'pageSnapshot', 'text/plain', '.ariasnapshot', async (page, path) => { | |||
this._pageSnapshotRecorder = new SnapshotRecorder(this, pageSnapshot ?? 'only-on-failure', 'pageSnapshot', 'text/plain', '.ariasnapshot', async (page, path) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a normalization function for pageSnapshot
similar to normalizeScreenshotMode
to ensure consistent handling of the pageSnapshot
option.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dunno Copilot, let's add that when we need it. ScreenshotMode
is a little bit more complicated of a type than pageSnapshot
.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
* since: v1.10 | ||
- type: <[PageSnapshotMode]<"off"|"on"|"only-on-failure">> | ||
|
||
Whether to automatically capture a ARIA snapshot of the page after each test. Defaults to `'only-on-failure'`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whether to automatically capture a ARIA snapshot of the page after each test. Defaults to `'only-on-failure'`. | |
Whether to automatically capture a ARIA snapshot of the page after each test. Defaults to `'off'`. |
I don't think we want it on by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My recollection of when we discussed this is to enable it by default - let's discuss tonight.
@@ -128,7 +128,7 @@ test('should work with screenshot: on', async ({ runInlineTest }, testInfo) => { | |||
const result = await runInlineTest({ | |||
...testFiles, | |||
'playwright.config.ts': ` | |||
module.exports = { use: { screenshot: 'on' } }; | |||
module.exports = { use: { screenshot: 'on', pageSnapshot: 'off' } }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did screenshot and trace tests change, let's revert this part?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if pageSnapshot
is on by default, it means that there's more attachments. all the changed tests assert on attachments, so they have to change. the easiest is to disable pageSnapshot, that way no assertions need to be changed.
@@ -485,7 +485,7 @@ test('should work with video: retain-on-failure', async ({ runInlineTest }) => { | |||
test('should work with video: on-first-retry', async ({ runInlineTest }) => { | |||
const result = await runInlineTest({ | |||
'playwright.config.ts': ` | |||
module.exports = { use: { video: 'on-first-retry' }, retries: 1, name: 'chromium' }; | |||
module.exports = { use: { video: 'on-first-retry', pageSnapshot: 'off' }, retries: 1, name: 'chromium' }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
@@ -59,7 +59,7 @@ test('should stop tracing with trace: on-first-retry, when not retrying', async | |||
test('should record api trace', async ({ runInlineTest, server }, testInfo) => { | |||
const result = await runInlineTest({ | |||
'playwright.config.ts': ` | |||
module.exports = { use: { trace: 'on' } }; | |||
module.exports = { use: { trace: 'on', pageSnapshot: 'off' } }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
Co-authored-by: Yury Semikhatsky <[email protected]> Signed-off-by: Simon Knott <[email protected]>
Test results for "tests 1"10 flaky37840 passed, 654 skipped Merge workflow run. |
As discussed yesterday, this makes
pageSnapshot
available to configure as an option.Also adds a 5s timeout to the snapshot taking.
Follow-up to #34573.