diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-search.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-search.test.js index 95082777711b33..6aea27dab063a2 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-search.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-search.test.js @@ -151,7 +151,7 @@ const verifySearchElementText = async ( testId, expected ) => { if ( isAndroid() ) { const input = await editorPage.getSearchBlockTextElement( testId ); - const inputValue = await input.text(); + const inputValue = await input.getText(); actual = inputValue.trim(); } else { actual = await editorPage.getHtmlContent(); 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 d102a7620a672a..b4a433d5c1ab9f 100644 --- a/packages/react-native-editor/__device-tests__/pages/editor-page.js +++ b/packages/react-native-editor/__device-tests__/pages/editor-page.js @@ -1,9 +1,3 @@ -/** - * External dependencies - */ -// eslint-disable-next-line import/no-extraneous-dependencies -const wd = null; // TODO: Replace this - /** * Internal dependencies */ @@ -843,12 +837,12 @@ class EditorPage { // ============================= async getSearchBlockTextElement( testID ) { - const child = await this.driver.elementByAccessibilityId( testID ); + const child = await this.driver.$( `~${ testID }` ); if ( isAndroid() ) { // Get the child EditText element of the ViewGroup returned by // elementByAccessibilityId. - return await child.elementByClassName( 'android.widget.EditText' ); + return await child.$( 'android.widget.EditText' ); } return child; @@ -989,11 +983,14 @@ class EditorPage { } async waitForElementToBeDisplayedByXPath( id, timeout = 2000 ) { - return await this.driver.waitForElementByXPath( - id, - wd.asserters.isDisplayed, - timeout - ); + const element = await this.driver.$( `${ id }` ); + + if ( element ) { + return element; + } + + await element.waitForDisplayed( { timeout } ); + return element; } }