@@ -155,24 +155,12 @@ describe('screenshot', () => {
155155 const fixture = screenshots . basic ;
156156 const page = context . getSelectedPage ( ) ;
157157 await page . setContent ( fixture . html ) ;
158- await screenshot . handler (
159- { params : { format : 'png' , filePath} } ,
160- response ,
161- context ,
162- ) ;
163-
164- assert . equal ( response . images . length , 0 ) ;
165- assert . equal (
166- response . responseLines . at ( 0 ) ,
167- "Took a screenshot of the current page's viewport." ,
168- ) ;
169- assert . ok (
170- response . responseLines
171- . at ( 1 )
172- ?. startsWith ( `Could not write screenshot to ${ filePath } .` ) ,
173- `Expected error message for unwritable path, but got: ${ response . responseLines . at (
174- 1 ,
175- ) } `,
158+ await assert . rejects (
159+ screenshot . handler (
160+ { params : { format : 'png' , filePath} } ,
161+ response ,
162+ context ,
163+ ) ,
176164 ) ;
177165 } ) ;
178166 } finally {
@@ -187,24 +175,12 @@ describe('screenshot', () => {
187175 const fixture = screenshots . basic ;
188176 const page = context . getSelectedPage ( ) ;
189177 await page . setContent ( fixture . html ) ;
190- await screenshot . handler (
191- { params : { format : 'png' , filePath} } ,
192- response ,
193- context ,
194- ) ;
195-
196- assert . equal ( response . images . length , 0 ) ;
197- assert . equal (
198- response . responseLines . at ( 0 ) ,
199- "Took a screenshot of the current page's viewport." ,
200- ) ;
201- assert . ok (
202- response . responseLines
203- . at ( 1 )
204- ?. startsWith ( `Could not write screenshot to ${ filePath } .` ) ,
205- `Expected error message for malformed path, but got: ${ response . responseLines . at (
206- 1 ,
207- ) } `,
178+ await assert . rejects (
179+ screenshot . handler (
180+ { params : { format : 'png' , filePath} } ,
181+ response ,
182+ context ,
183+ ) ,
208184 ) ;
209185 } ) ;
210186 } ) ;
0 commit comments