Automation Happy Hour 6: Twitter

This week, JLipps tackles an app that he uses an awful lot, maybe more than any other app. And that's not necessarily a good thing. But Twitter is certainly a big one, and we attempt to automate a login/logout flow with the Android app.
Mobile 
Group

Code samples for Automation Happy Hour are available at github.com/appium-pro/ahh

This week, I decided to tackle an app that I use really frequently---Twitter. Twitter has a mass of features, and I wanted to start simply by getting a solid login/logout flow. This is especially important since I didn't have a reliable APK of the Twitter app that would allow me to install/uninstall it. Given that I chose to launch the app purely via package and activity, it would start up with some pre-existing state, such as login state. What this means is that for each test run to start at the same state, I actually need to make sure to log out using the UI at the end of each test.

Ultimately, we were successful in getting a login and logout flow working. Here were some of the highlights (see full video above):

  • The Twitter app does have some Android IDs on elements, so we weren't limited to using just text/xpath (though for some elements we were)
  • We encountered an element with a link inside it, that wasn't itself an element, so we had to construct a helper method to tap an element at a specific location within the element (rather than the middle)
  • We encountered a situation where the element we wanted was down a scrollable view, so we had to construct a helper method to scroll (and scroll, and scroll) until Appium could see the element we wanted to interact with.

Otherwise, it was a pretty straightforward experience! It didn't go entirely smoothly, but that's what happens when my brain makes simple mistakes like using the wrong element variable.