Skip to content

feat(tests): Run Playwright tests using bundles. #4551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
34de27d
feat(test): Run Playwright tests using bundles.
onurtemizkan Feb 11, 2022
f64c953
Merge branch 'master' of https://github.com/getsentry/sentry-javascri…
onurtemizkan Feb 11, 2022
6389f7d
Simplify generation logic.
onurtemizkan Feb 11, 2022
8aa54db
Fix unsafe lookup.
onurtemizkan Feb 11, 2022
3586b49
Document code, update README.
onurtemizkan Feb 11, 2022
ea4044f
Remove unnecessary `Bundle` prefix.
onurtemizkan Feb 11, 2022
05692e2
Move bundle injections to their own HTML scripts.
onurtemizkan Feb 11, 2022
de4e070
Remove unused filter.
onurtemizkan Feb 11, 2022
b90bd61
Remove empty `meta` and `title` elements from templates.
onurtemizkan Feb 11, 2022
ad1918d
Move misplaced script.
onurtemizkan Feb 11, 2022
2897b84
Update comments.
onurtemizkan Feb 14, 2022
627de51
Remove default external types and `Integration` external.
onurtemizkan Feb 14, 2022
a7bc9de
Rename `dist`s to `cjs`.
onurtemizkan Feb 14, 2022
14cbf6a
Remove unnecessary check.
onurtemizkan Feb 14, 2022
efe3ced
Remove typo.
onurtemizkan Feb 14, 2022
0659941
Merge branch 'master' of https://github.com/getsentry/sentry-javascri…
onurtemizkan Feb 14, 2022
3687d0c
Use a custom webpack plugin to generate scenarios.
onurtemizkan Feb 19, 2022
f69b8a9
Run tracing-only bundle tests.
onurtemizkan Feb 21, 2022
2d00b51
Merge branch 'master' of https://github.com/getsentry/sentry-javascri…
onurtemizkan Feb 21, 2022
f4c0ebd
Merge branch 'master' of https://github.com/getsentry/sentry-javascri…
onurtemizkan Feb 23, 2022
69ae75a
Address review comments.
onurtemizkan Feb 24, 2022
2c0f8aa
Remove unused default assets.
onurtemizkan Feb 24, 2022
11caa05
Update packages/integration-tests/utils/generatePlugin.ts
onurtemizkan Feb 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,26 @@ jobs:
${{ github.workspace }}/packages/serverless/dist-awslambda-layer/*.zip

job_browser_playwright_tests:
name: Browser Playwright Tests
name: Browser Playwright Tests (${{ matrix.bundle }} - tracing_only = ${{ matrix.tracing_only }})
needs: job_build
runs-on: ubuntu-latest
strategy:
matrix:
bundle:
- esm
- cjs
- bundle_es5
- bundle_es5_min
- bundle_es6
- bundle_es6_min
tracing_only:
- true
- false
exclude:
- bundle: esm
tracing_only: true
- bundle: cjs
tracing_only: true
steps:
- name: Check out current commit (${{ github.sha }})
uses: actions/checkout@v2
Expand All @@ -297,6 +314,9 @@ jobs:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Run Playwright tests
env:
PW_BUNDLE: ${{ matrix.bundle }}
PW_TRACING_ONLY: ${{ matrix.tracing_only }}
run: |
cd packages/integration-tests
yarn run playwright install-deps webkit
Expand Down
3 changes: 3 additions & 0 deletions packages/integration-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ To filter tests by their title:

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

You can set env variable `PW_BUNDLE` to set specific build or bundle to test against.
Available options: `esm`, `cjs`, `bundle_es5`, `bundle_es5_min`, `bundle_es6`, `bundle_es6_min`

### Troubleshooting

Apart from [Playwright-specific issues](https://playwright.dev/docs/troubleshooting), below are common issues that might occur while writing tests for Sentry Browser SDK.
Expand Down
11 changes: 8 additions & 3 deletions packages/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,21 @@
"lint": "run-s lint:prettier lint:eslint",
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
"lint:prettier": "prettier --check \"{suites,utils}/**/*.ts\"",
"test:ci": "playwright test ./suites --browser='all' --reporter='line'",
"type-check": "tsc",
"pretest": "yarn clean && yarn type-check",
"test": "playwright test ./suites"
"test": "playwright test ./suites",
"test:bundle:es5": "PW_BUNDLE=bundle_es5 yarn test",
"test:bundle:es5:min": "PW_BUNDLE=bundle_es5_min yarn test",
"test:bundle:es6": "PW_BUNDLE=bundle_es6 yarn test",
"test:bundle:es6:min": "PW_BUNDLE=bundle_es6_min yarn test",
"test:cjs": "PW_BUNDLE=cjs yarn test",
"test:esm": "PW_BUNDLE=esm yarn test",
"test:ci": "playwright test ./suites --browser='all' --reporter='line'"
},
"dependencies": {
"@babel/preset-typescript": "^7.16.7",
"@playwright/test": "^1.17.0",
"babel-loader": "^8.2.2",
"handlebars-loader": "^1.7.1",
"html-webpack-plugin": "^5.5.0",
"playwright": "^1.17.1",
"typescript": "^4.5.2",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions packages/integration-tests/suites/public-api/setExtra/template.hbs

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions packages/integration-tests/suites/public-api/setTag/template.hbs

This file was deleted.

11 changes: 0 additions & 11 deletions packages/integration-tests/suites/public-api/setTags/template.hbs

This file was deleted.

11 changes: 0 additions & 11 deletions packages/integration-tests/suites/public-api/setUser/template.hbs

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<a id='navigate' href="foo">Navigate</button>
</body>
</html>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<button id="throw-error">Throw Error</button>
<button id="capture-exception">Capture Exception</button>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<script src="{{htmlWebpackPlugin.options.initialization}}"></script>
<meta charset="utf-8" />
</head>
<body>
<button id="start-transaction">Start Transaction</button>
<button id="go-background">New Tab</button>
<script src="{{htmlWebpackPlugin.options.subject}}"></script>
</body>
</html>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<button id="go-background">New Tab</button>
</body>
</html>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<html>
<head>
<meta charset="utf-8" />
<meta name="sentry-trace" content="12312012123120121231201212312012-1121201211212012-1" />
</head>
</html>

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div>Rendered</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="{{htmlWebpackPlugin.options.initialization}}"></script>
</head>
<body>
<img src="https://example.com/path/to/image.svg">
<img src="https://example.com/path/to/image.svg" />
<script src="https://example.com/path/to/script.js"></script>
<link href="https://example.com/path/to/style.css" type="text/css" rel="stylesheet">
<link href="https://example.com/path/to/style.css" type="text/css" rel="stylesheet" />
<span>Rendered</span>
</body>
</html>
12 changes: 0 additions & 12 deletions packages/integration-tests/suites/tracing/metrics/template.hbs

This file was deleted.

This file was deleted.

Loading