Giter Club home page Giter Club logo

playwright-video's Introduction

QA Wolf - Ship confidently

We take testing off your plate. We build complete coverage in 4 months and keep you there. You get unlimited, parallel test runs on our infrastructure, and we guarantee zero flakes. It’s like magic but it’s QA Wolf.

tweet

🐺 What is QA Wolf?

At QA Wolf, we’re building the magical QA experience that we wanted when we were managing engineering teams. With zero effort on your part, we get you to 80% automated test coverage in 4 months — and keep you there.

  • We plan. You’ll get a test matrix covering every user flow in your web app, from happy path to edge case and everything in between.
  • We automate. Using vanilla, open source Microsoft Playwright so that there’s no vendor lock-in — you own every test.
  • We run. Every test in full parallel, on our own infrastructure, as many times as you want — no extra charge.
  • We triage. When tests fail, we have full-time human QA engineers review the tests. We clear out all the noise of flaky tests and give you clear, human-verified bug reports.
  • We maintain. Flaky and broken tests are fixed automatically, 24-hours a day.
  • We integrate. Into your CI/CD, your issue tracker, your messaging app — we’ll feel like part of your team.

It’s truly everything you could possibly want from automated testing. And it’s half the cost of an in-house QA engineer.

🕹️ Schedule a demo

Let’s talk about your testing needs and how QA Wolf can help you stop bugs from reaching production without waiting hours or days for QA. Find a time that works for you.

💻 Work with us

Keep any eye out for new job openings here.

🙏 Acknowledgments

We use several open source tools and want to thank everyone who contributes to those great projects, particularly Microsoft's Playwright library.

playwright-video's People

Contributors

andycloke avatar celeryclub avatar flaurida avatar jperl avatar mxschmitt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

playwright-video's Issues

Not possible to record videos when running tests in parallel

Hi

I'm running playwright scenario's with cucumber-js. One of the cucumber options is to run tests in parallel. When running scenario's in parallel no video captures are created.

Using:
"playwright": "^0.11.1-next.1583993157193",
"playwright-video": "^0.5.0",
"cucumber": "^6.0.5",

Regards

Marco

Recorded video out of sync

The video recording works great, thanks. However, the recorded video seems to be out of sync and lags behind the page.

For example, recording the entire length of a fairly long youtube video on a page would produce a video with a far shorter length than the youtube video.

Invalid video file

Hi team. Hope all is well!

I've been testing this out on a project and I'm running into a weird issue. I'm running inside of docker using qawolf/playwright-ci:v1.0.0.

My JS looks like this.

import { saveVideo } from 'playwright-video';

describe('marketing/overview', () => {
  it('loads the overview page', async () => {
    const capture = await saveVideo(page, 'videos/marketing/overview.mp4');
    // do some stuff on the page
    await capture.stop();
  });
});

I can run the code and everything passes and a video file is even generated, but when I try to open it QuickTime tells me it's invalid.

Do you know why this might be? If not, I can create a more detailed repro if that would be helpful.

Thanks for building this tool! 🙏🏻

feature request: include browser level recording rather than page

I create multiple pages in runtime and close them. It is difficult to add save video every time and moreover they are recorded to different files. Rather than page recording, Can you go up with context or browser recording? Which would record the total execution in a single file?

Feature: Multi-tab recording

Hey team. This tool has been working really well for me. Thanks for building this!

I'm wondering if you'd consider supporting multi-tab recording. Right now if my tests opens another tab, the video still only shows the original tab.

Thanks for your consideration!

Gracefully handle errors

console.error node_modules/jest-jasmine2/build/jasmine/Env.js:248
  Unhandled error
console.error node_modules/jest-jasmine2/build/jasmine/Env.js:249
  Error: Protocol error (Page.screencastFrameAck): Target closed.
      at /Users/jon/dev/qawolf/node_modules/playwright-core/lib/chromium/crConnection.js:123:63          at new Promise (<anonymous>)
      at CRSession.send (/Users/jon/dev/qawolf/node_modules/playwright-core/lib/chromium/crConnection.js:122:16)
      at CRSession.<anonymous> (/Users/jon/dev/qawolf/node_modules/playwright-core/lib/helper.js:84:31)
      at CRSession.<anonymous> (/Users/jon/dev/qawolf/node_modules/playwright-video/src/ScreencastFrameCollector.ts:40:20)
      at CRSession.emit (events.js:210:5)
      at CRSession.EventEmitter.emit (domain.js:476:20)
      at /Users/jon/dev/qawolf/node_modules/playwright-core/lib/chromium/crConnection.js:137:47
console.error node_modules/jest-jasmine2/build/jasmine/Env.js:248
  Unhandled error
console.error node_modules/jest-jasmine2/build/jasmine/Env.js:249
  Error: Protocol error (Page.screencastFrameAck): Target closed.
      at /Users/jon/dev/qawolf/node_modules/playwright-core/lib/chromium/crConnection.js:123:63
      at new Promise (<anonymous>)
      at CRSession.send (/Users/jon/dev/qawolf/node_modules/playwright-core/lib/chromium/crConnection.js:122:16)
      at CRSession.<anonymous> (/Users/jon/dev/qawolf/node_modules/playwright-core/lib/helper.js:84:31)
      at CRSession.<anonymous> (/Users/jon/dev/qawolf/node_modules/playwright-video/src/ScreencastFrameCollector.ts:40:20)
      at CRSession.emit (events.js:210:5)
      at CRSession.EventEmitter.emit (domain.js:476:20)
      at /Users/jon/dev/qawolf/node_modules/playwright-core/lib/chromium/crConnection.js:137:47

Refactoring Improvements

Separate out logic into:

ScreencastFrameCollector

  • emit frames from screencast

VideoFrameBuilder

  • order frames based on correct FPS

VideoWriter

  • start and end ffmpeg

PageVideoCapture

  • tie everything together

Record video when the test fails

I am using this library to record the video but i am not able to check is there any way to record/save the video when only the test fail

Q: Compatibility issue with playwright 1.4?

Hi

I'm creating UI tests using playwright 1.4 and use your awesome playwright-video package to capture the results of the UI test.
When I call saveVideo I see some typescript error in my editor. I'm not sure if this is because of using playwright 1.4. Never hurts to ask ;)

image

Looking for maintainers

Playwright and QA Wolf have evolved a lot since we initially wrote playwright-video.

For these reasons, we are no longer maintaining playwright-video. However we are happy for any community members to take this project forward if they are interested.

Pass ffmpeg’s stdout and stderr to ffmpegerror event

.on('error', (e) => {
this.emit('ffmpegerror', e.message);
// do not reject as a result of not having frames
if (
!this._receivedFrame &&
e.message.includes('pipe:0: End of file')
) {
resolve();
return;
}
reject(`pw-video: error capturing video: ${e.message}`);
})

fluent-ffmpeg sends the stdout and stderr, so our error handler can accept this:

-        .on('error', (e) => {
+        .on('error', (e, stdout, stderr) => {

This helps with some obscure edge cases like this:

[libx264 @ 0x648b540] width not divisible by 2 (1045x730)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!

The first line which shows the culprit isn’t present in any output generated by playwright-video and DEBUG='pw-video:*'. I had to dig in and make it print the stderr so I can see the real reason.

Bug: Frames not being written correctly

After #31 I started seeing this at the end of my logs. I haven't yet determined if the frames are actually written incorrectly, but something is off. Going to dig in further.

pw-video:VideoWriter write -1 frames for duration -0.03s +3s
pw-video:VideoWriter write 9 frames for duration 0.373s +0ms
pw-video:VideoWriter write -2 frames for duration -0.074s +1ms
pw-video:VideoWriter write 4 frames for duration 0.172s +0ms
pw-video:VideoWriter write 12 frames for duration 0.494s +0ms
pw-video:VideoWriter write 5 frames for duration 0.181s +0ms
pw-video:VideoWriter write 0 frames for duration 0s +0ms
pw-video:VideoWriter write 15 frames for duration 0.592s +0ms
pw-video:VideoWriter write 2 frames for duration 0.094s +0ms
pw-video:VideoWriter write -4 frames for duration -0.154s +11ms
pw-video:VideoWriter write 8 frames for duration 0.336s +0ms

Record video with multiple windows

The app I am writing tests, has multiple windows. For example, first I need to login on MainPage, click button Edit, then second page EditPage will be opened, and the rest of actions happen on second page EditPage

I have written method to take video with chromium of the whole test flow from begin to end, but when the EditPage opens, the video is still focused on MainPage. The same goes for screenshot, when test fails on EditPage, the screenshot is still taken on MainPage

Below is part of my code:

// definition of take video and take screenshot functions
export async function recordeVideo(page: Page, name: string) {
  return await saveVideo(page, videoDir + name + "_" + Date.now() + ".mp4");
}

// definition of test
beforeAll(async () => {
  browser = await _.getBrowser();
  context = await browser.newContext(_.contextOptions);
  page = await context.newPage();
  capture = await _.recordeVideo(page, "test_video");
  await page.goto(URL, { waitUntil: "networkidle" });
});

describe("E2E Tests", () => {
  // here are all defined test steps, 
 // just example how to handle multiple windows:
const editBtn = await page.$(editButton);

// Get EditPage after clicking button
[editPage] = await Promise.all([
    context.waitForEvent('page')
]);
await editPage.waitForLoadState();
// then the tests go on on editPage
});

As I see the problem is, page is the input of function recordeVideo and takeScreenshot, that's why they don't take video or screenshot on editPage.

How can I record or take screenshot with multiple windows?

Thanks in advance.

Feature: Abort capture

Hey again. I have a feature request. In my scenario, I'm saving screenshots (and now videos) only when my tests fail in order to conserve disk space in CI. It'd be nice to have a way to run either await capture.stop() or await capture.abort() depending on the situation. What do you think about this idea?

feature: Use ffmpeg from path

It would be nice if it would detect / use as a fallback the ffmpeg which which is in the path if there is one. So apt-get install ffmpeg would work out of the box.

In the end the user has three ways of using it:

  • custom FFMPEG_PATH
  • @ffmpeg-installer/ffmpeg
  • fallback of ffmpeg which is in the path

Current workaround:

export FFMPEG_PATH=$(which ffmpeg)

The engine "node" is incompatible with this module.

Yarn install output:

➜  playwright-record-example yarn add -D playwright-video
yarn add v1.21.1
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">= 12.13 <13". Got "13.0.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

I would only set it to >= 12.13, or what do you think? So that 13.x is also allowed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.