github-action icon indicating copy to clipboard operation
github-action copied to clipboard

Sometimes the test fails because it cannot find the generated video.

Open redshoga opened this issue 4 years ago • 2 comments

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 }}

redshoga avatar Mar 31 '21 01:03 redshoga

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

bahmutov avatar Mar 31 '21 19:03 bahmutov

Setup Cypress Action for first time in our project and same error:

ENOENT: no such file or directory, stat '/home/runner/work/core-cypress/core-cypress/cypress/videos/core/login.cy.ts-compressed.mp4'
Error: ENOENT: no such file or directory, stat '/home/runner/work/core-cypress/core-cypress/cypress/videos/core/login.cy.ts-compressed.mp4'


Test run failed, code 1
More information might be available above
Cypress module has returned the following error message:
Could not find Cypress test run results
Error: Could not find Cypress test run results

Action (CYPRESS_RECORD_KEY is stored as GitHub Secret):

name: Daily Regression Tests

on:
  schedule:
    #https://crontab.guru/#0_0_*_*_*
    - cron: "0 0 * * *"

jobs:
  cypress-run:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      # Install NPM dependencies, cache them correctly
      # and run all Cypress tests
      - name: Cypress run
        uses: cypress-io/github-action@v4
        with:
          start: npm start --record

Script: "start": "npx cypress run"

GeorgeXCV avatar Aug 05 '22 09:08 GeorgeXCV

Same here, should add, it's not consistent, sometimes it works, sometimes it fails to find the file. Even rerunning a failed job usually makes it pass. It's kind of critical for us right now, I might have to disable videos to have a working CI.

lalomartins avatar Nov 02 '22 13:11 lalomartins

I'm getting the exact same problem too.

DisasterMan78 avatar Nov 29 '22 19:11 DisasterMan78

Yes! same here when running cypress version: 11.2.0 ... I am trying to run it on Circle-CI and every now and then it fails for a certain commit. ENOENT: no such file or directory, stat '/root/project/cypress/videos/test.cy.js-compressed.mp4' Error: ENOENT: no such file or directory, stat '/root/project/cypress/videos/test.cy.js-compressed.mp4'

REX500 avatar Dec 14 '22 15:12 REX500

@REX500

same here when running cypress version: 11.2.0

Which browser / version are you running against?

MikeMcC399 avatar Dec 14 '22 16:12 MikeMcC399

I have the same issue as well how did you solve it? This is my cypress config

jobs:
  e2e-tests:
    runs-on: ubuntu-latest
    container: cypress/included:cypress-12.7.0-node-18.14.1-chrome-110.0.5481.96-1-ff-109.0-edge-110.0.1587.41-1
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Cypress run
        uses: cypress-io/github-action@v5
        with:
          working-directory: automated_tests
          build: npm install
          start: npx cypress run

The error is

  -  Video output: /__w/foo/foo/automated_tests/cypress/videos/API/searchProperty.cy.js.mp4

ENOENT: no such file or directory, stat '/__w/foo/foo//automated_tests/cypress/videos/API/searchProperty.cy.js-compressed.mp4'
Error: ENOENT: no such file or directory, stat '/__w/foo/foo/automated_tests/cypress/videos/API/searchProperty.cy.js-compressed.mp4'

mdrmuhaimin avatar Feb 28 '23 05:02 mdrmuhaimin

@mdrmuhaimin

ENOENT: no such file or directory, stat '/__w/foo/foo//automated_tests/cypress/videos/API/searchProperty.cy.js-compressed.mp4'

That looks a little suspicious with double slash //. You may be able to able to find out more about what is going wrong if you enable debugging and look at your logs. I don't expect that cypress-io/github-action is causing the issue, but who knows?

You can enable debugging with:

env:
  DEBUG: '@cypress/github-action, cypress:*'

MikeMcC399 avatar Feb 28 '23 08:02 MikeMcC399

We got the same error after we upgrade to v12 (not 100%, same things like 20% chance):

 -  Finished processing: 3 seconds                                                  

  -  Video output: /home/circleci/project/e2e-test/cypress/videos/actions/overview.spec.ts.mp4
ENOENT: no such file or directory, stat '/home/circleci/project/e2e-test/cypress/videos/actions/overview.spec.ts-compressed.mp4'
Error: ENOENT: no such file or directory, stat '/home/circleci/project/e2e-test/cypress/videos/actions/overview.spec.ts-compressed.mp4'

I think it's not related to double slash //. We are running the cases on circleCI. BTW I noticed the generated video is overview.spec.ts.mp4 but the saving video is overview.spec.ts-compressed.mp4, is this the reason or related?

Jianrong-Yu avatar Mar 02 '23 15:03 Jianrong-Yu

@Jianrong-Yu

We got the same error after we upgrade to v12 (not 100%, same things like 20% chance)

Did you try with debug logs?

env:
  DEBUG: 'cypress:*'

Since you say that you are running on CircleCI it sounds like this is not related to cypress-io/github-action, so you probably need a different syntax for CircleCI like

environment:
  DEBUG: 'cypress:*'

This is not really the right repository for this issue though.

MikeMcC399 avatar Mar 02 '23 16:03 MikeMcC399

@MikeMcC399 I reproduced the bug and get the log by running it several times, in the log there are a lot of this error message like this:

  cypress:server:video compression stderr log { message: 'Error while decoding stream #1:0: Invalid data found when processing input' } +0ms
  cypress:server:video compression stderr log { message: '[h264 @ 0x7177240] Invalid NAL unit size (-472234882 > 1358).' } +0ms
  cypress:server:video compression stderr log { message: '[h264 @ 0x7177240] Error splitting the input into NAL units.' } +0ms
  cypress:server:video compression stderr log { message: 'Error while decoding stream #1:0: Invalid data found when processing input' } +0ms
  cypress:server:video compression stderr log { message: '[h264 @ 0x71939c0] Invalid NAL unit size (-1353388075 > 1147).' } +0ms
  cypress:server:video compression stderr log { message: '[h264 @ 0x71939c0] Error splitting the input into NAL units.' } +1ms
  cypress:server:video compression stderr log { message: 'Error while decoding stream #1:0: Invalid data found when processing input' } +0ms
  cypress:server:video compression stderr log { message: '[h264 @ 0x71b0140] Invalid NAL unit size (-760478530 > 1349).' } +0ms
  cypress:server:video compression stderr log { message: '[h264 @ 0x71b0140] Error splitting the input into NAL units.' } +0ms
  cypress:server:video compression stderr log { message: 'Error while decoding stream #1:0: Invalid data found when processing input' } +0ms
  cypress:server:video compression stderr log { message: '[h264 @ 0x6f7a080] Invalid NAL unit size (-1597972671 > 1149).' } +0ms
  cypress:server:video compression stderr log { message: '[h264 @ 0x6f7a080] Error splitting the input into NAL units.' } +0ms
  cypress:server:video compression stderr log { message: 'Error while decoding stream #1:0: Invalid data found when processing input' } +0ms
  cypress:server:video compression stderr log { message: '    Last message repeated 14 times' } +54ms
  cypress:server:video compression stderr log { message: 'frame=  929 fps=402 q=-1.0 Lsize=     420kB time=00:00:37.04 bitrate=  92.9kbits/s dup=477 drop=0 speed=  16x    ' } +0ms
  cypress:server:video compression progress: { frames: 929, currentFps: 402, currentKbps: 92.9, targetSize: 420, timemark: '00:00:37.04' } +0ms
  cypress:server:video compression stderr log { message: 'video:408kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.989861%' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] frame I:5     Avg QP:22.35  size: 19707' } +4ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] frame P:250   Avg QP:27.85  size:  1084' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] frame B:674   Avg QP:25.34  size:    71' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] consecutive B-frames:  2.3%  1.9%  3.2% 92.6%' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] mb I  I16..4: 45.4% 45.5%  9.1%' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] mb P  I16..4:  0.8%  1.1%  0.6%  P16..4:  0.5%  0.1%  0.0%  0.0%  0.0%    skip:96.8%' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] mb B  I16..4:  0.1%  0.0%  0.0%  B16..8:  0.4%  0.0%  0.0%  direct: 0.0%  skip:99.4%  L0:44.5% L1:55.1% BI: 0.4%' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] 8x8 transform intra:42.4% inter:37.5%' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] coded y,uvDC,uvAC intra: 14.3% 9.1% 2.6% inter: 0.0% 0.0% 0.0%' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] i16 v,h,dc,p: 56% 40%  4%  0%' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 18% 43%  1%  0%  0%  1%  0%  1%' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 36% 18%  2%  3%  2%  4%  3%  5%' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] i8c dc,h,v,p: 74% 19%  7%  0%' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] Weighted P-Frames: Y:0.0% UV:0.0%' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] ref P L0: 78.2% 21.8%' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] ref B L0: 82.3% 17.7%' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] ref B L1: 94.4%  5.6%' } +0ms
  cypress:server:video compression stderr log { message: '[libx264 @ 0x6f83cc0] kb/s:89.80' } +0ms
  cypress:server:video compression stderr log { message: '    Last message repeated 14 times' } +126ms
  cypress:server:video compression stderr log { message: '[h264 @ 0x6576080] mb_type 45 in P slice too large at 8 25' } +0ms
  cypress:server:video compression stderr log { message: '[h264 @ 0x6576080] error while decoding MB 8 25' } +0ms
  cypress:server:video compression stderr log { message: '[h264 @ 0x6576080] concealing 1641 DC, 1641 AC, 1641 MV errors in P frame' } +0ms
  cypress:server:video compression stderr log { message: '' } +15ms
  cypress:server:video compression ended +0ms
  cypress:server:video compression stderr log { message: '[h264 @ 0x65f4a00] Invalid NAL unit size (1484769311 > 1634).' } +2ms
  cypress:server:video compression stderr log { message: '[h264 @ 0x65f4a00] Error splitting the input into NAL units.' } +0ms
  -  Finished processing: 2 seconds

Is this helpful for you? I cannot share the full log here since it violates our security policy. If you need the full log, please leave your Email for me.

Jianrong-Yu avatar Mar 02 '23 19:03 Jianrong-Yu

@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!

MikeMcC399 avatar Mar 02 '23 20:03 MikeMcC399

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

hernanmateika-stuart avatar May 30 '23 18:05 hernanmateika-stuart

@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.

MikeMcC399 avatar May 30 '23 19:05 MikeMcC399

Unfortunately we have to close this issue due to inactivity. Please comment if there is new information to provide concerning the original issue and we can reopen.

AtofStryker avatar Jun 06 '23 18:06 AtofStryker

I am also getting this issue, did anyone solve this by any chance?

` ENOENT: no such file or directory, stat '/home/runner/work/v3/v3/dist/cypress/apps/v3-demo-e2e/videos/demoAppContentPage.cy.ts-compressed.mp4' Error: ENOENT: no such file or directory, stat '/home/runner/work/v3/v3/dist/cypress/apps/v3-demo-e2e/videos/demoAppContentPage.cy.ts-compressed.mp4'

`

jhopley-stadion avatar Nov 16 '23 09:11 jhopley-stadion

@jhopley-stadion

This isn't an issue with github-action as such. Which version of Cypress are you using? Note that the current version of Cypress (13.x) no longer generates videos by default.

MikeMcC399 avatar Nov 16 '23 09:11 MikeMcC399

@jhopley-stadion

This isn't an issue with github-action as such. Which version of Cypress are you using? Note that the current version of Cypress (13.x) no longer generates videos by default.

Hey Mike,

I am using "cypress": "^12.16.0"

jhopley-stadion avatar Nov 16 '23 09:11 jhopley-stadion

@jhopley-stadion

You could enable Cypress debugging in the action by adding the following to the workflow:

  env:
    DEBUG: 'cypress:*'

You are most likely to find compression errors as other users have found. In that case the mitigation could be to run on a more powerful runner e.g. GitHub Larger Runners. Another possibility could be to disable or reduce videoCompression.

If you think that you have found a bug in Cypress which is also reproducible in the latest Cypress version 13.5.1 you could open a new issue against Cypress on https://github.com/cypress-io/cypress/issues. Cypress has however moved the focus away from video recording and over to Test Replay

MikeMcC399 avatar Nov 16 '23 10:11 MikeMcC399

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.

jhopley-stadion avatar Nov 16 '23 10:11 jhopley-stadion

@jhopley-stadion

You could enable Cypress debugging in the action by adding the following to the workflow:

  env:
    DEBUG: 'cypress:*'

You are most likely to find compression errors as other users have found. In that case the mitigation could be to run on a more powerful runner e.g. GitHub Larger Runners. Another possibility could be to disable or reduce videoCompression.

If you think that you have found a bug in Cypress which is also reproducible in the latest Cypress version 13.5.1 you could open a new issue against Cypress on https://github.com/cypress-io/cypress/issues. Cypress has however moved the focus away from video recording and over to Test Replay

I cant seem to find away of triggering tests in cypress cloud from a github action without having record set

jhopley-stadion avatar Nov 16 '23 14:11 jhopley-stadion

@jhopley-stadion

I cant seem to find away of triggering tests in cypress cloud from a github action without having record set

That is correct. Cypress Cloud records results from tests running in a GitHub Runner under control of a GitHub Actions workflow when the record parameter is set. Tests still run in GitHub not in Cypress Cloud.

MikeMcC399 avatar Nov 16 '23 23:11 MikeMcC399