Better Android automation with Mobile Prism

# login.rb
find_css(“input#username”).set(“joe9”)
find_css(“input#password”).set(“999”)
find_xpath(“//button[@title=’submit’]”).click
# login_page.rb
class LoginPage < SitePrism::Page
element :username, “input#username”
element :password, “input#password”
element :submit, :xpath, “//button[@title=’submit’]”
end
# login_test.rb
LoginScreen.username.set(‘joe9’)
LoginScreen.password.set(‘999’)
LoginScreen.submit.click
Espresso out of the box. The documentation claims we can write “beautiful” tests. I suppose someone might consider a Chevy Cavalier beautiful … compared to a Plymouth Reliant. Smh.
Test execution code can focus on describing a use case.
Screen model implementations — stupid simple.
Attaching PrismElements to Screens.
Instantiating PrismElements. Pass an android R.id, or a Hamcrest matcher.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store