Bird
0
0

What will happen if the following GitHub Actions workflow snippet is used?

medium📝 Command Output Q5 of 15
Cypress - CI/CD and Reporting
What will happen if the following GitHub Actions workflow snippet is used?
on:
  pull_request:
    branches:
      - main
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: npx cypress run
AWorkflow will not run due to syntax error
BTests run only on pushes to main branch
CWorkflow triggers on any branch push
DCypress tests run automatically on pull requests to main branch
Step-by-Step Solution
Solution:
  1. Step 1: Understand the 'on' trigger for pull_request on main branch

    The workflow triggers on pull requests targeting the main branch only.
  2. Step 2: Confirm the job runs Cypress tests

    The job runs Cypress tests using 'npx cypress run' after checking out code.
  3. Final Answer:

    Cypress tests run automatically on pull requests to main branch -> Option D
  4. Quick Check:

    Trigger on pull_request to main = tests run on PRs [OK]
Quick Trick: pull_request trigger runs tests on PRs to specified branch [OK]
Common Mistakes:
  • Confusing pull_request with push triggers
  • Assuming tests run on all branches
  • Thinking syntax error exists here

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes