Bird
0
0

You want to run Cypress tests only on pull requests targeting the 'develop' branch and save test videos as artifacts. Which YAML snippet correctly configures this?

hard📝 Workflow Q8 of 15
Cypress - CI/CD and Reporting
You want to run Cypress tests only on pull requests targeting the 'develop' branch and save test videos as artifacts. Which YAML snippet correctly configures this?
Aon: pull_request: branches: - develop jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - run: npx cypress run --record - uses: actions/upload-artifact@v3 with: name: cypress-videos path: cypress/videos
Bon: push: branches: - develop jobs: test: runs-on: ubuntu-latest steps: - run: npx cypress run - uses: actions/upload-artifact@v3 with: name: videos path: cypress/videos
Con: pull_request: branches: - main jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - run: npx cypress run - uses: actions/upload-artifact@v3 with: name: videos path: cypress/screenshots
Don: pull_request: branches: - develop jobs: test: runs-on: ubuntu-latest steps: - run: npx cypress run --record - uses: actions/upload-artifact@v3 with: name: cypress-videos path: cypress/videos
Step-by-Step Solution
Solution:
  1. Step 1: Confirm trigger on pull_request to 'develop'

    Uses 'on: pull_request: branches: - develop' to trigger only on PRs targeting develop branch.
  2. Step 2: Check for checkout and artifact upload steps

    Includes 'uses: actions/checkout@v3' and 'actions/upload-artifact@v3' with 'name: cypress-videos' and 'path: cypress/videos'.
  3. Step 3: Verify Cypress run command

    Uses 'npx cypress run --record' suitable for CI.
  4. Final Answer:

    on: pull_request: branches: - develop with checkout, Cypress run --record, and cypress/videos artifact upload -> Option A
  5. Quick Check:

    develop PR trigger + checkout + cypress run + videos artifact [OK]
Quick Trick: Include checkout before tests and upload artifacts after [OK]
Common Mistakes:
  • Missing checkout step
  • Wrong branch in trigger
  • Uploading wrong artifact path
  • Triggering on push instead of pull_request

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes