Skip to content

Controller: Create Verify Flow

MatthewMazaika edited this page Apr 22, 2015 · 1 revision

This is a description of all the steps that a controller does when you execute a create or verify.

YourController.run(:create, :verify)

before_all                                     # override in YourController
before_each                                    # override in YourController 
create                                         # override in YourController   
    @view.create(@model)                       # obviously set in the view
    populate_data                              # override in YourController
        keyword_elements.each                  # this is an array of keywords from view that have values in the model
        next unless k.populate_allowed?        # filters out navigation_keyword and verify_keyword as defined in view
        submit_process_page_when_page_changes  # clicks a next/submit/etc button if process_page stored in keyword is different from previous keyword
        before_process_page                    # override is to define before_process_page_foo  in YourController
                                                   # Note that this is only executed with the first keyword that has that process page name
        populate_keyword:                      # can't override this one
                before_keyword                 # override is to define before_bar in YourController
                populate_keyword_value         # override is to define populate_bar in YourController
                    navigate to process page   # override is to define process_page_navigate_method Proc.new {} in the view
                                                   # Note this applies to all process pages in the view
                    element.wait_until_present # Note this is a temporary thing for CLO only --> looks up and waits for element
                    element.get                # Creates Watir::Element & adds keyword & keyword methods
                    element.set                # Looks up element and executes the proper method for the element (send_keys/select/click/etc)
                after_keyword                  # override is to define after_bar in YourController
    submit_process_page last_process_page      # override is to define submit in YourController
after_each                                     # override in YourController

before_each                                    # override in YourController
verify                                         # override in YourController
    search_for_record if @search defined
    @view.edit(@model)                         # obviously set in the view
    verify_data                                # override in YourController
                                                   # Note that when you override this, please follow this convention to get the proper error message
        @verification_errors = []
        keyword_elements.each                  # this is an array of keywords from view that have values in the model
        next unless k.verify_allowed?          # filters out navigation_keyword and populate_keyword as defined in view
            verify_keyword                     # can't override this one
                verify_keyword_value           # override is to define verify_bar in YourController
                    navigate to process page   # override is to define process_page_navigate_method Proc.new {} in the view
                                                   # Note this applies to all process pages in the view
                    element.wait_until_present # Note this is a temporary thing for CLO only --> looks up and waits for element
                    assert_equal               # Raises Watirmark::VerificationException if element.get does not properly match keyword_value
                        element.get            # Creates Watir::Element & adds keyword & keyword methods
                        keyword_value          # override is to define bar_value in YourController; Otherwise pulls value from model
                                                   # Note: If the match throws a verification exception, it is captured and added to @verification_errors
    raise exception if errors in array
after_each                                     # override in YourController
after_all                                      # override in YourController
Clone this wiki locally