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 UI Tests for Simple Text Formatting #382
Conversation
I just edited the original description to add a setup step for changing the "Touch & hold delay" setting to I do want to note that I observed a persistent problem with the click turning into a long click if the formatting button was selected as the first step in the test (before adding any text to the editor). That could indicate a potential performance issue when Aztec is first launched, and I went ahead and opened an issue to track that: #383 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
@Override | ||
@SuppressWarnings("unchecked") | ||
public Matcher<View> getConstraints() { | ||
Matcher<View> standardConstraint = isDisplayingAtLeast(65); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the 65 for? Does this relate to the comment at the top?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the 65 here is a percentage: The default ClickAction
in Espresso checks to make sure at least 90% of the element is displayed on-screen before clicking on it. The 65 here checks to make sure at least 65% of the element is displayed on-screen instead.
toggleHTMLView(); | ||
sourceText.check(matches(withText(unformattedText + "\n<pre>" + formattedText + "</pre>"))); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NL @ EOF
public class TestUtils { | ||
|
||
// Strings | ||
public static String unformattedText = "hello"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice that we can have proper strings in Android - unlike iOS! :)
|
||
// Check that HTML formatting tags were correctly added | ||
toggleHTMLView(); | ||
sourceText.check(matches(withText(unformattedText + "\n<ol>\n\t<li>" + formattedText + "</li>\n</ol>"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is there a \t here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The \t
indents the list item on screen.
} | ||
|
||
/* | ||
* This test is disabled because Espresso does not click in the correct position for the link dialog's OK button. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think don't comment out a test if you've replaced it - instead probably add a comment inside the other one noting why it's tested that way and not this.
@0nko ptal - if you're happy let's merge it. |
@rachelmcr I finally got a chance to get my Android dev environment set back up and take a look. Everything checks out My only comment is that you should probably include an update to the README to provide the "Before running the tests" setup steps from the PR details. Is there maybe a way to automate those steps via a set of ADB commands prior to starting the tests? |
After following the device configuration steps the tests pass. I'll add these to the README, like @hoverduck suggested. Quickly searching for the
And for setting a long tap delay:
I haven't tested them, though. @rachelmcr, thank you so much for setting up the test environment and writing these! |
|
This PR adds a suite of UI tests for simple text formatting in the Aztec demo app, using the Android Espresso testing framework.
Before running the tests
Espresso advises disabling system animations on devices used for testing:
One additional setup step is also required to handle an Espresso issue with clicks (see the caveats below):
On your device, under Settings -> Accessibility -> Touch & hold delay, set the delay to
Long
.Test Details
Each test performs the following steps:
A couple caveats:
AlertDialog
and so I reversed the link formatting test. (It enters the link HTML and then verifies that the link dialog displays the expected values.)cc @catehstn @lancewillett @hoverduck