Skip to content

Commit

Permalink
[Mobile] - E2E Initial HTML Test - Update test to use the Paste funct…
Browse files Browse the repository at this point in the history
…ionality for Android (#47643)

* Mobile - E2E Initial HTML Test - Update test to use the Paste functionality like iOS instead of passing they content with the "type" feature which hangs if the content is pretty long.

* Mobile - E2E Editor Page - Updates setHtmlContent to remove old comment not being accurate with the newly introduced changes
  • Loading branch information
Gerardo Pacheco authored Feb 2, 2023
1 parent 943a842 commit 6ab8b30
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions packages/react-native-editor/__device-tests__/pages/editor-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const {
swipeDown,
swipeFromTo,
swipeUp,
tapPasteAboveElement,
toggleHtmlMode,
typeString,
waitForVisible,
Expand Down Expand Up @@ -228,22 +229,9 @@ class EditorPage {

const htmlContentView = await this.getTextViewForHtmlViewContent();

if ( isAndroid() ) {
// Attention! On Android `.type()` replaces the content of htmlContentView instead of appending
// contrary to what iOS is doing. On Android tried calling `driver.pressKeycode( 279 ) // KEYCODE_PASTE`
// before to paste, but for some reason it didn't work on GitHub Actions but worked only on Sauce Labs
await htmlContentView.type( html );
} else {
await htmlContentView.click();
await doubleTap( this.driver, htmlContentView );
// Sometimes double tap is not enough for paste menu to appear, so we also long press.
await longPressMiddleOfElement( this.driver, htmlContentView );

await clickIfClickable(
this.driver,
'//XCUIElementTypeMenuItem[@name="Paste"]'
);
}
await htmlContentView.click();
await doubleTap( this.driver, htmlContentView );
await tapPasteAboveElement( this.driver, htmlContentView );

await toggleHtmlMode( this.driver, false );
}
Expand Down

0 comments on commit 6ab8b30

Please sign in to comment.