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 ddc7bd8131c44..e9f1b57c82f57 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 @@ -30,7 +30,7 @@ describe( 'Gutenberg Editor Audio Block tests', () => { // tap on Media Library option await editorPage.chooseMediaLibrary(); // wait until the media is added - await editorPage.driver.sleep( 500 ); + await editorPage.driver.pause( 500 ); // get the html version of the content const html = await editorPage.getHtmlContent(); @@ -65,7 +65,7 @@ describe( 'Gutenberg Editor File Block tests', () => { // tap on Media Library option await editorPage.chooseMediaLibrary(); // wait until the media is added - await editorPage.driver.sleep( 500 ); + await editorPage.driver.pause( 500 ); // get the html version of the content const html = await editorPage.getHtmlContent(); @@ -151,8 +151,7 @@ onlyOniOS( 'Gutenberg Editor Cover Block test', () => { await editorPage.replaceMediaImage(); // First modal should no longer be presented. - const replaceButtons = - await editorPage.driver.elementsByAccessibilityId( 'Replace' ); + const replaceButtons = await editorPage.driver.$$( '~Replace' ); // eslint-disable-next-line jest/no-conditional-expect expect( replaceButtons.length ).toBe( 0 ); 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 b4a433d5c1ab9..c4ede7c1daa0c 100644 --- a/packages/react-native-editor/__device-tests__/pages/editor-page.js +++ b/packages/react-native-editor/__device-tests__/pages/editor-page.js @@ -527,9 +527,8 @@ class EditorPage { async moveBlockSelectionUp( options = { toRoot: false } ) { let navigateUpElements = []; do { - await this.driver.sleep( 2000 ); - navigateUpElements = - await this.driver.elementsByAccessibilityId( 'Navigate Up' ); + await this.driver.pause( 2000 ); + navigateUpElements = await this.driver.$$( `~Navigate Up` ); if ( navigateUpElements.length > 0 ) { await navigateUpElements[ 0 ].click(); } @@ -578,7 +577,7 @@ class EditorPage { blockLocator += `[@${ this.accessibilityIdXPathAttrib }="Move block up from row ${ position } to row ${ position - 1 }"]`; - const moveUpButton = await this.driver.elementByXPath( blockLocator ); + const moveUpButton = await this.driver.$( `~${ blockLocator }` ); await moveUpButton.click(); } @@ -770,8 +769,7 @@ class EditorPage { this.driver, '//XCUIElementTypeOther[@name="Media Add image or video"]' ); - const addMediaButton = - await mediaSection.elementByAccessibilityId( 'Add image or video' ); + const addMediaButton = await mediaSection.$( '~Add image or video' ); await addMediaButton.click(); } @@ -795,8 +793,7 @@ class EditorPage { this.accessibilityIdKey ); const blockLocator = `//*[@${ this.accessibilityIdXPathAttrib }="${ accessibilityId }"]//XCUIElementTypeButton[@name="Image block. Empty"]`; - const imageBlockInnerElement = - await this.driver.elementByXPath( blockLocator ); + const imageBlockInnerElement = await this.driver.$( blockLocator ); await imageBlockInnerElement.click(); } @@ -809,10 +806,13 @@ class EditorPage { } async enterCaptionToSelectedImageBlock( caption, clear = true ) { - const imageBlockCaptionField = await this.driver.elementByXPath( + const imageBlockCaptionButton = await this.driver.$( '//XCUIElementTypeButton[starts-with(@name, "Image caption.")]' ); - await imageBlockCaptionField.click(); + await imageBlockCaptionButton.click(); + const imageBlockCaptionField = await imageBlockCaptionButton.$( + '//XCUIElementTypeTextView' + ); await typeString( this.driver, imageBlockCaptionField, caption, clear ); }