diff --git a/.circleci/config.yml b/.circleci/config.yml index 7cc98747..7be27bf0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,6 +93,30 @@ jobs: distribution-id: 'E2QD6IZIYBGTJK' paths: '"/*"' + e2e-tests: + docker: + - image: mcr.microsoft.com/playwright:v1.60.0-jammy + steps: + - checkout + - node/install-packages + - run: + name: Run Playwright E2E tests + command: npm run test:e2e + environment: + CI: 'true' + - store_test_results: + path: test-results + - aws-cli/setup: + aws_access_key_id: $AWS_ACCESS_KEY + region: $AWS_DEFAULT_REGION + aws_secret_access_key: $AWS_SECRET_ACCESS_KEY + - run: + name: Upload Playwright report to S3 + when: always + command: | + aws s3 sync playwright-report \ + "s3://globallit-aws-s3-static-webapp-test-us-east-2/e2e-reports/${CIRCLE_BRANCH}/${CIRCLE_BUILD_NUM}/" + # TODO: move invalidate-cloudfront-cache parameters to project env variables # Eventually these will be the new cloudfront name for apps and app name respectively. @@ -103,9 +127,17 @@ workflows: s3-deploy-workflow: jobs: - node/test + - e2e-tests: + context: + - aws-context + requires: + - node/test - build-and-deploy-dev: context: - aws-context + requires: + - node/test + - e2e-tests filters: branches: only: @@ -115,6 +147,7 @@ workflows: - aws-context requires: - node/test + - e2e-tests filters: branches: only: @@ -124,6 +157,7 @@ workflows: - aws-context requires: - node/test + - e2e-tests filters: branches: only: @@ -133,6 +167,7 @@ workflows: - aws-context requires: - node/test + - e2e-tests filters: branches: only: diff --git a/playwright.config.ts b/playwright.config.ts index f10cdff1..5ad3afc4 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -22,7 +22,8 @@ export default defineConfig({ ['json', { outputFile: 'test-results/results.json' }], ], use: { - baseURL: 'http://localhost:8080', + headless: process.env.CI ? true : false, + baseURL: process.env.BASE_URL || 'http://localhost:8080', // Capture screenshot on every failure for debugging screenshot: 'only-on-failure', // Retain video for failed tests so failures are reproducible