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

[UXIT-1471] Optimise Percy snapshots [skip percy] #599

Merged
merged 19 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 22 additions & 1 deletion .github/workflows/cypress-percy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

jobs:
cypress-run:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest

env:
Expand Down Expand Up @@ -36,5 +37,25 @@ jobs:
echo "Waiting for server to start..."
npx wait-on http://localhost:3000

- name: Determine Test Type
id: test-type
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
COMMIT_MESSAGE="${{ github.event.pull_request.title }}"
else
COMMIT_MESSAGE="${{ github.event.head_commit.message }}"
fi

if [[ "$COMMIT_MESSAGE" == *"[skip percy]"* ]]; then
echo "skip_percy=true" >> $GITHUB_OUTPUT
else
echo "skip_percy=false" >> $GITHUB_OUTPUT
fi

- name: Run Cypress Tests without Percy
if: steps.test-type.outputs.skip_percy == 'true'
run: npm run test:cypress:critical

- name: Run Cypress Tests with Percy
run: npm run test:critical
if: steps.test-type.outputs.skip_percy == 'false'
run: npm run test:cypress:percy:critical
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# .husky/pre-commit

npm run lint
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
"lint": "next lint --fix",
"validate-md": "node scripts/validateMarkdown.js",
"test:all": "cypress run --spec 'cypress/e2e/**/*.cy.ts'",
"test:critical": "percy exec -- cypress run --spec 'cypress/e2e/critical/**/*.cy.ts'",
"test:cypress:percy:critical": "percy exec -- cypress run --spec 'cypress/e2e/critical/**/*.cy.ts'",
"test:cypress:critical": "cypress run --spec 'cypress/e2e/critical/**/*.cy.ts'",
"test:weekly_schedule": "cypress run --spec 'cypress/e2e/weekly_schedule/**/*.cy.ts'",
"generate:page": "node scripts/generatePageTemplates.js"
"generate:page": "node scripts/generatePageTemplates.js",
"prepare": "husky"
},
"dependencies": {
"@headlessui/react": "^2.1.2",
Expand Down Expand Up @@ -73,6 +75,7 @@
"eslint-config-next": "14.2.5",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-react": "^7.35.0",
"husky": "^9.1.5",
"postcss": "^8.4.41",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.5",
Expand Down
Loading