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
44describe "announcements" do
55 include_examples "in-process server selenium tests"
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
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
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
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
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
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
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' ) )
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 } "
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
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
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
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
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
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 }
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 ]
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"
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
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