Sha256: 62ecb96848c7a5e98e07988bb5671a7c8c3246d0bb661560bfc7e26b6f27f910

Contents?: true

Size: 1.61 KB

Versions: 3

Compression:

Stored size: 1.61 KB

Contents

# TODO: Fix Authlogic where it saves records with save(false). Use save(:validation => false) instead. Search for /save.*\(false\)/

module ActionController
  class IntegrationTest

  protected

    def login
      visit "/cms"
      page.execute_script "$('div#rich_cms_dock a.login').click()"
      fill_in_and_submit "#raccoon_tip", {:Email => "paul.engel@holder.nl", :Password => "testrichcms"}, "Login"
    end

    def logout
      find("#rich_cms_dock").click_link "Logout"
    end

    def hide_dock
      find("#rich_cms_dock").click_link "Hide"
    end

    def close_raccoontip
      find("#raccoontip").click_link "Close"
      assert !find("#raccoon_tip").visible?
    end

    def mark_content
      page.execute_script "$('div#rich_cms_dock a.mark').click()"
    end

    def edit_content(key)
      page.execute_script "$('.cms_content.marked[data-key=" + key + "]').click()"
      assert find("#raccoon_tip").visible?
    end

    def fill_in_and_submit(selector, with, submit)
      within "#{selector} fieldset.inputs" do
        with.each do |key, value|
          begin
            fill_in key.to_s, :with => value
          rescue Selenium::WebDriver::Error::ElementNotDisplayedError
            page.execute_script "var input = $('#{selector} [name=\"#{key}\"]');" +
                                "if (input.data('cleditor')) {" +
                                "  input.val('#{value}');" +
                                "  input.data('cleditor').updateFrame();" +
                                "}"
          end
        end
      end
      find(selector).find_button(submit).click
      sleep 2
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rich_cms-3.0.2 test/shared/support/action_controller/integration.rb
rich_cms-3.0.1 test/shared/support/action_controller/integration.rb
rich_cms-3.0.0 test/shared/support/action_controller/integration.rb