diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-27 15:00:57 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-27 15:00:57 +0200 |
commit | 81eae5de89d13e6079ee5a9d975216d1a460d8d0 (patch) | |
tree | d4bd8759a649deb449eaf64cc92f25fbb9a7a0c1 /spec/features | |
parent | 3f94e14d9694ba487599354dd0a2ec0964fcdcd4 (diff) | |
download | gitlab-ce-81eae5de89d13e6079ee5a9d975216d1a460d8d0.tar.gz |
Capybara tests with first-child/last-child randomly fails so replaced with alternative method
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/issues_spec.rb | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index bb83e343462..bb0c4dbd5dd 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -107,15 +107,15 @@ describe "Issues" do it 'sorts by newest' do visit project_issues_path(project, sort: 'newest') - page.should have_selector("ul.issues-list li:first-child", text: 'foo') - page.should have_selector("ul.issues-list li:last-child", text: 'baz') + first_issue.should include("foo") + last_issue.should include("baz") end it 'sorts by oldest' do visit project_issues_path(project, sort: 'oldest') - page.should have_selector("ul.issues-list li:first-child", text: 'baz') - page.should have_selector("ul.issues-list li:last-child", text: 'foo') + first_issue.should include("baz") + last_issue.should include("foo") end it 'sorts by most recently updated' do @@ -123,7 +123,7 @@ describe "Issues" do baz.save 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 it 'sorts by least recently updated' do @@ -131,7 +131,7 @@ describe "Issues" do baz.save 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 describe 'sorting by milestone' do @@ -145,13 +145,13 @@ describe "Issues" do it 'sorts by recently due milestone' do 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 it 'sorts by least recently due milestone' do 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 @@ -168,10 +168,18 @@ describe "Issues" do it 'sorts with a filter applied' do visit project_issues_path(project, sort: 'oldest', assignee_id: user2.id) - page.should have_selector("ul.issues-list li:first-child", text: 'bar') - page.should have_selector("ul.issues-list li:last-child", text: 'foo') + first_issue.should include("bar") + last_issue.should include("foo") page.should_not have_content 'baz' 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 |