From 8874ad299ce9a64c2fe6ffa407c453ecf95f1f47 Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Wed, 16 Nov 2022 00:25:39 +0000 Subject: [PATCH 1/6] Add ability to run test suite for just one metric --- README.md | 8 ++++++++ wdio.conf.cjs | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/README.md b/README.md index 63728f6a..9be1629f 100644 --- a/README.md +++ b/README.md @@ -1200,6 +1200,14 @@ 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. + ## 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/wdio.conf.cjs b/wdio.conf.cjs index a07bc45c..1684d278 100644 --- a/wdio.conf.cjs +++ b/wdio.conf.cjs @@ -38,6 +38,26 @@ module.exports.config = { specs: [ 'test/e2e/*-test.js', ], + 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' From 7c1f7a6bc1cae482e7c2a0abe7d144288e71308b Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Wed, 16 Nov 2022 00:31:42 +0000 Subject: [PATCH 2/6] Multiple runs --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 9be1629f..cafda3eb 100644 --- a/README.md +++ b/README.md @@ -1208,6 +1208,12 @@ npm run test:e2e -- --suite INP Note the `--` is needed to avoid this being seen as an argument to the `npm` command itself. +To test multiple metircs, use multiple `--suite` arguments: + +```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/). From a7fe4cdf6085644b15c08419dcfed86be75d9c91 Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Wed, 16 Nov 2022 00:32:19 +0000 Subject: [PATCH 3/6] Comment --- wdio.conf.cjs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wdio.conf.cjs b/wdio.conf.cjs index 1684d278..701be29d 100644 --- a/wdio.conf.cjs +++ b/wdio.conf.cjs @@ -38,6 +38,12 @@ 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', From 5c552c2e8e009c872b90651a532c2e1abf02bbfe Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Wed, 16 Nov 2022 00:40:49 +0000 Subject: [PATCH 4/6] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cafda3eb..17a5b596 100644 --- a/README.md +++ b/README.md @@ -1208,7 +1208,7 @@ npm run test:e2e -- --suite INP Note the `--` is needed to avoid this being seen as an argument to the `npm` command itself. -To test multiple metircs, use multiple `--suite` arguments: +To test multiple metrics, use multiple `--suite` arguments: ```sh npm run test:e2e -- --suite FID --suite INP From 356f7baad6d6ca59af734a6f366fc5f8121208e7 Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Wed, 16 Nov 2022 00:55:51 +0000 Subject: [PATCH 5/6] Add shortcuts --- README.md | 8 +++++++- package.json | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 17a5b596..d56b6709 100644 --- a/README.md +++ b/README.md @@ -1208,7 +1208,13 @@ npm run test:e2e -- --suite INP Note the `--` is needed to avoid this being seen as an argument to the `npm` command itself. -To test multiple metrics, use multiple `--suite` arguments: +Short runs 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 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", From 725f997c679ca0730623c4ccef6b85c29e9b9fe9 Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Wed, 16 Nov 2022 00:56:36 +0000 Subject: [PATCH 6/6] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d56b6709..ec483ff2 100644 --- a/README.md +++ b/README.md @@ -1208,7 +1208,7 @@ npm run test:e2e -- --suite INP Note the `--` is needed to avoid this being seen as an argument to the `npm` command itself. -Short runs have been created to run single metrics: +Shortcuts have been created to run single metrics: ```sh npm run test:INP