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

ci(tests): adds fixtures and sanity-test validation (garris#1533) #87

Closed
wants to merge 89 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
d99ffb8
ci(tests): add test fixtures and validations (garris#1533)
dgrebb Dec 31, 2023
2d1d41c
fix: remove errant newlines from fixtures
dgrebb Jan 1, 2024
b1426b0
style: log reports.json diffs in GitHub Actions summary
dgrebb Jan 1, 2024
9b0ad1e
wip: fixing smoke tests
dgrebb Jan 1, 2024
32044cc
wip: show full diff
dgrebb Jan 1, 2024
ea70a0c
wip: set results to var and echo in both pass and fail summary
dgrebb Jan 1, 2024
f5d468e
wip: remove extra playwright install shenanigans
dgrebb Jan 1, 2024
f2d18e1
wip: remove errant quote
dgrebb Jan 1, 2024
5fec75f
wip: try set +e to avoid step failure but fail nonetheless
dgrebb Jan 2, 2024
6e864d6
wip: do not silence any diff output
dgrebb Jan 2, 2024
96fd517
wip: ignore all of the diff object and add better formatting
dgrebb Jan 2, 2024
697ff15
wip: fail in a separate step to allow summary before exit
dgrebb Jan 2, 2024
05ec530
wip: remove github_env output
dgrebb Jan 3, 2024
c56ff34
wip: use `steps.validate.outcome` instead of `failure()`
dgrebb Jan 3, 2024
b5492b4
wip: use new lines
dgrebb Jan 3, 2024
3a5d78c
wip: remofve code block
dgrebb Jan 3, 2024
1504917
wip: set diff to var to prevent exit 1
dgrebb Jan 3, 2024
31a923f
wip: set +x
dgrebb Jan 3, 2024
f525cb3
wip: set -e after +e
dgrebb Jan 3, 2024
0aeb93f
wip: use single quotes for backticks
dgrebb Jan 3, 2024
affd9d1
wip: wrong line
dgrebb Jan 3, 2024
0b78d50
wip: try removing set +e
dgrebb Jan 3, 2024
51eb6f1
wip: separate summary into its own step
dgrebb Jan 3, 2024
db3d516
wip: RESULT already set
dgrebb Jan 3, 2024
440f3d3
wip: use output as var immediateily
dgrebb Jan 3, 2024
90b4e3e
wip: again
dgrebb Jan 3, 2024
dc55e14
again
dgrebb Jan 3, 2024
db11270
yep
dgrebb Jan 3, 2024
78ff8f2
try this
dgrebb Jan 3, 2024
2acb843
wip: add both integration test files in fixture
dgrebb Jan 3, 2024
dc8899c
wip: separate integration tests and use wildcards
dgrebb Jan 3, 2024
4556b70
use two stars?
dgrebb Jan 3, 2024
7da28ea
move tests
dgrebb Jan 3, 2024
4877066
wip: refactor command
dgrebb Jan 3, 2024
b38495f
if result is nothing, because two files
dgrebb Jan 3, 2024
806f0d3
add smoke test
dgrebb Jan 3, 2024
ed2bf8f
check for empty in integration test
dgrebb Jan 3, 2024
87bfa67
gotsta set continue-on-error
dgrebb Jan 3, 2024
4e27d8f
wip: only compare keys
dgrebb Jan 3, 2024
bd9b929
wip: set all properties to empty string
dgrebb Jan 4, 2024
d04532f
wip: remove diff object to avoid property differences
dgrebb Jan 5, 2024
545702f
wip: update sanity-test with new jq comparison pattern
dgrebb Jan 5, 2024
e8b2337
wip: updates remaining tests with new jq pattern
dgrebb Jan 5, 2024
eb29f77
wip: add property sort and echo real diff to summary on fail
dgrebb Jan 5, 2024
c148892
wip: use quotes to keep formatting
dgrebb Jan 5, 2024
5e9a5ca
wip: extend integration test to display full diff
dgrebb Jan 14, 2024
4e49911
wip: add summary/details expand/collapse for full diff
dgrebb Jan 14, 2024
11c7577
wip: update integration test fixtures
dgrebb Jan 15, 2024
e2450ef
wip: add var to echo rows
dgrebb Jan 15, 2024
aae54a5
wip: add linebreaks between markdown and markup
dgrebb Jan 15, 2024
98f45fc
wip: specifically test reference and test report based on date direct…
dgrebb Jan 15, 2024
b1e9049
wip: only test test results - not reference
dgrebb Jan 15, 2024
84d6022
wip: remove linebreaks
dgrebb Jan 15, 2024
dfe4f30
only test integration test result and skip reference report
dgrebb Jan 15, 2024
48465ba
wip: again
dgrebb Jan 15, 2024
0e8d202
wip: quote
dgrebb Jan 15, 2024
c43ca2e
wip: closing if
dgrebb Jan 15, 2024
ff2e1dd
wip: add paragraph
dgrebb Jan 15, 2024
859d88b
wip: final layout for integration workflow
dgrebb Jan 15, 2024
b6a4cd9
wip: add full diff to sanity test
dgrebb Jan 15, 2024
1a273f8
wip: updates smoke and sanity
dgrebb Jan 15, 2024
d721183
wip: sanity broken
dgrebb Jan 15, 2024
ad128b0
wip: update sanity check
dgrebb Jan 15, 2024
99453aa
wip: integration test was not correct
dgrebb Jan 15, 2024
7e9c97b
wip: break test
dgrebb Jan 15, 2024
eafa30e
wip: set diff to var before github env
dgrebb Jan 15, 2024
ef714ff
add the diff proeprty back to report object
dgrebb Jan 15, 2024
0603ca4
apply the same to sanity
dgrebb Jan 15, 2024
3a375a0
wip: updates sanity with var/echo to env pattern
dgrebb Jan 15, 2024
1faa5e7
fix syntax
dgrebb Jan 15, 2024
bea3364
simplify conditional only test if diff is not empty
dgrebb Jan 15, 2024
9cee6f3
intentionally break test command
dgrebb Jan 15, 2024
b511931
wrap var in quotes
dgrebb Jan 15, 2024
5d381b4
fixes intentionally broken test command
dgrebb Jan 15, 2024
22962d4
change check workflow names
dgrebb Jan 15, 2024
cf514c3
fix test
dgrebb Jan 15, 2024
4a78ef5
reformat smoke test
dgrebb Jan 15, 2024
23081e5
fix jq filter for smoke
dgrebb Jan 15, 2024
5048247
echo the var not a new diff
dgrebb Jan 15, 2024
3ddeb42
update smoek test
dgrebb Jan 15, 2024
bf62dfd
remove diffImage from smoketests
dgrebb Jan 15, 2024
abf2f9a
try sorting smoke tests
dgrebb Jan 15, 2024
1ae314a
try removing diffimage removal
dgrebb Jan 15, 2024
328d9e3
remove diffImage
dgrebb Jan 15, 2024
a26ae31
apply logic to docker smoke tests
dgrebb Jan 15, 2024
dcb2311
remove diff removal
dgrebb Jan 15, 2024
eb5a523
set +e as well
dgrebb Jan 15, 2024
2757230
continue on error
dgrebb Jan 15, 2024
564635a
set +e for docker as well
dgrebb Jan 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 45 additions & 2 deletions .github/workflows/backstop-integration-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Backstop Integration Tests
name: Integration Test Check

on:
workflow_dispatch:
Expand All @@ -14,7 +14,7 @@ env:

jobs:
integration:
name: 🧩 Integration
name: 🧩 Validate Integration Test Results
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -35,3 +35,46 @@ jobs:
- name: "𓋏 Run `npm run integration-test`"
run: |
npm run integration-test

- name: "Validate Integration Test Results"
id: validate
continue-on-error: true
run: |
set +e
TEST_REPORT_DIR=$(ls -ltd integrationTestDir/backstop_data/bitmaps_test/*/ | grep '^d' | head -n 1 | awk '{print $NF}')
echo "TEST_REPORT_DIR=$TEST_REPORT_DIR" >> $GITHUB_ENV
TEST_RESULT=$(diff <(jq 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end)' test/__fixtures__/integration-test.json) <(jq 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end)' ${TEST_REPORT_DIR}report.json))
echo "TEST_RESULT=$TEST_RESULT" >> $GITHUB_ENV
if [[ "$TEST_RESULT" != "" ]]; then
echo "# ❎ Integration Test Report Shapes Differ:" >> $GITHUB_STEP_SUMMARY
echo "## Failing Diff" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "${TEST_RESULT}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
else
echo "# ✅ Integration Test Report Shapes Match" >> $GITHUB_STEP_SUMMARY
fi

- name: "Full Integration Test Diff"
id: diff
continue-on-error: true
run: |
set +e
FULL_TEST_DIFF=$(diff <(jq -S '.tests[]' test/__fixtures__/integration-test.json) <(jq -S '.tests[]' ${TEST_REPORT_DIR}report.json))
echo "## Unfiltered Diff" >> $GITHUB_STEP_SUMMARY
echo "<details>" >> $GITHUB_STEP_SUMMARY
echo "<summary>Expand Diff</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "${FULL_TEST_DIFF}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY

- name: "Test Results Validation Outcome"
run: |
if [[ "$TEST_RESULT" != "" ]]; then
exit 1
else
exit 0
fi
86 changes: 85 additions & 1 deletion .github/workflows/backstop-sanity-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Backstop Sanity Tests
name: Sanity Test Checks

on:
workflow_dispatch:
Expand Down Expand Up @@ -33,9 +33,51 @@ jobs:
run: npm ci

- name: "𓋏 Run `npm run sanity-test`"
continue-on-error: true
run: |
npm run sanity-test

- name: "Validate Puppeteer Report"
id: validate-puppeteer
continue-on-error: true
run: |
set +e
PUPPETEER_TEST_RESULT=$(diff -c <(jq 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end)' test/__fixtures__/sanity-test.json) \
<(jq 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end)' test/configs/backstop_data/bitmaps_test/**/report.json))
echo "PUPPETEER_TEST_RESULT=$PUPPETEER_TEST_RESULT" >> $GITHUB_ENV
if [[ "$PUPPETEER_TEST_RESULT" != "" ]]; then
echo "# ❎ Puppeteer Sanity Different" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "${PUPPETEER_TEST_RESULT}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
else
echo "# ✅ Puppeteer Sanity Report Valid" >> $GITHUB_STEP_SUMMARY
fi

- name: "Full Sanity Report Diff"
id: diff
continue-on-error: true
run: |
set +e
FULL_TEST_DIFF=$(diff <(jq -S '.tests[]' test/__fixtures__/sanity-test.json) <(jq -S '.tests[]' test/configs/backstop_data/bitmaps_test/**/report.json))
echo "## Unfiltered Diff" >> $GITHUB_STEP_SUMMARY
echo "<details>" >> $GITHUB_STEP_SUMMARY
echo "<summary>Expand Diff</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "${FULL_TEST_DIFF}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY

- name: "Report Validation Outcome"
run: |
if [[ "$PUPPETEER_TEST_RESULT" != "" ]]; then
exit 1
else
exit 0
fi

sanity-playwright:
name: 🤪 Playwright
runs-on: ubuntu-latest
Expand All @@ -56,6 +98,48 @@ jobs:
run: npm ci

- name: "🎭 Run `npm run sanity-test-playwright`"
continue-on-error: true
run: |
npx playwright install --with-deps
npm run sanity-test-playwright

- name: "Validate Playwright Report"
id: validate-playwright
continue-on-error: true
run: |
set +e
PLAYWRIGHT_TEST_RESULT=$(diff -c <(jq 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end)' test/__fixtures__/sanity-test-playwright.json) \
<(jq 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end)' test/configs/backstop_data/bitmaps_test/**/report.json))
echo "PLAYWRIGHT_TEST_RESULT=$PLAYWRIGHT_TEST_RESULT" >> $GITHUB_ENV
if [[ "$PLAYWRIGHT_TEST_RESULT" != "" ]]; then
echo "# ❎ Playwright Sanity Report Different" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "${PLAYWRIGHT_TEST_RESULT}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
else
echo "# ✅ Playwright Sanity Report Valid" >> $GITHUB_STEP_SUMMARY
fi

- name: "Full Sanity Report Diff"
id: diff
continue-on-error: true
run: |
set +e
FULL_TEST_DIFF=$(diff <(jq -S '.tests[]' test/__fixtures__/sanity-test-playwright.json) <(jq -S '.tests[]' test/configs/backstop_data/bitmaps_test/**/report.json))
echo "## Unfiltered Diff" >> $GITHUB_STEP_SUMMARY
echo "<details>" >> $GITHUB_STEP_SUMMARY
echo "<summary>Expand Diff</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "${FULL_TEST_DIFF}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY

- name: "Report Validation Outcome"
run: |
if [[ "$PLAYWRIGHT_TEST_RESULT" != "" ]]; then
exit 1
else
exit 0
fi
84 changes: 83 additions & 1 deletion .github/workflows/backstop-smoke-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Backstop Smoke Tests
name: Smoke Test Checks

on:
workflow_dispatch:
Expand Down Expand Up @@ -37,6 +37,47 @@ jobs:
run: |
npm run smoke-test

- name: "Validate Puppeteer Report"
id: validate
continue-on-error: true
run: |
set +e
PUPPETEER_TEST_RESULT=$(diff -c <(jq 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end) | del(.tests[].pair.diff, .tests[].pair.diffImage)' test/__fixtures__/smoke-test.json) \
<(jq 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end) | del(.tests[].pair.diff, .tests[].pair.diffImage)' test/configs/backstop_data/bitmaps_test/**/report.json))
echo "PUPPETEER_TEST_RESULT=$PUPPETEER_TEST_RESULT" >> $GITHUB_ENV
if [[ "$PUPPETEER_TEST_RESULT" != "" ]]; then
echo "# ❎ Puppeteer Report Different" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "$PUPPETEER_TEST_RESULT" >> $GITHUB_STEP_SUMMARY
echo '```'
else
echo "# ✅ Puppeteer Report Validated" >> $GITHUB_STEP_SUMMARY
fi

- name: "Full Smoke Test Diff"
id: diff
continue-on-error: true
run: |
set +e
FULL_TEST_DIFF=$(diff <(jq -S '.tests[]' test/__fixtures__/sanity-test-playwright.json) <(jq -S '.tests[]' test/configs/backstop_data/bitmaps_test/**/report.json))
echo "## Unfiltered Diff" >> $GITHUB_STEP_SUMMARY
echo "<details>" >> $GITHUB_STEP_SUMMARY
echo "<summary>Expand Diff</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "${FULL_TEST_DIFF}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY

- name: "Report Validation Outcome"
run: |
if [[ "$PUPPETEER_TEST_RESULT" != "" ]]; then
exit 1
else
exit 0
fi

smoke-playwright:
name: 💨 Playwright
runs-on: ubuntu-latest
Expand All @@ -61,3 +102,44 @@ jobs:
run: |
npx playwright install --with-deps
npm run smoke-test-playwright

- name: "Validate Playwright Report"
id: validate
continue-on-error: true
run: |
set +e
PLAYWRIGHT_TEST_RESULT=$(diff -c <(jq -S 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end)' | del(.tests[].pair.diff, .tests[].pair.diffImage)' test/__fixtures__/smoke-test-playwright.json) \
<(jq -S 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end)' | del(.tests[].pair.diff, .tests[].pair.diffImage)' test/configs/backstop_data/bitmaps_test/**/report.json))
echo "PLAYWRIGHT_TEST_RESULT=$PLAYWRIGHT_TEST_RESULT" >> $GITHUB_ENV
if [[ "$PLAYWRIGHT_TEST_RESULT" != "" ]]; then
echo "# ❎ Playwright Report Different" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "$PLAYWRIGHT_TEST_RESULT" >> $GITHUB_STEP_SUMMARY
echo '```'
else
echo "# ✅ Playwright Report Validated" >> $GITHUB_STEP_SUMMARY
fi

- name: "Full Smoke Test Diff"
id: diff
continue-on-error: true
run: |
set +e
FULL_TEST_DIFF=$(diff <(jq -S '.tests[]' test/__fixtures__/sanity-test-playwright.json) <(jq -S '.tests[]' test/configs/backstop_data/bitmaps_test/**/report.json))
echo "## Unfiltered Diff" >> $GITHUB_STEP_SUMMARY
echo "<details>" >> $GITHUB_STEP_SUMMARY
echo "<summary>Expand Diff</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "${FULL_TEST_DIFF}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY

- name: "Report Validation Outcome"
run: |
if [[ "$PLAYWRIGHT_TEST_RESULT" != "" ]]; then
exit 1
else
exit 0
fi
86 changes: 85 additions & 1 deletion .github/workflows/docker-sanity-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker Sanity Tests
name: Docker Sanity Test Checks

on:
workflow_dispatch:
Expand Down Expand Up @@ -63,9 +63,51 @@ jobs:
docker pull $REGISTRY/$IMAGE_NAME_LC:$TAG

- name: "𓋏 Run `backstop test` in Docker"
continue-on-error: true
run: |
set +e
cd test/configs/ && docker run --rm -t --mount type=bind,source="$(pwd)",target=/src $REGISTRY/$IMAGE_NAME_LC:$TAG test

- name: "Validate Puppeteer Docker Test Results"
continue-on-error: true
run: |
set +e
PUPPETEER_TEST_RESULT=$(diff -c <(jq 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end) | del(.tests[].pair.diff)' test/__fixtures__/sanity-test-docker.json) \
<(jq 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end) | del(.tests[].pair.diff)' test/configs/backstop_data/bitmaps_test/**/report.json))
echo "PUPPETEER_TEST_RESULT=$PUPPETEER_TEST_RESULT" >> $GITHUB_ENV
if [[ "$PUPPETEER_TEST_RESULT" != "" ]]; then
echo "# ❎ Puppeteer Smoke Different" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "${PUPPETEER_TEST_RESULT}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
else
echo "# ✅ Puppeteer Smoke Report Valid" >> $GITHUB_STEP_SUMMARY
fi

- name: "Full Smoke Report Diff"
id: diff
continue-on-error: true
run: |
set +e
FULL_TEST_DIFF=$(diff <(jq -S '.tests[]' test/__fixtures__/sanity-test-docker.json) <(jq -S '.tests[]' test/configs/backstop_data/bitmaps_test/**/report.json))
echo "## Unfiltered Diff" >> $GITHUB_STEP_SUMMARY
echo "<details>" >> $GITHUB_STEP_SUMMARY
echo "<summary>Expand Diff</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "${FULL_TEST_DIFF}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY

- name: "Report Validation Outcome"
run: |
if [[ "$PUPPETEER_TEST_RESULT" != "" ]]; then
exit 1
else
exit 0
fi

sanity-test-playwright:
name: 🤪 Playwright
runs-on: ubuntu-latest
Expand Down Expand Up @@ -111,5 +153,47 @@ jobs:
docker pull $REGISTRY/$IMAGE_NAME_LC:$TAG

- name: "🎭 Run `backstop test --confg=playwright` in Docker"
continue-on-error: true
run: |
set +e
cd test/configs/ && docker run --rm -t --entrypoint='' --mount type=bind,source="$(pwd)",target=/src $REGISTRY/$IMAGE_NAME_LC:$TAG sh -c "chmod -R 777 /root && chmod -R 777 /opt/pw-browsers && npm --verbose --foreground-scripts i -D playwright && npx --verbose --foreground-scripts --yes playwright@$PLAYWRIGHT_VERSION install && backstop test --config=playwright"

- name: "Validate Playwright Docker Test Results"
continue-on-error: true
run: |
set +e
diff -c <(jq 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end) | del(.tests[].pair.diff)' test/__fixtures__/sanity-test-playwright-docker.json) \
<(jq 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end) | del(.tests[].pair.diff)' test/configs/backstop_data/bitmaps_test/**/report.json)
echo "PLAYWRIGHT_TEST_RESULT=$PLAYWRIGHT_TEST_RESULT" >> $GITHUB_ENV
if [[ "$PLAYWRIGHT_TEST_RESULT" != "" ]]; then
echo "# ❎ Playwright Sanity Report Different" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "${PLAYWRIGHT_TEST_RESULT}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
else
echo "# ✅ Playwright Sanity Report Valid" >> $GITHUB_STEP_SUMMARY
fi

- name: "Full Sanity Report Diff"
id: diff
continue-on-error: true
run: |
set +e
FULL_TEST_DIFF=$(diff <(jq -S '.tests[]' test/__fixtures__/sanity-test-playwright-docker.json) <(jq -S '.tests[]' test/configs/backstop_data/bitmaps_test/**/report.json))
echo "## Unfiltered Diff" >> $GITHUB_STEP_SUMMARY
echo "<details>" >> $GITHUB_STEP_SUMMARY
echo "<summary>Expand Diff</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "${FULL_TEST_DIFF}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY

- name: "Report Validation Outcome"
run: |
if [[ "$PLAYWRIGHT_TEST_RESULT" != "" ]]; then
exit 1
else
exit 0
fi
Loading
Loading