Skip to content

Commit fc1be0c

Browse files
author
kinezu
committed
Added announcement spec_ids and removed 3 duplicate specs
Change-Id: I64f82f8e2275d09de8d2cd2f50e6aee635447467 Reviewed-on: https://gerrit.instructure.com/58038 Tested-by: Jenkins Reviewed-by: Steven Shepherd <sshepherd@instructure.com> QA-Review: Steven Shepherd <sshepherd@instructure.com> Product-Review: Derek Hansen <dhansen@instructure.com>
1 parent 21ba974 commit fc1be0c

3 files changed

Lines changed: 42 additions & 92 deletions

File tree

spec/selenium/announcements_public_course_spec.rb renamed to spec/selenium/announcements/announcements_public_course_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
require File.expand_path(File.dirname(__FILE__) + '/common')
2-
require File.expand_path(File.dirname(__FILE__) + '/helpers/announcements_common')
1+
require File.expand_path(File.dirname(__FILE__) + '/../common')
2+
require File.expand_path(File.dirname(__FILE__) + '/../helpers/announcements_common')
33

44
describe "announcements public course" do
55
include_examples "in-process server selenium tests"
@@ -18,18 +18,18 @@
1818
@announcement.discussion_entries.create!(:user => @student2, :parent_entry => s1e, :message => "Hello I'm student 2!")
1919
end
2020

21-
it "does not display replies on announcements to unauthenticated users" do
21+
it "does not display replies on announcements to unauthenticated users", priority: "1", test_id: 220381 do
2222
get "/courses/#{@course.id}/discussion_topics/#{@announcement.id}"
2323
wait_for_ajaximations
2424
expect(f('#discussion_subentries span').text).to match(/must log in/i)
2525
end
2626

27-
it "does not display replies on announcements to users not enrolled in the course" do
27+
it "does not display replies on announcements to users not enrolled in the course", priority: "1", test_id: 220382 do
2828
user_session(user)
2929

3030
get "/courses/#{@course.id}/discussion_topics/#{@announcement.id}"
3131
wait_for_ajaximations
3232
expect(f('#discussion_subentries span').text).to match(/must log in/i)
3333
end
3434
end
35-
end
35+
end

spec/selenium/announcements_student_spec.rb renamed to spec/selenium/announcements/announcements_student_spec.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
require File.expand_path(File.dirname(__FILE__) + '/common')
2-
require File.expand_path(File.dirname(__FILE__) + '/helpers/announcements_common')
1+
require File.expand_path(File.dirname(__FILE__) + '/../common')
2+
require File.expand_path(File.dirname(__FILE__) + '/../helpers/announcements_common')
33

44
describe "announcements" do
55
include_examples "in-process server selenium tests"
66

7-
it "should validate replies are not visible until after users post" do
7+
it "should validate replies are not visible until after users post", priority: "1", test_id: 150533 do
88
password = 'asdfasdf'
99
student_2_entry = 'reply from student 2'
1010
topic_title = 'new replies hidden until post topic'
@@ -46,12 +46,12 @@
4646
course_with_student_logged_in
4747
end
4848

49-
it "should not show an announcements section if there are no announcments" do
49+
it "should not show an announcements section if there are no announcements", priority: "1", test_id: 150534 do
5050
get "/courses/#{@course.id}"
5151
expect(f(".announcements active")).to be_nil
5252
end
5353

54-
it "should not show JSON when loading more announcements via pageless" do
54+
it "should not show JSON when loading more announcements via pageless", priority: "2", test_id: 220375 do
5555
50.times { @course.announcements.create!(:title => 'Hi there!', :message => 'Announcement time!') }
5656
get "/courses/#{@course.id}/announcements"
5757

@@ -62,7 +62,7 @@
6262
expect(f(".discussionTopicIndexList")).not_to include_text('discussion_topic')
6363
end
6464

65-
it "should validate that a student can not see an announcement with a delayed posting date" do
65+
it "should validate that a student can not see an announcement with a delayed posting date", priority: "1", test_id: 220376 do
6666
announcement_title = 'Hi there!'
6767
announcement = @course.announcements.create!(:title => announcement_title, :message => 'Announcement time!', :delayed_post_at => Time.now + 1.day)
6868
get "/courses/#{@course.id}/announcements"
@@ -74,7 +74,7 @@
7474
expect(f(".discussion-topic")).to include_text(announcement_title)
7575
end
7676

77-
it "should not allow a student to close/open announcement for comments or delete an announcement" do
77+
it "should not allow a student to close/open announcement for comments or delete an announcement", priority: "1", test_id: 220377 do
7878
announcement_title = "Announcement 1"
7979
announcement = @course.announcements.create!(:title => announcement_title, :message => "Hey")
8080
get "/courses/#{@course.id}/announcements"
@@ -84,7 +84,7 @@
8484
expect(f('.discussion_actions ul.al-options')).to be_nil
8585
end
8686

87-
it "should allow a group member to create an announcement" do
87+
it "should allow a group member to create an announcement", priority: "1", test_id: 220378 do
8888
gc = group_category
8989
group = gc.groups.create!(:context => @course)
9090
group.add_user(@student, 'accepted')
@@ -96,7 +96,7 @@
9696
}.to change(Announcement, :count).by 1
9797
end
9898

99-
it "should have deleted announcement removed from student account" do
99+
it "should have deleted announcement removed from student account", priority: "1", test_id: 220379 do
100100
@announcement = @course.announcements.create!(:title => 'delete me', :message => 'Here is my message')
101101
get "/courses/#{@course.id}/announcements/"
102102
expect(f(".discussion-title")).to include_text('delete me')
@@ -105,7 +105,7 @@
105105
expect(f(".discussion-title")).to be_nil
106106
end
107107

108-
it "should remove notifications from unenrolled courses" do
108+
it "should remove notifications from unenrolled courses", priority: "1", test_id: 220380 do
109109
enable_cache do
110110
@student.enrollments.first.update_attribute(:workflow_state, 'active')
111111
@course.announcements.create!(:title => 'Something', :message => 'Announcement time!')
@@ -117,4 +117,4 @@
117117
end
118118
end
119119
end
120-
end
120+
end

spec/selenium/announcements_teacher_spec.rb renamed to spec/selenium/announcements/announcements_teacher_spec.rb

Lines changed: 26 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
require File.expand_path(File.dirname(__FILE__) + '/common')
2-
require File.expand_path(File.dirname(__FILE__) + '/helpers/announcements_common')
1+
require File.expand_path(File.dirname(__FILE__) + '/../common')
2+
require File.expand_path(File.dirname(__FILE__) + '/../helpers/announcements_common')
33

44
describe "announcements" do
55
include_examples "in-process server selenium tests"
@@ -23,7 +23,7 @@
2323
@checkboxes = ff('.toggleSelected')
2424
end
2525

26-
it "should bulk delete topics" do
26+
it "should bulk delete topics", priority: "1", test_id: 220360 do
2727
5.times { |i| @checkboxes[i].click }
2828
f('#delete').click
2929
driver.switch_to.alert.accept
@@ -32,40 +32,40 @@
3232
expect(what_to_create.where(:workflow_state => 'active').count).to eq 0
3333
end
3434

35-
it "should bulk lock topics" do
35+
it "should bulk lock topics", priority: "1", test_id: 220361 do
3636
5.times { |i| @checkboxes[i].click }
3737
f('#lock').click
3838
wait_for_ajax_requests
3939
#TODO: check the UI to make sure the topics have a locked symbol
4040
expect(what_to_create.where(:locked => true).count).to eq 5
4141
end
4242

43-
it "should search by title" do
43+
it "should search by title", priority: "1", test_id: 150525 do
4444
expected_text = 'hey there'
4545
update_attributes_and_validate(:title, expected_text)
4646
end
4747

48-
it "should search by body" do
48+
it "should search by body", priority: "1", test_id: 220358 do
4949
body_text = 'new topic body'
5050
update_attributes_and_validate(:message, body_text, 'topic')
5151
end
5252

53-
it "should search by author" do
53+
it "should search by author", priority: "1", test_id: 220359 do
5454
user_name = 'jake@instructure.com'
5555
title = 'new one'
5656
new_teacher = teacher_in_course(:course => @course, :active_all => true, :name => user_name)
5757
what_to_create == DiscussionTopic ? @course.discussion_topics.create!(:title => title, :user => new_teacher.user) : announcement_model(:title => title, :user => new_teacher.user)
5858
refresh_and_filter(:string, 'jake', user_name)
5959
end
6060

61-
it "should return multiple items in the search" do
61+
it "should return multiple items in the search", priority: "1", test_id: 220362 do
6262
new_title = 'updated'
6363
what_to_create.first.update_attributes(:title => "#{new_title} first")
6464
what_to_create.last.update_attributes(:title => "#{new_title} last")
6565
refresh_and_filter(:string, new_title, new_title, 2)
6666
end
6767

68-
it "should filter by unread" do
68+
it "should filter by unread", priority: "1", test_id: 220363 do
6969
what_to_create.last.change_read_state('unread', @user)
7070
refresh_and_filter(:css, '#onlyUnread', 'new 004')
7171
end
@@ -80,7 +80,7 @@
8080
@context = @course
8181
end
8282

83-
it "should have a lock that appears and disappears when the cog menu is used to lock/unlock the announcement for comments" do
83+
it "should have a lock that appears and disappears when the cog menu is used to lock/unlock the announcement for comments", priority: "1", test_id: 220365 do
8484
title = "My announcement"
8585
announcement_model(:title => title, :user => @user)
8686
get url
@@ -98,7 +98,7 @@
9898
expect(f('.discussion-info-icons .icon-lock')).to be_nil
9999
end
100100

101-
it "should remove an announcement when it is deleted from the delete option in the cog menu" do
101+
it "should remove an announcement when it is deleted from the delete option in the cog menu", priority: "1", test_id: 220364 do
102102
title = "My announcement"
103103
announcement_model(:title => title, :user => @user)
104104
get url
@@ -113,14 +113,14 @@
113113
expect(f('.discussion-topic')).to be_nil
114114
end
115115

116-
it "should start a new topic" do
116+
it "should start a new topic", priority: "1", test_id: 150528 do
117117
get url
118118

119119
expect_new_page_load { f('.btn-primary').click }
120120
edit(@topic_title, 'new topic')
121121
end
122122

123-
it "should add an attachment to a new topic" do
123+
it "should add an attachment to a new topic", priority: "1", test_id: 150529 do
124124
topic_title = 'new topic with file'
125125
get url
126126

@@ -130,7 +130,7 @@
130130
expect(what_to_create.where(title: topic_title).first.attachment_id).to be_present
131131
end
132132

133-
it "should perform front-end validation for message" do
133+
it "should perform front-end validation for message", priority: "1", test_id: 220366 do
134134
topic_title = 'new topic with file'
135135
get url
136136

@@ -144,7 +144,7 @@
144144
expect(ff('.error_box').any?{|box| box.text.include?("A message is required")}).to be_truthy
145145
end
146146

147-
it "should add an attachment to a graded topic" do
147+
it "should add an attachment to a graded topic", priority: "1", test_id: 220367 do
148148
what_to_create == DiscussionTopic ? @course.discussion_topics.create!(:title => 'graded attachment topic', :user => @user) : announcement_model(:title => 'graded attachment topic', :user => @user)
149149
if what_to_create == DiscussionTopic
150150
what_to_create.last.update_attributes(:assignment => @course.assignments.create!(:name => 'graded topic assignment'))
@@ -156,7 +156,7 @@
156156
add_attachment_and_validate
157157
end
158158

159-
it "should edit a topic" do
159+
it "should edit a topic", priority: "1", test_id: 150530 do
160160
edit_name = 'edited discussion name'
161161
topic = what_to_create == DiscussionTopic ? @course.discussion_topics.create!(:title => @topic_title, :user => @user) : announcement_model(:title => @topic_title, :user => @user)
162162
get url + "#{topic.id}"
@@ -165,7 +165,7 @@
165165
edit(edit_name, 'edit message')
166166
end
167167

168-
it "should delete a topic" do
168+
it "should delete a topic", priority: "1", test_id: 150526 do
169169
what_to_create == DiscussionTopic ? @course.discussion_topics.create!(:title => @topic_title, :user => @user) : announcement_model(:title => @topic_title, :user => @user)
170170
get url
171171

@@ -177,7 +177,7 @@
177177
expect(f('.discussionTopicIndexList')).to be_nil
178178
end
179179

180-
it "should reorder topics" do
180+
it "should reorder topics", priority: "1", test_id: 220368 do
181181
3.times { |i| what_to_create == DiscussionTopic ? @course.discussion_topics.create!(:title => "new topic #{i}", :user => @user) : announcement_model(:title => "new topic #{i}", :user => @user) }
182182
get url
183183

@@ -192,7 +192,7 @@
192192
end
193193
end
194194

195-
it "should create a delayed announcement" do
195+
it "should create a delayed announcement", priority: "1", test_id: 150531 do
196196
get course_announcements_path(@course)
197197
create_announcement_option('input[type=checkbox][name=delay_posting]')
198198
f('.ui-datepicker-trigger').click
@@ -202,7 +202,7 @@
202202
expect(f('.discussion-fyi')).to include_text('The content of this announcement will not be visible to users until')
203203
end
204204

205-
it "allows creating a delayed announcement with an attachment" do
205+
it "allows creating a delayed announcement with an attachment", priority: "1", test_id: 220369 do
206206
get course_announcements_path(@course)
207207
create_announcement_option('input[type=checkbox][name=delay_posting]')
208208
f('.ui-datepicker-trigger').click
@@ -214,7 +214,7 @@
214214
expect(f('.discussion-fyi')).to include_text('The content of this announcement will not be visible to users until')
215215
end
216216

217-
it "should add and remove an external feed to announcements" do
217+
it "should add and remove an external feed to announcements", priority: "1", test_id: 220370 do
218218
get "/courses/#{@course.id}/announcements"
219219

220220
#add external feed to announcements
@@ -244,7 +244,7 @@
244244
}.to change(ExternalFeed, :count).by(-1)
245245
end
246246

247-
it "should remove delayed_post_at when unchecking delay_posting" do
247+
it "should remove delayed_post_at when unchecking delay_posting", priority: "1", test_id: 220371 do
248248
topic = @course.announcements.create!(:title => @topic_title, :user => @user, :delayed_post_at => 10.days.ago, :message => "message")
249249
get "/courses/#{@course.id}/announcements/#{topic.id}"
250250
expect_new_page_load { f(".edit-btn").click }
@@ -256,7 +256,7 @@
256256
expect(topic.delayed_post_at).to be_nil
257257
end
258258

259-
it "should have a teacher add a new entry to its own announcement" do
259+
it "should have a teacher add a new entry to its own announcement", priority: "1", test_id: 220372 do
260260
skip "delayed jobs"
261261
create_announcement
262262
get [@course, @announcement]
@@ -270,7 +270,7 @@
270270
expect(f('.topic_reply_count').text).to eq '1'
271271
end
272272

273-
it "should show announcements to student view student" do
273+
it "should show announcements to student view student", priority: "1", test_id: 220373 do
274274
create_announcement
275275
enter_student_view
276276
get "/courses/#{@course.id}/announcements"
@@ -279,7 +279,7 @@
279279
expect(announcement.find_element(:css, '.discussion-summary')).to include_text(@announcement.message)
280280
end
281281

282-
it "should always see student replies when 'initial post required' is turned on" do
282+
it "should always see student replies when 'initial post required' is turned on", priority: "1", test_id: 220374 do
283283
student_entry = 'this is my reply'
284284

285285
create_announcement_initial
@@ -294,55 +294,5 @@
294294
get "/courses/#{@course.id}/discussion_topics/#{@announcement.id}"
295295
expect(ff('.discussion_entry .message')[1]).to include_text(student_entry)
296296
end
297-
298-
def setup_search()
299-
create_announcement('day one', 'partridge')
300-
create_announcement('day two', 'turtle doves')
301-
create_announcement('day three', 'french hens')
302-
end
303-
304-
305-
# Search for an announcement by the content of the announcement
306-
it "should search by body" do
307-
setup_search
308-
get "/courses/#{@course.id}/announcements/"
309-
f('#searchTerm').send_keys('turtle')
310-
311-
# The keyword 'turtle' is in the body. Due to the layout of the html, it
312-
#is more efficient to look for the title that matches the body
313-
expect(f('.discussion-title')).not_to include_text("one")
314-
expect(f('.discussion-title')).to include_text("two")
315-
expect(f('.discussion-title')).not_to include_text("three")
316-
end
317-
318-
# Search for an announcement by the title of the announcement
319-
it "should search by title" do
320-
setup_search
321-
get "/courses/#{@course.id}/announcements/"
322-
f('#searchTerm').send_keys('o')
323-
324-
#Two of our titles have an 'o' in them. There are two announcements
325-
#so we store the ones we find in an array. Sorting algorithms will put
326-
# "two" first and "one" second. We should not see three.
327-
expect(ff('.discussion-title')[1]).to include_text("one")
328-
expect(ff('.discussion-title')[0]).to include_text("two")
329-
expect(f('.discussion-title')[2]).to be_nil #No 3rd one listed
330-
end
331-
332-
# Search for an announcement by the author of the announcement
333-
it "should search by author" do
334-
setup_search
335-
# Creating users through the rails function does not set an author.
336-
# Manual setup is needed
337-
create_announcement_manual("title 1", "jocoga")
338-
create_announcement_manual("title 2", "hotdog")
339-
get "/courses/#{@course.id}/announcements/"
340-
f('#searchTerm').send_keys('nob')
341-
342-
# Only 2 of the 5 announcements will have an author
343-
expect(ff('.discussion-author')[0]).to include_text("nobody")
344-
expect(ff('.discussion-author')[1]).to include_text("nobody")
345-
expect(ff('.discussion-author')[2]).to be_nil #No 3rd one listed
346-
end
347297
end
348-
end
298+
end

0 commit comments

Comments
 (0)