Skip to content
This repository has been archived by the owner on May 23, 2022. It is now read-only.

jfinkhaeuser/unobtainium

Repository files navigation

unobtainium

Obtain the unobtainable: test code covering multiple platforms

Unobtainium wraps Selenium and Appium in a simple driver abstraction so that test code can more easily cover:

  • 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.

Gem Version Build status

Usage

You can use unobtainium on its own, or use it as part of a cucumber test suite.

Unobtainium Demonstration

Unobtainium's functionality is in standalone classes, but it's all combined in the Unobtainium::World module.

  • The Runtime class 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.

  • The Driver class, 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.

World

The World module combines all of the above by providing a simple entry point for everything:

  • World.config_file can be set to the path of a config file to be loaded, defaulting to config/config.yml.
  • World#config is a Config instance containing the above file's contents.
  • World#driver returns 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).

Configuration File

The configuration file knows two configuration variables:

  • driver is 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.create as the second parameter.

See the documentation on configuration features for details.

Development

Additional Drivers

Driver Modules

Integrations

  • unobtainium-cucumber integrates with cucumber, specifically providing some convenient functionality such as automatic screenshot taking on failures.

Credits

This gem is inspired by LapisLazuli, but vastly less complex, and aims to stay so.

About

Obtain the unobtainable: test code covering multiple platforms

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published