diff --git a/.github/workflows/e2e_tests_preview.yml b/.github/workflows/e2e_tests_preview.yml index 2294a2d8..17645d87 100644 --- a/.github/workflows/e2e_tests_preview.yml +++ b/.github/workflows/e2e_tests_preview.yml @@ -39,41 +39,41 @@ jobs: run: | echo "${{ secrets.STAGING_ENV_FILE }}" > .env -# - name: configure aws credentials -# uses: aws-actions/configure-aws-credentials@v3 -# with: -# role-to-assume: arn:aws:iam::932748244514:role/GithubActionRole -# role-session-name: GithubActionRole -# aws-region: ${{ env.AWS_REGION }} -# - name: Login to Amazon ECR -# id: login-ecr -# uses: aws-actions/amazon-ecr-login@62f4f872db3836360b72999f4b87f1ff13310f3a -# - name: Build, tag, and push image to Amazon ECR -# id: build-image -# env: -# ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} -# IMAGE_TAG: ${{ github.sha }} -# run: | -# # Build a docker container and -# # push it to ECR so that it can -# # be deployed to ECS. -# docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile.prod . -# docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -# echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT -# - name: Fill in the new image ID in the Amazon ECS task definition -# id: task-def -# uses: aws-actions/amazon-ecs-render-task-definition@c804dfbdd57f713b6c079302a4c01db7017a36fc -# with: -# task-definition: ${{ env.ECS_TASK_DEFINITION }} -# container-name: ${{ env.CONTAINER_NAME }} -# image: ${{ steps.build-image.outputs.image }} -# - name: Deploy Amazon ECS task definition -# uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a -# with: -# task-definition: ${{ steps.task-def.outputs.task-definition }} -# service: ${{ env.ECS_SERVICE }} -# cluster: ${{ env.ECS_CLUSTER }} -# wait-for-service-stability: true + - name: configure aws credentials + uses: aws-actions/configure-aws-credentials@v3 + with: + role-to-assume: arn:aws:iam::932748244514:role/GithubActionRole + role-session-name: GithubActionRole + aws-region: ${{ env.AWS_REGION }} + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@62f4f872db3836360b72999f4b87f1ff13310f3a + - name: Build, tag, and push image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + IMAGE_TAG: ${{ github.sha }} + run: | + # Build a docker container and + # push it to ECR so that it can + # be deployed to ECS. + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile.prod . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT + - name: Fill in the new image ID in the Amazon ECS task definition + id: task-def + uses: aws-actions/amazon-ecs-render-task-definition@c804dfbdd57f713b6c079302a4c01db7017a36fc + with: + task-definition: ${{ env.ECS_TASK_DEFINITION }} + container-name: ${{ env.CONTAINER_NAME }} + image: ${{ steps.build-image.outputs.image }} + - name: Deploy Amazon ECS task definition + uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a + with: + task-definition: ${{ steps.task-def.outputs.task-definition }} + service: ${{ env.ECS_SERVICE }} + cluster: ${{ env.ECS_CLUSTER }} + wait-for-service-stability: true setup-db: name: Migrate Database @@ -98,25 +98,44 @@ jobs: runs-on: ubuntu-latest needs: [ deploy-preview, setup-db] steps: - - uses: actions/checkout@v4 - - name: Write environment variables - run: | - echo "${{ secrets.STAGING_ENV_FILE }}" > .env - - name: Install Packages - run: | - npm ci - - name: Generate Prisma - run: | - npx prisma generate - - name: Run Cypress Tests - run: | - npx cypress run - - name: Save Results - if: always() - uses: actions/upload-artifact@v4 - with: - name: e2e-test-results - path: cypress/reports/e2e/e2e*.json + - uses: actions/checkout@v4 + - name: Write environment variables + run: | + echo "${{ secrets.STAGING_ENV_FILE }}" > .env + - name: Install Packages + run: | + npm ci + - name: Generate Prisma + run: | + npx prisma generate + - name: Run Cypress Tests + run: | + npx cypress run + - name: Upload screenshots + uses: actions/upload-artifact@v4 + if: failure() + with: + name: cypress-screenshots + path: cypress/screenshots + if-no-files-found: ignore + - name: Upload videos + uses: actions/upload-artifact@v4 + if: failure() + with: + name: cypress-videos + path: cypress/videos + if-no-files-found: ignore + - name: Save cypress outputs + if: always() + id: save-cypress-outputs + run: | + echo "PR_ID=$CYPRESS_PULL_REQUEST_ID" >> $GITHUB_OUTPUT + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v4 + with: + name: e2e-test-results + path: cypress/reports/e2e/e2e*.json # cypress-e2e: # name: Run cypress E2E tests on preview deployment diff --git a/cypress/e2e/app/submission-box/create/full-process.cy.ts b/cypress/e2e/app/submission-box/create/full-process.cy.ts index e80db4d0..bf6ae4c2 100644 --- a/cypress/e2e/app/submission-box/create/full-process.cy.ts +++ b/cypress/e2e/app/submission-box/create/full-process.cy.ts @@ -39,14 +39,14 @@ describe('Test full submission box creation', () => { cy.get('[data-cy=submission-box-title]').type(sb.title) cy.get('[data-cy=description]').type(sb.description) cy.get('.data-cy-date-time-picker').type(sb.closesAt.replaceAll(' ', '')) - cy.get('[data-cy=next]').click() + cy.get('[data-cy=Next]').click() cy.get('[data-cy=title]').should('contain', 'Request Submissions') cy.wrap(sb.requestedEmails).each((email: string) => { cy.get('[data-cy=email]').type(email).type('{enter}') }) - cy.get('[data-cy=next]').click() + cy.get('[data-cy=Next]').click() cy.get('[data-cy=title]').should('contain', 'Review & Create') @@ -57,7 +57,7 @@ describe('Test full submission box creation', () => { cy.get('[data-cy=requested-emails]').should('contain', email) }) - cy.get('[data-cy=next]').click() + cy.get('[data-cy=Create]').click() cy.wait(DELAY.MEDIUM)