Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Update Search tests for Appium 2 #55170

Merged
merged 4 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading