1.2.0 • Published 3 years ago

web-test-runner-screenshot v1.2.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Web-test-runner-screenshot

This is a web-test-runner plugin to capture screenshots during regular tests in playwright.

Usage

npm install --save-dev web-test-runner-screenshot

In your web-test-runner file

import { takeScreenshotPlugin } from 'web-test-runner-screenshot/plugin';

export default {
    ...
    plugins: {
        ...
        takeScreenshotPlugin(),
    }
}

In your test file

import { makeScreenshot } from 'web-test-runner-screenshot';

Inside your test

      it('My awesome test', async () => {
        // My webcomponent test
        expect(true).to.be.true;
        await makeScreenshot({ name: 'my_screenshot-filename' });
      });

Or make it automatically to every test in your afterEach, based on the test title

  afterEach(async function () { // Note that you can't use arrow function because you lose the currentTest context
    await makeScreenshot({ name: this.currentTest.title });
  });

Parameters

makeScreenshot accepts a configuration parameter with the following options

ParameterTypeDescriptionDefault valueMandatory
namestringname of the file-yes
browserbooleanappend the browser context to the file namefalseno
folderstringfolder to store the screenshotsevidencesno
1.2.0

3 years ago

0.0.1

3 years ago

0.0.0

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.0-beta.1

3 years ago