github-action: Sometimes the test fails because it cannot find the generated video.

SSIA

The project uses Cypress Dashboard and cypress-io/github-action@v2. All tests are passing, but the test fails about 20% of the time because the generated operation video is not found. The following is a detailed description of the operating environment.

Error Log

// ...

  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        2                                                                                │
  │ Passing:      2                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        true                                                                             │
  │ Duration:     18 seconds                                                                       │
  │ Estimated:    17 seconds                                                                       │
  │ Spec Ran:     auth.spec.ts                                                                     │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


  (Video)

  -  Started processing:  Compressing to 32 CRF                                                     
  -  Finished processing: /home/runner/work/<repo-name>/<repo-name>/e2e/cyp    (6 seconds)
                          ress/videos/auth.spec.ts.mp4                                              


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  editCompany.spec.ts                                                             (2 of 2)


  企業情報
  -  Finished processing: /home/runner/work/<repo-name>/<repo-name>/e2e/cyp    (9 seconds)
                          ress/videos/auth.spec.ts.mp4                                              

[OperationalError: ENOENT: no such file or directory, stat '/home/runner/work/<repo-name>/<repo-name>/e2e/cypress/videos/auth.spec.ts-compressed.mp4'

] {
  cause: [Error: ENOENT: no such file or directory, stat '/home/runner/work/<repo-name>/<repo-name>/e2e/cypress/videos/auth.spec.ts-compressed.mp4'
  
  ] {
    errno: -2,
    code: 'ENOENT',
    syscall: 'stat',
    path: '/home/runner/work/<repo-name>/<repo-name>/e2e/cypress/videos/auth.spec.ts-compressed.mp4'
  },
  isOperational: true,
  errno: -2,
  code: 'ENOENT',
  syscall: 'stat',
  path: '/home/runner/work/<repo-name>/<repo-name>/e2e/cypress/videos/auth.spec.ts-compressed.mp4'
}
Error: ENOENT: no such file or directory, stat '/home/runner/work/<repo-name>/<repo-name>/e2e/cypress/videos/auth.spec.ts-compressed.mp4'

e2e/package.json

{
  "name": "e2e",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "cypress:staging:open": "cypress open -C cypress.staging.json",
    "cypress:staging:run": "cypress run -C cypress.staging.json"
  },
  "dependencies": {
    "cypress": "^6.6.0",
    "typescript": "^4.2.3"
  }
}

.github/workflows/cypress.yml

name: Cypress tests

on:
  schedule:
    - cron: '0 0 * * 1-5'

jobs:
  cypress-run:
    name: Cypress run
    runs-on: ubuntu-18.04
    timeout-minutes: 10

    strategy:
      matrix:
        node-version: [12.x]

    steps:
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}

      - name: Checkout
        uses: actions/checkout@v2

      - name: Cypress run
        uses: cypress-io/github-action@v2
        with:
          record: true
          working-directory: e2e
          start: yarn cypress:staging:run
          config-file: cypress.staging.json
          cache-key: node-v${{ matrix.node }}-on-${{ runner.os }}-hash-${{ hashFiles('yarn.lock') }}

        env:
          # pass the Dashboard record key as an environment variable
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
          # pass GitHub token to allow accurately detecting a build vs a re-run build
          # https://docs.github.com/ja/actions/reference/authentication-in-a-workflow
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 7
  • Comments: 22 (2 by maintainers)

Commits related to this issue

Most upvoted comments

@hernanmateika-stuart

Is there any update here? Im getting the same issue. It happens some times on our Jenkins CI but sometimes it works.

The comments I made previously are still relevant. You should check if your environment meets the System requirements especially in terms of hardware dimensioning.

The github-action itself has no influence in the generation of videos. It just hands over to Cypress via the Module API call to do the work.

@Jianrong-Yu

It’s good that you found some errors in the logs! cypress:server:video compression errors are from Cypress not from cypress-io/github-action.

I found some other issues with video recording in the Cypress issue list which were diagnosed as being due to hardware not being dimensioned powerful enough. If you want the Cypress team to look at this it would be best to open a new Cypress issue. You should let them know what runner you are using (GitHub or self-hosted, which operating system, number of cores and memory size) and if you are perhaps using GitHub “Larger runners” already.

I’m sorry that I can’t personally help you much further with this since I am only a community volunteer working in this repository. I’m not a Cypress.io employee.

Good luck!

Test Replay

I think i will have a play with test replay, seems a more suited solution. Guessing that will minimise the testing execution time.

I have never seen such error, not sure why it would happen