Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: move remaining files from old test/ directory (#6081)
Dmitry Gozman5afe282fbbb2
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex 0bc7afe568..a3c09982a7 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -40,7 +40,7 @@ jobs:# Wrap `npm run` in a subshell to redirect STDERR to file.# Enable core dumps in the subshell.- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- bash -c "ulimit -c unlimited && npm run test -- ${{ matrix.browser }} --reporter=dot,json"- - run: node test/checkCoverage.js ${{ matrix.browser }}+ - run: node tests/config/checkCoverage.js ${{ matrix.browser }}- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.jsonif: always() && github.repository == 'microsoft/playwright' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-'))- uses: actions/upload-artifact@v1diff --git a/.gitignore b/.gitignoreindex 5be73dc582..22f016a50f 100644--- a/.gitignore+++ b/.gitignore@@ -1,6 +1,5 @@/node_modules//test-results/-/test/coverage-report/tests/coverage-report.local-browsers//.dev_profile*@@ -9,13 +8,11 @@*.pyc.vscodeyarn.lock-/node6/src/generated/*lib/-jest-report.jsondrivers/.android-sdk/.gradle/nohup.outapi.json-.trace\ No newline at end of file+.tracediff --git a/src/utils/stackTrace.ts b/src/utils/stackTrace.tsindex 7fe6d1c4f2..385812dd61 100644--- a/src/utils/stackTrace.ts+++ b/src/utils/stackTrace.ts@@ -58,7 +58,7 @@ export function captureStackTrace(): { stack: string, frames: StackFrame[] } {// for tests.if (isUnderTest() && fileName.includes(path.join('playwright', 'src')))continue;- if (isUnderTest() && fileName.includes(path.join('playwright', 'test', 'coverage.js')))+ if (isUnderTest() && fileName.includes(path.join('playwright', 'tests', 'config', 'coverage.js')))continue;frames.push({file: fileName,diff --git a/test/tsconfig.json b/test/tsconfig.jsondeleted file mode 100644index c83918cd80..0000000000--- a/test/tsconfig.json+++ /dev/null@@ -1,13 +0,0 @@-{- "compilerOptions": {- "allowJs": true,- "checkJs": false,- "noEmit": true,- "moduleResolution": "node",- "target": "ESNext",- "strictNullChecks": false,- "strictBindCallApply": true,- "allowSyntheticDefaultImports": true,- },- "include": ["**/*.spec.js", "**/*.ts"]- }\ No newline at end of filediff --git a/test/assets/background-color.html b/tests/assets/background-color.htmlsimilarity index 100%rename from test/assets/background-color.htmlrename to tests/assets/background-color.htmldiff --git a/test/assets/beforeunload.html b/tests/assets/beforeunload.htmlsimilarity index 100%rename from test/assets/beforeunload.htmlrename to tests/assets/beforeunload.htmldiff --git a/test/assets/button-overlay-oopif.html b/tests/assets/button-overlay-oopif.htmlsimilarity index 100%rename from test/assets/button-overlay-oopif.htmlrename to tests/assets/button-overlay-oopif.htmldiff --git a/test/assets/cached/one-style.css b/tests/assets/cached/one-style.csssimilarity index 100%rename from test/assets/cached/one-style.cssrename to tests/assets/cached/one-style.cssdiff --git a/test/assets/cached/one-style.html b/tests/assets/cached/one-style.htmlsimilarity index 100%rename from test/assets/cached/one-style.htmlrename to tests/assets/cached/one-style.htmldiff --git a/test/assets/checkerboard.html b/tests/assets/checkerboard.htmlsimilarity index 100%rename from test/assets/checkerboard.htmlrename to tests/assets/checkerboard.htmldiff --git a/test/assets/chromium-linux.zip b/tests/assets/chromium-linux.zipsimilarity index 100%rename from test/assets/chromium-linux.ziprename to tests/assets/chromium-linux.zipdiff --git a/test/assets/consolelog.html b/tests/assets/consolelog.htmlsimilarity index 100%rename from test/assets/consolelog.htmlrename to tests/assets/consolelog.htmldiff --git a/test/assets/csp.html b/tests/assets/csp.htmlsimilarity index 100%rename from test/assets/csp.htmlrename to tests/assets/csp.htmldiff --git a/test/assets/csscoverage/Dosis-Regular.ttf b/tests/assets/csscoverage/Dosis-Regular.ttfsimilarity index 100%rename from test/assets/csscoverage/Dosis-Regular.ttfrename to tests/assets/csscoverage/Dosis-Regular.ttfdiff --git a/test/assets/csscoverage/OFL.txt b/tests/assets/csscoverage/OFL.txtsimilarity index 100%rename from test/assets/csscoverage/OFL.txtrename to tests/assets/csscoverage/OFL.txtdiff --git a/test/assets/csscoverage/involved.html b/tests/assets/csscoverage/involved.htmlsimilarity index 100%rename from test/assets/csscoverage/involved.htmlrename to tests/assets/csscoverage/involved.htmldiff --git a/test/assets/csscoverage/media.html b/tests/assets/csscoverage/media.htmlsimilarity index 100%rename from test/assets/csscoverage/media.htmlrename to tests/assets/csscoverage/media.htmldiff --git a/test/assets/csscoverage/multiple.html b/tests/assets/csscoverage/multiple.htmlsimilarity index 100%rename from test/assets/csscoverage/multiple.htmlrename to tests/assets/csscoverage/multiple.htmldiff --git a/test/assets/csscoverage/simple.html b/tests/assets/csscoverage/simple.htmlsimilarity index 100%rename from test/assets/csscoverage/simple.htmlrename to tests/assets/csscoverage/simple.htmldiff --git a/test/assets/csscoverage/sourceurl.html b/tests/assets/csscoverage/sourceurl.htmlsimilarity index 100%rename from test/assets/csscoverage/sourceurl.htmlrename to tests/assets/csscoverage/sourceurl.htmldiff --git a/test/assets/csscoverage/stylesheet1.css b/tests/assets/csscoverage/stylesheet1.csssimilarity index 100%rename from test/assets/csscoverage/stylesheet1.cssrename to tests/assets/csscoverage/stylesheet1.cssdiff --git a/test/assets/csscoverage/stylesheet2.css b/tests/assets/csscoverage/stylesheet2.csssimilarity index 100%rename from test/assets/csscoverage/stylesheet2.cssrename to tests/assets/csscoverage/stylesheet2.cssdiff --git a/test/assets/csscoverage/unused.html b/tests/assets/csscoverage/unused.htmlsimilarity index 100%rename from test/assets/csscoverage/unused.htmlrename to tests/assets/csscoverage/unused.htmldiff --git a/test/assets/deep-shadow.html b/tests/assets/deep-shadow.htmlsimilarity index 100%rename from test/assets/deep-shadow.htmlrename to tests/assets/deep-shadow.htmldiff --git a/test/assets/detect-touch.html b/tests/assets/detect-touch.htmlsimilarity index 100%rename from test/assets/detect-touch.htmlrename to tests/assets/detect-touch.htmldiff --git a/test/assets/digits/0.png b/tests/assets/digits/0.pngsimilarity index 100%rename from test/assets/digits/0.pngrename to tests/assets/digits/0.pngdiff --git a/test/assets/digits/1.png b/tests/assets/digits/1.pngsimilarity index 100%rename from test/assets/digits/1.pngrename to tests/assets/digits/1.pngdiff --git a/test/assets/digits/2.png b/tests/assets/digits/2.pngsimilarity index 100%rename from test/assets/digits/2.pngrename to tests/assets/digits/2.pngdiff --git a/test/assets/digits/3.png b/tests/assets/digits/3.pngsimilarity index 100%rename from test/assets/digits/3.pngrename to tests/assets/digits/3.pngdiff --git a/test/assets/digits/4.png b/tests/assets/digits/4.pngsimilarity index 100%rename from test/assets/digits/4.pngrename to tests/assets/digits/4.pngdiff --git a/test/assets/digits/5.png b/tests/assets/digits/5.pngsimilarity index 100%rename from test/assets/digits/5.pngrename to tests/assets/digits/5.pngdiff --git a/test/assets/digits/6.png b/tests/assets/digits/6.pngsimilarity index 100%rename from test/assets/digits/6.pngrename to tests/assets/digits/6.pngdiff --git a/test/assets/digits/7.png b/tests/assets/digits/7.pngsimilarity index 100%rename from test/assets/digits/7.pngrename to tests/assets/digits/7.pngdiff --git a/test/assets/digits/8.png b/tests/assets/digits/8.pngsimilarity index 100%rename from test/assets/digits/8.pngrename to tests/assets/digits/8.pngdiff --git a/test/assets/digits/9.png b/tests/assets/digits/9.pngsimilarity index 100%rename from test/assets/digits/9.pngrename to tests/assets/digits/9.pngdiff --git a/test/assets/dom.html b/tests/assets/dom.htmlsimilarity index 100%rename from test/assets/dom.htmlrename to tests/assets/dom.htmldiff --git a/test/assets/download-blob.html b/tests/assets/download-blob.htmlsimilarity index 100%rename from test/assets/download-blob.htmlrename to tests/assets/download-blob.htmldiff --git a/test/assets/drag-n-drop.html b/tests/assets/drag-n-drop.htmlsimilarity index 100%rename from test/assets/drag-n-drop.htmlrename to tests/assets/drag-n-drop.htmldiff --git a/test/assets/dummy_bad_browser_executable.js b/tests/assets/dummy_bad_browser_executable.jssimilarity index 100%rename from test/assets/dummy_bad_browser_executable.jsrename to tests/assets/dummy_bad_browser_executable.jsdiff --git a/test/assets/dynamic-oopif.html b/tests/assets/dynamic-oopif.htmlsimilarity index 100%rename from test/assets/dynamic-oopif.htmlrename to tests/assets/dynamic-oopif.htmldiff --git a/test/assets/empty.html b/tests/assets/empty.htmlsimilarity index 100%rename from test/assets/empty.htmlrename to tests/assets/empty.htmldiff --git a/test/assets/error.html b/tests/assets/error.htmlsimilarity index 100%rename from test/assets/error.htmlrename to tests/assets/error.htmldiff --git a/test/assets/es6/.eslintrc b/tests/assets/es6/.eslintrcsimilarity index 100%rename from test/assets/es6/.eslintrcrename to tests/assets/es6/.eslintrcdiff --git a/test/assets/es6/es6import.js b/tests/assets/es6/es6import.jssimilarity index 100%rename from test/assets/es6/es6import.jsrename to tests/assets/es6/es6import.jsdiff --git a/test/assets/es6/es6module.js b/tests/assets/es6/es6module.jssimilarity index 100%rename from test/assets/es6/es6module.jsrename to tests/assets/es6/es6module.jsdiff --git a/test/assets/es6/es6pathimport.js b/tests/assets/es6/es6pathimport.jssimilarity index 100%rename from test/assets/es6/es6pathimport.jsrename to tests/assets/es6/es6pathimport.jsdiff --git a/test/assets/file-to-upload-2.txt b/tests/assets/file-to-upload-2.txtsimilarity index 100%rename from test/assets/file-to-upload-2.txtrename to tests/assets/file-to-upload-2.txtdiff --git a/test/assets/file-to-upload.txt b/tests/assets/file-to-upload.txtsimilarity index 100%rename from test/assets/file-to-upload.txtrename to tests/assets/file-to-upload.txtdiff --git a/test/assets/formatted-number.html b/tests/assets/formatted-number.htmlsimilarity index 100%rename from test/assets/formatted-number.htmlrename to tests/assets/formatted-number.htmldiff --git a/test/assets/frames/child-redirect.html b/tests/assets/frames/child-redirect.htmlsimilarity index 100%rename from test/assets/frames/child-redirect.htmlrename to tests/assets/frames/child-redirect.htmldiff --git a/test/assets/frames/frame.html b/tests/assets/frames/frame.htmlsimilarity index 100%rename from test/assets/frames/frame.htmlrename to tests/assets/frames/frame.htmldiff --git a/test/assets/frames/frameset.html b/tests/assets/frames/frameset.htmlsimilarity index 100%rename from test/assets/frames/frameset.htmlrename to tests/assets/frames/frameset.htmldiff --git a/test/assets/frames/lazy-frame.html b/tests/assets/frames/lazy-frame.htmlsimilarity index 100%rename from test/assets/frames/lazy-frame.htmlrename to tests/assets/frames/lazy-frame.htmldiff --git a/test/assets/frames/nested-frames.html b/tests/assets/frames/nested-frames.htmlsimilarity index 100%rename from test/assets/frames/nested-frames.htmlrename to tests/assets/frames/nested-frames.htmldiff --git a/test/assets/frames/one-frame.html b/tests/assets/frames/one-frame.htmlsimilarity index 100%rename from test/assets/frames/one-frame.htmlrename to tests/assets/frames/one-frame.htmldiff --git a/test/assets/frames/redirect-my-parent.html b/tests/assets/frames/redirect-my-parent.htmlsimilarity index 100%rename from test/assets/frames/redirect-my-parent.htmlrename to tests/assets/frames/redirect-my-parent.htmldiff --git a/test/assets/frames/script.js b/tests/assets/frames/script.jssimilarity index 100%rename from test/assets/frames/script.jsrename to tests/assets/frames/script.jsdiff --git a/test/assets/frames/style.css b/tests/assets/frames/style.csssimilarity index 100%rename from test/assets/frames/style.cssrename to tests/assets/frames/style.cssdiff --git a/test/assets/frames/two-frames.html b/tests/assets/frames/two-frames.htmlsimilarity index 100%rename from test/assets/frames/two-frames.htmlrename to tests/assets/frames/two-frames.htmldiff --git a/test/assets/geolocation.html b/tests/assets/geolocation.htmlsimilarity index 100%rename from test/assets/geolocation.htmlrename to tests/assets/geolocation.htmldiff --git a/test/assets/global-var.html b/tests/assets/global-var.htmlsimilarity index 100%rename from test/assets/global-var.htmlrename to tests/assets/global-var.htmldiff --git a/test/assets/grid-iframe-in-shadow.html b/tests/assets/grid-iframe-in-shadow.htmlsimilarity index 100%rename from test/assets/grid-iframe-in-shadow.htmlrename to tests/assets/grid-iframe-in-shadow.htmldiff --git a/test/assets/grid.html b/tests/assets/grid.htmlsimilarity index 100%rename from test/assets/grid.htmlrename to tests/assets/grid.htmldiff --git a/test/assets/har.html b/tests/assets/har.htmlsimilarity index 100%rename from test/assets/har.htmlrename to tests/assets/har.htmldiff --git a/test/assets/highdpi.html b/tests/assets/highdpi.htmlsimilarity index 100%rename from test/assets/highdpi.htmlrename to tests/assets/highdpi.htmldiff --git a/test/assets/historyapi.html b/tests/assets/historyapi.htmlsimilarity index 100%rename from test/assets/historyapi.htmlrename to tests/assets/historyapi.htmldiff --git a/test/assets/injectedfile.js b/tests/assets/injectedfile.jssimilarity index 100%rename from test/assets/injectedfile.jsrename to tests/assets/injectedfile.jsdiff --git a/test/assets/injectedstyle.css b/tests/assets/injectedstyle.csssimilarity index 100%rename from test/assets/injectedstyle.cssrename to tests/assets/injectedstyle.cssdiff --git a/test/assets/input/animating-button.html b/tests/assets/input/animating-button.htmlsimilarity index 100%rename from test/assets/input/animating-button.htmlrename to tests/assets/input/animating-button.htmldiff --git a/test/assets/input/button.html b/tests/assets/input/button.htmlsimilarity index 100%rename from test/assets/input/button.htmlrename to tests/assets/input/button.htmldiff --git a/test/assets/input/checkbox.html b/tests/assets/input/checkbox.htmlsimilarity index 100%rename from test/assets/input/checkbox.htmlrename to tests/assets/input/checkbox.htmldiff --git a/test/assets/input/fileupload.html b/tests/assets/input/fileupload.htmlsimilarity index 100%rename from test/assets/input/fileupload.htmlrename to tests/assets/input/fileupload.htmldiff --git a/test/assets/input/keyboard.html b/tests/assets/input/keyboard.htmlsimilarity index 100%rename from test/assets/input/keyboard.htmlrename to tests/assets/input/keyboard.htmldiff --git a/test/assets/input/mouse-helper.js b/tests/assets/input/mouse-helper.jssimilarity index 100%rename from test/assets/input/mouse-helper.jsrename to tests/assets/input/mouse-helper.jsdiff --git a/test/assets/input/rotatedButton.html b/tests/assets/input/rotatedButton.htmlsimilarity index 100%rename from test/assets/input/rotatedButton.htmlrename to tests/assets/input/rotatedButton.htmldiff --git a/test/assets/input/scrollable.html b/tests/assets/input/scrollable.htmlsimilarity index 100%rename from test/assets/input/scrollable.htmlrename to tests/assets/input/scrollable.htmldiff --git a/test/assets/input/scrollable2.html b/tests/assets/input/scrollable2.htmlsimilarity index 100%rename from test/assets/input/scrollable2.htmlrename to tests/assets/input/scrollable2.htmldiff --git a/test/assets/input/select.html b/tests/assets/input/select.htmlsimilarity index 100%rename from test/assets/input/select.htmlrename to tests/assets/input/select.htmldiff --git a/test/assets/input/textarea.html b/tests/assets/input/textarea.htmlsimilarity index 100%rename from test/assets/input/textarea.htmlrename to tests/assets/input/textarea.htmldiff --git a/test/assets/input/touches.html b/tests/assets/input/touches.htmlsimilarity index 100%rename from test/assets/input/touches.htmlrename to tests/assets/input/touches.htmldiff --git a/test/assets/jscoverage/eval.html b/tests/assets/jscoverage/eval.htmlsimilarity index 100%rename from test/assets/jscoverage/eval.htmlrename to tests/assets/jscoverage/eval.htmldiff --git a/test/assets/jscoverage/involved.html b/tests/assets/jscoverage/involved.htmlsimilarity index 100%rename from test/assets/jscoverage/involved.htmlrename to tests/assets/jscoverage/involved.htmldiff --git a/test/assets/jscoverage/multiple.html b/tests/assets/jscoverage/multiple.htmlsimilarity index 100%rename from test/assets/jscoverage/multiple.htmlrename to tests/assets/jscoverage/multiple.htmldiff --git a/test/assets/jscoverage/ranges.html b/tests/assets/jscoverage/ranges.htmlsimilarity index 100%rename from test/assets/jscoverage/ranges.htmlrename to tests/assets/jscoverage/ranges.htmldiff --git a/test/assets/jscoverage/script1.js b/tests/assets/jscoverage/script1.jssimilarity index 100%rename from test/assets/jscoverage/script1.jsrename to tests/assets/jscoverage/script1.jsdiff --git a/test/assets/jscoverage/script2.js b/tests/assets/jscoverage/script2.jssimilarity index 100%rename from test/assets/jscoverage/script2.jsrename to tests/assets/jscoverage/script2.jsdiff --git a/test/assets/jscoverage/simple.html b/tests/assets/jscoverage/simple.htmlsimilarity index 100%rename from test/assets/jscoverage/simple.htmlrename to tests/assets/jscoverage/simple.htmldiff --git a/test/assets/jscoverage/sourceurl.html b/tests/assets/jscoverage/sourceurl.htmlsimilarity index 100%rename from test/assets/jscoverage/sourceurl.htmlrename to tests/assets/jscoverage/sourceurl.htmldiff --git a/test/assets/jscoverage/unused.html b/tests/assets/jscoverage/unused.htmlsimilarity index 100%rename from test/assets/jscoverage/unused.htmlrename to tests/assets/jscoverage/unused.htmldiff --git a/test/assets/media-query-prefers-color-scheme.svg b/tests/assets/media-query-prefers-color-scheme.svgsimilarity index 100%rename from test/assets/media-query-prefers-color-scheme.svgrename to tests/assets/media-query-prefers-color-scheme.svgdiff --git a/test/assets/mobile.html b/tests/assets/mobile.htmlsimilarity index 100%rename from test/assets/mobile.htmlrename to tests/assets/mobile.htmldiff --git a/test/assets/modernizr.js b/tests/assets/modernizr.jssimilarity index 100%rename from test/assets/modernizr.jsrename to tests/assets/modernizr.jsdiff --git a/test/assets/movie.mp4 b/tests/assets/movie.mp4similarity index 100%rename from test/assets/movie.mp4rename to tests/assets/movie.mp4diff --git a/test/assets/movie.ogv b/tests/assets/movie.ogvsimilarity index 100%rename from test/assets/movie.ogvrename to tests/assets/movie.ogvdiff --git a/test/assets/networkidle-frame.html b/tests/assets/networkidle-frame.htmlsimilarity index 100%rename from test/assets/networkidle-frame.htmlrename to tests/assets/networkidle-frame.htmldiff --git a/test/assets/networkidle.html b/tests/assets/networkidle.htmlsimilarity index 100%rename from test/assets/networkidle.htmlrename to tests/assets/networkidle.htmldiff --git a/test/assets/networkidle.js b/tests/assets/networkidle.jssimilarity index 100%rename from test/assets/networkidle.jsrename to tests/assets/networkidle.jsdiff --git a/test/assets/offscreenbuttons.html b/tests/assets/offscreenbuttons.htmlsimilarity index 100%rename from test/assets/offscreenbuttons.htmlrename to tests/assets/offscreenbuttons.htmldiff --git a/test/assets/one-style.css b/tests/assets/one-style.csssimilarity index 100%rename from test/assets/one-style.cssrename to tests/assets/one-style.cssdiff --git a/test/assets/one-style.html b/tests/assets/one-style.htmlsimilarity index 100%rename from test/assets/one-style.htmlrename to tests/assets/one-style.htmldiff --git a/test/assets/overflow-large.html b/tests/assets/overflow-large.htmlsimilarity index 100%rename from test/assets/overflow-large.htmlrename to tests/assets/overflow-large.htmldiff --git a/test/assets/overflow.html b/tests/assets/overflow.htmlsimilarity index 100%rename from test/assets/overflow.htmlrename to tests/assets/overflow.htmldiff --git a/test/assets/player.html b/tests/assets/player.htmlsimilarity index 100%rename from test/assets/player.htmlrename to tests/assets/player.htmldiff --git a/test/assets/playground.html b/tests/assets/playground.htmlsimilarity index 100%rename from test/assets/playground.htmlrename to tests/assets/playground.htmldiff --git a/test/assets/popup/popup.html b/tests/assets/popup/popup.htmlsimilarity index 100%rename from test/assets/popup/popup.htmlrename to tests/assets/popup/popup.htmldiff --git a/test/assets/popup/window-open.html b/tests/assets/popup/window-open.htmlsimilarity index 100%rename from test/assets/popup/window-open.htmlrename to tests/assets/popup/window-open.htmldiff --git a/test/assets/pptr.png b/tests/assets/pptr.pngsimilarity index 100%rename from test/assets/pptr.pngrename to tests/assets/pptr.pngdiff --git a/test/assets/react.html b/tests/assets/react.htmlsimilarity index 100%rename from test/assets/react.htmlrename to tests/assets/react.htmldiff --git a/test/assets/react/[email protected] b/tests/assets/react/[email protected]similarity index 100%rename from test/assets/react/[email protected]rename to tests/assets/react/[email protected]diff --git a/test/assets/react/[email protected] b/tests/assets/react/[email protected]similarity index 100%rename from test/assets/react/[email protected]rename to tests/assets/react/[email protected]diff --git a/test/assets/redirectloop1.html b/tests/assets/redirectloop1.htmlsimilarity index 100%rename from test/assets/redirectloop1.htmlrename to tests/assets/redirectloop1.htmldiff --git a/test/assets/redirectloop2.html b/tests/assets/redirectloop2.htmlsimilarity index 100%rename from test/assets/redirectloop2.htmlrename to tests/assets/redirectloop2.htmldiff --git a/test/assets/resetcss.html b/tests/assets/resetcss.htmlsimilarity index 100%rename from test/assets/resetcss.htmlrename to tests/assets/resetcss.htmldiff --git a/test/assets/rotate-z.html b/tests/assets/rotate-z.htmlsimilarity index 100%rename from test/assets/rotate-z.htmlrename to tests/assets/rotate-z.htmldiff --git a/test/assets/screenshots/canvas.html b/tests/assets/screenshots/canvas.htmlsimilarity index 100%rename from test/assets/screenshots/canvas.htmlrename to tests/assets/screenshots/canvas.htmldiff --git a/test/assets/screenshots/controls.html b/tests/assets/screenshots/controls.htmlsimilarity index 100%rename from test/assets/screenshots/controls.htmlrename to tests/assets/screenshots/controls.htmldiff --git a/test/assets/screenshots/translateZ.html b/tests/assets/screenshots/translateZ.htmlsimilarity index 100%rename from test/assets/screenshots/translateZ.htmlrename to tests/assets/screenshots/translateZ.htmldiff --git a/test/assets/screenshots/webgl.html b/tests/assets/screenshots/webgl.htmlsimilarity index 100%rename from test/assets/screenshots/webgl.htmlrename to tests/assets/screenshots/webgl.htmldiff --git a/test/assets/sectionselectorengine.js b/tests/assets/sectionselectorengine.jssimilarity index 100%rename from test/assets/sectionselectorengine.jsrename to tests/assets/sectionselectorengine.jsdiff --git a/test/assets/self-request.html b/tests/assets/self-request.htmlsimilarity index 100%rename from test/assets/self-request.htmlrename to tests/assets/self-request.htmldiff --git a/test/assets/serviceworkers/empty/sw.html b/tests/assets/serviceworkers/empty/sw.htmlsimilarity index 100%rename from test/assets/serviceworkers/empty/sw.htmlrename to tests/assets/serviceworkers/empty/sw.htmldiff --git a/test/assets/serviceworkers/empty/sw.js b/tests/assets/serviceworkers/empty/sw.jssimilarity index 100%rename from test/assets/serviceworkers/empty/sw.jsrename to tests/assets/serviceworkers/empty/sw.jsdiff --git a/test/assets/serviceworkers/fetch/style.css b/tests/assets/serviceworkers/fetch/style.csssimilarity index 100%rename from test/assets/serviceworkers/fetch/style.cssrename to tests/assets/serviceworkers/fetch/style.cssdiff --git a/test/assets/serviceworkers/fetch/sw.html b/tests/assets/serviceworkers/fetch/sw.htmlsimilarity index 100%rename from test/assets/serviceworkers/fetch/sw.htmlrename to tests/assets/serviceworkers/fetch/sw.htmldiff --git a/test/assets/serviceworkers/fetch/sw.js b/tests/assets/serviceworkers/fetch/sw.jssimilarity index 100%rename from test/assets/serviceworkers/fetch/sw.jsrename to tests/assets/serviceworkers/fetch/sw.jsdiff --git a/test/assets/serviceworkers/fetchdummy/sw.html b/tests/assets/serviceworkers/fetchdummy/sw.htmlsimilarity index 100%rename from test/assets/serviceworkers/fetchdummy/sw.htmlrename to tests/assets/serviceworkers/fetchdummy/sw.htmldiff --git a/test/assets/serviceworkers/fetchdummy/sw.js b/tests/assets/serviceworkers/fetchdummy/sw.jssimilarity index 100%rename from test/assets/serviceworkers/fetchdummy/sw.jsrename to tests/assets/serviceworkers/fetchdummy/sw.jsdiff --git a/test/assets/shadow-dom-link.html b/tests/assets/shadow-dom-link.htmlsimilarity index 100%rename from test/assets/shadow-dom-link.htmlrename to tests/assets/shadow-dom-link.htmldiff --git a/test/assets/shadow.html b/tests/assets/shadow.htmlsimilarity index 100%rename from test/assets/shadow.htmlrename to tests/assets/shadow.htmldiff --git a/test/assets/simple-extension/content-script.js b/tests/assets/simple-extension/content-script.jssimilarity index 100%rename from test/assets/simple-extension/content-script.jsrename to tests/assets/simple-extension/content-script.jsdiff --git a/test/assets/simple-extension/index.js b/tests/assets/simple-extension/index.jssimilarity index 100%rename from test/assets/simple-extension/index.jsrename to tests/assets/simple-extension/index.jsdiff --git a/test/assets/simple-extension/manifest.json b/tests/assets/simple-extension/manifest.jsonsimilarity index 100%rename from test/assets/simple-extension/manifest.jsonrename to tests/assets/simple-extension/manifest.jsondiff --git a/test/assets/simple.json b/tests/assets/simple.jsonsimilarity index 100%rename from test/assets/simple.jsonrename to tests/assets/simple.jsondiff --git a/test/assets/tamperable.html b/tests/assets/tamperable.htmlsimilarity index 100%rename from test/assets/tamperable.htmlrename to tests/assets/tamperable.htmldiff --git a/test/assets/title.html b/tests/assets/title.htmlsimilarity index 100%rename from test/assets/title.htmlrename to tests/assets/title.htmldiff --git a/test/assets/video.html b/tests/assets/video.htmlsimilarity index 100%rename from test/assets/video.htmlrename to tests/assets/video.htmldiff --git a/test/assets/video_mp4.html b/tests/assets/video_mp4.htmlsimilarity index 100%rename from test/assets/video_mp4.htmlrename to tests/assets/video_mp4.htmldiff --git a/test/assets/wasm/table2.html b/tests/assets/wasm/table2.htmlsimilarity index 100%rename from test/assets/wasm/table2.htmlrename to tests/assets/wasm/table2.htmldiff --git a/test/assets/wasm/table2.wasm b/tests/assets/wasm/table2.wasmsimilarity index 100%rename from test/assets/wasm/table2.wasmrename to tests/assets/wasm/table2.wasmdiff --git a/test/assets/worker/import-me.js b/tests/assets/worker/import-me.jssimilarity index 100%rename from test/assets/worker/import-me.jsrename to tests/assets/worker/import-me.jsdiff --git a/test/assets/worker/worker-http-import.html b/tests/assets/worker/worker-http-import.htmlsimilarity index 100%rename from test/assets/worker/worker-http-import.htmlrename to tests/assets/worker/worker-http-import.htmldiff --git a/test/assets/worker/worker-http-import.js b/tests/assets/worker/worker-http-import.jssimilarity index 100%rename from test/assets/worker/worker-http-import.jsrename to tests/assets/worker/worker-http-import.jsdiff --git a/test/assets/worker/worker.html b/tests/assets/worker/worker.htmlsimilarity index 100%rename from test/assets/worker/worker.htmlrename to tests/assets/worker/worker.htmldiff --git a/test/assets/worker/worker.js b/tests/assets/worker/worker.jssimilarity index 100%rename from test/assets/worker/worker.jsrename to tests/assets/worker/worker.jsdiff --git a/test/assets/wrappedlink.html b/tests/assets/wrappedlink.htmlsimilarity index 100%rename from test/assets/wrappedlink.htmlrename to tests/assets/wrappedlink.htmldiff --git a/tests/browsercontext-add-init-script.spec.ts b/tests/browsercontext-add-init-script.spec.tsindex 0649bcaf74..86c5705ddc 100644--- a/tests/browsercontext-add-init-script.spec.ts+++ b/tests/browsercontext-add-init-script.spec.ts@@ -16,7 +16,6 @@*/import { contextTest as it, expect } from './config/browserTest';-import path from 'path';it('should work with browser context scripts', async ({ context, server }) => {await context.addInitScript(() => window['temp'] = 123);@@ -53,8 +52,8 @@ it('should work without navigation in popup', async ({ context }) => {expect(await popup.evaluate(() => window['temp'])).toBe(123);});-it('should work with browser context scripts with a path', async ({ context, server }) => {- await context.addInitScript({ path: path.join(__dirname, '../test/assets/injectedfile.js') });+it('should work with browser context scripts with a path', async ({ context, server, asset }) => {+ await context.addInitScript({ path: asset('injectedfile.js') });const page = await context.newPage();await page.goto(server.PREFIX + '/tamperable.html');expect(await page.evaluate(() => window['result'])).toBe(123);diff --git a/tests/browsercontext-basic.spec.ts b/tests/browsercontext-basic.spec.tsindex fa2675c12d..20551af0d2 100644--- a/tests/browsercontext-basic.spec.ts+++ b/tests/browsercontext-basic.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/browserTest';-import { verifyViewport } from '../test/utils';+import { verifyViewport } from './config/utils';it('should create new context', async function({browser}) {expect(browser.contexts().length).toBe(0);diff --git a/tests/browsercontext-csp.spec.ts b/tests/browsercontext-csp.spec.tsindex 229731887a..6f7b474c8f 100644--- a/tests/browsercontext-csp.spec.ts+++ b/tests/browsercontext-csp.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/browserTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';it('should bypass CSP meta tag', async ({browser, server}) => {// Make sure CSP prohibits addScriptTag.diff --git a/tests/browsercontext-user-agent.spec.ts b/tests/browsercontext-user-agent.spec.tsindex d25186c246..141199edab 100644--- a/tests/browsercontext-user-agent.spec.ts+++ b/tests/browsercontext-user-agent.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/browserTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';it('should work', async ({browser, server}) => {{diff --git a/tests/browsercontext-viewport.spec.ts b/tests/browsercontext-viewport.spec.tsindex f9922aa47b..82fcf3a7ff 100644--- a/tests/browsercontext-viewport.spec.ts+++ b/tests/browsercontext-viewport.spec.ts@@ -17,7 +17,7 @@import { test as it, expect } from './config/pageTest';import { test as browserTest } from './config/browserTest';-import { verifyViewport } from '../test/utils';+import { verifyViewport } from './config/utils';it.beforeEach(async () => {it.skip(!!process.env.PW_ANDROID_TESTS);diff --git a/tests/browsertype-launch.spec.ts b/tests/browsertype-launch.spec.tsindex 2b4f5c7a88..0357722f2a 100644--- a/tests/browsertype-launch.spec.ts+++ b/tests/browsertype-launch.spec.ts@@ -15,7 +15,6 @@* limitations under the License.*/-import path from 'path';import { test as it, slowTest, expect } from './config/playwrightTest';it('should reject all promises when browser is closed', async ({browserType, browserOptions}) => {@@ -64,8 +63,8 @@ it('should throw if page argument is passed', async ({browserType, browserOptionexpect(waitError.message).toContain('can not specify page');});-it('should reject if launched browser fails immediately', async ({browserType, browserOptions}) => {- const options = Object.assign({}, browserOptions, {executablePath: path.join(__dirname, '..', 'test', 'assets', 'dummy_bad_browser_executable.js')});+it('should reject if launched browser fails immediately', async ({browserType, browserOptions, asset}) => {+ const options = Object.assign({}, browserOptions, {executablePath: asset('dummy_bad_browser_executable.js')});let waitError = null;await browserType.launch(options).catch(e => waitError = e);expect(waitError.message).toContain('== logs ==');diff --git a/tests/chromium/launcher.spec.ts b/tests/chromium/launcher.spec.tsindex 6b8aacf162..c1a05902ce 100644--- a/tests/chromium/launcher.spec.ts+++ b/tests/chromium/launcher.spec.ts@@ -15,7 +15,6 @@*/import { test as it, expect } from '../config/playwrightTest';-import path from 'path';it.beforeEach(async ({ browserName }) => {it.skip(browserName !== 'chromium');@@ -57,9 +56,9 @@ it('should open devtools when "devtools: true" option is given', async ({browserawait browser.close();});-it('should return background pages', async ({browserType, browserOptions, createUserDataDir}) => {+it('should return background pages', async ({browserType, browserOptions, createUserDataDir, asset}) => {const userDataDir = await createUserDataDir();- const extensionPath = path.join(__dirname, '..', '..', 'test', 'assets', 'simple-extension');+ const extensionPath = asset('simple-extension');const extensionOptions = {...browserOptions,headless: false,args: [@@ -78,9 +77,9 @@ it('should return background pages', async ({browserType, browserOptions, createawait context.close();});-it('should return background pages when recording video', async ({browserType, browserOptions, createUserDataDir}, testInfo) => {+it('should return background pages when recording video', async ({browserType, browserOptions, createUserDataDir, asset}, testInfo) => {const userDataDir = await createUserDataDir();- const extensionPath = path.join(__dirname, '..', '..', 'test', 'assets', 'simple-extension');+ const extensionPath = asset('simple-extension');const extensionOptions = {...browserOptions,headless: false,args: [diff --git a/tests/cli/cli-codegen-2.spec.ts b/tests/cli/cli-codegen-2.spec.tsindex 5e4d06487c..a42b4c3c4c 100644--- a/tests/cli/cli-codegen-2.spec.ts+++ b/tests/cli/cli-codegen-2.spec.ts@@ -117,7 +117,7 @@ await page.CloseAsync();`);expect(errors.length).toBe(0);});- test('should upload a single file', async ({ page, openRecorder, browserName }) => {+ test('should upload a single file', async ({ page, openRecorder, browserName, asset }) => {test.fixme(browserName === 'firefox', 'Hangs');const recorder = await openRecorder();@@ -128,7 +128,7 @@ await page.CloseAsync();`);`);await page.focus('input[type=file]');- await page.setInputFiles('input[type=file]', 'test/assets/file-to-upload.txt');+ await page.setInputFiles('input[type=file]', asset('file-to-upload.txt'));await page.click('input[type=file]');const sources = await recorder.waitForOutput('<javascript>', 'setInputFiles');@@ -155,7 +155,7 @@ await page.SetInputFilesAsync(\"input[type=\\\"file\\\"]\", \"file-to-upload.txt});- test('should upload multiple files', async ({ page, openRecorder, browserName }) => {+ test('should upload multiple files', async ({ page, openRecorder, browserName, asset }) => {test.fixme(browserName === 'firefox', 'Hangs');const recorder = await openRecorder();@@ -166,7 +166,7 @@ await page.SetInputFilesAsync(\"input[type=\\\"file\\\"]\", \"file-to-upload.txt`);await page.focus('input[type=file]');- await page.setInputFiles('input[type=file]', ['test/assets/file-to-upload.txt', 'test/assets/file-to-upload-2.txt']);+ await page.setInputFiles('input[type=file]', [asset('file-to-upload.txt'), asset('file-to-upload-2.txt')]);await page.click('input[type=file]');const sources = await recorder.waitForOutput('<javascript>', 'setInputFiles');@@ -192,7 +192,7 @@ await page.SetInputFilesAsync(\"input[type=\\\"file\\\"]\", \"file-to-upload.txtawait page.SetInputFilesAsync(\"input[type=\\\"file\\\"]\", new[] { \"file-to-upload.txt\", \"file-to-upload-2.txt\" });`);});- test('should clear files', async ({ page, openRecorder, browserName }) => {+ test('should clear files', async ({ page, openRecorder, browserName, asset }) => {test.fixme(browserName === 'firefox', 'Hangs');const recorder = await openRecorder();@@ -202,7 +202,7 @@ await page.SetInputFilesAsync(\"input[type=\\\"file\\\"]\", new[] { \"file-to-up</form>`);await page.focus('input[type=file]');- await page.setInputFiles('input[type=file]', 'test/assets/file-to-upload.txt');+ await page.setInputFiles('input[type=file]', asset('file-to-upload.txt'));await page.setInputFiles('input[type=file]', []);await page.click('input[type=file]');diff --git a/tests/cli/cli-codegen-csharp.spec.ts b/tests/cli/cli-codegen-csharp.spec.tsindex 5bfbbd7a87..2abef1df75 100644--- a/tests/cli/cli-codegen-csharp.spec.ts+++ b/tests/cli/cli-codegen-csharp.spec.ts@@ -18,7 +18,7 @@ import path from 'path';import fs from 'fs';import { test, expect } from '../config/cliTest';-const emptyHTML = new URL('file://' + path.join(__dirname, '..', '..', 'test', 'assets', 'empty.html')).toString();+const emptyHTML = new URL('file://' + path.join(__dirname, '..', 'assets', 'empty.html')).toString();const launchOptions = (channel: string) => {return channel ? `headless: false,\n channel: "${channel}"` : 'headless: false';};diff --git a/tests/cli/cli-codegen-java.spec.ts b/tests/cli/cli-codegen-java.spec.tsindex 94279f6b76..3fe1ba23a7 100644--- a/tests/cli/cli-codegen-java.spec.ts+++ b/tests/cli/cli-codegen-java.spec.ts@@ -18,7 +18,7 @@ import fs from 'fs';import path from 'path';import { test, expect } from '../config/cliTest';-const emptyHTML = new URL('file://' + path.join(__dirname, '..', '..', 'test', 'assets', 'empty.html')).toString();+const emptyHTML = new URL('file://' + path.join(__dirname, '..', 'assets', 'empty.html')).toString();const launchOptions = (channel: string) => {return channel ? `.setHeadless(false)\n .setChannel("${channel}")` : '.setHeadless(false)';};diff --git a/tests/cli/cli-codegen-javascript.spec.ts b/tests/cli/cli-codegen-javascript.spec.tsindex 90694af473..947f184074 100644--- a/tests/cli/cli-codegen-javascript.spec.ts+++ b/tests/cli/cli-codegen-javascript.spec.ts@@ -18,7 +18,7 @@ import fs from 'fs';import path from 'path';import { test, expect } from '../config/cliTest';-const emptyHTML = new URL('file://' + path.join(__dirname, '..', '..', 'test', 'assets', 'empty.html')).toString();+const emptyHTML = new URL('file://' + path.join(__dirname, '..', 'assets', 'empty.html')).toString();const launchOptions = (channel: string) => {return channel ? `headless: false,\n channel: '${channel}'` : 'headless: false';diff --git a/tests/cli/cli-codegen-python-async.spec.ts b/tests/cli/cli-codegen-python-async.spec.tsindex 2a9965dc0d..0722026cc3 100644--- a/tests/cli/cli-codegen-python-async.spec.ts+++ b/tests/cli/cli-codegen-python-async.spec.ts@@ -18,7 +18,7 @@ import fs from 'fs';import path from 'path';import { test, expect } from '../config/cliTest';-const emptyHTML = new URL('file://' + path.join(__dirname, '..', '..', 'test', 'assets', 'empty.html')).toString();+const emptyHTML = new URL('file://' + path.join(__dirname, '..', 'assets', 'empty.html')).toString();const launchOptions = (channel: string) => {return channel ? `headless=False, channel="${channel}"` : 'headless=False';};diff --git a/tests/cli/cli-codegen-python.spec.ts b/tests/cli/cli-codegen-python.spec.tsindex 3b3470ae6b..7dd6fde89a 100644--- a/tests/cli/cli-codegen-python.spec.ts+++ b/tests/cli/cli-codegen-python.spec.ts@@ -18,7 +18,7 @@ import fs from 'fs';import path from 'path';import { test, expect } from '../config/cliTest';-const emptyHTML = new URL('file://' + path.join(__dirname, '..', '..', 'test', 'assets', 'empty.html')).toString();+const emptyHTML = new URL('file://' + path.join(__dirname, '..', 'assets', 'empty.html')).toString();const launchOptions = (channel: string) => {return channel ? `headless=False, channel="${channel}"` : 'headless=False';};diff --git a/tests/config/browserEnv.ts b/tests/config/browserEnv.tsindex 8813cfbc06..a620b0b70f 100644--- a/tests/config/browserEnv.ts+++ b/tests/config/browserEnv.ts@@ -16,7 +16,7 @@import type { Env, WorkerInfo, TestInfo } from 'folio';import type { Browser, BrowserContext, BrowserContextOptions, BrowserType, LaunchOptions } from '../../index';-import { installCoverageHooks } from '../../test/coverage';+import { installCoverageHooks } from './coverage';import { start } from '../../lib/outofprocess';import { PlaywrightClient } from '../../lib/remote/playwrightClient';import { removeFolders } from '../../lib/utils/utils';@@ -202,7 +202,7 @@ export class PlaywrightEnv implements Env<PlaywrightTestArgs> {await this._mode.teardown();const { coverage, uninstall } = this._coverage!;uninstall();- const coveragePath = path.join(__dirname, '..', '..', 'test', 'coverage-report', workerInfo.workerIndex + '.json');+ const coveragePath = path.join(__dirname, '..', 'coverage-report', workerInfo.workerIndex + '.json');const coverageJSON = Array.from(coverage.keys()).filter(key => coverage.get(key));await fs.promises.mkdir(path.dirname(coveragePath), { recursive: true });await fs.promises.writeFile(coveragePath, JSON.stringify(coverageJSON, undefined, 2), 'utf8');diff --git a/test/checkCoverage.js b/tests/config/checkCoverage.jssimilarity index 97%rename from test/checkCoverage.jsrename to tests/config/checkCoverage.jsindex 658c118a43..1a8b8e7019 100644--- a/test/checkCoverage.js+++ b/tests/config/checkCoverage.js@@ -54,7 +54,7 @@ if (browserName === 'webkit')// Android coverage is abysmal.api = new Set(Array.from(api).filter(name => !name.toLowerCase().startsWith('android')));-const coverageDir = path.join(__dirname, 'coverage-report');+const coverageDir = path.join(__dirname, '..', 'coverage-report');const coveredMethods = new Set();for (const file of getCoverageFiles(coverageDir)) {diff --git a/test/coverage.js b/tests/config/coverage.jssimilarity index 96%rename from test/coverage.jsrename to tests/config/coverage.jsindex 1d0c2a6e43..24a0bb463c 100644--- a/test/coverage.js+++ b/tests/config/coverage.js@@ -60,8 +60,8 @@ function traceAPICoverage(apiCoverage, api, events) {* @param {string} browserName*/function apiForBrowser(browserName) {- const events = require('../lib/client/events').Events;- const api = require('../lib/client/api');+ const events = require('../../lib/client/events').Events;+ const api = require('../../lib/client/api');const otherBrowsers = ['chromium', 'webkit', 'firefox'].filter(name => name.toLowerCase() !== browserName.toLowerCase());const filteredKeys = Object.keys(api).filter(apiName => {if (apiName.toLowerCase().startsWith('electron'))diff --git a/test/run_static_server.js b/tests/config/run_static_server.jssimilarity index 100%rename from test/run_static_server.jsrename to tests/config/run_static_server.jsdiff --git a/tests/config/serverEnv.ts b/tests/config/serverEnv.tsindex 15c8f453c9..cdda097d15 100644--- a/tests/config/serverEnv.ts+++ b/tests/config/serverEnv.ts@@ -27,8 +27,8 @@ export class ServerEnv implements Env<ServerTestArgs> {private _socksPort: number;async beforeAll(workerInfo: WorkerInfo) {- const assetsPath = path.join(__dirname, '..', '..', 'test', 'assets');- const cachedPath = path.join(__dirname, '..', '..', 'test', 'assets', 'cached');+ const assetsPath = path.join(__dirname, '..', 'assets');+ const cachedPath = path.join(__dirname, '..', 'assets', 'cached');const port = 8907 + workerInfo.workerIndex * 3;this._server = await TestServer.create(assetsPath, port);@@ -63,7 +63,7 @@ export class ServerEnv implements Env<ServerTestArgs> {this._server.reset();this._httpsServer.reset();return {- asset: (p: string) => path.join(__dirname, '..', '..', 'test', 'assets', p),+ asset: (p: string) => path.join(__dirname, '..', 'assets', ...p.split('/')),server: this._server,httpsServer: this._httpsServer,socksPort: this._socksPort,diff --git a/test/utils.ts b/tests/config/utils.tssimilarity index 97%rename from test/utils.tsrename to tests/config/utils.tsindex 45fc1003dc..4c2d0f863a 100644--- a/test/utils.ts+++ b/tests/config/utils.ts@@ -15,7 +15,7 @@*/import { expect } from 'folio';-import type { Frame, Page } from '../index';+import type { Frame, Page } from '../../index';export async function attachFrame(page: Page, frameId: string, url: string): Promise<Frame> {const handle = await page.evaluateHandle(async ({ frameId, url }) => {diff --git a/tests/defaultbrowsercontext-1.spec.ts b/tests/defaultbrowsercontext-1.spec.tsindex 774162a384..5d80a91424 100644--- a/tests/defaultbrowsercontext-1.spec.ts+++ b/tests/defaultbrowsercontext-1.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/playwrightTest';-import { verifyViewport } from '../test/utils';+import { verifyViewport } from './config/utils';import fs from 'fs';it('context.cookies() should work', async ({server, launchPersistent}) => {diff --git a/tests/elementhandle-content-frame.spec.ts b/tests/elementhandle-content-frame.spec.tsindex 9ca6225a3d..22a6812c0b 100644--- a/tests/elementhandle-content-frame.spec.ts+++ b/tests/elementhandle-content-frame.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/pageTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';it('should work', async ({ page, server }) => {await page.goto(server.EMPTY_PAGE);diff --git a/tests/elementhandle-owner-frame.spec.ts b/tests/elementhandle-owner-frame.spec.tsindex e5ce7f674b..9efe9484da 100644--- a/tests/elementhandle-owner-frame.spec.ts+++ b/tests/elementhandle-owner-frame.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/pageTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';it('should work', async ({ page, server }) => {await page.goto(server.EMPTY_PAGE);diff --git a/tests/elementhandle-screenshot.spec.ts b/tests/elementhandle-screenshot.spec.tsindex 9429421461..4396607196 100644--- a/tests/elementhandle-screenshot.spec.ts+++ b/tests/elementhandle-screenshot.spec.ts@@ -17,7 +17,7 @@import { test as it, expect } from './config/pageTest';import { test as browserTest } from './config/browserTest';-import { verifyViewport } from '../test/utils';+import { verifyViewport } from './config/utils';import {PNG} from 'pngjs';import path from 'path';import fs from 'fs';diff --git a/tests/emulation-focus.spec.ts b/tests/emulation-focus.spec.tsindex ed47bc8d0d..bec91a68e5 100644--- a/tests/emulation-focus.spec.ts+++ b/tests/emulation-focus.spec.ts@@ -17,7 +17,7 @@import { test as it, expect } from './config/pageTest';import { test as browserTest } from './config/browserTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';it('should think that it is focused by default', async ({page}) => {expect(await page.evaluate('document.hasFocus()')).toBe(true);diff --git a/tests/favicon.spec.ts b/tests/favicon.spec.tsindex 25c2b89697..f968c21b34 100644--- a/tests/favicon.spec.ts+++ b/tests/favicon.spec.ts@@ -15,10 +15,9 @@* limitations under the License.*/-import path from 'path';import { test as it } from './config/browserTest';-it('should load svg favicon with prefer-color-scheme', async ({contextFactory, server, browserName, browserChannel, headful}) => {+it('should load svg favicon with prefer-color-scheme', async ({contextFactory, server, browserName, browserChannel, headful, asset}) => {it.skip(!headful && browserName !== 'firefox', 'headless browsers, except firefox, do not request favicons');it.skip(headful && browserName === 'webkit' && !browserChannel, 'playwright headful webkit does not have a favicon feature');@@ -29,7 +28,7 @@ it('should load svg favicon with prefer-color-scheme', async ({contextFactory, s// `d` parameter to make iterating on this test more predictable and isolated.const favicon = `/favicon.svg?d=${Date.now()}`;server.setRoute(favicon, (req, res) => {- server.serveFile(req, res, path.join(__dirname, 'assets', 'media-query-prefers-color-scheme.svg'));+ server.serveFile(req, res, asset('media-query-prefers-color-scheme.svg'));});server.setRoute('/page.html', (_, res) => {diff --git a/tests/frame-evaluate.spec.ts b/tests/frame-evaluate.spec.tsindex aa8f1706c4..5060287061 100644--- a/tests/frame-evaluate.spec.ts+++ b/tests/frame-evaluate.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/pageTest';-import { attachFrame, detachFrame } from '../test/utils';+import { attachFrame, detachFrame } from './config/utils';import type { Frame } from '../src/client/frame';it('should have different execution contexts', async ({ page, server }) => {diff --git a/tests/frame-frame-element.spec.ts b/tests/frame-frame-element.spec.tsindex 692183c86e..b471510e06 100644--- a/tests/frame-frame-element.spec.ts+++ b/tests/frame-frame-element.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/pageTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';it('should work', async ({page, server}) => {await page.goto(server.EMPTY_PAGE);diff --git a/tests/frame-goto.spec.ts b/tests/frame-goto.spec.tsindex b2ab907b08..6a71c9b9b2 100644--- a/tests/frame-goto.spec.ts+++ b/tests/frame-goto.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/pageTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';it('should navigate subframes', async ({page, server}) => {await page.goto(server.PREFIX + '/frames/one-frame.html');diff --git a/tests/frame-hierarchy.spec.ts b/tests/frame-hierarchy.spec.tsindex 11d4dcbedf..00f2d6e596 100644--- a/tests/frame-hierarchy.spec.ts+++ b/tests/frame-hierarchy.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/pageTest';-import { attachFrame, detachFrame } from '../test/utils';+import { attachFrame, detachFrame } from './config/utils';import type { Frame } from '../index';function dumpFrames(frame: Frame, indentation: string = ''): string[] {diff --git a/tests/page-add-init-script.spec.ts b/tests/page-add-init-script.spec.tsindex 4aaf68d061..1de68bbee8 100644--- a/tests/page-add-init-script.spec.ts+++ b/tests/page-add-init-script.spec.ts@@ -16,7 +16,6 @@*/import { test as it, expect } from './config/pageTest';-import path from 'path';it('should evaluate before anything else on the page', async ({ page, server }) => {await page.addInitScript(function() {@@ -26,8 +25,8 @@ it('should evaluate before anything else on the page', async ({ page, server })expect(await page.evaluate(() => window['result'])).toBe(123);});-it('should work with a path', async ({ page, server }) => {- await page.addInitScript({ path: path.join(__dirname, '../test/assets/injectedfile.js') });+it('should work with a path', async ({ page, server, asset }) => {+ await page.addInitScript({ path: asset('injectedfile.js') });await page.goto(server.PREFIX + '/tamperable.html');expect(await page.evaluate(() => window['result'])).toBe(123);});diff --git a/tests/page-add-script-tag.spec.ts b/tests/page-add-script-tag.spec.tsindex ccc23e0a4c..80a571ee93 100644--- a/tests/page-add-script-tag.spec.ts+++ b/tests/page-add-script-tag.spec.ts@@ -42,9 +42,9 @@ it('should work with a url and type=module', async ({page, server}) => {expect(await page.evaluate(() => window['__es6injected'])).toBe(42);});-it('should work with a path and type=module', async ({page, server}) => {+it('should work with a path and type=module', async ({page, server, asset}) => {await page.goto(server.EMPTY_PAGE);- await page.addScriptTag({ path: path.join(__dirname, '../test/assets/es6/es6pathimport.js'), type: 'module' });+ await page.addScriptTag({ path: asset('es6/es6pathimport.js'), type: 'module' });await page.waitForFunction('window.__es6injected');expect(await page.evaluate(() => window['__es6injected'])).toBe(42);});@@ -67,18 +67,18 @@ it('should throw an error if loading from url fail', async ({page, server}) => {expect(error).not.toBe(null);});-it('should work with a path', async ({page, server}) => {+it('should work with a path', async ({page, server, asset}) => {await page.goto(server.EMPTY_PAGE);- const scriptHandle = await page.addScriptTag({ path: path.join(__dirname, '../test/assets/injectedfile.js') });+ const scriptHandle = await page.addScriptTag({ path: asset('injectedfile.js') });expect(scriptHandle.asElement()).not.toBeNull();expect(await page.evaluate(() => window['__injected'])).toBe(42);});-it('should include sourceURL when path is provided', async ({page, server, isWebKit}) => {+it('should include sourceURL when path is provided', async ({page, server, isWebKit, asset}) => {it.skip(isWebKit);await page.goto(server.EMPTY_PAGE);- await page.addScriptTag({ path: path.join(__dirname, '../test/assets/injectedfile.js') });+ await page.addScriptTag({ path: asset('injectedfile.js') });const result = await page.evaluate(() => window['__injectedError'].stack);expect(result).toContain(path.join('assets', 'injectedfile.js'));});diff --git a/tests/page-add-style-tag.spec.ts b/tests/page-add-style-tag.spec.tsindex 6e53a8431c..6b6bdd939a 100644--- a/tests/page-add-style-tag.spec.ts+++ b/tests/page-add-style-tag.spec.ts@@ -47,16 +47,16 @@ it('should throw an error if loading from url fail', async ({page, server}) => {expect(error).not.toBe(null);});-it('should work with a path', async ({page, server}) => {+it('should work with a path', async ({page, server, asset}) => {await page.goto(server.EMPTY_PAGE);- const styleHandle = await page.addStyleTag({ path: path.join(__dirname, '../test/assets/injectedstyle.css') });+ const styleHandle = await page.addStyleTag({ path: asset('injectedstyle.css') });expect(styleHandle.asElement()).not.toBeNull();expect(await page.evaluate(`window.getComputedStyle(document.querySelector('body')).getPropertyValue('background-color')`)).toBe('rgb(255, 0, 0)');});-it('should include sourceURL when path is provided', async ({page, server}) => {+it('should include sourceURL when path is provided', async ({page, server, asset}) => {await page.goto(server.EMPTY_PAGE);- await page.addStyleTag({ path: path.join(__dirname, '../test/assets/injectedstyle.css') });+ await page.addStyleTag({ path: asset('injectedstyle.css') });const styleHandle = await page.$('style');const styleContent = await page.evaluate(style => style.innerHTML, styleHandle);expect(styleContent).toContain(path.join('assets', 'injectedstyle.css'));diff --git a/tests/page-click.spec.ts b/tests/page-click.spec.tsindex 88cee57d51..df3e6a24bd 100644--- a/tests/page-click.spec.ts+++ b/tests/page-click.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/pageTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';async function giveItAChanceToClick(page) {for (let i = 0; i < 5; i++)diff --git a/tests/page-drag.spec.ts b/tests/page-drag.spec.tsindex d8393d73e3..d5799ba4b4 100644--- a/tests/page-drag.spec.ts+++ b/tests/page-drag.spec.ts@@ -16,7 +16,7 @@import type { ElementHandle } from '../index';import { test as it, expect } from './config/pageTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';it.describe('Drag and drop', () => {it.beforeEach(async ({ browserName }) => {diff --git a/tests/page-emulate-media.spec.ts b/tests/page-emulate-media.spec.tsindex 6d7015f07f..e9e4cc6057 100644--- a/tests/page-emulate-media.spec.ts+++ b/tests/page-emulate-media.spec.ts@@ -17,7 +17,7 @@import { test as it, expect } from './config/pageTest';import { test as browserTest } from './config/browserTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';it.beforeEach(async () => {it.skip(!!process.env.PW_ANDROID_TESTS);diff --git a/tests/page-event-request.spec.ts b/tests/page-event-request.spec.tsindex fbce07e394..1f051fd738 100644--- a/tests/page-event-request.spec.ts+++ b/tests/page-event-request.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/pageTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';it('should fire for navigation requests', async ({page, server}) => {const requests = [];diff --git a/tests/page-expose-function.spec.ts b/tests/page-expose-function.spec.tsindex 669b680cfa..e551fcd53a 100644--- a/tests/page-expose-function.spec.ts+++ b/tests/page-expose-function.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/pageTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';import type { ElementHandle } from '../index';it('exposeBinding should work', async ({page}) => {diff --git a/tests/page-goto.spec.ts b/tests/page-goto.spec.tsindex 0695e63bef..ae36754bb6 100644--- a/tests/page-goto.spec.ts+++ b/tests/page-goto.spec.ts@@ -15,21 +15,20 @@* limitations under the License.*/-import path from 'path';import url from 'url';import { test as it, expect } from './config/pageTest';import { slowTest } from './config/browserTest';-import { expectedSSLError } from '../test/utils';+import { expectedSSLError } from './config/utils';it('should work', async ({page, server}) => {await page.goto(server.EMPTY_PAGE);expect(page.url()).toBe(server.EMPTY_PAGE);});-it('should work with file URL', async ({page}) => {+it('should work with file URL', async ({page, asset}) => {it.skip(!!process.env.PW_ANDROID_TESTS, 'No files on Android');- const fileurl = url.pathToFileURL(path.join(__dirname, '..', 'test', 'assets', 'frames', 'two-frames.html')).href;+ const fileurl = url.pathToFileURL(asset('frames/two-frames.html')).href;await page.goto(fileurl);expect(page.url().toLowerCase()).toBe(fileurl.toLowerCase());expect(page.frames().length).toBe(3);diff --git a/tests/page-in-context.spec.ts b/tests/page-in-context.spec.tsindex 5e1109fb50..95961fa006 100644--- a/tests/page-in-context.spec.ts+++ b/tests/page-in-context.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/browserTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';it('should not be visible in context.pages', async ({contextFactory}) => {const context = await contextFactory();diff --git a/tests/page-keyboard.spec.ts b/tests/page-keyboard.spec.tsindex 612e314340..61e8cb5931 100644--- a/tests/page-keyboard.spec.ts+++ b/tests/page-keyboard.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/pageTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';it.beforeEach(async () => {it.skip(!!process.env.PW_ANDROID_TESTS);diff --git a/tests/page-network-request.spec.ts b/tests/page-network-request.spec.tsindex 8a7afdb798..ba31e26874 100644--- a/tests/page-network-request.spec.ts+++ b/tests/page-network-request.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/pageTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';it('should work for main frame navigation request', async ({page, server}) => {const requests = [];diff --git a/tests/page-network-response.spec.ts b/tests/page-network-response.spec.tsindex 728e341680..d10fe5d37e 100644--- a/tests/page-network-response.spec.ts+++ b/tests/page-network-response.spec.ts@@ -17,7 +17,6 @@import { test as it, expect } from './config/pageTest';import fs from 'fs';-import path from 'path';it('should work', async ({page, server}) => {server.setRoute('/empty.html', (req, res) => {@@ -95,17 +94,17 @@ it('should return json', async ({page, server}) => {expect(await response.json()).toEqual({foo: 'bar'});});-it('should return body', async ({page, server}) => {+it('should return body', async ({page, server, asset}) => {const response = await page.goto(server.PREFIX + '/pptr.png');- const imageBuffer = fs.readFileSync(path.join(__dirname, '..', 'test', 'assets', 'pptr.png'));+ const imageBuffer = fs.readFileSync(asset('pptr.png'));const responseBuffer = await response.body();expect(responseBuffer.equals(imageBuffer)).toBe(true);});-it('should return body with compression', async ({page, server}) => {+it('should return body with compression', async ({page, server, asset}) => {server.enableGzip('/pptr.png');const response = await page.goto(server.PREFIX + '/pptr.png');- const imageBuffer = fs.readFileSync(path.join(__dirname, '..', 'test', 'assets', 'pptr.png'));+ const imageBuffer = fs.readFileSync(asset('pptr.png'));const responseBuffer = await response.body();expect(responseBuffer.equals(imageBuffer)).toBe(true);});diff --git a/tests/page-request-fulfill.spec.ts b/tests/page-request-fulfill.spec.tsindex e6a21e906d..451d274edb 100644--- a/tests/page-request-fulfill.spec.ts+++ b/tests/page-request-fulfill.spec.ts@@ -18,8 +18,6 @@import { test as it, expect } from './config/pageTest';import { test as browserTest } from './config/browserTest';import fs from 'fs';-import path from 'path';-it('should work', async ({page, server}) => {await page.route('**/*', route => {@@ -51,12 +49,12 @@ it('should work with status code 422', async ({page, server}) => {expect(await page.evaluate(() => document.body.textContent)).toBe('Yo, page!');});-it('should allow mocking binary responses', async ({page, server, browserName, headful}) => {+it('should allow mocking binary responses', async ({page, server, browserName, headful, asset}) => {it.skip(browserName === 'firefox' && headful, 'Firefox headful produces a different image.');it.skip(!!process.env.PW_ANDROID_TESTS);await page.route('**/*', route => {- const imageBuffer = fs.readFileSync(path.join(__dirname, '..', 'test', 'assets', 'pptr.png'));+ const imageBuffer = fs.readFileSync(asset('pptr.png'));route.fulfill({contentType: 'image/png',body: imageBuffer@@ -93,10 +91,10 @@ it('should allow mocking svg with charset', async ({page, server, browserName, hexpect(await img.screenshot()).toMatchSnapshot('mock-svg.png');});-it('should work with file path', async ({page, server}) => {+it('should work with file path', async ({page, server, asset}) => {it.skip(!!process.env.PW_ANDROID_TESTS);- await page.route('**/*', route => route.fulfill({ contentType: 'shouldBeIgnored', path: path.join(__dirname, '..', 'test', 'assets', 'pptr.png') }));+ await page.route('**/*', route => route.fulfill({ contentType: 'shouldBeIgnored', path: asset('pptr.png') }));await page.evaluate(PREFIX => {const img = document.createElement('img');img.src = PREFIX + '/does-not-exist.png';diff --git a/tests/page-screenshot.spec.ts b/tests/page-screenshot.spec.tsindex 78e1730d7a..d8ee6112eb 100644--- a/tests/page-screenshot.spec.ts+++ b/tests/page-screenshot.spec.ts@@ -17,7 +17,7 @@import { test as it, expect } from './config/pageTest';import { test as browserTest, slowTest as slowBrowserTest } from './config/browserTest';-import { verifyViewport } from '../test/utils';+import { verifyViewport } from './config/utils';import path from 'path';import fs from 'fs';import { PNG } from 'pngjs';diff --git a/tests/page-set-input-files.spec.ts b/tests/page-set-input-files.spec.tsindex 9665f392fc..055f901855 100644--- a/tests/page-set-input-files.spec.ts+++ b/tests/page-set-input-files.spec.ts@@ -21,11 +21,9 @@ import path from 'path';import fs from 'fs';import formidable from 'formidable';-const FILE_TO_UPLOAD = path.join(__dirname, '../test/assets/file-to-upload.txt');--it('should upload the file', async ({page, server}) => {+it('should upload the file', async ({page, server, asset}) => {await page.goto(server.PREFIX + '/input/fileupload.html');- const filePath = path.relative(process.cwd(), FILE_TO_UPLOAD);+ const filePath = path.relative(process.cwd(), asset('file-to-upload.txt'));const input = await page.$('input');await input.setInputFiles(filePath);expect(await page.evaluate(e => e.files[0].name, input)).toBe('file-to-upload.txt');@@ -37,9 +35,9 @@ it('should upload the file', async ({page, server}) => {}, input)).toBe('contents of the file');});-it('should work', async ({page}) => {+it('should work', async ({page, asset}) => {await page.setContent(`<input type=file>`);- await page.setInputFiles('input', path.join(__dirname, '../test/assets/file-to-upload.txt'));+ await page.setInputFiles('input', asset('file-to-upload.txt'));expect(await page.$eval('input', input => input.files.length)).toBe(1);expect(await page.$eval('input', input => input.files[0].name)).toBe('file-to-upload.txt');});@@ -103,9 +101,9 @@ it('should work when file input is attached to DOM', async ({page, server}) => {expect(chooser).toBeTruthy();});-it('should work when file input is not attached to DOM', async ({page, server}) => {+it('should work when file input is not attached to DOM', async ({page, asset}) => {const [,content] = await Promise.all([- page.waitForEvent('filechooser').then(chooser => chooser.setFiles(FILE_TO_UPLOAD)),+ page.waitForEvent('filechooser').then(chooser => chooser.setFiles(asset('file-to-upload.txt'))),page.evaluate(async () => {const el = document.createElement('input');el.type = 'file';@@ -164,11 +162,11 @@ it('should not throw when frame is detached immediately', async ({page, server})await page.waitForFunction(() => (window as any).__done);});-it('should work with CSP', async ({page, server}) => {+it('should work with CSP', async ({page, server, asset}) => {server.setCSP('/empty.html', 'default-src "none"');await page.goto(server.EMPTY_PAGE);await page.setContent(`<input type=file>`);- await page.setInputFiles('input', path.join(__dirname, '../test/assets/file-to-upload.txt'));+ await page.setInputFiles('input', asset('file-to-upload.txt'));expect(await page.$eval('input', input => input.files.length)).toBe(1);expect(await page.$eval('input', input => input.files[0].name)).toBe('file-to-upload.txt');});@@ -215,7 +213,7 @@ it('should return the same file chooser when there are many watchdogs simultaneoexpect(fileChooser1 === fileChooser2).toBe(true);});-it('should accept single file', async ({page, server}) => {+it('should accept single file', async ({page, asset}) => {await page.setContent(`<input type=file oninput='javascript:console.timeStamp()'>`);const [fileChooser] = await Promise.all([page.waitForEvent('filechooser'),@@ -223,12 +221,12 @@ it('should accept single file', async ({page, server}) => {]);expect(fileChooser.page()).toBe(page);expect(fileChooser.element()).toBeTruthy();- await fileChooser.setFiles(FILE_TO_UPLOAD);+ await fileChooser.setFiles(asset('file-to-upload.txt'));expect(await page.$eval('input', input => input.files.length)).toBe(1);expect(await page.$eval('input', input => input.files[0].name)).toBe('file-to-upload.txt');});-it('should detect mime type', async ({page, server}) => {+it('should detect mime type', async ({page, server, asset}) => {it.fixme(!!process.env.PW_ANDROID_TESTS);let files;@@ -246,8 +244,8 @@ it('should detect mime type', async ({page, server}) => {<input type="file" name="file2"><input type="submit" value="Submit"></form>`);- await (await page.$('input[name=file1]')).setInputFiles(path.join(__dirname, '../test/assets/file-to-upload.txt'));- await (await page.$('input[name=file2]')).setInputFiles(path.join(__dirname, '../test/assets/pptr.png'));+ await (await page.$('input[name=file1]')).setInputFiles(asset('file-to-upload.txt'));+ await (await page.$('input[name=file2]')).setInputFiles(asset('pptr.png'));await Promise.all([page.click('input[type=submit]'),server.waitForRequest('/upload'),@@ -256,17 +254,17 @@ it('should detect mime type', async ({page, server}) => {expect(file1.name).toBe('file-to-upload.txt');expect(file1.type).toBe('text/plain');expect(fs.readFileSync(file1.path).toString()).toBe(- fs.readFileSync(path.join(__dirname, '../test/assets/file-to-upload.txt')).toString());+ fs.readFileSync(asset('file-to-upload.txt')).toString());expect(file2.name).toBe('pptr.png');expect(file2.type).toBe('image/png');expect(fs.readFileSync(file2.path).toString()).toBe(- fs.readFileSync(path.join(__dirname, '../test/assets/pptr.png')).toString());+ fs.readFileSync(asset('pptr.png')).toString());});-it('should be able to read selected file', async ({page, server}) => {+it('should be able to read selected file', async ({page, asset}) => {await page.setContent(`<input type=file>`);const [, content] = await Promise.all([- page.waitForEvent('filechooser').then(fileChooser => fileChooser.setFiles(FILE_TO_UPLOAD)),+ page.waitForEvent('filechooser').then(fileChooser => fileChooser.setFiles(asset('file-to-upload.txt'))),page.$eval('input', async picker => {picker.click();await new Promise(x => picker.oninput = x);@@ -279,10 +277,10 @@ it('should be able to read selected file', async ({page, server}) => {expect(content).toBe('contents of the file');});-it('should be able to reset selected files with empty file list', async ({page, server}) => {+it('should be able to reset selected files with empty file list', async ({page, asset}) => {await page.setContent(`<input type=file>`);const [, fileLength1] = await Promise.all([- page.waitForEvent('filechooser').then(fileChooser => fileChooser.setFiles(FILE_TO_UPLOAD)),+ page.waitForEvent('filechooser').then(fileChooser => fileChooser.setFiles(asset('file-to-upload.txt'))),page.$eval('input', async picker => {picker.click();await new Promise(x => picker.oninput = x);@@ -301,7 +299,7 @@ it('should be able to reset selected files with empty file list', async ({page,expect(fileLength2).toBe(0);});-it('should not accept multiple files for single-file input', async ({page, server}) => {+it('should not accept multiple files for single-file input', async ({page, asset}) => {await page.setContent(`<input type=file>`);const [fileChooser] = await Promise.all([page.waitForEvent('filechooser'),@@ -309,13 +307,13 @@ it('should not accept multiple files for single-file input', async ({page, serve]);let error = null;await fileChooser.setFiles([- path.join(__dirname, '../test/assets/file-to-upload.txt'),- path.join(__dirname, '../test/assets/pptr.png')+ asset('file-to-upload.txt'),+ asset('pptr.png')]).catch(e => error = e);expect(error).not.toBe(null);});-it('should emit input and change events', async ({page, server}) => {+it('should emit input and change events', async ({page, asset}) => {const events = [];await page.exposeFunction('eventHandled', e => events.push(e));await page.setContent(`@@ -324,7 +322,7 @@ it('should emit input and change events', async ({page, server}) => {input.addEventListener('input', e => eventHandled({ type: e.type }));input.addEventListener('change', e => eventHandled({ type: e.type }));</script>`);- await (await page.$('input')).setInputFiles(FILE_TO_UPLOAD);+ await (await page.$('input')).setInputFiles(asset('file-to-upload.txt'));expect(events.length).toBe(2);expect(events[0].type).toBe('input');expect(events[1].type).toBe('change');diff --git a/tests/page-wait-for-navigation.spec.ts b/tests/page-wait-for-navigation.spec.tsindex f8124992e0..c74495bdf9 100644--- a/tests/page-wait-for-navigation.spec.ts+++ b/tests/page-wait-for-navigation.spec.ts@@ -17,7 +17,7 @@import { test as it, expect } from './config/pageTest';import type { Frame } from '../index';-import { expectedSSLError } from '../test/utils';+import { expectedSSLError } from './config/utils';it('should work', async ({page, server}) => {await page.goto(server.EMPTY_PAGE);diff --git a/tests/page-wait-for-selector-1.spec.ts b/tests/page-wait-for-selector-1.spec.tsindex ab3b08b157..d50ac4233e 100644--- a/tests/page-wait-for-selector-1.spec.ts+++ b/tests/page-wait-for-selector-1.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/pageTest';-import { attachFrame, detachFrame } from '../test/utils';+import { attachFrame, detachFrame } from './config/utils';async function giveItTimeToLog(frame) {await frame.evaluate(() => new Promise(f => requestAnimationFrame(() => requestAnimationFrame(f))));diff --git a/tests/page-wait-for-selector-2.spec.ts b/tests/page-wait-for-selector-2.spec.tsindex fe1f74c60a..3449718edb 100644--- a/tests/page-wait-for-selector-2.spec.ts+++ b/tests/page-wait-for-selector-2.spec.ts@@ -16,7 +16,7 @@*/import { test as it, expect } from './config/pageTest';-import { attachFrame, detachFrame } from '../test/utils';+import { attachFrame, detachFrame } from './config/utils';const addElement = tag => document.body.appendChild(document.createElement(tag));diff --git a/tests/selectors-register.spec.ts b/tests/selectors-register.spec.tsindex 1549295b5c..53df13d9b7 100644--- a/tests/selectors-register.spec.ts+++ b/tests/selectors-register.spec.ts@@ -16,7 +16,6 @@*/import { test as it, expect } from './config/browserTest';-import path from 'path';it('should work', async ({playwright, browser}) => {const createTagSelector = () => ({@@ -52,9 +51,9 @@ it('should work', async ({playwright, browser}) => {await context.close();});-it('should work with path', async ({playwright, browser}) => {+it('should work with path', async ({playwright, browser, asset}) => {const page = await browser.newPage();- await playwright.selectors.register('foo', { path: path.join(__dirname, '../test/assets/sectionselectorengine.js') });+ await playwright.selectors.register('foo', { path: asset('sectionselectorengine.js') });await page.setContent('<section></section>');expect(await page.$eval('foo=whatever', e => e.nodeName)).toBe('SECTION');});diff --git a/tests/slowmo.spec.ts b/tests/slowmo.spec.tsindex bc4e07602c..0ca0662918 100644--- a/tests/slowmo.spec.ts+++ b/tests/slowmo.spec.ts@@ -15,7 +15,7 @@*/import { test as it, expect } from './config/pageTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';async function checkSlowMo(toImpl, page, task) {let didSlowMo = false;diff --git a/tests/workers.spec.ts b/tests/workers.spec.tsindex 516fddf793..adbd22ed22 100644--- a/tests/workers.spec.ts+++ b/tests/workers.spec.ts@@ -17,7 +17,7 @@import { test as it, expect } from './config/pageTest';import { test as browserTest } from './config/browserTest';-import { attachFrame } from '../test/utils';+import { attachFrame } from './config/utils';import type { ConsoleMessage } from '../index';it('Page.workers', async function({page, server}) {