Module: PageMagic
- Extended by:
- SingleForwardable
- Defined in:
- lib/page_magic.rb,
lib/page_magic/driver.rb,
lib/page_magic/drivers.rb,
lib/page_magic/element.rb,
lib/page_magic/matcher.rb,
lib/page_magic/session.rb,
lib/page_magic/watcher.rb,
lib/page_magic/elements.rb,
lib/page_magic/watchers.rb,
lib/page_magic/exceptions.rb,
lib/page_magic/exceptions.rb,
lib/page_magic/wait_methods.rb,
lib/page_magic/class_methods.rb,
lib/page_magic/element/query.rb,
lib/page_magic/element_context.rb,
lib/page_magic/session_methods.rb,
lib/page_magic/element/locators.rb,
lib/page_magic/element/selector.rb,
lib/page_magic/instance_methods.rb,
lib/page_magic/element/selector_methods.rb,
lib/page_magic/element_definition_builder.rb
Overview
module PageMagic - PageMagic is an api for modelling pages in a website.
Defined Under Namespace
Modules: ClassMethods, Elements, InstanceMethods, SessionMethods, WaitMethods, Watchers Classes: Driver, Drivers, Element, ElementContext, ElementDefinitionBuilder, ElementMissingException, InvalidElementNameException, InvalidMethodNameException, InvalidURLException, Matcher, MatcherInvalidException, NotSupportedException, Session, TimeoutException, UndefinedSelectorException, UnspportedBrowserException, UnsupportedCriteriaException, UnsupportedSelectorException, Watcher
Class Method Summary collapse
-
.drivers ⇒ Drivers
Registered drivers.
-
.mapping(path = nil, parameters: nil, fragment: nil) ⇒ Object
Create a more complex mapping to identify when a page should be loaded.
-
.session(application: nil, browser: :rack_test, url:, options: {}) ⇒ Session
Visit this page based on the class level registered url.
Instance Method Summary collapse
-
#matcher ⇒ Matcher
define match critera for loading a page object class.
Class Method Details
.drivers ⇒ Drivers
Returns registered drivers.
27 28 29 |
# File 'lib/page_magic.rb', line 27 def drivers @drivers ||= Drivers.new.tap(&:load) end |
.mapping(path = nil, parameters: nil, fragment: nil) ⇒ Object
Create a more complex mapping to identify when a page should be loaded
42 43 44 |
# File 'lib/page_magic.rb', line 42 def mapping(path = nil, parameters: nil, fragment: nil) Matcher.new(path, parameters: parameters, fragment: fragment) end |
.session(application: nil, browser: :rack_test, url:, options: {}) ⇒ Session
Visit this page based on the class level registered url
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/page_magic.rb', line 52 def session(application: nil, browser: :rack_test, url:, options: {}) driver = drivers.find(browser) raise UnspportedBrowserException unless driver Capybara.register_driver browser do |app| driver.build(app, browser: browser, options: ) end Session.new(Capybara::Session.new(browser, application), url) end |