question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question/Help] How to record video of a test?

See original GitHub issue

I can record videos using playwright, while creating a page object.

//Playwright 1.8.0
// With browser.newPage()
const page = await browser.newPage({ recordVideo: { dir: 'videos/' } });
await page.close();

Since jest-playwright-preset creates a page object for us by default. How do we record videos using jest-playwright-preset?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
mxschmittcommented, Jan 29, 2021

Something like that should work when you put it into your configuration file.

// jest-playwright.config.js
module.exports = {
  contextOptions: {
    recordVideo: { dir: 'videos/' }
  }
}
```
2reactions
se-thomascommented, May 13, 2021

I’ve been trying to follow the info I’ve found online regarding this setting, and there are no videos produced when I run my test:

// __tests_/example.js
describe('Visit websites', () => {
  it('can visit a few web pages successfully', async () => {
    await page.goto("https://google.com", { waitUntil: "networkidle" })
    await page.goto("https://apple.com", { waitUntil: "networkidle" })
    await page.goto("https://github.com", { waitUntil: "networkidle" })
  })
})
// jest-playwright.config
module.exports = {
    launchOptions: {
      headless: true
    },
    contextOptions: {
        recordVideo: {
            dir: "videos/"
        },
        ignoreHTTPSErrors: true,
        viewport: {
            width: 1920,
            height: 1080
        }
    },
    browsers: ["chromium", "firefox"]
}
// jest.e2e.config.js
module.exports = {
    verbose: true,
    preset: "jest-playwright-preset"
}
// package.json
{
  "name": "poc",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "jest -c jest.e2e.config.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "jest": "^26.6.3",
    "jest-playwright-preset": "^1.5.2",
    "playwright": "^1.11.0"
  }
}

Running test using: npm run test

I’m probably missing something basic, but some pointers please.

Many thanks in advance

Read more comments on GitHub >

github_iconTop Results From Across the Web

Question / Help - OBS does not record video preview in premier.
I attempted a test stream with a couple of my friends earlier but they could not see the actual video i was editing,...
Read more >
Use the Pearson LockDown Browser - help.pearsoncmg.com
Use the Pearson LockDown Browser to prevent students from opening applications or other browser windows while they take tests or quizzes ...
Read more >
Adding Sound as part of the question - Kahoot Support
I'm a music teacher and if I could record a rhythm being played and then. ... to upload my audio as a blank...
Read more >
Create and post a video - Flip Help Center
How to record and post a video · Open the Flip app. · Choose whether you want to post the video to a...
Read more >
Visual Guide: How to Use InQuizitive Activity | W. W. Norton
Click the Show InQuizitive Quickstart Video button to view the ... that is unfair or incorrect, click on the Question Help/Challenge button.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found