Skip to content
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

Add ability to run test suite for just one metric #286

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,26 @@ Then navigate to `http://localhost:9090/test/<view>`, where `<view>` is the base

You'll likely want to combine this with `npm run watch` to ensure any changes you make are transpiled and rebuilt.

To test only one metric, you can pass a `--suite` argument. For example to test just INP run this:

```sh
npm run test:e2e -- --suite INP
```

Note the `--` is needed to avoid this being seen as an argument to the `npm` command itself.

Shortcuts have been created to run single metrics:

```sh
npm run test:INP
```

To test multiple metrics, use multiple `--suite` arguments to the `test:e2e` command:

```sh
npm run test:e2e -- --suite FID --suite INP
```

## Integrations

- [**Web Vitals Connector**](https://goo.gle/web-vitals-connector): Data Studio connector to create dashboards from [Web Vitals data captured in BiqQuery](https://web.dev/vitals-ga4/).
Expand Down
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,13 @@
"release:major": "npm version major -m 'Release v%s' && npm publish",
"release:minor": "npm version minor -m 'Release v%s' && npm publish",
"release:patch": "npm version patch -m 'Release v%s' && npm publish",
"test": "npm-run-all build -p -r test:*",
"test": "npm-run-all build -p -r test:server test:e2e",
"test:CLS": "wdio wdio.conf.cjs --suite CLS",
"test:FCP": "wdio wdio.conf.cjs --suite FCP",
"test:FID": "wdio wdio.conf.cjs --suite FID",
"test:INP": "wdio wdio.conf.cjs --suite INP",
"test:LCP": "wdio wdio.conf.cjs --suite LCP",
"test:TTFB": "wdio wdio.conf.cjs --suite TTFB",
"test:e2e": "wdio wdio.conf.cjs",
"test:server": "node test/server.js",
"start": "run-s build:ts test:server watch",
Expand Down
26 changes: 26 additions & 0 deletions wdio.conf.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,32 @@ module.exports.config = {
specs: [
'test/e2e/*-test.js',
],
// ====================
// Specify Test Suites
// ===================
// These can be run with using `--suite` command to override the full list of test files
// from the `specs` setting above
//
suites: {
CLS: [
'test/e2e/onCLS-test.js',
],
FCP: [
'test/e2e/onFCP-test.js',
],
FID: [
'test/e2e/onFID-test.js',
],
INP: [
'test/e2e/onINP-test.js',
],
LCP: [
'test/e2e/onLCP-test.js',
],
TTFB: [
'test/e2e/onTTFB-test.js',
],
},
// Patterns to exclude.
exclude: [
// 'path/to/excluded/files'
Expand Down