Skip to content

Commit

Permalink
Fixed test that was broken and updated action so the PR test report w…
Browse files Browse the repository at this point in the history
…ill be commented correctly
  • Loading branch information
Hedgemon4 committed Jan 23, 2024
1 parent 67a6c5b commit b034743
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 57 deletions.
127 changes: 73 additions & 54 deletions .github/workflows/e2e_tests_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/app/submission-box/create/full-process.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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)

Expand Down

0 comments on commit b034743

Please sign in to comment.