From 21856ef835e92495303007b03f6ad4562fe38fc1 Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Thu, 14 Apr 2022 13:23:17 -0700 Subject: [PATCH 1/2] Allow the doodad tests to run one at a time without percy --- script/puppeteer-tests-no-percy.sh | 2 +- script/puppeteer-tests.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/script/puppeteer-tests-no-percy.sh b/script/puppeteer-tests-no-percy.sh index 2ae818e9..3694e2b6 100755 --- a/script/puppeteer-tests-no-percy.sh +++ b/script/puppeteer-tests-no-percy.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash set -euo pipefail -npx mocha script/puppeteer-tests.js --timeout 15000 --exit \ No newline at end of file +env ONLYDOODAD=${1-default} npx mocha script/puppeteer-tests.js --timeout 15000 --exit \ No newline at end of file diff --git a/script/puppeteer-tests.js b/script/puppeteer-tests.js index e46efbd0..cfaee08d 100644 --- a/script/puppeteer-tests.js +++ b/script/puppeteer-tests.js @@ -49,7 +49,6 @@ describe('UI tests', function () { await page.goto(location) await page.waitFor(`#${name.replace(".", "-")}`) await percySnapshot(page, name) - console.log(`Snapshot complete for ${name}`) const results = await new AxePuppeteer(page).disableRules(skippedRules[name] || []).analyze(); handleAxeResults(name, results); @@ -65,7 +64,6 @@ describe('UI tests', function () { await page.waitForSelector(".checkbox-V5__Checked") await percySnapshot(page, `${name} - display icon names`) - console.log(`Snapshots complete for ${name}`) const results = await new AxePuppeteer(page).disableRules(skippedRules[name] || []).analyze(); handleAxeResults(name, results); @@ -156,10 +154,12 @@ describe('UI tests', function () { await links.reduce((acc, [name, location]) => { return acc.then(() => { - let handler = specialProcessing[name] || defaultProcessing - return handler(name, location) + if (process.env.ONLYDOODAD == "default" || process.env.ONLYDOODAD == name) { + console.log(`Testing ${name}`) + let handler = specialProcessing[name] || defaultProcessing; + return handler(name, location); } - ) + }) }, Promise.resolve()) page.close(); From 8277788c29c335fc5f2735c0a1550b6f7b7bd63a Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Thu, 14 Apr 2022 13:28:30 -0700 Subject: [PATCH 2/2] Update readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9e22b498..0d1b8fdd 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,8 @@ Run tests with - `shake test` - `elm-test` +You can run the Puppeteer tests for only one component by passing the name of the component to the test script, for example: `./script/puppeteer-tests-no-percy.sh Button` + ### CI (Travis) Travis will run `shake ci` to verify everything looks good.