From 87f05843d660ba6613f5c54b34c849bd2e7dfd18 Mon Sep 17 00:00:00 2001 From: Cameron Voell Date: Wed, 22 Jan 2020 20:33:38 -0800 Subject: [PATCH 1/3] Added list block ordered button e2e test --- __device-tests__/gutenberg-editor-lists.test.js | 16 ++++++++++++++++ __device-tests__/helpers/test-data.js | 3 +++ __device-tests__/pages/editor-page.js | 11 +++++++++++ 3 files changed, 30 insertions(+) diff --git a/__device-tests__/gutenberg-editor-lists.test.js b/__device-tests__/gutenberg-editor-lists.test.js index ad708491e1..0d71a8802f 100644 --- a/__device-tests__/gutenberg-editor-lists.test.js +++ b/__device-tests__/gutenberg-editor-lists.test.js @@ -63,6 +63,22 @@ describe( 'Gutenberg Editor tests for List block', () => { await editorPage.verifyHtmlContent( testData.listHtml ); } ); + it( 'should be able to update format to ordered list, using toolbar button', async () => { + const listBlockElement = await editorPage.getListBlockAtPosition( 1 ); + + // Click List block on Android to force EditText focus + if ( isAndroid() ) { + await listBlockElement.click(); + } + + // Send a click on the order list format button + await editorPage.clickOrderedListToolBarButton() + + // switch to html and verify html + await editorPage.verifyHtmlContent( testData.listHtmlOrdered ); + + } ); + afterAll( async () => { if ( ! isLocalEnvironment() ) { driver.sauceJobStatus( allPassed ); diff --git a/__device-tests__/helpers/test-data.js b/__device-tests__/helpers/test-data.js index 817c94abdb..149a86fc00 100644 --- a/__device-tests__/helpers/test-data.js +++ b/__device-tests__/helpers/test-data.js @@ -11,6 +11,9 @@ exports.listItem2 = `Honey`; exports.listHtml = ` `; +exports.listHtmlOrdered = ` +
  1. Milk
  2. Honey
+`; exports.listEndedHtml = ` diff --git a/__device-tests__/pages/editor-page.js b/__device-tests__/pages/editor-page.js index 174dc6d4f6..c20754db09 100644 --- a/__device-tests__/pages/editor-page.js +++ b/__device-tests__/pages/editor-page.js @@ -21,6 +21,8 @@ export default class EditorPage { headingBlockName = 'Heading'; imageBlockName = 'Image'; galleryBlockName = 'Gallery'; + unorderedListButtonName = 'Convert to unordered list'; + orderedListButtonName = 'Convert to ordered list'; // This is needed to adapt to changes in the way accessibility ids are being // assigned after migrating to AndroidX and React Native 0.60. See: @@ -168,6 +170,11 @@ export default class EditorPage { await blockButton.click(); } + async clickToolBarButton( buttonName: string ) { + const toolBarButton = await this.driver.elementByAccessibilityId( buttonName ); + await toolBarButton.click(); + } + // ========================= // Inline toolbar functions // ========================= @@ -344,6 +351,10 @@ export default class EditorPage { return text.toString(); } + async clickOrderedListToolBarButton() { + await this.clickToolBarButton( this.orderedListButtonName ); + } + // ========================= // Image Block functions // ========================= From e3425e347b4a74bce6d056727173e2a0ad82575f Mon Sep 17 00:00:00 2001 From: Cameron Voell Date: Wed, 22 Jan 2020 21:05:58 -0800 Subject: [PATCH 2/3] Fix style error. --- __device-tests__/gutenberg-editor-lists.test.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/__device-tests__/gutenberg-editor-lists.test.js b/__device-tests__/gutenberg-editor-lists.test.js index 0d71a8802f..8d1a4c39b4 100644 --- a/__device-tests__/gutenberg-editor-lists.test.js +++ b/__device-tests__/gutenberg-editor-lists.test.js @@ -63,7 +63,7 @@ describe( 'Gutenberg Editor tests for List block', () => { await editorPage.verifyHtmlContent( testData.listHtml ); } ); - it( 'should be able to update format to ordered list, using toolbar button', async () => { + it( 'should update format to ordered list, using toolbar button', async () => { const listBlockElement = await editorPage.getListBlockAtPosition( 1 ); // Click List block on Android to force EditText focus @@ -72,11 +72,10 @@ describe( 'Gutenberg Editor tests for List block', () => { } // Send a click on the order list format button - await editorPage.clickOrderedListToolBarButton() + await editorPage.clickOrderedListToolBarButton(); // switch to html and verify html await editorPage.verifyHtmlContent( testData.listHtmlOrdered ); - } ); afterAll( async () => { From 14370a6d6f25a7f63c93f45894be60fa2fdcaf46 Mon Sep 17 00:00:00 2001 From: Cameron Voell Date: Fri, 31 Jan 2020 12:34:25 -0800 Subject: [PATCH 3/3] Click block on ios during list test --- __device-tests__/gutenberg-editor-lists.test.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/__device-tests__/gutenberg-editor-lists.test.js b/__device-tests__/gutenberg-editor-lists.test.js index 8d1a4c39b4..5fd4b52e03 100644 --- a/__device-tests__/gutenberg-editor-lists.test.js +++ b/__device-tests__/gutenberg-editor-lists.test.js @@ -66,10 +66,8 @@ describe( 'Gutenberg Editor tests for List block', () => { it( 'should update format to ordered list, using toolbar button', async () => { const listBlockElement = await editorPage.getListBlockAtPosition( 1 ); - // Click List block on Android to force EditText focus - if ( isAndroid() ) { - await listBlockElement.click(); - } + // Click List block to force EditText focus + await listBlockElement.click(); // Send a click on the order list format button await editorPage.clickOrderedListToolBarButton();