Class: Prof::OpsManager::WebAppInternals::Page::Form
- Inherits:
-
Object
- Object
- Prof::OpsManager::WebAppInternals::Page::Form
- Defined in:
- lib/prof/ops_manager/web_app_internals/page/form.rb
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Form
constructor
A new instance of Form.
- #update(config = {}) {|_self, page| ... } ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Form
Returns a new instance of Form.
24 25 26 27 |
# File 'lib/prof/ops_manager/web_app_internals/page/form.rb', line 24 def initialize(opts = {}) @page = opts.fetch(:page) @form_element = opts.fetch(:form_element) end |
Instance Method Details
#update(config = {}) {|_self, page| ... } ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/prof/ops_manager/web_app_internals/page/form.rb', line 29 def update(config = {}, &_block) case config when Array update_list(config) when Hash, FormFields raise "Add button on page #{page.current_url}, maybe you should update a list?" if update_fields(config) else raise "Unrecognised config #{config.inspect}" end yield self, page if block_given? form_element.click_on 'Save' # raise "Failed to save, the server 500ed" if page.status_code.to_i >= 500 raise "Failed to save, no success message. #{error_message}" unless success? end |