From 54221055a054ee0ad280b307b185d8dae4ef9b14 Mon Sep 17 00:00:00 2001 From: Gerardo Date: Thu, 18 May 2023 13:30:43 +0200 Subject: [PATCH 1/4] Mobile - E2E test - Update code to use the new navigateUp helper --- .../gutenberg-editor-media-blocks-@canary.test.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-media-blocks-@canary.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-media-blocks-@canary.test.js index 78215dcecc68cf..26fc0453f20359 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-media-blocks-@canary.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-media-blocks-@canary.test.js @@ -133,9 +133,7 @@ onlyOniOS( 'Gutenberg Editor Cover Block test', () => { expect( coverBlock ).toBeTruthy(); // Navigate upwards to select parent block - const navigateUpElement = - await editorPage.waitForElementToBeDisplayedById( 'Navigate Up' ); - await navigateUpElement.click(); + await editorPage.navigateUp(); await editorPage.removeBlockAtPosition( blockNames.cover ); } ); @@ -150,9 +148,7 @@ onlyOniOS( 'Gutenberg Editor Cover Block test', () => { ); await coverBlock.click(); // Navigate upwards to select parent block - const navigateUpElement = - await editorPage.waitForElementToBeDisplayedById( 'Navigate Up' ); - await navigateUpElement.click(); + await editorPage.navigateUp(); await editorPage.openBlockSettings(); await editorPage.clickAddMediaFromCoverBlock(); From c00d254b9a55a3b32c40bd9289d7e7ba77afc899 Mon Sep 17 00:00:00 2001 From: Gerardo Date: Thu, 18 May 2023 14:38:31 +0200 Subject: [PATCH 2/4] Mobile - E2E helpers - Update navigateUp helper to include recursive option with a false default value --- .../__device-tests__/pages/editor-page.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-native-editor/__device-tests__/pages/editor-page.js b/packages/react-native-editor/__device-tests__/pages/editor-page.js index defc7bf277c93f..b3e5f3293b2153 100644 --- a/packages/react-native-editor/__device-tests__/pages/editor-page.js +++ b/packages/react-native-editor/__device-tests__/pages/editor-page.js @@ -499,7 +499,7 @@ class EditorPage { await toolBarButton.click(); } - async navigateUp() { + async navigateUp( options = { recursive: false } ) { let navigateUpElements = []; do { await this.driver.sleep( 2000 ); @@ -509,6 +509,9 @@ class EditorPage { if ( navigateUpElements.length > 0 ) { await navigateUpElements[ 0 ].click(); } + if ( ! options.recursive ) { + break; + } } while ( navigateUpElements.length > 0 ); } From 273a81937e97947efed57a924cee0c2b6065aaeb Mon Sep 17 00:00:00 2001 From: Gerardo Date: Thu, 18 May 2023 16:15:38 +0200 Subject: [PATCH 3/4] Mobile - E2E Helpers - Rename navigateUp to moveBlockSelectionUp with toRoot as options param --- .../react-native-editor/__device-tests__/pages/editor-page.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native-editor/__device-tests__/pages/editor-page.js b/packages/react-native-editor/__device-tests__/pages/editor-page.js index b3e5f3293b2153..3b06187482a6f4 100644 --- a/packages/react-native-editor/__device-tests__/pages/editor-page.js +++ b/packages/react-native-editor/__device-tests__/pages/editor-page.js @@ -499,7 +499,7 @@ class EditorPage { await toolBarButton.click(); } - async navigateUp( options = { recursive: false } ) { + async moveBlockSelectionUp( options = { toRoot: false } ) { let navigateUpElements = []; do { await this.driver.sleep( 2000 ); @@ -509,7 +509,7 @@ class EditorPage { if ( navigateUpElements.length > 0 ) { await navigateUpElements[ 0 ].click(); } - if ( ! options.recursive ) { + if ( ! options.toRoot ) { break; } } while ( navigateUpElements.length > 0 ); From 36e627f80f37a269b2794f7e8cc886cc934d5fd2 Mon Sep 17 00:00:00 2001 From: Gerardo Date: Thu, 18 May 2023 16:16:16 +0200 Subject: [PATCH 4/4] Mobile - E2E test - Update usage of navigateUp to new moveBlockSelectionUp name --- .../gutenberg-editor-media-blocks-@canary.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-media-blocks-@canary.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-media-blocks-@canary.test.js index 26fc0453f20359..6fd68a7a4aff34 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-media-blocks-@canary.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-media-blocks-@canary.test.js @@ -133,7 +133,7 @@ onlyOniOS( 'Gutenberg Editor Cover Block test', () => { expect( coverBlock ).toBeTruthy(); // Navigate upwards to select parent block - await editorPage.navigateUp(); + await editorPage.moveBlockSelectionUp(); await editorPage.removeBlockAtPosition( blockNames.cover ); } ); @@ -148,7 +148,7 @@ onlyOniOS( 'Gutenberg Editor Cover Block test', () => { ); await coverBlock.click(); // Navigate upwards to select parent block - await editorPage.navigateUp(); + await editorPage.moveBlockSelectionUp(); await editorPage.openBlockSettings(); await editorPage.clickAddMediaFromCoverBlock();