Commit 81eae5de authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Capybara tests with first-child/last-child randomly fails so replaced with alternative method

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 3f94e14d
...@@ -107,15 +107,15 @@ describe "Issues" do ...@@ -107,15 +107,15 @@ describe "Issues" do
it 'sorts by newest' do it 'sorts by newest' do
visit project_issues_path(project, sort: 'newest') visit project_issues_path(project, sort: 'newest')
page.should have_selector("ul.issues-list li:first-child", text: 'foo') first_issue.should include("foo")
page.should have_selector("ul.issues-list li:last-child", text: 'baz') last_issue.should include("baz")
end end
it 'sorts by oldest' do it 'sorts by oldest' do
visit project_issues_path(project, sort: 'oldest') visit project_issues_path(project, sort: 'oldest')
page.should have_selector("ul.issues-list li:first-child", text: 'baz') first_issue.should include("baz")
page.should have_selector("ul.issues-list li:last-child", text: 'foo') last_issue.should include("foo")
end end
it 'sorts by most recently updated' do it 'sorts by most recently updated' do
...@@ -123,7 +123,7 @@ describe "Issues" do ...@@ -123,7 +123,7 @@ describe "Issues" do
baz.save baz.save
visit project_issues_path(project, sort: 'recently_updated') visit project_issues_path(project, sort: 'recently_updated')
page.should have_selector("ul.issues-list li:first-child", text: 'baz') first_issue.should include("baz")
end end
it 'sorts by least recently updated' do it 'sorts by least recently updated' do
...@@ -131,7 +131,7 @@ describe "Issues" do ...@@ -131,7 +131,7 @@ describe "Issues" do
baz.save baz.save
visit project_issues_path(project, sort: 'last_updated') visit project_issues_path(project, sort: 'last_updated')
page.should have_selector("ul.issues-list li:first-child", text: 'baz') first_issue.should include("baz")
end end
describe 'sorting by milestone' do describe 'sorting by milestone' do
...@@ -145,13 +145,13 @@ describe "Issues" do ...@@ -145,13 +145,13 @@ describe "Issues" do
it 'sorts by recently due milestone' do it 'sorts by recently due milestone' do
visit project_issues_path(project, sort: 'milestone_due_soon') visit project_issues_path(project, sort: 'milestone_due_soon')
page.should have_selector("ul.issues-list li:first-child", text: 'foo') first_issue.should include("foo")
end end
it 'sorts by least recently due milestone' do it 'sorts by least recently due milestone' do
visit project_issues_path(project, sort: 'milestone_due_later') visit project_issues_path(project, sort: 'milestone_due_later')
page.should have_selector("ul.issues-list li:first-child", text: 'bar') first_issue.should include("bar")
end end
end end
...@@ -168,10 +168,18 @@ describe "Issues" do ...@@ -168,10 +168,18 @@ describe "Issues" do
it 'sorts with a filter applied' do it 'sorts with a filter applied' do
visit project_issues_path(project, sort: 'oldest', assignee_id: user2.id) visit project_issues_path(project, sort: 'oldest', assignee_id: user2.id)
page.should have_selector("ul.issues-list li:first-child", text: 'bar') first_issue.should include("bar")
page.should have_selector("ul.issues-list li:last-child", text: 'foo') last_issue.should include("foo")
page.should_not have_content 'baz' page.should_not have_content 'baz'
end end
end end
end end
def first_issue
all("ul.issues-list li").first.text
end
def last_issue
all("ul.issues-list li").last.text
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment