Added Several Contact Support tests.#15744
Conversation
|
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
|
You can test the changes on this Pull Request by downloading the APKs: |
This reverts commit 08fd20d.
| static ViewInteraction textInput = onView(allOf( | ||
| isCompletelyDisplayed(), | ||
| anyOf( | ||
| withId(R.id.message_composer_input_text), | ||
| withId(R.id.request_message_field) | ||
| ) | ||
| )); |
There was a problem hiding this comment.
This translates to: find an element that is both completely displayed and has either R.id.message_composer_input_text or R.id.request_message_field ID.
In fact, both of these elements are present when the screen is opened, but only one is visible.
| } | ||
| } | ||
|
|
||
| @Ignore("As long as CI does not use gradle.properties from MobileSecrets") |
There was a problem hiding this comment.
As can be seen from the number of commits in this PR starting with CI fail fix:..., I spent quite a while figuring out why the tests that involve Contact Support screen failed on CI but never failed the same way locally. At some point (thanks to video recording in Firebase) I saw that the screen on CI:
Looks different from the same screen on my local Emulator:
After blaming the Emulator/Android differences for some time, I realized that CI uses the default gradle.properties, which makes the screen look like differently (and the message cannot be sent, hence the disabled test).
Since I automated this test, I decided to keep it for the case if Mobile Secrets will be used on CI.
There was a problem hiding this comment.
In case we have this test running in CI are we going to be creating real Zendesk tickets? I'm afraid it can get real noisy.
There was a problem hiding this comment.
I have this suspicion too. This test is disabled for now, so it's not an urgent matter, but I think we can contact the HE team, and ask them if there's a painless way for them to filter out certain messages, so that they wouldn't be bothered with them.
There was a problem hiding this comment.
If it turns out to be the case that we cannot prevent the creation of real tickets, and idea could be to use the Zendesk APIs to find the tickets created by the UI tests and delete them.
| } finally { | ||
| new ContactSupportScreen().goBackAndDeleteUnsentMessageIfNeeded(); | ||
| } |
There was a problem hiding this comment.
A kind of local teardown, in order to not slow down helpCanBeOpenedWhileEnteringEmail and helpCanBeOpenedWhileEnteringPassword which do not get to ContactSupport screen, so there's no possibility of unsent message.
| onView(anyOf( | ||
| withText(android.R.string.ok), | ||
| withId(android.R.id.button1) | ||
| )) |
There was a problem hiding this comment.
This is the locator for OK button in this dialog:
I used something like onView(withText("OK")) initially, and this worked locally, but never on CI. Thanks to this discussion, I found out that "OK" button might be presented differently by different Android versions, while android.R.id.button1 always stands for the "positive" option in the dialog.
Contact Support tests.Contact Support tests.
| String automatedReplyText = "Mobile support will respond as soon as possible, " | ||
| + "generally within 48-96 hours. " | ||
| + "Please reply with your site address (URL) " | ||
| + "and any additional details we should know."; |
There was a problem hiding this comment.
Yes. So far, I'm not sure if it makes sense to maintain this test (or even to keep it) - I probably firstly need to ask if Zendesk connection is ever planned on CI.
There was a problem hiding this comment.
We have it connected for WPiOS because it was not possible to even check if the screen had been loaded. From what I can recall it is possible but not desirable. Given it is an identified critical flow I'd ask @jkmassel to weigh in. =)
There was a problem hiding this comment.
We could also use a less sophisticated check and ensure we get any text in R.id.request_system_message_text. 🤷♂️
| public static boolean waitForElementToBeDisplayedWithoutFailure(final ViewInteraction element) { | ||
| try { | ||
| waitForConditionToBeTrueWithoutFailure(new Supplier<Boolean>() { | ||
| @Override | ||
| public Boolean get() { | ||
| return isElementDisplayed(element); | ||
| } | ||
| }); | ||
| } catch (Exception e) { | ||
| // ignore the failure | ||
| } | ||
| return isElementDisplayed(element); | ||
| } | ||
|
|
There was a problem hiding this comment.
I had to do the same thing in my PR. The only difference was that I made waitForElementToBeDisplayedWithoutFailure(final Integer elementID) call waitForElementToBeDisplayedWithoutFailure(final ViewInteraction element) to avoid a bit of code duplication.
Nothing to do here.
tiagomar
left a comment
There was a problem hiding this comment.
CI is green, I ran the tests locally several times and the only issue I found was the Zendesk response message which seems to change seasonally, however this test is disabled so no impact is expected in CI and it will no longer be a problem the next week. That said, I feel comfortable to approve this PR and have this test fixed later on in another PR. ![]()
mokagio
left a comment
There was a problem hiding this comment.
Thank you for putting this together!
| } | ||
| } | ||
|
|
||
| @Ignore("As long as CI does not use gradle.properties from MobileSecrets") |
There was a problem hiding this comment.
If it turns out to be the case that we cannot prevent the creation of real tickets, and idea could be to use the Zendesk APIs to find the tickets created by the UI tests and delete them.
| String automatedReplyText = "Mobile support will respond as soon as possible, " | ||
| + "generally within 48-96 hours. " | ||
| + "Please reply with your site address (URL) " | ||
| + "and any additional details we should know."; |
There was a problem hiding this comment.
We could also use a less sophisticated check and ensure we get any text in R.id.request_system_message_text. 🤷♂️
|
Since @pachlava will be AFK this week and the PR has two approvals already, I'll merge it now. |




Description
Since the ability to contact support is considered one of the most critical, this PR adds several tests:
helpCanBeOpenedWhileEnteringPassword: checks thatHelpbutton is accessible from the password prompt screen.helpCanBeOpenedWhileEnteringPassword: checks thatHelpbutton is accessible from the email prompt screen.sendButtonEnabledWhenTextIsEntered: checks thatSendbutton switches states correctly depending on the entered message text.messageCanBeSent(disabled, only executable withgradle.propertiesfrom Mobile Secrets, more here): sends a message and checks that a certain reply is returned.Testing Instructions
Connected Tests-2CI job is green, and you can seehelpCanBeOpenedWhileEnteringPassword,sendButtonEnabledWhenTextIsEntered,helpCanBeOpenedWhileEnteringEmailtests included.gradle.propertiesand the ones from Mobile Secrets) onPixel 2 API 28(this is the model used on CI).messageCanBeSentlocally withgradle.propertiesfrom Mobile Secrets.Regression Notes
Potential unintended areas of impact:
All changes took place in the package related to automated tests. The app behaviour should not be affected.
What I did to test those areas of impact (or what existing automated tests I relied on):
I executed all existing automated tests, and the CI is green.
What automated tests I added:
I added:
sendButtonEnabledWhenTextIsEnteredmessageCanBeSenthelpCanBeOpenedWhileEnteringEmailhelpCanBeOpenedWhileEnteringPasswordPR submission checklist:
RELEASE-NOTES.txtif necessary.