Skip to content

Commit

Permalink
test: Update Search tests for Appium 2 (#55170)
Browse files Browse the repository at this point in the history
* test: Update getSearchBlockTextElement query

Update syntax for WebdriverIO, which is a part of the Appium 2 upgrade.

* test: Update waitForElementToBeDisplayedByXPath query

Update syntax for WebdriverIO, which is a part of the Appium 2 upgrade.

* test: Update verifySearchElementText query

Update syntax for WebdriverIO, which is a part of the Appium 2 upgrade.

* test: Update getSearchBlockTextElement query

Update syntax for WebdriverIO, which is a part of the Appium 2 upgrade.
  • Loading branch information
dcalhoun committed Oct 10, 2023
1 parent d1ce7b3 commit 35293d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
23 changes: 10 additions & 13 deletions packages/react-native-editor/__device-tests__/pages/editor-page.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* External dependencies
*/
// eslint-disable-next-line import/no-extraneous-dependencies
const wd = null; // TODO: Replace this

/**
* Internal dependencies
*/
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 35293d9

Please sign in to comment.