Commit ac983319d3dca597d9a1dcfa46f6acc6ebcfa07a

Authored by Dmitriy Zaporozhets
1 parent f598cc78

fixing some test

features/steps/project/project_merge_requests.rb
... ... @@ -110,6 +110,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps
110 110 end
111 111  
112 112 And 'I leave a comment like "Line is wrong" on line 185 of the first file' do
  113 + save_and_open_page
113 114 within(:xpath, "//div[@class='diff_file'][1]") do
114 115 click_link "add-diff-line-note-0_185_185"
115 116 end
... ...
features/steps/shared/diff_note.rb
... ... @@ -20,7 +20,7 @@ module SharedDiffNote
20 20 end
21 21  
22 22 Given 'I leave a diff comment like "Typo, please fix"' do
23   - find("#0_29_14.line_holder .js-add-diff-note-button").trigger("click")
  23 + find("#586fb7c4e1add2d4d24e27566ed7064680098646_29_14.line_holder .js-add-diff-note-button").trigger("click")
24 24 within(".diff_file") do
25 25 fill_in "note[note]", with: "Typo, please fix"
26 26 #click_button("Add Comment")
... ... @@ -29,7 +29,7 @@ module SharedDiffNote
29 29 end
30 30  
31 31 Given 'I preview a diff comment text like "Should fix it :smile:"' do
32   - find("#0_29_14.line_holder .js-add-diff-note-button").trigger("click")
  32 + find("#586fb7c4e1add2d4d24e27566ed7064680098646_29_14.line_holder .js-add-diff-note-button").trigger("click")
33 33 within(".diff_file") do
34 34 fill_in "note[note]", with: "Should fix it :smile:"
35 35 find(".js-note-preview-button").trigger("click")
... ... @@ -37,7 +37,7 @@ module SharedDiffNote
37 37 end
38 38  
39 39 Given 'I preview another diff comment text like "DRY this up"' do
40   - find("#0_57_41.line_holder .js-add-diff-note-button").trigger("click")
  40 + find("#586fb7c4e1add2d4d24e27566ed7064680098646_57_41.line_holder .js-add-diff-note-button").trigger("click")
41 41 within(".diff_file") do
42 42 fill_in "note[note]", with: "DRY this up"
43 43 find(".js-note-preview-button").trigger("click")
... ... @@ -45,11 +45,11 @@ module SharedDiffNote
45 45 end
46 46  
47 47 Given 'I open a diff comment form' do
48   - find("#0_29_14.line_holder .js-add-diff-note-button").trigger("click")
  48 + find("#586fb7c4e1add2d4d24e27566ed7064680098646_29_14.line_holder .js-add-diff-note-button").trigger("click")
49 49 end
50 50  
51 51 Given 'I open another diff comment form' do
52   - find("#0_57_41.line_holder .js-add-diff-note-button").trigger("click")
  52 + find("#586fb7c4e1add2d4d24e27566ed7064680098646_57_41.line_holder .js-add-diff-note-button").trigger("click")
53 53 end
54 54  
55 55 Given 'I write a diff comment like ":-1: I don\'t like this"' do
... ...
spec/requests/notes_on_merge_requests_spec.rb
... ... @@ -6,7 +6,7 @@ describe "On a merge request", js: true do
6 6  
7 7 before do
8 8 login_as :user
9   - project.add_access(@user, :read, :write)
  9 + project.team << [@user, :master]
10 10  
11 11 visit project_merge_request_path(project, merge_request)
12 12 end
... ... @@ -91,13 +91,11 @@ describe &quot;On a merge request diff&quot;, js: true, focus: true do
91 91 let!(:project) { create(:project) }
92 92 let!(:merge_request) { create(:merge_request_with_diffs, project: project) }
93 93  
94   - before(:all) do
  94 + before do
95 95 login_as :user
96   - project.add_access(@user, :read, :write)
97   -
98   - visit project_merge_request_diff_path(project, merge_request)
  96 + project.team << [@user, :master]
99 97  
100   - save_and_open_page
  98 + visit diffs_project_merge_request_path(project, merge_request)
101 99  
102 100 click_link("Diff")
103 101 end
... ... @@ -106,21 +104,21 @@ describe &quot;On a merge request diff&quot;, js: true, focus: true do
106 104  
107 105 describe "when adding a note" do
108 106 before do
109   - find("#0_185_185.line_holder .js-add-diff-note-button").trigger("click")
  107 + find("#4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185.line_holder .js-add-diff-note-button").trigger("click")
110 108 end
111 109  
112 110 describe "the notes holder" do
113   - it { should have_css("#0_185_185.line_holder + .js-temp-notes-holder") }
  111 + it { should have_css("#4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185.line_holder + .js-temp-notes-holder") }
114 112  
115 113 it { within(".js-temp-notes-holder") { should have_css(".new_note") } }
116 114 end
117 115  
118 116 describe "the note form" do
119 117 # set up hidden fields correctly
120   - it { within(".js-temp-notes-holder") { find("#note_noteable_type").value.should == "Commit" } }
  118 + it { within(".js-temp-notes-holder") { find("#note_noteable_type").value.should == "MergeRequest" } }
121 119 it { within(".js-temp-notes-holder") { find("#note_noteable_id").value.should == "" } }
122 120 it { within(".js-temp-notes-holder") { find("#note_commit_id").value.should == "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a" } }
123   - it { within(".js-temp-notes-holder") { find("#note_line_code").value.should == "0_185_185" } }
  121 + it { within(".js-temp-notes-holder") { find("#note_line_code").value.should == "4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185" } }
124 122  
125 123 # buttons
126 124 it { should have_button("Add Comment") }
... ... @@ -131,9 +129,9 @@ describe &quot;On a merge request diff&quot;, js: true, focus: true do
131 129 it { should have_checked_field("Commit author") }
132 130  
133 131 it "shouldn't add a second form for same row" do
134   - find("#0_185_185.line_holder .js-add-diff-note-button").trigger("click")
  132 + find("#4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185.line_holder .js-add-diff-note-button").trigger("click")
135 133  
136   - should have_css("#0_185_185.line_holder + .js-temp-notes-holder form", count: 1)
  134 + should have_css("#4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185.line_holder + .js-temp-notes-holder form", count: 1)
137 135 end
138 136  
139 137 it "should be removed when canceled" do
... ... @@ -146,8 +144,8 @@ describe &quot;On a merge request diff&quot;, js: true, focus: true do
146 144  
147 145 describe "with muliple note forms" do
148 146 before do
149   - find("#0_185_185.line_holder .js-add-diff-note-button").trigger("click")
150   - find("#1_18_17.line_holder .js-add-diff-note-button").trigger("click")
  147 + find("#4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185.line_holder .js-add-diff-note-button").trigger("click")
  148 + find("#342e16cbbd482ac2047dc679b2749d248cc1428f_18_17.line_holder .js-add-diff-note-button").trigger("click")
151 149 end
152 150  
153 151 # has two line forms
... ... @@ -156,46 +154,46 @@ describe &quot;On a merge request diff&quot;, js: true, focus: true do
156 154 describe "previewing them separately" do
157 155 before do
158 156 # add two separate texts and trigger previews on both
159   - within("#0_185_185.line_holder + .js-temp-notes-holder") do
  157 + within("#4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185.line_holder + .js-temp-notes-holder") do
160 158 fill_in "note[note]", with: "One comment on line 185"
161 159 find(".js-note-preview-button").trigger("click")
162 160 end
163   - within("#1_18_17.line_holder + .js-temp-notes-holder") do
  161 + within("#342e16cbbd482ac2047dc679b2749d248cc1428f_18_17.line_holder + .js-temp-notes-holder") do
164 162 fill_in "note[note]", with: "Another comment on line 17"
165 163 find(".js-note-preview-button").trigger("click")
166 164 end
167 165 end
168 166  
169 167 # check if previews were rendered separately
170   - it { within("#0_185_185.line_holder + .js-temp-notes-holder") { should have_css(".js-note-preview", text: "One comment on line 185") } }
171   - it { within("#1_18_17.line_holder + .js-temp-notes-holder") { should have_css(".js-note-preview", text: "Another comment on line 17") } }
  168 + it { within("#4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185.line_holder + .js-temp-notes-holder") { should have_css(".js-note-preview", text: "One comment on line 185") } }
  169 + it { within("#342e16cbbd482ac2047dc679b2749d248cc1428f_18_17.line_holder + .js-temp-notes-holder") { should have_css(".js-note-preview", text: "Another comment on line 17") } }
172 170 end
173 171  
174 172 describe "posting a note" do
175 173 before do
176   - within("#1_18_17.line_holder + .js-temp-notes-holder") do
  174 + within("#342e16cbbd482ac2047dc679b2749d248cc1428f_18_17.line_holder + .js-temp-notes-holder") do
177 175 fill_in "note[note]", with: "Another comment on line 17"
178 176 click_button("Add Comment")
179 177 end
180 178 end
181 179  
182 180 # removed form after submit
183   - it { should have_no_css("#1_18_17.line_holder + .js-temp-notes-holder") }
  181 + it { should have_no_css("#342e16cbbd482ac2047dc679b2749d248cc1428f_18_17.line_holder + .js-temp-notes-holder") }
184 182  
185 183 # added discussion
186 184 it { should have_content("Another comment on line 17") }
187   - it { should have_css("#1_18_17.line_holder + .notes_holder") }
188   - it { should have_css("#1_18_17.line_holder + .notes_holder .note", count: 1) }
  185 + it { should have_css("#342e16cbbd482ac2047dc679b2749d248cc1428f_18_17.line_holder + .notes_holder") }
  186 + it { should have_css("#342e16cbbd482ac2047dc679b2749d248cc1428f_18_17.line_holder + .notes_holder .note", count: 1) }
189 187 it { should have_link("Reply") }
190 188  
191 189 it "should remove last note of a discussion" do
192   - within("#1_18_17.line_holder + .notes_holder") do
  190 + within("#342e16cbbd482ac2047dc679b2749d248cc1428f_18_17.line_holder + .notes_holder") do
193 191 find(".js-note-delete").trigger("click")
194 192 end
195 193  
196 194 # removed whole discussion
197 195 should_not have_css(".note_holder")
198   - should have_css("#1_18_17.line_holder + #1_18_18.line_holder")
  196 + should have_css("#342e16cbbd482ac2047dc679b2749d248cc1428f_18_17.line_holder + #342e16cbbd482ac2047dc679b2749d248cc1428f_18_18.line_holder")
199 197 end
200 198 end
201 199 end
... ... @@ -203,13 +201,13 @@ describe &quot;On a merge request diff&quot;, js: true, focus: true do
203 201 describe "when replying to a note" do
204 202 before do
205 203 # create first note
206   - find("#0_184_184.line_holder .js-add-diff-note-button").trigger("click")
207   - within("#0_184_184.line_holder + .js-temp-notes-holder") do
  204 + find("#4735dfc552ad7bf15ca468adc3cad9d05b624490_184_184.line_holder .js-add-diff-note-button").trigger("click")
  205 + within("#4735dfc552ad7bf15ca468adc3cad9d05b624490_184_184.line_holder + .js-temp-notes-holder") do
208 206 fill_in "note[note]", with: "One comment on line 184"
209 207 click_button("Add Comment")
210 208 end
211 209 # create second note
212   - within("#0_184_184.line_holder + .notes_holder") do
  210 + within("#4735dfc552ad7bf15ca468adc3cad9d05b624490_184_184.line_holder + .notes_holder") do
213 211 find(".js-discussion-reply-button").trigger("click")
214 212 fill_in "note[note]", with: "An additional comment in reply"
215 213 click_button("Add Comment")
... ... @@ -218,11 +216,11 @@ describe &quot;On a merge request diff&quot;, js: true, focus: true do
218 216  
219 217 # inserted note
220 218 it { should have_content("An additional comment in reply") }
221   - it { within("#0_184_184.line_holder + .notes_holder") { should have_css(".note", count: 2) } }
  219 + it { within("#4735dfc552ad7bf15ca468adc3cad9d05b624490_184_184.line_holder + .notes_holder") { should have_css(".note", count: 2) } }
222 220  
223 221 # removed form after reply
224   - it { within("#0_184_184.line_holder + .notes_holder") { should have_no_css("form") } }
225   - it { within("#0_184_184.line_holder + .notes_holder") { should have_link("Reply") } }
  222 + it { within("#4735dfc552ad7bf15ca468adc3cad9d05b624490_184_184.line_holder + .notes_holder") { should have_no_css("form") } }
  223 + it { within("#4735dfc552ad7bf15ca468adc3cad9d05b624490_184_184.line_holder + .notes_holder") { should have_link("Reply") } }
226 224 end
227 225 end
228 226  
... ... @@ -232,4 +230,4 @@ describe &quot;On merge request discussion&quot;, js: true do
232 230 describe "with merge request diff note"
233 231 describe "with commit note"
234 232 describe "with commit diff note"
235   -end
236 233 \ No newline at end of file
  234 +end
... ...
spec/requests/notes_on_wall_spec.rb
... ... @@ -6,8 +6,7 @@ describe &quot;On the project wall&quot;, js: true do
6 6  
7 7 before do
8 8 login_as :user
9   - project.add_access(@user, :read, :write)
10   -
  9 + project.team << [@user, :master]
11 10 visit wall_project_path(project)
12 11 end
13 12  
... ...