-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gerardo
committed
Jul 19, 2023
1 parent
dbe8a4d
commit 8537631
Showing
11 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
109 changes: 109 additions & 0 deletions
109
__device-tests__/gutenberg-editor-unsupported-block-visual.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
const { isAndroid, toggleDarkMode, isEditorVisible } = e2eUtils; | ||
import { takeScreenshot } from './utils'; | ||
|
||
describe( 'Gutenberg Editor Visual test for Unsupported Block', () => { | ||
it( 'should show the empty placeholder for the selected/unselected state', async () => { | ||
await editorPage.setHtmlContent( e2eTestData.unsupportedBlockHtml ); | ||
|
||
let unsupportedBlock = await editorPage.getBlockAtPosition( | ||
editorPage.blockNames.unsupported | ||
); | ||
await unsupportedBlock.click(); | ||
|
||
// Visual test check | ||
let screenshot = await takeScreenshot(); | ||
expect( screenshot ).toMatchImageSnapshot(); | ||
|
||
// Select title to unfocus the block | ||
const titleElement = await editorPage.getTitleElement(); | ||
await titleElement.click(); | ||
|
||
await editorPage.dismissKeyboard(); | ||
|
||
// Visual test check | ||
screenshot = await takeScreenshot(); | ||
expect( screenshot ).toMatchImageSnapshot(); | ||
|
||
unsupportedBlock = await editorPage.getBlockAtPosition( | ||
editorPage.blockNames.unsupported | ||
); | ||
await unsupportedBlock.click(); | ||
await editorPage.removeBlock(); | ||
} ); | ||
|
||
it( 'should show the empty placeholder for the selected/unselected state in dark mode', async () => { | ||
await toggleDarkMode( editorPage.driver, true ); | ||
|
||
// The Android editor requires a restart to apply dark mode | ||
if ( isAndroid() ) { | ||
await editorPage.driver.resetApp(); | ||
await isEditorVisible( editorPage.driver ); | ||
} | ||
|
||
await editorPage.setHtmlContent( e2eTestData.unsupportedBlockHtml ); | ||
|
||
let unsupportedBlock = await editorPage.getBlockAtPosition( | ||
editorPage.blockNames.unsupported | ||
); | ||
await unsupportedBlock.click(); | ||
|
||
// Visual test check | ||
let screenshot = await takeScreenshot(); | ||
expect( screenshot ).toMatchImageSnapshot(); | ||
|
||
// Select title to unfocus the block | ||
const titleElement = await editorPage.getTitleElement(); | ||
await titleElement.click(); | ||
|
||
await editorPage.dismissKeyboard(); | ||
|
||
// Visual test check | ||
screenshot = await takeScreenshot(); | ||
expect( screenshot ).toMatchImageSnapshot(); | ||
|
||
unsupportedBlock = await editorPage.getBlockAtPosition( | ||
editorPage.blockNames.unsupported | ||
); | ||
await unsupportedBlock.click(); | ||
await editorPage.removeBlock(); | ||
|
||
await toggleDarkMode( editorPage.driver, false ); | ||
|
||
// The Android editor requires a restart to apply dark mode | ||
if ( isAndroid() ) { | ||
await editorPage.driver.resetApp(); | ||
await isEditorVisible( editorPage.driver ); | ||
} | ||
} ); | ||
|
||
it( 'should be able to open the unsupported block web view editor', async () => { | ||
await editorPage.setHtmlContent( e2eTestData.unsupportedBlockHtml ); | ||
|
||
const unsupportedBlock = await editorPage.getBlockAtPosition( | ||
editorPage.blockNames.unsupported | ||
); | ||
await unsupportedBlock.click(); | ||
|
||
const helpButton = await editorPage.getUnsupportedBlockHelpButton(); | ||
await helpButton.click(); | ||
|
||
// Wait for the modal to show | ||
await editorPage.driver.sleep( 3000 ); | ||
|
||
// Visual test check | ||
const screenshot = await takeScreenshot(); | ||
expect( screenshot ).toMatchImageSnapshot(); | ||
|
||
// Disabled for now on Android see https://github.com/wordpress-mobile/gutenberg-mobile/issues/5321 | ||
if ( ! isAndroid() ) { | ||
const editButton = await editorPage.getUnsupportedBlockBottomSheetEditButton(); | ||
await editButton.click(); | ||
|
||
const webView = await editorPage.getUnsupportedBlockWebView(); | ||
await expect( webView ).toBeTruthy(); | ||
} | ||
} ); | ||
} ); |
Binary file added
BIN
+29.2 KB
...lock-should-be-able-to-open-the-unsupported-block-web-view-editor-1-android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+42.4 KB
...ed-block-should-be-able-to-open-the-unsupported-block-web-view-editor-1-ios.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.7 KB
...ould-show-the-empty-placeholder-for-the-selected-unselected-state-1-android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.3 KB
...k-should-show-the-empty-placeholder-for-the-selected-unselected-state-1-ios.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.7 KB
...ould-show-the-empty-placeholder-for-the-selected-unselected-state-2-android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+18.5 KB
...k-should-show-the-empty-placeholder-for-the-selected-unselected-state-2-ios.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.7 KB
...-empty-placeholder-for-the-selected-unselected-state-in-dark-mode-1-android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.2 KB
...-the-empty-placeholder-for-the-selected-unselected-state-in-dark-mode-1-ios.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.8 KB
...-empty-placeholder-for-the-selected-unselected-state-in-dark-mode-2-android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.9 KB
...-the-empty-placeholder-for-the-selected-unselected-state-in-dark-mode-2-ios.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.