Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio block: test the block for visual regressions #59986

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions test/e2e/specs/editor/blocks/audio.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'Visual Regression Testing', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'twentytwentyfour' );
} );

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

test( 'should match baseline screenshot', async ( { editor, page } ) => {
// Inserting an audio block
await editor.insertBlock( {
name: 'core/audio',
} );

await editor.canvas
.getByRole( 'button', { name: 'Insert from URL' } )
.click();
await page.keyboard.type( 'http://example.com/audio.mp3' );
await page.keyboard.press( 'Enter' );

const postId = await editor.publishPost();
await page.goto( `/?p=${ postId }` );
await expect( page ).toHaveScreenshot();

Check failure on line 29 in test/e2e/specs/editor/blocks/audio.spec.js

View workflow job for this annotation

GitHub Actions / Playwright - 1

[chromium] › editor/blocks/audio.spec.js:15:2 › Visual Regression Testing › should match baseline screenshot

1) [chromium] › editor/blocks/audio.spec.js:15:2 › Visual Regression Testing › should match baseline screenshot Error: Screenshot comparison failed: 3932 pixels (ratio 0.01 of all image pixels) are different. Expected: /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/__snapshots__/Visual-Regression-Testing-should-match-baseline-screenshot-1-chromium.png Received: /home/runner/work/gutenberg/gutenberg/artifacts/test-results/editor-blocks-audio-Visual-Regression-Testing-should-match-baseline-screenshot-chromium/Visual-Regression-Testing-should-match-baseline-screenshot-1-actual.png Diff: /home/runner/work/gutenberg/gutenberg/artifacts/test-results/editor-blocks-audio-Visual-Regression-Testing-should-match-baseline-screenshot-chromium/Visual-Regression-Testing-should-match-baseline-screenshot-1-diff.png Call log: - page._expectScreenshot with timeout 5000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - 3932 pixels (ratio 0.01 of all image pixels) are different. - waiting 100ms before taking screenshot - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - captured a stable screenshot - 3932 pixels (ratio 0.01 of all image pixels) are different. 27 | const postId = await editor.publishPost(); 28 | await page.goto( `/?p=${ postId }` ); > 29 | await expect( page ).toHaveScreenshot(); | ^ 30 | } ); 31 | } ); 32 | at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/audio.spec.js:29:24

Check failure on line 29 in test/e2e/specs/editor/blocks/audio.spec.js

View workflow job for this annotation

GitHub Actions / Playwright - 1

[chromium] › editor/blocks/audio.spec.js:15:2 › Visual Regression Testing › should match baseline screenshot

1) [chromium] › editor/blocks/audio.spec.js:15:2 › Visual Regression Testing › should match baseline screenshot Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Screenshot comparison failed: 3932 pixels (ratio 0.01 of all image pixels) are different. Expected: /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/__snapshots__/Visual-Regression-Testing-should-match-baseline-screenshot-1-chromium.png Received: /home/runner/work/gutenberg/gutenberg/artifacts/test-results/editor-blocks-audio-Visual-Regression-Testing-should-match-baseline-screenshot-chromium-retry1/Visual-Regression-Testing-should-match-baseline-screenshot-1-actual.png Diff: /home/runner/work/gutenberg/gutenberg/artifacts/test-results/editor-blocks-audio-Visual-Regression-Testing-should-match-baseline-screenshot-chromium-retry1/Visual-Regression-Testing-should-match-baseline-screenshot-1-diff.png Call log: - page._expectScreenshot with timeout 5000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - 3932 pixels (ratio 0.01 of all image pixels) are different. - waiting 100ms before taking screenshot - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - captured a stable screenshot - 3932 pixels (ratio 0.01 of all image pixels) are different. 27 | const postId = await editor.publishPost(); 28 | await page.goto( `/?p=${ postId }` ); > 29 | await expect( page ).toHaveScreenshot(); | ^ 30 | } ); 31 | } ); 32 | at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/audio.spec.js:29:24

Check failure on line 29 in test/e2e/specs/editor/blocks/audio.spec.js

View workflow job for this annotation

GitHub Actions / Playwright - 1

[chromium] › editor/blocks/audio.spec.js:15:2 › Visual Regression Testing › should match baseline screenshot

1) [chromium] › editor/blocks/audio.spec.js:15:2 › Visual Regression Testing › should match baseline screenshot Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: Screenshot comparison failed: 3932 pixels (ratio 0.01 of all image pixels) are different. Expected: /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/__snapshots__/Visual-Regression-Testing-should-match-baseline-screenshot-1-chromium.png Received: /home/runner/work/gutenberg/gutenberg/artifacts/test-results/editor-blocks-audio-Visual-Regression-Testing-should-match-baseline-screenshot-chromium-retry2/Visual-Regression-Testing-should-match-baseline-screenshot-1-actual.png Diff: /home/runner/work/gutenberg/gutenberg/artifacts/test-results/editor-blocks-audio-Visual-Regression-Testing-should-match-baseline-screenshot-chromium-retry2/Visual-Regression-Testing-should-match-baseline-screenshot-1-diff.png Call log: - page._expectScreenshot with timeout 5000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - 3932 pixels (ratio 0.01 of all image pixels) are different. - waiting 100ms before taking screenshot - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - captured a stable screenshot - 3932 pixels (ratio 0.01 of all image pixels) are different. 27 | const postId = await editor.publishPost(); 28 | await page.goto( `/?p=${ postId }` ); > 29 | await expect( page ).toHaveScreenshot(); | ^ 30 | } ); 31 | } ); 32 | at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/audio.spec.js:29:24
} );
} );
Loading