Skip to content

Commit

Permalink
The github workflow now runs the playwright ui tests.
Browse files Browse the repository at this point in the history
Also fixes a broken test that wasn't caught by the pipeline because it does not run it.
Fix: #681
  • Loading branch information
GabrielBruno24 committed Sep 11, 2024
1 parent 7f13b0d commit 68f4d40
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/evolution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,27 @@ jobs:
run: yarn build:prod
- name: Unit Test
run: yarn test
# Following configure the automated UI tests
- name: Create DB
run: yarn setup && yarn migrate
env:
NODE_ENV: production
- name: Get Playwright config
run: cp packages/evolution-frontend/playwright-example.config.ts example/demo_survey/playwright.config.ts
- name: Start application
run: yarn start &
env:
NODE_ENV: production
- name: Run tests
run: yarn test:survey
- name: Archive UI Test results
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-results-${{matrix.node-version}} # This is to make sure that the results are stored in a unique name
path: example/demo_survey/test-results
retention-days: 2
# End of automated UI tests

code-lint:
runs-on: ubuntu-latest
Expand Down
10 changes: 5 additions & 5 deletions example/demo_survey/tests/test-input-validation.UI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ surveyTestHelpers.startAndLoginAnonymously({ context, title: 'Démo', hasUser: t

// Test the home page
testHelpers.tryToContinueWithInvalidInputs({ context, text: 'Save and continue', currentPageUrl: '/survey/home' , nextPageUrl: '/survey/householdMembers' });
testHelpers.inputInvalidStringValueTest({ context, path: 'household.carNumber', value: '14' });
testHelpers.inputInvalidStringValueTest({ context, path: 'home.postalCode', value: 'H1S1V77' });
testHelpers.inputInvalidStringValueTest({ context, path: 'home.postalCode', value: 'H1S1V' });
testHelpers.inputInvalidStringValueTest({ context, path: 'home.postalCode', value: '1H1S7V' });
testHelpers.inputStringInvalidValueTest({ context, path: 'household.carNumber', value: '14' });
testHelpers.inputStringInvalidValueTest({ context, path: 'home.postalCode', value: 'H1S1V77' });
testHelpers.inputStringInvalidValueTest({ context, path: 'home.postalCode', value: 'H1S1V' });
testHelpers.inputStringInvalidValueTest({ context, path: 'home.postalCode', value: '1H1S7V' });

onePersonTestHelpers.completeHomePage(context);

// Test the household page
testHelpers.inputInvalidStringTypeTest({ context, path: 'household.persons.${personId[0]}.age', value: testHelpers.nonNumericString });
testHelpers.inputStringInvalidTypeTest({ context, path: 'household.persons.${personId[0]}.age', value: testHelpers.nonNumericString });
testHelpers.inputStringTest({ context, path: 'household.persons.${personId[0]}.age', value: '15' });
testHelpers.tryToContinueWithPopup({ context, text: 'Save and continue', currentPageUrl: '/survey/householdMembers' , nextPageUrl: '/survey/profile' });
testHelpers.inputStringTest({ context, path: 'household.persons.${personId[0]}.age', value: '30' });
Expand Down

0 comments on commit 68f4d40

Please sign in to comment.