Run random order tests without javascript

Speeds it up a little, there is no need to take into account javascript
in these tests
This commit is contained in:
rgarcia
2018-03-01 22:39:37 +01:00
parent ef30dc1efe
commit 3dcbb6b976

View File

@@ -470,7 +470,7 @@ feature 'Budget Investments' do
end
end
context("Orders") do
context "Orders" do
before { budget.update(phase: 'selecting') }
scenario "Default order is random" do
@@ -502,7 +502,7 @@ feature 'Budget Investments' do
expect(order).not_to eq(new_order)
end
scenario 'Random order maintained with pagination', :js do
scenario 'Random order maintained with pagination' do
per_page = Kaminari.config.default_per_page
(per_page + 2).times { create(:budget_investment, heading: heading) }
@@ -520,7 +520,21 @@ feature 'Budget Investments' do
expect(order).to eq(new_order)
end
scenario "Investments are not repeated with random order", :js do
scenario 'Random order maintained when going back from show' do
10.times { |i| create(:budget_investment, heading: heading) }
visit budget_investments_path(budget, heading_id: heading.id)
order = all(".budget-investment h3").collect {|i| i.text }
click_link Budget::Investment.first.title
click_link "Go back"
new_order = all(".budget-investment h3").collect {|i| i.text }
expect(order).to eq(new_order)
end
scenario "Investments are not repeated with random order" do
12.times { create(:budget_investment, heading: heading) }
# 12 instead of per_page + 2 because in each page there are 10 (in this case), not 25
@@ -539,7 +553,7 @@ feature 'Budget Investments' do
end
scenario 'Proposals are ordered by confidence_score', :js do
scenario 'Proposals are ordered by confidence_score' do
best_proposal = create(:budget_investment, heading: heading, title: 'Best proposal')
best_proposal.update_column(:confidence_score, 10)
worst_proposal = create(:budget_investment, heading: heading, title: 'Worst proposal')
@@ -560,7 +574,7 @@ feature 'Budget Investments' do
expect(current_url).to include('page=1')
end
scenario 'Each user has a different and consistent random budget investment order when random_seed is disctint', :js do
scenario 'Each user has a different and consistent random budget investment order when random_seed is disctint' do
(Kaminari.config.default_per_page * 1.3).to_i.times { create(:budget_investment, heading: heading) }
in_browser(:one) do
@@ -596,7 +610,7 @@ feature 'Budget Investments' do
end
end
scenario 'Each user has a equal and consistent budget investment order when the random_seed is equal', :js do
scenario 'Each user has a equal and consistent budget investment order when the random_seed is equal' do
(Kaminari.config.default_per_page * 1.3).to_i.times { create(:budget_investment, heading: heading) }
in_browser(:one) do