Skip to content

Commit 0a4f278

Browse files
feat(tests): Run Playwright tests using bundles. (#4551)
Co-authored-by: Katie Byers <[email protected]>
1 parent ab73aa8 commit 0a4f278

File tree

46 files changed

+253
-366
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+253
-366
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,26 @@ jobs:
276276
${{ github.workspace }}/packages/serverless/dist-awslambda-layer/*.zip
277277
278278
job_browser_playwright_tests:
279-
name: Browser Playwright Tests
279+
name: Browser Playwright Tests (${{ matrix.bundle }} - tracing_only = ${{ matrix.tracing_only }})
280280
needs: job_build
281281
runs-on: ubuntu-latest
282+
strategy:
283+
matrix:
284+
bundle:
285+
- esm
286+
- cjs
287+
- bundle_es5
288+
- bundle_es5_min
289+
- bundle_es6
290+
- bundle_es6_min
291+
tracing_only:
292+
- true
293+
- false
294+
exclude:
295+
- bundle: esm
296+
tracing_only: true
297+
- bundle: cjs
298+
tracing_only: true
282299
steps:
283300
- name: Check out current commit (${{ github.sha }})
284301
uses: actions/checkout@v2
@@ -297,6 +314,9 @@ jobs:
297314
path: ${{ env.CACHED_BUILD_PATHS }}
298315
key: ${{ env.BUILD_CACHE_KEY }}
299316
- name: Run Playwright tests
317+
env:
318+
PW_BUNDLE: ${{ matrix.bundle }}
319+
PW_TRACING_ONLY: ${{ matrix.tracing_only }}
300320
run: |
301321
cd packages/integration-tests
302322
yarn run playwright install-deps webkit

packages/integration-tests/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ To filter tests by their title:
5656

5757
You can refer to [Playwright documentation](https://playwright.dev/docs/test-cli) for other CLI options.
5858

59+
You can set env variable `PW_BUNDLE` to set specific build or bundle to test against.
60+
Available options: `esm`, `cjs`, `bundle_es5`, `bundle_es5_min`, `bundle_es6`, `bundle_es6_min`
61+
5962
### Troubleshooting
6063

6164
Apart from [Playwright-specific issues](https://playwright.dev/docs/troubleshooting), below are common issues that might occur while writing tests for Sentry Browser SDK.

packages/integration-tests/package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,21 @@
1313
"lint": "run-s lint:prettier lint:eslint",
1414
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
1515
"lint:prettier": "prettier --check \"{suites,utils}/**/*.ts\"",
16-
"test:ci": "playwright test ./suites --browser='all' --reporter='line'",
1716
"type-check": "tsc",
1817
"pretest": "yarn clean && yarn type-check",
19-
"test": "playwright test ./suites"
18+
"test": "playwright test ./suites",
19+
"test:bundle:es5": "PW_BUNDLE=bundle_es5 yarn test",
20+
"test:bundle:es5:min": "PW_BUNDLE=bundle_es5_min yarn test",
21+
"test:bundle:es6": "PW_BUNDLE=bundle_es6 yarn test",
22+
"test:bundle:es6:min": "PW_BUNDLE=bundle_es6_min yarn test",
23+
"test:cjs": "PW_BUNDLE=cjs yarn test",
24+
"test:esm": "PW_BUNDLE=esm yarn test",
25+
"test:ci": "playwright test ./suites --browser='all' --reporter='line'"
2026
},
2127
"dependencies": {
2228
"@babel/preset-typescript": "^7.16.7",
2329
"@playwright/test": "^1.17.0",
2430
"babel-loader": "^8.2.2",
25-
"handlebars-loader": "^1.7.1",
2631
"html-webpack-plugin": "^5.5.0",
2732
"playwright": "^1.17.1",
2833
"typescript": "^4.5.2",

packages/integration-tests/suites/public-api/addBreadcrumb/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/captureException/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/captureMessage/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/configureScope/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/setContext/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/setExtra/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/setExtras/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)