Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bb004f2

Browse files
authoredMar 13, 2024
docs: Add docs for node setup in v8 (#11060)
This also: * Fixes our prettier setup so it actually captures all files (and runs it on everything) * Updates node & node-experimental readmes to be correct There is still a lot missing but it's a start!
1 parent 6027caa commit bb004f2

File tree

43 files changed

+685
-494
lines changed

Some content is hidden

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

43 files changed

+685
-494
lines changed
 

‎.github/CANARY_FAILURE_TEMPLATE.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
title: '{{ env.TITLE }}'
33
labels: 'Type: Tests, Waiting for: Product Owner'
44
---
5+
56
Canary tests failed: {{ env.RUN_LINK }}

‎dev-packages/browser-integration-tests/README.md

+39-16
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
# Integration Tests for Sentry Browser SDK
22

3-
Integration tests for Sentry's Browser SDK use [Playwright](https://playwright.dev/) internally. These tests are run on latest stable versions of Chromium, Firefox and Webkit.
3+
Integration tests for Sentry's Browser SDK use [Playwright](https://playwright.dev/) internally. These tests are run on
4+
latest stable versions of Chromium, Firefox and Webkit.
45

56
## Structure
67

7-
The tests are grouped by their scope such as `breadcrumbs` or `onunhandledrejection`. In every group of tests, there are multiple folders containing test cases with their optional supporting assets.
8+
The tests are grouped by their scope such as `breadcrumbs` or `onunhandledrejection`. In every group of tests, there are
9+
multiple folders containing test cases with their optional supporting assets.
810

9-
Each case group has a default HTML skeleton named `template.hbs`, and also a default initialization script named `init.js `, which contains the `Sentry.init()` call. These defaults are used as fallbacks when a specific `template.hbs` or `init.js` is not defined in a case folder.
11+
Each case group has a default HTML skeleton named `template.hbs`, and also a default initialization script named
12+
`init.js `, which contains the `Sentry.init()` call. These defaults are used as fallbacks when a specific `template.hbs`
13+
or `init.js` is not defined in a case folder.
1014

11-
`subject.js` contains the logic that sets up the environment to be tested. It also can be defined locally and as a group fallback. Unlike `template.hbs` and `init.js`, it's not required to be defined for a group, as there may be cases that does not require a subject, instead the logic is injected using `injectScriptAndGetEvents` from `utils/helpers.ts`.
15+
`subject.js` contains the logic that sets up the environment to be tested. It also can be defined locally and as a group
16+
fallback. Unlike `template.hbs` and `init.js`, it's not required to be defined for a group, as there may be cases that
17+
does not require a subject, instead the logic is injected using `injectScriptAndGetEvents` from `utils/helpers.ts`.
1218

13-
`test.ts` is required for each test case, which contains the assertions (and if required the script injection logic). For every case, any set of `init.js`, `template.hbs` and `subject.js` can be defined locally, and each one of them will have precedence over the default definitions of the test group.
19+
`test.ts` is required for each test case, which contains the assertions (and if required the script injection logic).
20+
For every case, any set of `init.js`, `template.hbs` and `subject.js` can be defined locally, and each one of them will
21+
have precedence over the default definitions of the test group.
1422

15-
To test page multi-page navigations, you can specify additional `page-*.html` (e.g. `page-0.html`, `page-1.html`) files. These will also be compiled and initialized with the same `init.js` and `subject.js` files that are applied to `template.hbs/html`. Note: `page-*.html` file lookup **doesn not** fall back to the
16-
parent directories, meaning that page files have to be directly in the `test.ts` directory.
23+
To test page multi-page navigations, you can specify additional `page-*.html` (e.g. `page-0.html`, `page-1.html`) files.
24+
These will also be compiled and initialized with the same `init.js` and `subject.js` files that are applied to
25+
`template.hbs/html`. Note: `page-*.html` file lookup **doesn not** fall back to the parent directories, meaning that
26+
page files have to be directly in the `test.ts` directory.
1727

1828
```
1929
suites/
@@ -33,11 +43,16 @@ suites/
3343

3444
### Helpers
3545

36-
`utils/helpers.ts` contains helpers that could be used in assertions (`test.ts`). These helpers define a convenient and reliable API to interact with Playwright's native API. It's highly recommended to define all common patterns of Playwright usage in helpers.
46+
`utils/helpers.ts` contains helpers that could be used in assertions (`test.ts`). These helpers define a convenient and
47+
reliable API to interact with Playwright's native API. It's highly recommended to define all common patterns of
48+
Playwright usage in helpers.
3749

3850
### Fixtures
3951

40-
[Fixtures](https://playwright.dev/docs/api/class-fixtures) allows us to define the globals and test-specific information in assertion groups (`test.ts` files). In it's current state, `fixtures.ts` contains an extension over the pure version of `test()` function of Playwright. All the tests should import `sentryTest` function from `utils/fixtures.ts` instead of `@playwright/test` to be able to access the extra fixtures.
52+
[Fixtures](https://playwright.dev/docs/api/class-fixtures) allows us to define the globals and test-specific information
53+
in assertion groups (`test.ts` files). In it's current state, `fixtures.ts` contains an extension over the pure version
54+
of `test()` function of Playwright. All the tests should import `sentryTest` function from `utils/fixtures.ts` instead
55+
of `@playwright/test` to be able to access the extra fixtures.
4156

4257
## Running Tests Locally
4358

@@ -47,8 +62,7 @@ Tests can be run locally using the latest version of Chromium with:
4762

4863
To run tests with a different browser such as `firefox` or `webkit`:
4964

50-
`yarn test --project='firefox'`
51-
`yarn test --project='webkit'`
65+
`yarn test --project='firefox'` `yarn test --project='webkit'`
5266

5367
Or to run on all three browsers:
5468

@@ -60,18 +74,27 @@ To filter tests by their title:
6074

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

63-
You can set env variable `PW_BUNDLE` to set specific build or bundle to test against.
64-
Available options: `esm`, `cjs`, `bundle`, `bundle_min`
77+
You can set env variable `PW_BUNDLE` to set specific build or bundle to test against. Available options: `esm`, `cjs`,
78+
`bundle`, `bundle_min`
6579

6680
### Troubleshooting
6781

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

7085
- #### Flaky Tests
71-
If a test fails randomly, giving a `Page Closed`, `Target Closed` or a similar error, most of the times, the reason is a race condition between the page action defined in the `subject` and the listeners of the Sentry event / request. It's recommended to firstly check `utils/helpers.ts` whether if that async logic can be replaced by one of the helpers. If not, whether the awaited (or non-awaited on purpose in some cases) Playwright methods can be orchestrated by [`Promise.all`](http://mdn.io/promise.all). Manually-defined waiting logic such as timeouts are not recommended, and should not be required in most of the cases.
86+
87+
If a test fails randomly, giving a `Page Closed`, `Target Closed` or a similar error, most of the times, the reason is
88+
a race condition between the page action defined in the `subject` and the listeners of the Sentry event / request.
89+
It's recommended to firstly check `utils/helpers.ts` whether if that async logic can be replaced by one of the
90+
helpers. If not, whether the awaited (or non-awaited on purpose in some cases) Playwright methods can be orchestrated
91+
by [`Promise.all`](http://mdn.io/promise.all). Manually-defined waiting logic such as timeouts are not recommended,
92+
and should not be required in most of the cases.
7293

7394
- #### Build Errors
74-
Before running, a page for each test case is built under the case folder inside `dist`. If a page build is failed, it's recommended to check:
95+
96+
Before running, a page for each test case is built under the case folder inside `dist`. If a page build is failed,
97+
it's recommended to check:
7598

7699
- If both default `template.hbs` and `init.js` are defined for the test group.
77100
- If a `subject.js` is defined for the test case.

0 commit comments

Comments
 (0)