aws-amplify / amplify-backend

Home to all tools related to Amplify's code-first DX (Gen 2) for building fullstack apps on AWS
Apache License 2.0
175 stars 60 forks source link

I would like to see the ability to download test artifacts added to the Amplify console. #2150

Open InsurTechLab-Amp opened 1 week ago

InsurTechLab-Amp commented 1 week ago

Before opening, please confirm:

Amplify Hosting feature

Build settings, E2E Cypress tests

Is your feature request related to a problem? Please describe:

When an E2E test FAILs and the deployment fails, the test artifact cannot be downloaded and the FAIL point cannot be verified.

Describe how you'd like this feature to work

I would like to see the download button on the deploy screen of the Amplify console added to download test artifacts as well as build artifacts.

github-actions[bot] commented 1 week ago

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!

Jay2113 commented 1 week ago

Hi @InsurTechLab-Amp 👋 , thanks for reaching out. Can you share your Amplify app id and the branch name where you are observing this issue?

InsurTechLab-Amp commented 5 days ago

Thanks for your comment. Amplify app id and branch name is below.

Amplify app id : d1hrcn2hvtu4w3 branch name : PBI3236_for_issue

Jay2113 commented 2 days ago

@InsurTechLab-Amp can you confirm if you are able to view the Download artifacts button within the Test artifacts tab in the console?

Screenshot 2024-10-30 at 12 29 11 PM
InsurTechLab-Amp commented 2 days ago

@Jay2113 I don't see a tab for Test artifacts in the console.

image

The amplify.yml is written as follows.

version: 1
backend:
  phases:
    build:
      commands:
        - npm ci --cache .npm --prefer-offline
        - npx ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
        - npm audit --audit-level=high
        - npm run check
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: dist
    files: 
      - '**/*'
  cache:
    paths:
      - .npm/**/*
      - node_modules/**/*

test:
  phases:
    preTest:
     commands:
        - npm ci
        - npm install -g pm2
        - npm install -g wait-on
        - npm install -g allure-commandline
        - npx playwright install
        - pm2 start npm -- start
        - wait-on http://localhost:5173
    test:
      commands:
        - npm run test -- --coverage
        - npm run test:e2e
        - npm run test:allure
        - npm run alluregenerate
    postTest:
      commands:
        - cp -r ./coverage ./dist/coverage
        - cp -r ./playwright-report ./dist/playwright-report 
        - cp -r ./playwright-screenshot ./dist/playwright-screenshot
        - cp -r ./playwright-video ./dist/playwright-video
        - cp -r ./allure-report ./dist/allure-report
        - pm2 kill 

  artifacts:
    baseDirectory: coverage
    files: 
      - '**/*'

The running log will be as follows. image

matt-at-allera commented 1 day ago

We're running into a similar situation where we cannot see the Test Artifacts tab nor do we see the option to Download Test Artifacts on individual builds:

image

This seems to have been broken since the migration to the new UI for the amplify front-end apps. The only way we can download test artifacts are by using the get-job command:

aws amplify get-job --region us-east-1 --app-id APP_ID --branch-name BRANCH_NAME --job-id JOB_NUMBER  --profile  AWS_PROFILE

(reference https://github.com/aws-amplify/amplify-backend/issues/1623)

For reference, we are using a Amplify Gen 1 backend application where the builds are triggered via Webhooks.

Jay2113 commented 14 hours ago

@InsurTechLab-Amp @matt-at-allera do you have a build specification file amplify.yml at the root of your git repository? If yes, can you try the following?

You should now see a dedicated section for the test phase in the UI and also a test artifacts tab below it to see the test details. Please note that this is a one time setup only and going forward you can continue to modify the amplify.yml that is present at the root of your git repository. It takes precedence over the build settings in the console.

Please let us know how it goes. Thanks.