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

Add Paste UI Tests for Android #1100

Merged
merged 9 commits into from
Jun 13, 2019
Merged

Add Paste UI Tests for Android #1100

merged 9 commits into from
Jun 13, 2019

Conversation

mkevins
Copy link
Contributor

@mkevins mkevins commented Jun 7, 2019

Description

This PR aims to implement UI tests for copying and pasting plain text and styled text from one paragraph block into another.

Since the copy and paste context menu items are not part of the application itself, the approach used to tap those buttons relies on specific x,y offsets from the active UI element. This may be somewhat brittle, and will likely require some tweaking for different platforms / OSs, however, in lieu of an alternative, I think there is some value in using such a workaround.

To test:

Run a device or emulator with Android 8.
(It may be necessary to specify the exact platform version of in the caps.js file https://github.com/wordpress-mobile/gutenberg-mobile/blob/develop/__device-tests__/helpers/caps.js#L16).
Run the test:
TEST_RN_PLATFORM=android yarn device-tests __device-tests__/gutenberg-editor-paste.test.js

Screencast:

There are no user facing changes in this PR.

  • If there are user facing changes, I have added an item to RELEASE-NOTES.txt.

@mkevins mkevins added [OS] Android Paste Testing Anything related to automated tests labels Jun 7, 2019
@mkevins mkevins added this to the v1.7 milestone Jun 7, 2019
@mkevins mkevins requested review from hypest and JavonDavis June 7, 2019 14:51
@mkevins mkevins changed the title Try/add paste ui test Add Paste UI Tests Jun 7, 2019
@mkevins mkevins changed the title Add Paste UI Tests Add Paste UI Tests for Android Jun 7, 2019
@mkevins mkevins modified the milestones: v1.7, v1.8 Jun 10, 2019
const x = location.x + 220;
const y = location.y - 50;
action.press( { x, y } );
//action.wait( 1000 );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably remove this right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll push a commit to remove those. Initially, I wasn't sure if they were required, as I'd seen similar waits on examples online.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've removed them.

Copy link
Contributor

@JavonDavis JavonDavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mkevins I spent some time looking at this and can't come up with a better way to paste the styled text. Though using the coordinates can be a bit unstable and I'd usually opt against it but in this case(checking the styled text) we can go with this for now and open an issue to track it and maybe look at how we can improve it in the future.

Otherwise, the code looks good to me! 👍🏽Thanks for adding this 🙇🏽‍♂️

const location = await element.getLocation();
const action = await new wd.TouchAction( driver );
action.press( { x: location.x + 100, y: location.y - 50 } );
//action.wait( 1000 );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've removed them.

@mkevins mkevins merged commit 2b13f52 into develop Jun 13, 2019
@mkevins mkevins deleted the try/add-paste-ui-test branch June 13, 2019 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[OS] Android Paste Testing Anything related to automated tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants