File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed
Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @quickpickle/playwright " : patch
3+ ---
4+
5+ Fix an error that arises when a mask is set and two screenshots are taken within one test.
Original file line number Diff line number Diff line change @@ -307,7 +307,7 @@ export class PlaywrightWorld extends VisualWorld implements VisualWorldInterface
307307
308308 get screenshotOptions ( ) {
309309 let opts = defaultsDeep ( this . worldConfig . screenshotOptions || { } , this . worldConfig . screenshotOpts || { } )
310- if ( opts . mask ) opts . mask = opts . mask . map ( ( m :string ) => this . page . locator ( m ) )
310+ if ( opts . mask ) opts . mask = opts . mask . map ( ( m :string | Locator ) => typeof m === 'string' ? this . page . locator ( m ) : m )
311311 return opts
312312 }
313313
Original file line number Diff line number Diff line change @@ -95,6 +95,19 @@ Feature: Basic tests of Playwright browser and steps
9595 ```
9696 Then the screenshot should match
9797
98+ Scenario : Two screenshots with a mask
99+ Given I load the file "tests/examples/example.html"
100+ And the following world config:
101+ ```yaml
102+ screenshotOptions:
103+ mask:
104+ - form
105+ ```
106+ When I take a screenshot named "mask"
107+ And I take a screenshot named "mask"
108+ Then the screenshot "mask.png" should exist--delete it
109+
110+
98111 Rule: Screenshots should be placed in the proper directory
99112
100113 Scenario : Taking a screenshot
You can’t perform that action at this time.
0 commit comments