Sha256: 6a3e6cb943e3578d0b8c3fca84327c934055b56a1dd50841c2186f0044e25f59

Contents?: true

Size: 1.2 KB

Versions: 5

Compression:

Stored size: 1.2 KB

Contents

require 'test_helper'

class IncludeTest < ActionDispatch::IntegrationTest
  test "include & navigate site with better_frame" do

    visit "/foreign_website"
    wait_for_page_load("products#index")

    # run custom javascripts!
    assert_equal "test", find("#products-table")["class"]

    assert_equal '/', find("#rails-path")["data-path"]
    click_on "New Product"
    wait_for_page_load("products#new")

    history(:back)
    wait_for_page_load("products#index")

    assert_equal 2, all("table tbody tr").count

    history(:forward)
    wait_for_page_load("products#new")

    assert_equal '/products/new', find("#rails-path")["data-path"]

    fill_in "Name", with: "test"
    fill_in "Price", with: "120.30"
    find("#submit-product").click

    wait_for_page_load("products#show")

    assert_equal "Name: test", find("#name").text
    assert_equal "Price: 120.3", find("#price").text

    click_on "Back"
    wait_for_page_load("products#index")

    assert_equal 3, all("table tbody tr").count
  end

  def wait_for_page_load(id)
    converted_id_selector = "#" + id.gsub("#", "-")
    find(converted_id_selector)
  end

  def history(whereto)
    page.execute_script "window.history.#{whereto}()"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
better_frame-0.3.3 test/integration/include_test.rb
better_frame-0.3.2 test/integration/include_test.rb
better_frame-0.3.1 test/integration/include_test.rb
better_frame-0.3.0 test/integration/include_test.rb
better_frame-0.2.0 test/integration/include_test.rb