From 953db8477e301d6cbd9ddf560264da708cd92aba Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Tue, 15 Jan 2013 14:28:04 +0200
Subject: [PATCH] More fixes for test

---
 features/steps/project/project_merge_requests.rb | 10 ++++------
 features/steps/shared/diff_note.rb               |  2 ++
 features/steps/shared/note.rb                    |  8 ++++++--
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/features/steps/project/project_merge_requests.rb b/features/steps/project/project_merge_requests.rb
index 5d5ad4490de..5dae791f9ec 100644
--- a/features/steps/project/project_merge_requests.rb
+++ b/features/steps/project/project_merge_requests.rb
@@ -103,21 +103,19 @@ class ProjectMergeRequests < Spinach::FeatureSteps
   end
 
   And 'I leave a comment on the diff page' do
-    within(:xpath, "//div[@class='note-form-holder']") do
+    within('.js-temp-notes-holder') do
       fill_in "note_note", with: "One comment to rule them all"
       click_button "Add Comment"
     end
   end
 
   And 'I leave a comment like "Line is wrong" on line 185 of the first file' do
-    save_and_open_page
-    within(:xpath, "//div[@class='diff_file'][1]") do
-      click_link "add-diff-line-note-0_185_185"
-    end
+    find("#4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185 .add-diff-note").click
 
-    within(:xpath, "//div[@class='line-note-form-holder']") do
+    within(".js-temp-notes-holder") do
       fill_in "note_note", with: "Line is wrong"
       click_button "Add Comment"
+      sleep 0.05
     end
   end
 
diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb
index 431ef022d0b..2ae0f1241b8 100644
--- a/features/steps/shared/diff_note.rb
+++ b/features/steps/shared/diff_note.rb
@@ -8,6 +8,7 @@ module SharedDiffNote
   end
 
   Given 'I delete a diff comment' do
+    sleep 1
     within(".diff_file") do
       first(".js-note-delete").trigger("click")
     end
@@ -25,6 +26,7 @@ module SharedDiffNote
       fill_in "note[note]", with: "Typo, please fix"
       #click_button("Add Comment")
       find(".js-comment-button").trigger("click")
+      sleep 0.05
     end
   end
 
diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb
index 934aba6a91a..5dcc75f9165 100644
--- a/features/steps/shared/note.rb
+++ b/features/steps/shared/note.rb
@@ -39,8 +39,6 @@ module SharedNote
     end
   end
 
-
-
   Then 'I should not see a comment saying "XML attached"' do
     page.should_not have_css(".note")
   end
@@ -113,4 +111,10 @@ module SharedNote
   Then 'I should see project wall note "my special test message"' do
     page.should have_content "my special test message"
   end
+
+  Then 'I should see comment "XML attached"' do
+    within(".note") do
+      page.should have_content("XML attached")
+    end
+  end
 end
-- 
GitLab