From f1dc6b57d78ff1af6758061873f2dd7e85feeff7 Mon Sep 17 00:00:00 2001
From: Clement Ho <ClemMakesApps@gmail.com>
Date: Tue, 6 Jun 2017 16:58:44 -0500
Subject: [PATCH] Fix spinach test

---
 features/project/issues/issues.feature   | 2 ++
 features/project/merge_requests.feature  | 2 ++
 features/steps/project/issues/issues.rb  | 4 ++--
 features/steps/project/merge_requests.rb | 6 ++----
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature
index 1b00d8a32a0..4f905674d8c 100644
--- a/features/project/issues/issues.feature
+++ b/features/project/issues/issues.feature
@@ -12,11 +12,13 @@ Feature: Project Issues
     Given I should see "Release 0.4" in issues
     And I should not see "Release 0.3" in issues
 
+  @javascript
   Scenario: I should see closed issues
     Given I click link "Closed"
     Then I should see "Release 0.3" in issues
     And I should not see "Release 0.4" in issues
 
+  @javascript
   Scenario: I should see all issues
     Given I click link "All"
     Then I should see "Release 0.3" in issues
diff --git a/features/project/merge_requests.feature b/features/project/merge_requests.feature
index a8c528d3d6f..0ebeded7fc5 100644
--- a/features/project/merge_requests.feature
+++ b/features/project/merge_requests.feature
@@ -38,11 +38,13 @@ Feature: Project Merge Requests
     When I visit merge request page "Bug NS-08"
     Then I should see the diverged commits count
 
+  @javascript
   Scenario: I should see rejected merge requests
     Given I click link "Closed"
     Then I should see "Feature NS-03" in merge requests
     And I should not see "Bug NS-04" in merge requests
 
+  @javascript
   Scenario: I should see all merge requests
     Given I click link "All"
     Then I should see "Feature NS-03" in merge requests
diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb
index 637e6568267..30db6e5d4e2 100644
--- a/features/steps/project/issues/issues.rb
+++ b/features/steps/project/issues/issues.rb
@@ -28,7 +28,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
   end
 
   step 'I click link "Closed"' do
-    find('.issues-state-filters a', text: "Closed").click
+    find('.issues-state-filters .state-closed span', text: 'Closed').click
   end
 
   step 'I click button "Unsubscribe"' do
@@ -44,7 +44,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
   end
 
   step 'I click link "All"' do
-    click_link "All"
+    find('.issues-state-filters .state-all span', text: 'All').click
     # Waits for load
     expect(find('.issues-state-filters > .active')).to have_content 'All'
   end
diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb
index 54b6352c952..0e70b832562 100644
--- a/features/steps/project/merge_requests.rb
+++ b/features/steps/project/merge_requests.rb
@@ -26,7 +26,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
   end
 
   step 'I click link "All"' do
-    click_link "All"
+    find('.issues-state-filters .state-all span', text: 'All').click
     # Waits for load
     expect(find('.issues-state-filters > .active')).to have_content 'All'
   end
@@ -36,9 +36,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
   end
 
   step 'I click link "Closed"' do
-    page.within('.issues-state-filters') do
-      click_link "Closed"
-    end
+    find('.issues-state-filters .state-closed span', text: 'Closed').click
   end
 
   step 'I should see merge request "Wiki Feature"' do
-- 
GitLab