Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-11-27 17:00:57 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-11-27 17:00:57 +0400
commit81eae5de89d13e6079ee5a9d975216d1a460d8d0 (patch)
treed4bd8759a649deb449eaf64cc92f25fbb9a7a0c1 /spec
parent3f94e14d9694ba487599354dd0a2ec0964fcdcd4 (diff)
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')
-rw-r--r--spec/features/issues_spec.rb28
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