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

test: Add Sanity Test Suite 1 #5548

Merged
merged 29 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1c3980e
build: Update Gutenberg ref
dcalhoun Mar 9, 2023
7cf9638
test: Add Columns block placeholder test
dcalhoun Mar 9, 2023
f4c0a36
test: Add Columns block display test
dcalhoun Mar 9, 2023
abc76ce
build: Update Gutenberg ref
dcalhoun Mar 9, 2023
ae74f0d
test: Reset orientation after Columns block tests
dcalhoun Mar 9, 2023
bfd7518
test: Add Columns block mover buttons test
dcalhoun Mar 9, 2023
3da06dd
test: Await modal closure for existing Columns block tests
dcalhoun Mar 9, 2023
4be2879
test: Add Columns block dark mode test
dcalhoun Mar 9, 2023
4a79f29
build: Update Gutenberg ref
dcalhoun Mar 9, 2023
2303324
test: Add Columns proportionate fill previews test
dcalhoun Mar 10, 2023
0487003
refactor: Fix typo
dcalhoun Mar 13, 2023
d0d091a
test: Dismiss bottom sheet with existing helper
dcalhoun Mar 13, 2023
1d717a8
test: Use toggleDarkMode e2e mobile test helper
dcalhoun Mar 13, 2023
7d25930
test: Dismiss bottom sheet with existing helper
dcalhoun Mar 17, 2023
671a06c
test: Fix Android block appender button query
dcalhoun Mar 17, 2023
c0284e6
test: Fix Android dark mode toggling
dcalhoun Mar 17, 2023
25fb1b2
test: Add initial Android snapshot images
dcalhoun Mar 17, 2023
1c615de
test: Columns slider interactions rely upon element coordinates
dcalhoun Mar 17, 2023
7a58ad3
fix: Remove unused import
dcalhoun Mar 17, 2023
b2e07f7
test: Adjust slider test scroll position
dcalhoun Mar 17, 2023
7e90f2c
test: Decrease slider test failure threshold
dcalhoun Mar 17, 2023
51f8823
refactor: Rename for clarity
dcalhoun Mar 17, 2023
8c44141
refactor: Leverage updated addNewBlock test helper
dcalhoun Mar 17, 2023
040e78e
build: Update Gutenberg ref
dcalhoun Mar 17, 2023
d7df0fc
build: Update Gutenberg ref
dcalhoun Mar 17, 2023
139c069
Merge branch 'trunk' of github.com:wordpress-mobile/gutenberg-mobile …
dcalhoun Mar 17, 2023
e8ebc0f
test: Fix test description typo
dcalhoun Mar 24, 2023
f3b8d07
build: Update Gutenberg ref
dcalhoun Mar 27, 2023
a102203
Merge branch 'trunk' of github.com:wordpress-mobile/gutenberg-mobile …
dcalhoun Mar 27, 2023
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
294 changes: 294 additions & 0 deletions __device-tests__/gutenberg-editor-sanity-test-1-visual.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
/**
* External dependencies
*/
import wd from 'wd';

/**
* Internal dependencies
*/
const { blockNames } = editorPage;
import { takeScreenshot } from './utils';
const { toggleOrientation, isAndroid, swipeFromTo } = e2eUtils;

describe( 'Gutenberg Editor - Test Suite 4', () => {
dcalhoun marked this conversation as resolved.
Show resolved Hide resolved
describe( 'Columns block', () => {
it( 'displays placeholders when unselected', async () => {
await editorPage.addNewBlock( blockNames.columns );
// Wait for the modal to open
await editorPage.driver.sleep( 3000 );
// Dismiss coluns layout picker
dcalhoun marked this conversation as resolved.
Show resolved Hide resolved
await editorPage.driver
.elementByAccessibilityId( 'Cancel' )
.click();
// Wait for the modal to close
await editorPage.driver.sleep( 3000 );
// Select title to unfocus the block
const titleElement = await editorPage.getTitleElement();
await titleElement.click();
await editorPage.dismissKeyboard();

// Visual test check for portrait orientation
let screenshot = await takeScreenshot();
expect( screenshot ).toMatchImageSnapshot();

await toggleOrientation( editorPage.driver );
// Wait for the device to finish rotating
await editorPage.driver.sleep( 3000 );

// Visual test check for landscape orientation
screenshot = await takeScreenshot();
expect( screenshot ).toMatchImageSnapshot();

await toggleOrientation( editorPage.driver );
// Wait for the device to finish rotating
await editorPage.driver.sleep( 3000 );
const columnsBlock = await editorPage.getBlockAtPosition(
blockNames.columns
);
await columnsBlock.click();
await editorPage.removeBlock();
} );

it( 'displays correctly in portrait and landscape orientations', async () => {
await editorPage.addNewBlock( blockNames.columns );
// Wait for the modal to open
await editorPage.driver.sleep( 3000 );
// Dismiss coluns layout picker
dcalhoun marked this conversation as resolved.
Show resolved Hide resolved
await editorPage.driver
.elementByAccessibilityId( 'Cancel' )
.click();
// Wait for the modal to close
await editorPage.driver.sleep( 3000 );

// Click the block appender within the first column
await editorPage.driver
.elementByAccessibilityId( 'Column Block. Row 1' )
.click()
.click();

// Click the Columns block type button
const blockButton = await editorPage.findBlockButton(
blockNames.columns
);
if ( isAndroid() ) {
await blockButton.click();
} else {
await editorPage.driver.execute( 'mobile: tap', {
element: blockButton,
x: 10,
y: 10,
} );
}
dcalhoun marked this conversation as resolved.
Show resolved Hide resolved

// Wait for the modal to open
await editorPage.driver.sleep( 3000 );
// Dismiss coluns layout picker
dcalhoun marked this conversation as resolved.
Show resolved Hide resolved
await editorPage.driver
.elementByAccessibilityId( 'Cancel' )
.click();
// Wait for the modal to close
await editorPage.driver.sleep( 3000 );
// Navigate upwards in block hierarchy
await editorPage.driver
.elementByAccessibilityId( 'Navigate Up' )
.click()
.click();
await editorPage.driver.sleep( 1000 );

// Visual test check for portrait orientation
let screenshot = await takeScreenshot();
expect( screenshot ).toMatchImageSnapshot();

await toggleOrientation( editorPage.driver );
// Wait for the device to finish rotating
await editorPage.driver.sleep( 3000 );

// Visual test check for landscape orientation
screenshot = await takeScreenshot();
expect( screenshot ).toMatchImageSnapshot();

await toggleOrientation( editorPage.driver );
// Wait for the device to finish rotating
await editorPage.driver.sleep( 3000 );
await editorPage.removeBlock();
} );

it( 'mover buttons display in the correct positions', async () => {
await editorPage.addNewBlock( blockNames.columns );
// Wait for the modal to open
await editorPage.driver.sleep( 3000 );
// Dismiss coluns layout picker
dcalhoun marked this conversation as resolved.
Show resolved Hide resolved
await editorPage.driver
.elementByAccessibilityId( 'Cancel' )
.click();
// Wait for the modal to close
await editorPage.driver.sleep( 3000 );

// Click the block appender within the first column
await editorPage.driver
.elementByAccessibilityId( 'Column Block. Row 1' )
.click()
.click();

// Click the Columns block type button
const blockButton = await editorPage.findBlockButton(
blockNames.columns
);
if ( isAndroid() ) {
await blockButton.click();
} else {
await editorPage.driver.execute( 'mobile: tap', {
element: blockButton,
x: 10,
y: 10,
} );
}

// Wait for the modal to open
await editorPage.driver.sleep( 3000 );
// Dismiss coluns layout picker
dcalhoun marked this conversation as resolved.
Show resolved Hide resolved
await editorPage.driver
.elementByAccessibilityId( 'Cancel' )
.click();
await toggleOrientation( editorPage.driver );
// Wait for the device to finish rotating
await editorPage.driver.sleep( 3000 );

// Visual test check for landscape orientation
let screenshot = await takeScreenshot();
expect( screenshot ).toMatchImageSnapshot();

// Navigate upwards in block hierarchy
await editorPage.driver
.elementByAccessibilityId( 'Navigate Up' )
.click();
await editorPage.driver.sleep( 1000 );

// Visual test check for landscape orientation
screenshot = await takeScreenshot();
expect( screenshot ).toMatchImageSnapshot();

await toggleOrientation( editorPage.driver );
// Wait for the device to finish rotating
await editorPage.driver.sleep( 3000 );
// Navigate upwards in block hierarchy
await editorPage.driver
.elementByAccessibilityId( 'Navigate Up' )
.click();
await editorPage.driver.sleep( 1000 );
await editorPage.removeBlock();
} );

it( 'displays with correct colors with dark mode enabled', async () => {
if ( isAndroid() ) {
await editorPage.driver.executeScript( 'mobile: shell', [
{
command: 'settings put system ui_night_mode 2',
},
] );
} else {
await editorPage.driver.execute( 'mobile: setAppearance', {
style: 'dark',
} );
}
dcalhoun marked this conversation as resolved.
Show resolved Hide resolved

await editorPage.addNewBlock( blockNames.columns );
// Wait for the modal to open
await editorPage.driver.sleep( 3000 );
// Dismiss coluns layout picker
dcalhoun marked this conversation as resolved.
Show resolved Hide resolved
await editorPage.driver
.elementByAccessibilityId( 'Cancel' )
.click();
// Wait for the modal to close
await editorPage.driver.sleep( 3000 );

// Visual test check for placeholders
let screenshot = await takeScreenshot();
expect( screenshot ).toMatchImageSnapshot();

// Click the block appender within the first column
await editorPage.driver
.elementByAccessibilityId( 'Column Block. Row 1' )
.click()
.click();

// Append a Preformatted block
const blockButton = await editorPage.findBlockButton(
blockNames.preformatted
);
if ( isAndroid() ) {
await blockButton.click();
} else {
await editorPage.driver.execute( 'mobile: tap', {
element: blockButton,
x: 10,
y: 10,
} );
}

// TODO: determine a way to type a text block nested within a Columns block

// Wait for the modal to close
await editorPage.driver.sleep( 3000 );
// Navigate upwards in block hierarchy
await editorPage.driver
.elementByAccessibilityId( 'Navigate Up' )
.click()
.click();
await editorPage.waitForKeyboardToBeHidden();

// Visual test check for nested content
screenshot = await takeScreenshot();
expect( screenshot ).toMatchImageSnapshot();

await editorPage.removeBlock();
if ( isAndroid() ) {
await editorPage.driver.executeScript( 'mobile: shell', [
{
command: 'settings put system ui_night_mode 1',
},
] );
} else {
await editorPage.driver.execute( 'mobile: setAppearance', {
style: 'light',
} );
}
} );
} );

it( 'sliders display proportionate fill level previews', async () => {
await editorPage.addNewBlock( blockNames.columns );
// Wait for the modal to open
await editorPage.driver.sleep( 3000 );
await editorPage.driver.elementByAccessibilityId( 'Cancel' ).click();
await editorPage.openBlockSettings();
// Wait for the modal to open
await editorPage.driver.sleep( 3000 );

// Reveal default column width sliders
await swipeFromTo(
editorPage.driver,
{ x: 180, y: 625 },
{ x: 180, y: 425 },
3000
dcalhoun marked this conversation as resolved.
Show resolved Hide resolved
);
// Shrink first column
await swipeFromTo(
editorPage.driver,
{ x: 165, y: 626 },
{ x: 100, y: 626 },
3000
);

// Visual test check for adjusted columns
const screenshot = await takeScreenshot();
expect( screenshot ).toMatchImageSnapshot();

// Dismiss block settings by tapping the modal overlay
const action = new wd.TouchAction( editorPage.driver );
action.tap( { x: 100, y: 100 } );
await action.perform();
dcalhoun marked this conversation as resolved.
Show resolved Hide resolved

await editorPage.removeBlock();
} );
} );
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion gutenberg
Submodule gutenberg updated 68 files
+16 −13 lib/compat/wordpress-6.2/html-api/class-wp-html-tag-processor.php
+16 −13 lib/compat/wordpress-6.3/html-api/class-gutenberg-html-tag-processor-6-3.php
+3 −0 packages/block-editor/src/components/block-inspector/style.scss
+20 −2 packages/block-editor/src/components/block-mover/test/__snapshots__/index.native.js.snap
+0 −1 packages/block-editor/src/components/inserter/menu.js
+1 −9 packages/block-editor/src/components/inserter/tabs.js
+44 −4 packages/block-library/src/audio/test/__snapshots__/edit.native.js.snap
+25 −0 packages/block-library/src/audio/test/__snapshots__/transforms.native.js.snap
+42 −0 packages/block-library/src/audio/test/transforms.native.js
+15 −0 packages/block-library/src/block/test/__snapshots__/transforms.native.js.snap
+40 −0 packages/block-library/src/block/test/transforms.native.js
+31 −0 packages/block-library/src/buttons/test/__snapshots__/transforms.native.js.snap
+48 −0 packages/block-library/src/buttons/test/transforms.native.js
+2 −3 packages/block-library/src/columns/edit.js
+61 −0 packages/block-library/src/columns/test/__snapshots__/transforms.native.js.snap
+91 −0 packages/block-library/src/columns/test/transforms.native.js
+73 −0 packages/block-library/src/cover/test/__snapshots__/transforms.native.js.snap
+112 −0 packages/block-library/src/cover/test/transforms.native.js
+23 −0 packages/block-library/src/embed/test/__snapshots__/transforms.native.js.snap
+44 −0 packages/block-library/src/embed/test/transforms.native.js
+18 −2 packages/block-library/src/file/test/__snapshots__/edit.native.js.snap
+19 −0 packages/block-library/src/file/test/__snapshots__/transforms.native.js.snap
+42 −0 packages/block-library/src/file/test/transforms.native.js
+19 −0 packages/block-library/src/freeform/test/__snapshots__/transforms.native.js.snap
+39 −0 packages/block-library/src/freeform/test/transforms.native.js
+53 −0 packages/block-library/src/gallery/test/__snapshots__/transforms.native.js.snap
+52 −0 packages/block-library/src/gallery/test/transforms.native.js
+35 −0 packages/block-library/src/group/test/__snapshots__/transforms.native.js.snap
+75 −0 packages/block-library/src/group/test/transforms.native.js
+49 −0 packages/block-library/src/image/test/__snapshots__/transforms.native.js.snap
+48 −0 packages/block-library/src/image/test/transforms.native.js
+7 −12 packages/block-library/src/latest-posts/edit.js
+15 −0 packages/block-library/src/latest-posts/test/__snapshots__/transforms.native.js.snap
+61 −0 packages/block-library/src/latest-posts/test/transforms.native.js
+2 −8 packages/block-library/src/media-text/edit.native.js
+73 −0 packages/block-library/src/media-text/test/__snapshots__/transforms.native.js.snap
+112 −0 packages/block-library/src/media-text/test/transforms.native.js
+20 −2 packages/block-library/src/missing/test/__snapshots__/edit.native.js.snap
+19 −0 packages/block-library/src/more/test/__snapshots__/transforms.native.js.snap
+42 −0 packages/block-library/src/more/test/transforms.native.js
+19 −0 packages/block-library/src/nextpage/test/__snapshots__/transforms.native.js.snap
+42 −0 packages/block-library/src/nextpage/test/transforms.native.js
+2 −6 packages/block-library/src/pullquote/deprecated.js
+33 −1 packages/block-library/src/query/test/utils.js
+19 −6 packages/block-library/src/query/utils.js
+11 −1 packages/block-library/src/search/test/__snapshots__/edit.native.js.snap
+15 −0 packages/block-library/src/search/test/__snapshots__/transforms.native.js.snap
+40 −0 packages/block-library/src/search/test/transforms.native.js
+19 −0 packages/block-library/src/separator/test/__snapshots__/transforms.native.js.snap
+42 −0 packages/block-library/src/separator/test/transforms.native.js
+31 −0 packages/block-library/src/social-links/test/__snapshots__/transforms.native.js.snap
+53 −0 packages/block-library/src/social-links/test/transforms.native.js
+19 −0 packages/block-library/src/spacer/test/__snapshots__/transforms.native.js.snap
+42 −0 packages/block-library/src/spacer/test/transforms.native.js
+8 −17 packages/block-library/src/table/state.js
+1 −6 packages/block-library/src/text-columns/edit.js
+1 −6 packages/block-library/src/text-columns/save.js
+41 −0 packages/block-library/src/video/test/__snapshots__/transforms.native.js.snap
+48 −0 packages/block-library/src/video/test/transforms.native.js
+12 −1 packages/components/src/button/style.scss
+0 −1 packages/compose/src/index.native.js
+1 −3 packages/edit-site/src/components/sidebar-navigation-item/style.scss
+5 −1 packages/edit-site/src/components/site-hub/index.js
+4 −0 packages/edit-site/src/components/site-hub/style.scss
+1 −1 packages/env/README.md
+10 −1 packages/react-native-editor/__device-tests__/pages/editor-page.js
+3 −0 test/native/__mocks__/styleMock.js
+11 −1 test/native/setup.js