Skip to content

Commit

Permalink
[CI] [playwright] Run UI tests on the browser app
Browse files Browse the repository at this point in the history
Since we have this minimal UI test suite, let's also use it on the
browser example app.

Signed-off-by: Marc Dumais <[email protected]>
  • Loading branch information
marcdumais-work committed Mar 21, 2024
1 parent a9c252b commit 9578624
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9

- name: Test
- name: Run Unit Tests
run: yarn test
env:
CI: true

- name: Run UI tests on Browser Example App
run:
yarn start:browser &
yarn test:browser-app

code-lint:
name: Lint and check format
runs-on: ubuntu-latest
Expand Down
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ If there is no notification, you can open the application directly in the **Remo

## Tests

### Unit tests

To run tests once, at the root of the project, run:

```bash
Expand All @@ -345,12 +347,29 @@ To keep tests running, use:
yarn test --verbose --watch
```

### Test coverage
#### Test coverage

The following computes the test coverage for the unit tests and command prints a coverage report to the terminal. As of now, it covers all typescript files of the project, including those that are not supposed to have tests. To access a more detailed coverage report, open this file in a browser after running the command below: `./packages/react-components/coverage/lcov-report/index.html`

```bash
yarn test --coverage
```

### UI Tests

To run the UI test suite, first start the browser example application or optionally the Docker example application using external port 3000:

```bash
yarn browser start
# or
docker run --init -d -p 0.0.0.0:3000:4000 tte

```

The following command prints a coverage report to the terminal. As of now, it covers all typescript files of the project, including those that are not supposed to have tests.
Then run the UI test suite like so:

```bash
yarn test --coverage --collectCoverageFrom='src/**/*.ts'
yarn test:browser-app
```

## About ADRs
Expand Down
1 change: 1 addition & 0 deletions playwright-tests/tests/trace-viewer-app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ test.describe('My Trace Explorer View', () => {
test('From closed, can be re-opened using the command palette', async () => {
expect(await traceExplorer.isDisplayed()).toBe(false);
await traceExplorer.open();
await traceExplorer.activate();
expect(await traceExplorer.isDisplayed()).toBe(true);
});
test('Trace Server status is shown as not started (red)', async () => {
Expand Down

0 comments on commit 9578624

Please sign in to comment.