woocommerce/plugins/woocommerce-blocks/tests/e2e/config/environment.js

17 lines
458 B
JavaScript

/**
* External dependencies
*/
const PuppeteerEnvironment = require( 'jest-environment-puppeteer' );
const { addAttach } = require( 'jest-html-reporters/helper' );
class E2EEnvironment extends PuppeteerEnvironment {
async handleTestEvent( event ) {
if ( event.name === 'test_fn_failure' ) {
const data = await this.global.page.screenshot();
await addAttach( data, 'Full Page Screenshot', this.global );
}
}
}
module.exports = E2EEnvironment;