@@ -99,6 +99,16 @@ module.exports.describe = ({testRunner, product, playwrightPath}) => {
9999 ASSETS_DIR ,
100100 } ;
101101
102+ function loadTests ( modulePath ) {
103+ const module = require ( modulePath ) ;
104+ if ( typeof module . describe === 'function' )
105+ describe ( '' , module . describe , testOptions ) ;
106+ if ( typeof module . fdescribe === 'function' )
107+ fdescribe ( '' , module . fdescribe , testOptions ) ;
108+ if ( typeof module . xdescribe === 'function' )
109+ xdescribe ( '' , module . xdescribe , testOptions ) ;
110+ }
111+
102112 describe ( '' , function ( ) {
103113 beforeAll ( async state => {
104114 state . browser = await browserType . launch ( defaultBrowserOptions ) ;
@@ -154,69 +164,69 @@ module.exports.describe = ({testRunner, product, playwrightPath}) => {
154164
155165 // Page-level tests that are given a browser, a context and a page.
156166 // Each test is launched in a new browser context.
157- describe ( '[Accessibility]' , ( ) => testRunner . loadTests ( require ( './accessibility.spec.js' ) , testOptions ) ) ;
167+ describe ( '[Accessibility]' , ( ) => loadTests ( './accessibility.spec.js' ) ) ;
158168 describe ( '[Driver]' , ( ) => {
159- testRunner . loadTests ( require ( './autowaiting.spec.js' ) , testOptions ) ;
160- testRunner . loadTests ( require ( './click.spec.js' ) , testOptions ) ;
161- testRunner . loadTests ( require ( './cookies.spec.js' ) , testOptions ) ;
162- testRunner . loadTests ( require ( './dialog.spec.js' ) , testOptions ) ;
163- testRunner . loadTests ( require ( './elementhandle.spec.js' ) , testOptions ) ;
164- testRunner . loadTests ( require ( './emulation.spec.js' ) , testOptions ) ;
165- testRunner . loadTests ( require ( './evaluation.spec.js' ) , testOptions ) ;
166- testRunner . loadTests ( require ( './frame.spec.js' ) , testOptions ) ;
167- testRunner . loadTests ( require ( './focus.spec.js' ) , testOptions ) ;
168- testRunner . loadTests ( require ( './input.spec.js' ) , testOptions ) ;
169- testRunner . loadTests ( require ( './jshandle.spec.js' ) , testOptions ) ;
170- testRunner . loadTests ( require ( './keyboard.spec.js' ) , testOptions ) ;
171- testRunner . loadTests ( require ( './mouse.spec.js' ) , testOptions ) ;
172- testRunner . loadTests ( require ( './navigation.spec.js' ) , testOptions ) ;
173- testRunner . loadTests ( require ( './network.spec.js' ) , testOptions ) ;
174- testRunner . loadTests ( require ( './page.spec.js' ) , testOptions ) ;
175- testRunner . loadTests ( require ( './queryselector.spec.js' ) , testOptions ) ;
176- testRunner . loadTests ( require ( './screenshot.spec.js' ) , testOptions ) ;
177- testRunner . loadTests ( require ( './waittask.spec.js' ) , testOptions ) ;
178- testRunner . loadTests ( require ( './interception.spec.js' ) , testOptions ) ;
179- testRunner . loadTests ( require ( './geolocation.spec.js' ) , testOptions ) ;
180- testRunner . loadTests ( require ( './workers.spec.js' ) , testOptions ) ;
181- testRunner . loadTests ( require ( './capabilities.spec.js' ) , testOptions ) ;
169+ loadTests ( './autowaiting.spec.js' ) ;
170+ loadTests ( './click.spec.js' ) ;
171+ loadTests ( './cookies.spec.js' ) ;
172+ loadTests ( './dialog.spec.js' ) ;
173+ loadTests ( './elementhandle.spec.js' ) ;
174+ loadTests ( './emulation.spec.js' ) ;
175+ loadTests ( './evaluation.spec.js' ) ;
176+ loadTests ( './frame.spec.js' ) ;
177+ loadTests ( './focus.spec.js' ) ;
178+ loadTests ( './input.spec.js' ) ;
179+ loadTests ( './jshandle.spec.js' ) ;
180+ loadTests ( './keyboard.spec.js' ) ;
181+ loadTests ( './mouse.spec.js' ) ;
182+ loadTests ( './navigation.spec.js' ) ;
183+ loadTests ( './network.spec.js' ) ;
184+ loadTests ( './page.spec.js' ) ;
185+ loadTests ( './queryselector.spec.js' ) ;
186+ loadTests ( './screenshot.spec.js' ) ;
187+ loadTests ( './waittask.spec.js' ) ;
188+ loadTests ( './interception.spec.js' ) ;
189+ loadTests ( './geolocation.spec.js' ) ;
190+ loadTests ( './workers.spec.js' ) ;
191+ loadTests ( './capabilities.spec.js' ) ;
182192 } ) ;
183193 describe ( '[Permissions]' , ( ) => {
184- testRunner . loadTests ( require ( './permissions.spec.js' ) , testOptions ) ;
194+ loadTests ( './permissions.spec.js' ) ;
185195 } ) ;
186196
187197 describe . skip ( ! CHROMIUM ) ( '[Chromium]' , ( ) => {
188- testRunner . loadTests ( require ( './chromium/chromium.spec.js' ) , testOptions ) ;
189- testRunner . loadTests ( require ( './chromium/coverage.spec.js' ) , testOptions ) ;
190- testRunner . loadTests ( require ( './chromium/pdf.spec.js' ) , testOptions ) ;
191- testRunner . loadTests ( require ( './chromium/session.spec.js' ) , testOptions ) ;
198+ loadTests ( './chromium/chromium.spec.js' ) ;
199+ loadTests ( './chromium/coverage.spec.js' ) ;
200+ loadTests ( './chromium/pdf.spec.js' ) ;
201+ loadTests ( './chromium/session.spec.js' ) ;
192202 } ) ;
193203 } ) ;
194204
195205 // Browser-level tests that are given a browser.
196206 describe ( '[Driver]' , ( ) => {
197- testRunner . loadTests ( require ( './browser.spec.js' ) , testOptions ) ;
198- testRunner . loadTests ( require ( './browsercontext.spec.js' ) , testOptions ) ;
199- testRunner . loadTests ( require ( './ignorehttpserrors.spec.js' ) , testOptions ) ;
200- testRunner . loadTests ( require ( './popup.spec.js' ) , testOptions ) ;
207+ loadTests ( './browser.spec.js' ) ;
208+ loadTests ( './browsercontext.spec.js' ) ;
209+ loadTests ( './ignorehttpserrors.spec.js' ) ;
210+ loadTests ( './popup.spec.js' ) ;
201211 } ) ;
202212 } ) ;
203213
204214 // Top-level tests that launch Browser themselves.
205215 describe ( '[Driver]' , ( ) => {
206- testRunner . loadTests ( require ( './defaultbrowsercontext.spec.js' ) , testOptions ) ;
207- testRunner . loadTests ( require ( './fixtures.spec.js' ) , testOptions ) ;
208- testRunner . loadTests ( require ( './launcher.spec.js' ) , testOptions ) ;
209- testRunner . loadTests ( require ( './headful.spec.js' ) , testOptions ) ;
210- testRunner . loadTests ( require ( './multiclient.spec.js' ) , testOptions ) ;
216+ loadTests ( './defaultbrowsercontext.spec.js' ) ;
217+ loadTests ( './fixtures.spec.js' ) ;
218+ loadTests ( './launcher.spec.js' ) ;
219+ loadTests ( './headful.spec.js' ) ;
220+ loadTests ( './multiclient.spec.js' ) ;
211221 } ) ;
212222
213223 describe . skip ( ! CHROMIUM ) ( '[Chromium]' , ( ) => {
214- testRunner . loadTests ( require ( './chromium/launcher.spec.js' ) , testOptions ) ;
215- testRunner . loadTests ( require ( './chromium/oopif.spec.js' ) , testOptions ) ;
216- testRunner . loadTests ( require ( './chromium/tracing.spec.js' ) , testOptions ) ;
224+ loadTests ( './chromium/launcher.spec.js' ) ;
225+ loadTests ( './chromium/oopif.spec.js' ) ;
226+ loadTests ( './chromium/tracing.spec.js' ) ;
217227 } ) ;
218228
219229 describe ( '[Driver]' , ( ) => {
220- testRunner . loadTests ( require ( './web.spec.js' ) , testOptions ) ;
230+ loadTests ( './web.spec.js' ) ;
221231 } ) ;
222232} ;
0 commit comments