From 1fe9626270035885c40c603dad88e033771cb6dc Mon Sep 17 00:00:00 2001 From: adamdavies1 Date: Wed, 19 Jan 2022 14:48:31 +0000 Subject: [PATCH 01/13] component json now building locally --- .../branch--lint-unit-and-smoke-test.yml | 7 +++++-- runner/package.json | 2 +- .../audit => src/server/forms}/components.json | 0 runner/test/audit/components.js | 18 ++++++++---------- 4 files changed, 14 insertions(+), 13 deletions(-) rename runner/{test/audit => src/server/forms}/components.json (100%) diff --git a/.github/workflows/branch--lint-unit-and-smoke-test.yml b/.github/workflows/branch--lint-unit-and-smoke-test.yml index 271bc4f2..936af7d7 100644 --- a/.github/workflows/branch--lint-unit-and-smoke-test.yml +++ b/.github/workflows/branch--lint-unit-and-smoke-test.yml @@ -5,8 +5,8 @@ on: - master - main paths-ignore: - - 'docs/**' - - '**/README.md' + - "docs/**" + - "**/README.md" workflow_dispatch: jobs: lint-and-test: @@ -125,6 +125,9 @@ jobs: run: | yarn smoke-tests/designer smoke-test-headless ls -lah smoke-tests/designer/reports/ + + - name: Lighthous Test + run: yarn designer dlx pa11y-ci - name: "Tar files" if: ${{ success() || failure() }} run: tar -cvf smoke-tests.tar smoke-tests/designer/reports diff --git a/runner/package.json b/runner/package.json index 0ec9126e..c84db724 100644 --- a/runner/package.json +++ b/runner/package.json @@ -19,7 +19,7 @@ "test:dev": "lab -T test/.transform.js -P **/**/*.test.* -v test --coverage-exclude src", "unit-test": "lab -T test/.transform.js -P **/**/*.test.* -v test -S -v -r console -o stdout -r html -o unit-test.html -I version -l", "unit-test-cov": "lab -T test/.transform.js -P **/**/*.test.* -v test -t 83 -S -v -r console -o stdout -r lcov -o test-coverage/lab/lcov.info -r html -o test-coverage/lab/unit-test.html -r junit -o test-results/junit/unit-test.xml -I version -l", - "a11y": "node test/audit/components && node lighthouse", + "lighthousea11y": "node test/audit && node lighthouse", "symlink-env": "./bin/symlink-config", "type-check": "tsc --noEmit", "generate-docs": "typedoc src --tsconfig tsconfig.json --out ../docs/runner/typedoc --exclude '**/*+(index|.test|.jest).ts'" diff --git a/runner/test/audit/components.json b/runner/src/server/forms/components.json similarity index 100% rename from runner/test/audit/components.json rename to runner/src/server/forms/components.json diff --git a/runner/test/audit/components.js b/runner/test/audit/components.js index 6b47d4da..190c8f44 100644 --- a/runner/test/audit/components.js +++ b/runner/test/audit/components.js @@ -1,6 +1,6 @@ -import createServer from "../../src/server"; +import createServer from "src/server"; import lighthouse from "lighthouse"; -import chromeLauncher from "chrome-launcher"; +import { launch } from "chrome-launcher"; import fs from "fs"; const opts = { @@ -29,13 +29,11 @@ createServer({ formFileName: "components.json", formFilePath: __dirname }) }); function launchChromeAndRunLighthouse(url, opts, config = null) { - return chromeLauncher - .launch({ chromeFlags: opts.chromeFlags }) - .then((chrome) => { - opts.port = chrome.port; - return lighthouse(url, opts, config).then((results) => { - fs.writeFileSync(`./report.${opts.output}`, results.report); - return chrome.kill().then(() => results.lhr); - }); + return launch({ chromeFlags: opts.chromeFlags }).then((chrome) => { + opts.port = chrome.port; + return lighthouse(url, opts, config).then((results) => { + fs.writeFileSync(`./report.${opts.output}`, results.report); + return chrome.kill().then(() => results.lhr); }); + }); } From 10c76acfb16ff3a6fcbf9173cb94cc1e36f6f0ec Mon Sep 17 00:00:00 2001 From: adamdavies1 Date: Wed, 19 Jan 2022 16:03:34 +0000 Subject: [PATCH 02/13] changes to work flow and component js --- .../branch--lint-unit-and-smoke-test.yml | 4 +- runner/src/server/forms/components.json | 83 ++++--------------- 2 files changed, 20 insertions(+), 67 deletions(-) diff --git a/.github/workflows/branch--lint-unit-and-smoke-test.yml b/.github/workflows/branch--lint-unit-and-smoke-test.yml index 936af7d7..bfdd8509 100644 --- a/.github/workflows/branch--lint-unit-and-smoke-test.yml +++ b/.github/workflows/branch--lint-unit-and-smoke-test.yml @@ -126,8 +126,8 @@ jobs: yarn smoke-tests/designer smoke-test-headless ls -lah smoke-tests/designer/reports/ - - name: Lighthous Test - run: yarn designer dlx pa11y-ci + - name: Lighthouse + run: yarn runner dlx lighthouse-ci http://localhost:3009/components/all-components - name: "Tar files" if: ${{ success() || failure() }} run: tar -cvf smoke-tests.tar smoke-tests/designer/reports diff --git a/runner/src/server/forms/components.json b/runner/src/server/forms/components.json index dbf00ff2..4d7f0832 100644 --- a/runner/src/server/forms/components.json +++ b/runner/src/server/forms/components.json @@ -11,7 +11,6 @@ "name": "textField", "title": "Text field", "hint": "Help text", - "options": {}, "schema": {} }, { @@ -19,101 +18,84 @@ "name": "multilineTextField", "title": "Multiline text field", "hint": "Help text", - "options": {}, "schema": {} }, { "type": "NumberField", "name": "numberField", "title": "Number field", - "options": {}, "schema": {} }, { "type": "DateField", "name": "dateField", "title": "Date field", - "options": {}, "schema": {} }, { "type": "DatePartsField", "name": "datePartsField", "title": "Date parts field", - "options": {}, "schema": {} }, { "type": "TimeField", "name": "timeField", "title": "Time field", - "options": {}, "schema": {} }, { "type": "DateTimeField", "name": "dateTimeField", "title": "Date time field", - "options": {}, "schema": {} }, { "type": "DateTimePartsField", "name": "dateTimePartsField", "title": "Date time parts field", - "options": {}, "schema": {} }, { "type": "YesNoField", "name": "yesNoField", "title": "Yes/No field", - "options": {}, "schema": {} }, { "type": "EmailAddressField", "name": "emailAddressField", "title": "Email address field", - "options": {}, "schema": {} }, { "type": "TelephoneNumberField", "name": "telephoneNumberField", "title": "Telephone number field", - "options": {}, "schema": {} }, { "type": "UkAddressField", "name": "addressField", "title": "Telephone number field", - "options": {}, "schema": {} }, { "type": "RadiosField", "name": "radiosField", "title": "Radios field", - "options": { - "list": "companyType" - }, + "list": "companyType", "schema": {} }, { "type": "SelectField", "name": "selectField", "title": "Select field", - "options": { - "list": "country" - }, + "list": "country", "schema": {} }, { - "options": { - "list": "horseBreed" - }, + "list": "horseBreed", "type": "CheckboxesField", "name": "checkboxesField", "title": "Checkboxes field", @@ -123,20 +105,17 @@ { "type": "Para", "content": "Paragraph...", - "options": {}, "schema": {} }, { "type": "InsetText", "content": "Inset text", - "options": {}, "schema": {} }, { "type": "Details", "title": "Title", "content": "Content", - "options": {}, "schema": {} } ] @@ -146,9 +125,7 @@ "title": "All Components Optional", "components": [ { - "options": { - "required": false - }, + "required": false, "type": "TextField", "name": "textField", "title": "Text field", @@ -156,9 +133,7 @@ "schema": {} }, { - "options": { - "required": false - }, + "required": false, "type": "MultilineTextField", "name": "multilineTextField", "title": "Multiline text field", @@ -166,72 +141,56 @@ "schema": {} }, { - "options": { - "required": false - }, + "required": false, "type": "NumberField", "name": "numberField", "title": "Number field", "schema": {} }, { - "options": { - "required": false - }, + "required": false, "type": "DateField", "name": "dateField", "title": "Date field", "schema": {} }, { - "options": { - "required": false - }, + "required": false, "type": "DatePartsField", "name": "datePartsField", "title": "Date parts field", "schema": {} }, { - "options": { - "required": false - }, + "required": false, "type": "TimeField", "name": "timeField", "title": "Time field", "schema": {} }, { - "options": { - "required": false - }, + "required": false, "type": "DateTimeField", "name": "dateTimeField", "title": "Date time field", "schema": {} }, { - "options": { - "required": false - }, + "required": false, "type": "DateTimePartsField", "name": "dateTimePartsField", "title": "Date time parts field", "schema": {} }, { - "options": { - "required": false - }, + "required": false, "type": "YesNoField", "name": "yesNoField", "title": "Yes/No field", "schema": {} }, { - "options": { - "required": false - }, + "required": false, "type": "EmailAddressField", "name": "emailAddressField", "title": "Email address field", @@ -256,10 +215,8 @@ "schema": {} }, { - "options": { - "required": false, - "list": "companyType" - }, + "required": false, + "list": "companyType", "type": "RadiosField", "name": "radiosField", "title": "Radios field", @@ -269,16 +226,12 @@ "type": "SelectField", "name": "selectField", "title": "Select field", - "options": { - "list": "country" - }, + "list": "country", "schema": {} }, { - "options": { - "required": false, - "list": "horseBreed" - }, + "required": false, + "list": "horseBreed", "type": "CheckboxesField", "name": "checkboxesField", "title": "Checkboxes field", From 033b885163c29a3495f09c816f6b8cb672187e37 Mon Sep 17 00:00:00 2001 From: adamdavies1 Date: Wed, 19 Jan 2022 16:30:24 +0000 Subject: [PATCH 03/13] changes to chrome verison --- smoke-tests/designer/wdio.conf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smoke-tests/designer/wdio.conf.js b/smoke-tests/designer/wdio.conf.js index ab48eb6c..9f0b216a 100644 --- a/smoke-tests/designer/wdio.conf.js +++ b/smoke-tests/designer/wdio.conf.js @@ -1,6 +1,6 @@ const { hooks } = require("./support/hooks"); const drivers = { - chrome: { version: "95.0.4638.69" }, // https://chromedriver.chromium.org/ + chrome: { version: "97.0.4692.71" }, // https://chromedriver.chromium.org/ firefox: { version: "0.29.1" }, // https://github.com/mozilla/geckodriver/releases }; From dc4c0744bc296a7596ed0dde333558236ea67fc4 Mon Sep 17 00:00:00 2001 From: adamdavies1 Date: Thu, 20 Jan 2022 10:40:44 +0000 Subject: [PATCH 04/13] Implementing new lighthouse-ci --- .../branch--lint-unit-and-smoke-test.yml | 6 ++++-- .gitignore | 1 + lighthouserc.js | 20 +++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 lighthouserc.js diff --git a/.github/workflows/branch--lint-unit-and-smoke-test.yml b/.github/workflows/branch--lint-unit-and-smoke-test.yml index bfdd8509..c82cf52c 100644 --- a/.github/workflows/branch--lint-unit-and-smoke-test.yml +++ b/.github/workflows/branch--lint-unit-and-smoke-test.yml @@ -126,8 +126,10 @@ jobs: yarn smoke-tests/designer smoke-test-headless ls -lah smoke-tests/designer/reports/ - - name: Lighthouse - run: yarn runner dlx lighthouse-ci http://localhost:3009/components/all-components + - name: run Lighthouse CI + run: | + npm install -g @lhci/cli@0.8.x + lhci autorun - name: "Tar files" if: ${{ success() || failure() }} run: tar -cvf smoke-tests.tar smoke-tests/designer/reports diff --git a/.gitignore b/.gitignore index 57cbc508..aeb8060c 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ smoke-tests/designer/reports/ */dist/ */.dist/ tsconfig.tsbuildinfo +.lighthouseci .yarn/* !.yarn/releases diff --git a/lighthouserc.js b/lighthouserc.js new file mode 100644 index 00000000..7ef457db --- /dev/null +++ b/lighthouserc.js @@ -0,0 +1,20 @@ +module.exports = { + ci: { + collect: { + url: [ + "http://localhost:3000/app", + "http://localhost:3000/app/new", + "http://localhost:3000/app/choose-existing", + "http://localhost:3000/app/designer/test-form-a", + "http://localhost:3009/components/all-components", + ], + startServerCommand: "", + }, + assert: { + preset: "lighthouse:recommended", + }, + upload: { + target: "temporary-public-storage", + }, + }, +}; From cbfe69ec50bd3fc568531f4483bc0b50cff0747d Mon Sep 17 00:00:00 2001 From: adamdavies1 Date: Thu, 20 Jan 2022 13:46:09 +0000 Subject: [PATCH 05/13] spelling change --- .github/workflows/branch--lint-unit-and-smoke-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branch--lint-unit-and-smoke-test.yml b/.github/workflows/branch--lint-unit-and-smoke-test.yml index c82cf52c..621bbdee 100644 --- a/.github/workflows/branch--lint-unit-and-smoke-test.yml +++ b/.github/workflows/branch--lint-unit-and-smoke-test.yml @@ -126,7 +126,7 @@ jobs: yarn smoke-tests/designer smoke-test-headless ls -lah smoke-tests/designer/reports/ - - name: run Lighthouse CI + - name: Run Lighthouse CI run: | npm install -g @lhci/cli@0.8.x lhci autorun From 67e030941dfea2a72b74cc944d619aaf2c350639 Mon Sep 17 00:00:00 2001 From: adamdavies1 Date: Fri, 21 Jan 2022 10:01:44 +0000 Subject: [PATCH 06/13] testing different ls --- .github/workflows/branch--lint-unit-and-smoke-test.yml | 10 ++++++++++ lighthouserc.js | 1 + 2 files changed, 11 insertions(+) diff --git a/.github/workflows/branch--lint-unit-and-smoke-test.yml b/.github/workflows/branch--lint-unit-and-smoke-test.yml index 621bbdee..f95e36dd 100644 --- a/.github/workflows/branch--lint-unit-and-smoke-test.yml +++ b/.github/workflows/branch--lint-unit-and-smoke-test.yml @@ -126,6 +126,16 @@ jobs: yarn smoke-tests/designer smoke-test-headless ls -lah smoke-tests/designer/reports/ + - uses: actions/checkout@v2 + - name: Audit URLs using Lighthouse + uses: treosh/lighthouse-ci-action@v8 + with: + urls: | + https://example.com/ + https://example.com/blog + budgetPath: ./budget.json # test performance budgets + uploadArtifacts: true # save results as an action artifacts + temporaryPublicStorage: true # upload lighthouse report to the temporary storage - name: Run Lighthouse CI run: | npm install -g @lhci/cli@0.8.x diff --git a/lighthouserc.js b/lighthouserc.js index 7ef457db..b7f7866a 100644 --- a/lighthouserc.js +++ b/lighthouserc.js @@ -14,6 +14,7 @@ module.exports = { preset: "lighthouse:recommended", }, upload: { + //target: "filesystem", target: "temporary-public-storage", }, }, From b88e2067e48fb08ad2f8e3824218c82cc69a661c Mon Sep 17 00:00:00 2001 From: adamdavies1 Date: Fri, 21 Jan 2022 10:40:11 +0000 Subject: [PATCH 07/13] change to filesystem --- .github/workflows/branch--lint-unit-and-smoke-test.yml | 10 ---------- lighthouserc.js | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/branch--lint-unit-and-smoke-test.yml b/.github/workflows/branch--lint-unit-and-smoke-test.yml index f95e36dd..621bbdee 100644 --- a/.github/workflows/branch--lint-unit-and-smoke-test.yml +++ b/.github/workflows/branch--lint-unit-and-smoke-test.yml @@ -126,16 +126,6 @@ jobs: yarn smoke-tests/designer smoke-test-headless ls -lah smoke-tests/designer/reports/ - - uses: actions/checkout@v2 - - name: Audit URLs using Lighthouse - uses: treosh/lighthouse-ci-action@v8 - with: - urls: | - https://example.com/ - https://example.com/blog - budgetPath: ./budget.json # test performance budgets - uploadArtifacts: true # save results as an action artifacts - temporaryPublicStorage: true # upload lighthouse report to the temporary storage - name: Run Lighthouse CI run: | npm install -g @lhci/cli@0.8.x diff --git a/lighthouserc.js b/lighthouserc.js index b7f7866a..c86fcaf7 100644 --- a/lighthouserc.js +++ b/lighthouserc.js @@ -14,8 +14,8 @@ module.exports = { preset: "lighthouse:recommended", }, upload: { - //target: "filesystem", - target: "temporary-public-storage", + target: "filesystem", + //target: "temporary-public-storage", }, }, }; From 2d6e835a415f0dcd6aed7050532fae9e91af0564 Mon Sep 17 00:00:00 2001 From: adamdavies1 Date: Fri, 21 Jan 2022 11:47:22 +0000 Subject: [PATCH 08/13] test lh-ci-action --- .github/workflows/branch--lint-unit-and-smoke-test.yml | 6 +++++- lighthouserc.js | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/branch--lint-unit-and-smoke-test.yml b/.github/workflows/branch--lint-unit-and-smoke-test.yml index 621bbdee..f4c5d14f 100644 --- a/.github/workflows/branch--lint-unit-and-smoke-test.yml +++ b/.github/workflows/branch--lint-unit-and-smoke-test.yml @@ -125,7 +125,11 @@ jobs: run: | yarn smoke-tests/designer smoke-test-headless ls -lah smoke-tests/designer/reports/ - + - name: Run Lighthouse on urls and validate with lighthouserc + uses: treosh/lighthouse-ci-action@v8 + with: + urls: "https://exterkamp.codes/" + configPath: "./lighthouserc.json" - name: Run Lighthouse CI run: | npm install -g @lhci/cli@0.8.x diff --git a/lighthouserc.js b/lighthouserc.js index c86fcaf7..65859121 100644 --- a/lighthouserc.js +++ b/lighthouserc.js @@ -11,6 +11,9 @@ module.exports = { startServerCommand: "", }, assert: { + assertions: { + "first-contentful-paint": ["error", { minScore: 0.6 }], + }, preset: "lighthouse:recommended", }, upload: { From 97bcc274076fe603685ea99f6c0ae0e9fcf0a0bb Mon Sep 17 00:00:00 2001 From: adamdavies1 Date: Fri, 21 Jan 2022 11:56:07 +0000 Subject: [PATCH 09/13] changed to config path --- .github/workflows/branch--lint-unit-and-smoke-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branch--lint-unit-and-smoke-test.yml b/.github/workflows/branch--lint-unit-and-smoke-test.yml index f4c5d14f..8f5b5909 100644 --- a/.github/workflows/branch--lint-unit-and-smoke-test.yml +++ b/.github/workflows/branch--lint-unit-and-smoke-test.yml @@ -129,7 +129,7 @@ jobs: uses: treosh/lighthouse-ci-action@v8 with: urls: "https://exterkamp.codes/" - configPath: "./lighthouserc.json" + configPath: "/lighthouserc.json" - name: Run Lighthouse CI run: | npm install -g @lhci/cli@0.8.x From d5df65fd804da653a041801683eb0b6ba544b18a Mon Sep 17 00:00:00 2001 From: adamdavies1 Date: Fri, 21 Jan 2022 13:21:06 +0000 Subject: [PATCH 10/13] changing file path --- .github/workflows/branch--lint-unit-and-smoke-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branch--lint-unit-and-smoke-test.yml b/.github/workflows/branch--lint-unit-and-smoke-test.yml index 8f5b5909..f4c5d14f 100644 --- a/.github/workflows/branch--lint-unit-and-smoke-test.yml +++ b/.github/workflows/branch--lint-unit-and-smoke-test.yml @@ -129,7 +129,7 @@ jobs: uses: treosh/lighthouse-ci-action@v8 with: urls: "https://exterkamp.codes/" - configPath: "/lighthouserc.json" + configPath: "./lighthouserc.json" - name: Run Lighthouse CI run: | npm install -g @lhci/cli@0.8.x From 39a43fdbe0236d3d688bd0e444c93b05b999884e Mon Sep 17 00:00:00 2001 From: adamdavies1 Date: Fri, 21 Jan 2022 13:56:20 +0000 Subject: [PATCH 11/13] updating file path --- .github/workflows/branch--lint-unit-and-smoke-test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/branch--lint-unit-and-smoke-test.yml b/.github/workflows/branch--lint-unit-and-smoke-test.yml index f4c5d14f..84750d24 100644 --- a/.github/workflows/branch--lint-unit-and-smoke-test.yml +++ b/.github/workflows/branch--lint-unit-and-smoke-test.yml @@ -125,11 +125,13 @@ jobs: run: | yarn smoke-tests/designer smoke-test-headless ls -lah smoke-tests/designer/reports/ + - name: Run Lighthouse on urls and validate with lighthouserc uses: treosh/lighthouse-ci-action@v8 with: - urls: "https://exterkamp.codes/" - configPath: "./lighthouserc.json" + configPath: "../lighthouserc.json" + uploadArtifacts: true + - name: Run Lighthouse CI run: | npm install -g @lhci/cli@0.8.x From b64bf6fe18421b30beb86960efa26401fb107cc1 Mon Sep 17 00:00:00 2001 From: adamdavies1 Date: Fri, 21 Jan 2022 13:58:55 +0000 Subject: [PATCH 12/13] change config path --- .github/workflows/branch--lint-unit-and-smoke-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/branch--lint-unit-and-smoke-test.yml b/.github/workflows/branch--lint-unit-and-smoke-test.yml index 84750d24..4584da60 100644 --- a/.github/workflows/branch--lint-unit-and-smoke-test.yml +++ b/.github/workflows/branch--lint-unit-and-smoke-test.yml @@ -129,7 +129,7 @@ jobs: - name: Run Lighthouse on urls and validate with lighthouserc uses: treosh/lighthouse-ci-action@v8 with: - configPath: "../lighthouserc.json" + configPath: "./lighthouserc.js" uploadArtifacts: true - name: Run Lighthouse CI From 0e17ec41c84f81b7dd632f81ad06f6444883a8ce Mon Sep 17 00:00:00 2001 From: adamdavies1 Date: Fri, 21 Jan 2022 14:30:36 +0000 Subject: [PATCH 13/13] changing lh package --- .github/workflows/branch--lint-unit-and-smoke-test.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/branch--lint-unit-and-smoke-test.yml b/.github/workflows/branch--lint-unit-and-smoke-test.yml index 4584da60..4a15c2f0 100644 --- a/.github/workflows/branch--lint-unit-and-smoke-test.yml +++ b/.github/workflows/branch--lint-unit-and-smoke-test.yml @@ -125,17 +125,11 @@ jobs: run: | yarn smoke-tests/designer smoke-test-headless ls -lah smoke-tests/designer/reports/ - - name: Run Lighthouse on urls and validate with lighthouserc uses: treosh/lighthouse-ci-action@v8 with: configPath: "./lighthouserc.js" uploadArtifacts: true - - - name: Run Lighthouse CI - run: | - npm install -g @lhci/cli@0.8.x - lhci autorun - name: "Tar files" if: ${{ success() || failure() }} run: tar -cvf smoke-tests.tar smoke-tests/designer/reports