0
0
Cypresstesting~20 mins

GitHub Actions integration in Cypress - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
GitHub Actions Cypress Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
GitHub Actions: Output of a Cypress test run step
You have a GitHub Actions workflow that runs Cypress tests using the command npx cypress run. What is the expected output snippet when all tests pass successfully?
Cypress
name: Run Cypress Tests
on: [push]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Run Cypress tests
        run: npx cypress run
ANo tests found in the specified folder
BError: Cypress command not found
C
All specs passed! ✨  
  Tests: 5  
  Passing: 5  
  Failing: 0  
  Pending: 0
D
Tests: 5  
  Passing: 3  
  Failing: 2
Attempts:
2 left
💡 Hint
Look for the summary line that shows all tests passing with zero failures.
Configuration
intermediate
2:00remaining
Correct GitHub Actions step to cache Cypress dependencies
Which GitHub Actions step correctly caches Cypress dependencies to speed up workflow runs?
A
- name: Cache Cypress
  uses: actions/cache@v3
  with:
    path: node_modules/cypress
    key: ${{ runner.os }}-cypress-${{ github.sha }}
B
- name: Cache Cypress
  uses: actions/cache@v3
  with:
    path: ~/.cache/Cypress
    key: ${{ runner.os }}-cypress-latest
C
- name: Cache Cypress
  uses: actions/cache@v2
  with:
    path: ~/.cache/cypress
    key: ${{ runner.os }}-cypress-${{ hashFiles('package.json') }}
D
- name: Cache Cypress
  uses: actions/cache@v3
  with:
    path: ~/.cache/Cypress
    key: ${{ runner.os }}-cypress-${{ hashFiles('package-lock.json') }}
Attempts:
2 left
💡 Hint
Check the correct cache path and use of hashFiles for key.
🔀 Workflow
advanced
2:00remaining
GitHub Actions workflow to run Cypress tests only on pull requests
You want to run Cypress tests only when a pull request is opened or updated. Which on trigger configuration achieves this?
A
on:
  push:
    branches: [main]
B
on:
  pull_request:
    types: [opened, synchronize]
C
on:
  pull_request:
    branches: [main]
D
on:
  push:
    types: [opened, synchronize]
Attempts:
2 left
💡 Hint
Pull request events include types like opened and synchronize.
Troubleshoot
advanced
2:00remaining
Diagnosing Cypress test failures in GitHub Actions logs
Your Cypress tests fail in GitHub Actions with the error: Timed out waiting for the browser to connect. What is the most likely cause?
AThe GitHub Actions runner does not have a display server or browser installed.
BThe Cypress test code has syntax errors causing immediate failure.
CThe GitHub Actions workflow YAML has invalid indentation.
DThe Cypress tests are passing but the logs are not showing correctly.
Attempts:
2 left
💡 Hint
Consider the environment where the tests run and browser requirements.
Best Practice
expert
2:00remaining
Best practice for storing Cypress test artifacts in GitHub Actions
Which GitHub Actions step correctly saves Cypress screenshots and videos as artifacts after test runs?
A
- name: Upload Cypress artifacts
  uses: actions/upload-artifact@v3
  with:
    name: cypress-artifacts
    path: |
      cypress/screenshots
      cypress/videos
B
- name: Upload Cypress artifacts
  uses: actions/upload-artifact@v2
  with:
    name: cypress-artifacts
    path: cypress/reports
C
- name: Upload Cypress artifacts
  uses: actions/upload-artifact@v3
  with:
    name: cypress-artifacts
    path: cypress/screenshots,cypress/videos
D
- name: Upload Cypress artifacts
  uses: actions/upload-artifact@v3
  with:
    name: screenshots
    path: cypress/screenshots/videos
Attempts:
2 left
💡 Hint
Check the correct syntax for multiple paths in the upload-artifact action.