A Page Object Model for Appium
Appom gives you a simple, clean and semantic for describing your application. Appom implements the Page Object Model pattern on top of Appium.
If you have used the Page Object Model (POM) with Appium you will probably know about Capybara and SitePrism. But CapyBara and SitePrism are designed for the web rather than the mobile.
Using POM with SitePrism and CapyBara makes interacting with Appium really not that direct. And Appium is not confirmed to work well with these two libraries.
Wishing to use the Page Object Model in the simplest way we created Appom. The idea created for Appom is taken from CapyBara and SitePrism.
Add this line to your application's Gemfile:
gem 'appom'
And then execute:
$ bundle
Or install it yourself as:
$ gem install appom
Here's an overview of how Appom is designed to be used:
Appium use appium directly to find elements. So that to use Appom you must register Appium Driver for Appom
Appom.register_driver do
options = {
appium_lib: appium_lib_options,
caps: caps
}
Appium::Driver.new(options, false)
end
appium_lib_options
and caps
are options to initiate a appium driver. You can follow Appium Ruby Client
Appom.configure do |config|
config.max_wait_time = 30
end
class LoginPage < Appom::Page
element :email, :accessibility_id, 'email_text_field'
element :password, :accessibility_id, 'password_text_field'
element :sign_in_button, :accessibility_id, 'sign_in_button'
end
The Appom Wiki has lots of additional information about Appom. Please browse the Wiki after finishing this README: https://github.com/hoangtaiki/appom/wiki
authentication-appom-appium is an example about using Appom with Appium.
Bug reports and pull requests are welcome on GitHub at Appom. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Appom project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.