-
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.
Merge pull request #6653 from wordpress-mobile/test/add-dark-mode-tests
test: Add dark mode tests
- Loading branch information
Showing
13 changed files
with
112 additions
and
2 deletions.
There are no files selected for viewing
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
39 changes: 39 additions & 0 deletions
39
__device-tests__/gutenberg-editor-media-text-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,39 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
const { blockNames } = editorPage; | ||
const { toggleDarkMode } = e2eUtils; | ||
import { takeScreenshotByElement } from './utils'; | ||
|
||
const mediaTextBlock = `<!-- wp:media-text --> | ||
<div class="wp-block-media-text is-stacked-on-mobile"><figure class="wp-block-media-text__media"></figure><div class="wp-block-media-text__content"><!-- wp:paragraph --> | ||
<p></p> | ||
<!-- /wp:paragraph --></div></div> | ||
<!-- /wp:media-text -->`; | ||
|
||
describe( 'Gutenberg Editor Visual test for Media & Text Block', () => { | ||
it( 'should display correct colors for dark mode', async () => { | ||
await toggleDarkMode( editorPage.driver, true ); | ||
await editorPage.initializeEditor( { | ||
initialData: mediaTextBlock, | ||
} ); | ||
|
||
const tapOutsideMediaButton = { | ||
offset: { | ||
x: ( width ) => Math.floor( width * -0.5 + 20 ), | ||
y: ( height ) => Math.floor( height * -0.5 + 20 ), | ||
}, | ||
}; | ||
|
||
const block = await editorPage.selectBlock( | ||
await editorPage.getBlockAtPosition( blockNames.mediaText ), | ||
tapOutsideMediaButton | ||
); | ||
|
||
const screenshot = await takeScreenshotByElement( block, { | ||
padding: 7, | ||
} ); | ||
await toggleDarkMode( editorPage.driver, false ); | ||
expect( screenshot ).toMatchImageSnapshot(); | ||
} ); | ||
} ); |
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,28 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
const { blockNames } = editorPage; | ||
const { toggleDarkMode } = e2eUtils; | ||
import { takeScreenshotByElement } from './utils'; | ||
|
||
const quoteBlock = `<!-- wp:quote --> | ||
<blockquote class="wp-block-quote"><!-- wp:paragraph --> | ||
<p>Hello, world!</p> | ||
<!-- /wp:paragraph --><cite>A person</cite></blockquote> | ||
<!-- /wp:quote -->`; | ||
|
||
describe( 'Gutenberg Editor Visual test for Quote Block', () => { | ||
it( 'should display correct colors for dark mode', async () => { | ||
await toggleDarkMode( editorPage.driver, true ); | ||
await editorPage.initializeEditor( { | ||
initialData: quoteBlock, | ||
} ); | ||
|
||
const block = await editorPage.getBlockAtPosition( blockNames.quote ); | ||
const screenshot = await takeScreenshotByElement( block, { | ||
padding: 7, | ||
} ); | ||
await toggleDarkMode( editorPage.driver, false ); | ||
expect( screenshot ).toMatchImageSnapshot(); | ||
} ); | ||
} ); |
24 changes: 24 additions & 0 deletions
24
__device-tests__/gutenberg-editor-shortcode-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,24 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
const { blockNames } = editorPage; | ||
const { toggleDarkMode } = e2eUtils; | ||
import { takeScreenshotByElement } from './utils'; | ||
|
||
const shortcodeBlock = `<!-- wp:shortcode /-->`; | ||
|
||
describe( 'Gutenberg Editor Visual test for Shortcode Block', () => { | ||
it( 'should display correct colors for dark mode', async () => { | ||
await toggleDarkMode( editorPage.driver, true ); | ||
await editorPage.initializeEditor( { | ||
initialData: shortcodeBlock, | ||
} ); | ||
|
||
const block = await editorPage.getBlockAtPosition( | ||
blockNames.shortcode | ||
); | ||
const screenshot = await takeScreenshotByElement( block ); | ||
await toggleDarkMode( editorPage.driver, false ); | ||
expect( screenshot ).toMatchImageSnapshot(); | ||
} ); | ||
} ); |
Binary file added
BIN
+6.94 KB
...est-for-gallery-block-should-display-correct-colors-for-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
+7.1 KB
...al-test-for-gallery-block-should-display-correct-colors-for-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
+7.33 KB
...-for-media-text-block-should-display-correct-colors-for-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
+7.55 KB
...test-for-media-text-block-should-display-correct-colors-for-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
+3.32 KB
...-test-for-quote-block-should-display-correct-colors-for-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
+3.43 KB
...sual-test-for-quote-block-should-display-correct-colors-for-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
+3.08 KB
...t-for-shortcode-block-should-display-correct-colors-for-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
+3.27 KB
...-test-for-shortcode-block-should-display-correct-colors-for-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.
Submodule gutenberg
updated
53 files