diff --git a/plugins/woocommerce-blocks/tests/e2e/config/environment.js b/plugins/woocommerce-blocks/tests/e2e/config/environment.js index 3e28acae25b..33c1da80b9e 100644 --- a/plugins/woocommerce-blocks/tests/e2e/config/environment.js +++ b/plugins/woocommerce-blocks/tests/e2e/config/environment.js @@ -6,9 +6,19 @@ 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 ); + if ( + event.name === 'test_fn_failure' || + event.name === 'hook_failure' + ) { + const attach = await this.global.page.screenshot( { + fullPage: event.name !== 'hook_failure', + } ); + await addAttach( { + attach, + description: 'Full Page Screenshot', + context: this.global, + bufferFormat: 'png', + } ); } } }