Obtain the unobtainable: test code covering multiple platforms
- Desktop browsers
- Mobile browsers
- Mobile apps
The gem also wraps PhantomJS for headless testing.
Some additional useful functionality for the maintenance of test suites is also added.
You can use unobtainium on its own, or use it as part of a cucumber test suite.
Unobtainium's functionality is in standalone classes, but it's all combined in
Runtimeclass is a singleton and a
Hash-like container (but simpler), that destroys all of its contents at the end of a script, calling custom destructors if required. That allows for clean teardown and avoids everything having to implement the Singleton pattern itself.
Driverclass, of course, wraps either of Appium or Selenium drivers:
drv = Driver.create(:firefox) # uses Selenium and Firefox drv = Driver.create(:android) # uses Appium (browser or device) drv = Driver.create(:phantomjs) # use Selenium and PhantomJS drv.navigate.to "..." # delegates to Selenium or Appium
See the documentation on configuration features for details on configuration.
The World module combines all of the above by providing a simple entry point for everything:
World.config_filecan be set to the path of a config file to be loaded, defaulting to
Configinstance containing the above file's contents.
World#driverreturns a Driver, initialized to the settings contained in the configuration file.
For a simple usage example of the World module, see the cuke subdirectory (used with cucumber).
The configuration file knows two configuration variables:
driveris expected to be a string, specifying the driver to use as if it was passed to
Driver.create(see above), e.g. "android", "chrome", etc.
drivers(note the trailing s) is a Hash. Under each key you can nest an options hash you might otherwise pass to
Driver.createas the second parameter.
See the documentation on configuration features for details.
- unobtainium-nokogiri is a nokogiri-based driver for entirely browserless access to XML and HTML files and pages.
- unobtainium-faraday is a faraday-based driver for dealing with RESTish APIs.
- unobtainium-kramdown is an open-uri-based driver for dealing with Markdown structured text.
is a module providing a
#multifindfunction for searching for multiple elements at the same time.
multifind, simplifies waiting for an element to appear.
- unobtainium-cucumber integrates with cucumber, specifically providing some convenient functionality such as automatic screenshot taking on failures.
This gem is inspired by LapisLazuli, but vastly less complex, and aims to stay so.