diff --git a/README.md b/README.md index 63728f6a..ec483ff2 100644 --- a/README.md +++ b/README.md @@ -1200,6 +1200,26 @@ Then navigate to `http://localhost:9090/test/`, where `` 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/). diff --git a/package.json b/package.json index 75bcce17..31cf3ec7 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/wdio.conf.cjs b/wdio.conf.cjs index a07bc45c..701be29d 100644 --- a/wdio.conf.cjs +++ b/wdio.conf.cjs @@ -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'