Class: Prof::OpsManager::WebAppInternals::Page::Modal
- Inherits:
-
Object
- Object
- Prof::OpsManager::WebAppInternals::Page::Modal
- Defined in:
- lib/prof/ops_manager/web_app_internals/page/modal.rb
Constant Summary collapse
- ModalStillPresent =
Class.new(StandardError)
Instance Method Summary collapse
- #confirm ⇒ Object
- #failure? ⇒ Boolean
-
#initialize(page:) ⇒ Modal
constructor
A new instance of Modal.
- #message ⇒ Object
- #present? ⇒ Boolean
- #success? ⇒ Boolean
Constructor Details
#initialize(page:) ⇒ Modal
Returns a new instance of Modal.
19 20 21 |
# File 'lib/prof/ops_manager/web_app_internals/page/modal.rb', line 19 def initialize(page:) @page = page end |
Instance Method Details
#confirm ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/prof/ops_manager/web_app_internals/page/modal.rb', line 23 def confirm # We have spent a long time trying to debug unreliable clicking of confirm # in both Selenium and Poltegeist. The box is animated which we think is causing # issues with where the browser is clicking. A sleep will resolve this, and has # lowest complexity. Kernel.sleep(3) .click await_modal_disappearance! true end |
#failure? ⇒ Boolean
40 41 42 |
# File 'lib/prof/ops_manager/web_app_internals/page/modal.rb', line 40 def failure? /failure/ =~ modal['id'] end |
#message ⇒ Object
44 45 46 |
# File 'lib/prof/ops_manager/web_app_internals/page/modal.rb', line 44 def modal.find('.modal-body').text end |
#present? ⇒ Boolean
48 49 50 51 52 |
# File 'lib/prof/ops_manager/web_app_internals/page/modal.rb', line 48 def present? page.all(modal_css_selector).any? || page.all('.modal-backdrop').any? rescue Capybara::Poltergeist::ObsoleteNode false end |
#success? ⇒ Boolean
36 37 38 |
# File 'lib/prof/ops_manager/web_app_internals/page/modal.rb', line 36 def success? /success/ =~ modal['id'] end |