Skip to content

Commit

Permalink
Testing: Try platform-specific modifier key
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Apr 17, 2018
1 parent d938e92 commit 23889c8
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions test/e2e/specs/change-detection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ describe( 'Change detection', () => {
await newPost();
} );

const MOD_KEY = process.platform === 'darwin' ? 'Meta' : 'Control';

This comment has been minimized.

Copy link
@youknowriad

youknowriad Apr 18, 2018

Contributor

I thought meta would trigger "Ctrl" on windows?


async function assertIsDirty( isDirty ) {
let hadDialog = false;

Expand Down Expand Up @@ -76,9 +78,9 @@ describe( 'Change detection', () => {
page.waitForSelector( '.editor-post-saved-state.is-saved' ),

// Keyboard shortcut Ctrl+S save.
page.keyboard.down( 'Meta' ),
page.keyboard.down( MOD_KEY ),
page.keyboard.press( 'S' ),
page.keyboard.up( 'Meta' ),
page.keyboard.up( MOD_KEY ),
] );

await assertIsDirty( false );
Expand All @@ -90,9 +92,9 @@ describe( 'Change detection', () => {
await page.setOfflineMode( true );

// Keyboard shortcut Ctrl+S save.
await page.keyboard.down( 'Meta' );
await page.keyboard.down( MOD_KEY );
await page.keyboard.press( 'S' );
await page.keyboard.up( 'Meta' );
await page.keyboard.up( MOD_KEY );

// Ensure save update fails and presents button.
await page.waitForXPath( '//p[contains(text(), \'Updating failed\')]' );
Expand All @@ -113,9 +115,9 @@ describe( 'Change detection', () => {
await interceptSave();

// Keyboard shortcut Ctrl+S save.
await page.keyboard.down( 'Meta' );
await page.keyboard.down( MOD_KEY );
await page.keyboard.press( 'S' );
await page.keyboard.up( 'Meta' );
await page.keyboard.up( MOD_KEY );

await releaseSaveIntercept();

Expand All @@ -131,9 +133,9 @@ describe( 'Change detection', () => {
await interceptSave();

// Keyboard shortcut Ctrl+S save.
await page.keyboard.down( 'Meta' );
await page.keyboard.down( MOD_KEY );
await page.keyboard.press( 'S' );
await page.keyboard.up( 'Meta' );
await page.keyboard.up( MOD_KEY );

await page.type( '.editor-post-title__input', '!' );

Expand All @@ -150,9 +152,9 @@ describe( 'Change detection', () => {
await interceptSave();

// Keyboard shortcut Ctrl+S save.
await page.keyboard.down( 'Meta' );
await page.keyboard.down( MOD_KEY );
await page.keyboard.press( 'S' );
await page.keyboard.up( 'Meta' );
await page.keyboard.up( MOD_KEY );

// Dirty post while save is in-flight.
await page.type( '.editor-post-title__input', '!' );
Expand All @@ -174,9 +176,9 @@ describe( 'Change detection', () => {
await interceptSave();

// Keyboard shortcut Ctrl+S save.
await page.keyboard.down( 'Meta' );
await page.keyboard.down( MOD_KEY );
await page.keyboard.press( 'S' );
await page.keyboard.up( 'Meta' );
await page.keyboard.up( MOD_KEY );

await page.click( '.editor-default-block-appender' );

Expand Down

0 comments on commit 23889c8

Please sign in to comment.