Skip to content

Videos generated are not attached to an allure report if using Mocha before / beforeEach hooks #272

@GibDot

Description

@GibDot

Describe the bug
Videos generated are not attached correctly to the allure report if a before / beforeEach hook exists in Mocha.

Log:

[2024-04-15T19:00:35.834Z] Adding execution video attachment as /Users/.../.../wdio_video_temp/allure-results/Should-fail-0-0--CHROME--2024-04-15--15-00-35-817.webm
[2024-04-15T19:00:37.763Z] Add frame for command: /session/:sessionId/url => [url]
[2024-04-15T19:00:41.091Z] Add frame for command: /session/:sessionId/url => [url]
[2024-04-15T19:00:41.195Z] - Screenshot (frame: 0)
[2024-04-15T19:00:41.300Z] - Screenshot (frame: 1)
[2024-04-15T19:00:41.311Z] Add frame for command: /session/:sessionId/execute/sync => [sync]
[2024-04-15T19:00:41.471Z] - Screenshot (frame: 2)
[2024-04-15T19:00:41.472Z] Add frame for command: /session/:sessionId/execute/sync => [sync]
[2024-04-15T19:00:41.564Z] - Screenshot (frame: 3)
[2024-04-15T19:00:43.590Z] ffmpeg command: "/Users/.../.../wdio_video_temp/node_modules/@ffmpeg-installer/darwin-arm64/ffmpeg" -y -r 10 -i "/Users/.../.../wdio_video_temp/allure-results/.video-reporter-screenshots/Should-fail-0-0--CHROME--2024-04-15--15-00-35-817/%04d.png" -vcodec libvpx-vp9 -crf 32 -pix_fmt yuv420p -vf "scale=1200:trunc(ow/a/2)*2","setpts=3.0*PTS" "/Users/.../.../wdio_video_temp/allure-results/Should-fail-0-0--CHROME--2024-04-15--15-00-35-817.webm"
[2024-04-15T19:00:43.690Z] Screenshot not available (frame: 4). Error: Error: There isn't any active test!..
[2024-04-15T19:00:44.041Z] Screenshot not available (frame: 5). Error: RequestError: connect ECONNREFUSED 0.0.0.0:62345..
[2024-04-15T19:00:44.197Z] Generated video: "/Users/.../.../wdio_video_temp/allure-results/Should-fail-0-0--CHROME--2024-04-15--15-00-35-817.webm" (607ms)
[2024-04-15T19:00:44.197Z] Generated 1 videos, video report done!

To Reproduce

Test File:

describe('WDIO Video Test', () => {
    beforeEach(async () => {
        await browser.navigateTo('https://www.google.com/')
    })

    it('Should fail', async () => {
        await browser.navigateTo('https://webdriver.io/')
        await $('.footer__title').scrollIntoView()
        await browser.pause(2000)
        await expect(1).toEqual(2)
    })
})

package.json:

{
  "name": "wdio_video_temp",
  "type": "module",
  "devDependencies": {
    "@babel/core": "^7.24.4",
    "@babel/preset-env": "^7.24.4",
    "@babel/register": "^7.23.7",
    "@wdio/allure-reporter": "^8.14.0",
    "@wdio/cli": "^8.36.0",
    "@wdio/local-runner": "^8.36.0",
    "@wdio/mocha-framework": "^8.36.0",
    "@wdio/spec-reporter": "^8.36.0",
    "wdio-video-reporter": "^5.2.0"
  },
  "scripts": {
    "wdio": "wdio run ./wdio.conf.js"
  }
}

wdio.conf.js:

Boiler plate configuration with the below updates to reporters:

    reporters: ['spec',
        ['allure',
            { outputDir: 'allure-results' }],
        ['video',
            {
                outputDir: 'allure-results',
                saveAllVideos: false,
            }]
    ],

Expected behavior:

I expect the video files that are generated and present within the output directory to be included in the Allure Report when using before / beforeEach hooks.

Environment (please complete the following information):

  • wdio-video-reporter version: 5.2.0
  • WebdriverIO version: 8.36.0
  • Mode: Testrunner
  • If WDIO Testrunner, running sync/async: async
  • Node.js version: v20.11.1
  • NPM version: 10.2.4
  • Browser name and version: 123.0.6312.122
  • Platform name and version: MacOS Ventura - 13.6.3

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Chrome
  • Version: 123.0.6312.122

Additional context:

  • Viewing the output directory, the video file is present and labelled appropriately.
  • Despite the before / beforeEach hooks succeeding, a video is created for these steps are attached to the allure report regardless of the 'saveAllVideos' parameter in the configuration.
  • When removing the beforeEach hook in the above snippet, the videos of the tests are attached to the allure report as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions