Sha256: 0109efefec0ca3dc8212bb63e185d32a87279171ec41ae635ccb11d3adbcbd4c
Contents?: true
Size: 1.45 KB
Versions: 5
Compression:
Stored size: 1.45 KB
Contents
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}") require 'capybara' require 'page_magic/exceptions' require 'page_magic/wait_methods' require 'page_magic/watchers' require 'page_magic/session' require 'page_magic/session_methods' require 'page_magic/elements' require 'page_magic/element_context' require 'page_magic/element' require 'page_magic/class_methods' require 'page_magic/instance_methods' require 'page_magic/drivers' # module PageMagic - PageMagic is an api for modelling pages in a website. module PageMagic class << self # @return [Drivers] registered drivers def drivers @drivers ||= Drivers.new.tap(&:load) end def included(clazz) clazz.class_eval do include(InstanceMethods) extend(Elements, ClassMethods) end end # Visit this page based on the class level registered url # @param [Object] application rack application (optional) # @param [Symbol] browser name of browser # @param [String] url url to start the session on # @param [Hash] options browser driver specific options # @return [Session] configured sessoin def session(application: nil, browser: :rack_test, url:, options: {}) driver = drivers.find(browser) fail UnspportedBrowserException unless driver Capybara.register_driver browser do |app| driver.build(app, browser: browser, options: options) end Session.new(Capybara::Session.new(browser, application), url) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
page_magic-1.0.4 | lib/page_magic.rb |
page_magic-1.0.3 | lib/page_magic.rb |
page_magic-1.0.2 | lib/page_magic.rb |
page_magic-1.0.1 | lib/page_magic.rb |
page_magic-1.0.0 | lib/page_magic.rb |