Adding test id's to convo specs and a few other minor improvments

test plan:
- pass jenkins

Change-Id: I39f1a043b4a184047c6dcce4a4d3234e1dba403f
Reviewed-on: https://gerrit.instructure.com/56127
Tested-by: Jenkins
Reviewed-by: Ben Bolton <bbolton@instructure.com>
Product-Review: Derek Hansen <dhansen@instructure.com>
QA-Review: Derek Hansen <dhansen@instructure.com>
This commit is contained in:
Derek Hansen 2015-06-10 12:47:47 -06:00
parent 405d6a8a66
commit a2ec00f281
9 changed files with 87 additions and 69 deletions

View File

@ -20,7 +20,7 @@ describe "conversations new" do
get_conversations
end
it "should be allowed on new private conversations with students" do
it "should be allowed on new private conversations with students", priority: "1", test_id: 207094 do
compose course: @course, to: [@s1, @s2], body: 'hallo!', send: false
checkbox = f(".user_note")
@ -34,7 +34,7 @@ describe "conversations new" do
expect(@s2.user_notes.reload.count).to eq count2 + 1
end
it "should be allowed with student groups" do
it "should be allowed with student groups", priority: "1", test_id: 207093 do
compose course: @course, to: [@group], body: 'hallo!', send: false
checkbox = f(".user_note")
@ -46,21 +46,21 @@ describe "conversations new" do
expect(@s1.user_notes.reload.count).to eq count1 + 1
end
it "should not be allowed if disabled" do
it "should not be allowed if disabled", priority: "1", test_id: 207092 do
@course.account.update_attribute(:enable_user_notes, false)
get_conversations
compose course: @course, to: [@s1], body: 'hallo!', send: false
expect(f(".user_note")).not_to be_displayed
end
it "should not be allowed for students" do
it "should not be allowed for students", priority: "1", test_id: 138686 do
user_session(@s1)
get_conversations
compose course: @course, to: [@s2], body: 'hallo!', send: false
expect(f(".user_note")).not_to be_displayed
end
it "should not be allowed with non-student recipient" do
it "should not be allowed with non-student recipient", priority: "1", test_id: 138687 do
compose course: @course, to: [@teacher], body: 'hallo!', send: false
expect(f(".user_note")).not_to be_displayed
end

View File

@ -8,19 +8,19 @@ describe "conversations new" do
end
describe 'conversations inbox opt-out option' do
it "should be hidden a feature flag" do
it "should be hidden a feature flag", priority: "1", test_id: 206028 do
get "/profile/settings"
expect(ff('#disable_inbox').count).to eq 0
end
it "should reveal when the feature flag is set" do
it "should reveal when the feature flag is set", priority: "1", test_id: 138894 do
@course.root_account.enable_feature!(:allow_opt_out_of_inbox)
get "/profile/settings"
expect(ff('#disable_inbox').count).to eq 1
end
context "when activated" do
it "should set the notification preferences for conversations to ASAP, and hide those options" do
it "should set the notification preferences for conversations to ASAP, and hide those options", priority: "1", test_id: 207091 do
@course.root_account.enable_feature!(:allow_opt_out_of_inbox)
expect(@teacher.reload.disabled_inbox?).to be_falsey
notification = Notification.create!(workflow_state: "active", name: "Conversation Message",

View File

@ -14,7 +14,7 @@ describe "conversations new" do
end
describe "message sending" do
it "should start a group conversation when there is only one recipient" do
it "should start a group conversation when there is only one recipient", priority: "2", test_id: 201499 do
get_conversations
compose course: @course, to: [@s1], subject: 'single recipient', body: 'hallo!'
c = @s1.conversations.last.conversation
@ -22,7 +22,7 @@ describe "conversations new" do
expect(c.private?).to be_falsey
end
it "should start a group conversation when there is more than one recipient" do
it "should start a group conversation when there is more than one recipient", priority: "2", test_id: 201500 do
get_conversations
compose course: @course, to: [@s1, @s2], subject: 'multiple recipients', body: 'hallo!'
c = @s1.conversations.last.conversation
@ -31,7 +31,7 @@ describe "conversations new" do
expect(c.conversation_participants.collect(&:user_id).sort).to eq([@teacher, @s1, @s2].collect(&:id).sort)
end
it "should allow admins to send a message without picking a context" do
it "should allow admins to send a message without picking a context", priority: "1", test_id: 138677 do
user = account_admin_user
user_logged_in({:user => user})
get_conversations
@ -41,14 +41,14 @@ describe "conversations new" do
expect(c.context).to eq Account.default
end
it "should not allow non-admins to send a message without picking a context" do
it "should not allow non-admins to send a message without picking a context", priority: "1", test_id: 138678 do
get_conversations
fj('#compose-btn').click
wait_for_animations
expect(fj('#recipient-row')).to have_attribute(:style, 'display: none;')
end
it "should allow non-admins to send a message to an account-level group" do
it "should allow non-admins to send a message to an account-level group", priority: "2", test_id: 201506 do
@group = Account.default.groups.create(:name => "the group")
@group.add_user(@s1)
@group.add_user(@s2)
@ -61,7 +61,7 @@ describe "conversations new" do
add_message_recipient @s2
end
it "should allow admins to message users from their profiles" do
it "should allow admins to message users from their profiles", priority: "2", test_id: 201940 do
user = account_admin_user
user_logged_in({:user => user})
get "/accounts/#{Account.default.id}/users"
@ -73,7 +73,7 @@ describe "conversations new" do
expect(f('.ac-token')).not_to be_nil
end
it "should allow selecting multiple recipients in one search" do
it "should allow selecting multiple recipients in one search", priority: "2", test_id: 201941 do
get_conversations
fj('#compose-btn').click
wait_for_ajaximations
@ -86,7 +86,7 @@ describe "conversations new" do
expect(ff('.ac-token').count).to eq 2
end
it "should not send the message on shift-enter" do
it "should not send the message on shift-enter", priority: "1", test_id: 206019 do
get_conversations
compose course: @course, to: [@s1], subject: 'context-free', body: 'hallo!', send: false
driver.action.key_down(:shift).perform
@ -95,13 +95,14 @@ describe "conversations new" do
expect(fj('#compose-new-message:visible')).not_to be_nil
end
#
context "bulk_message locking" do
before do
# because i'm too lazy to create more users
Conversation.stubs(:max_group_conversation_size).returns(1)
end
it "should check and lock the bulk_message checkbox when over the max size" do
it "should check and lock the bulk_message checkbox when over the max size", priority: "2", test_id: 206022 do
get_conversations
compose course: @course, subject: 'lockme', body: 'hallo!', send: false
@ -123,7 +124,7 @@ describe "conversations new" do
expect(is_checked(selector)).to be_falsey # should be unchecked
end
it "should leave the value the same as before after unlocking" do
it "should leave the value the same as before after unlocking", priority: "2", test_id: 206023 do
get_conversations
compose course: @course, subject: 'lockme', body: 'hallo!', send: false
@ -141,7 +142,6 @@ describe "conversations new" do
expect(bulk_cb.attribute('disabled')).to be_blank
expect(is_checked(selector)).to be_truthy # should still be checked
end
end
end
end

View File

@ -22,7 +22,7 @@ describe "conversations new" do
@convo.add_message(@s2, "I need the homework too.")
end
it "should maintain context and subject" do
it "should maintain context and subject", priority: "1", test_id: 138696 do
get_conversations
conversation_elements[0].click
wait_for_ajaximations
@ -36,7 +36,7 @@ describe "conversations new" do
expect(fj('.message_subject_ro').text).to eq @convo.subject
end
it "should address replies to the most recent author by default" do
it "should address replies to the most recent author by default", priority: "2", test_id: 197538 do
get_conversations
conversation_elements[0].click
wait_for_ajaximations
@ -45,7 +45,7 @@ describe "conversations new" do
expect(fj('input[name="recipients[]"]')).to have_value(@s2.id.to_s)
end
it "should add new messages to the conversation" do
it "should add new messages to the conversation", priority: "1", test_id: 197537 do
get_conversations
initial_message_count = @convo.conversation_messages.length
conversation_elements[0].click

View File

@ -1,6 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + '/../helpers/conversations_common')
describe "conversations new" do
describe "conversations index page" do
include_examples "in-process server selenium tests"
before do
@ -15,11 +15,11 @@ describe "conversations new" do
describe "search" do
before do
@conv1 = conversation(@teacher, @s1)
@conv2 = conversation(@teacher, @s2)
@conv1 = conversation(@teacher, @s1,body:"adrian")
@conv2 = conversation(@teacher, @s2,body:"roberto")
end
it "should allow finding messages by recipient" do
it "should allow finding messages by recipient", priority: "1", test_id: 197540 do
get_conversations
name = @s2.name
f('[role=main] header [role=search] input').send_keys(name)
@ -31,35 +31,28 @@ describe "conversations new" do
describe "multi-select" do
before(:each) do
@conversations = [conversation(@teacher, @s1, @s2, workflow_state: 'read'),
conversation(@teacher, @s1, @s2, workflow_state: 'read'),
conversation(@teacher, @s1, @s2, workflow_state: 'read')]
end
def select_all_conversations
driver.action.key_down(modifier).perform
ff('.messages li').each do |message|
message.click
end
driver.action.key_up(modifier).perform
end
it "should select multiple conversations" do
it "should select multiple conversations", priority: "1", test_id: 201429 do
get_conversations
select_all_conversations
select_conversations(2)
expect(ff('.messages li.active').count).to eq 2
end
it "should select all conversations" do
it "should select all conversations", priority: "1", test_id: 201462 do
get_conversations
driver.action.key_down(modifier)
.send_keys('a')
.key_up(modifier)
.perform
expect(ff('.messages li.active').count).to eq 2
expect(ff('.messages li.active').count).to eq 3
end
it "should archive multiple conversations" do
it "should archive multiple conversations", priority: "1", test_id: 201490 do
get_conversations
select_all_conversations
select_conversations
f('#archive-btn').click
wait_for_ajaximations
expect(conversation_elements.count).to eq 0
@ -67,9 +60,9 @@ describe "conversations new" do
@conversations.each { |c| expect(c.reload).to be_archived }
end
it "should delete multiple conversations" do
it "should delete multiple conversations", priority: "1", test_id: 201491 do
get_conversations
select_all_conversations
select_conversations
f('#delete-btn').click
driver.switch_to.alert.accept
wait_for_ajaximations
@ -79,26 +72,26 @@ describe "conversations new" do
it "should mark multiple conversations as unread" do
skip('breaks b/c jenkins is weird')
get_conversations
select_all_conversations
select_conversations
click_unread_toggle_menu_item
keep_trying_until { expect(ffj('.read-state[aria-checked=false]').count).to eq 2 }
keep_trying_until { expect(ffj('.read-state[aria-checked=false]').count).to eq 3 }
end
it "should mark multiple conversations as unread" do
skip('breaks b/c jenkins is weird')
get_conversations
select_all_conversations
select_conversations
click_read_toggle_menu_item
keep_trying_until { expect(ffj('.read-state[aria-checked=true]').count).to eq 2 }
keep_trying_until { expect(ffj('.read-state[aria-checked=true]').count).to eq 3 }
end
it "should star multiple conversations" do
skip('breaks b/c jenkins is weird')
get_conversations
select_all_conversations
select_conversations
click_star_toggle_menu_item
run_progress_job
keep_trying_until { expect(ff('.star-btn.active').count).to eq 2 }
keep_trying_until { expect(ff('.star-btn.active').count).to eq 3 }
@conversations.each { |c| expect(c.reload).to be_starred }
end
end

View File

@ -20,43 +20,43 @@ describe "conversations new" do
conversation(@teacher, @s1, @s2, workflow_state: 'archived', starred: true)
end
it "should default to inbox view" do
it "should default to inbox view", priority: "1", test_id: 86601 do
get_conversations
selected = expect(get_bootstrap_select_value(get_view_filter)).to eq 'inbox'
expect(conversation_elements.size).to eq 2
end
it "should have an unread view" do
it "should have an unread view", priority: "1", test_id: 197523 do
get_conversations
select_view('unread')
expect(conversation_elements.size).to eq 1
end
it "should have an starred view" do
it "should have an starred view", priority: "1", test_id: 197524 do
get_conversations
select_view('starred')
expect(conversation_elements.size).to eq 2
end
it "should have an sent view" do
it "should have an sent view", priority: "1", test_id: 197525 do
get_conversations
select_view('sent')
expect(conversation_elements.size).to eq 3
end
it "should have an archived view" do
it "should have an archived view", priority: "1", test_id: 197526 do
get_conversations
select_view('archived')
expect(conversation_elements.size).to eq 1
end
it "should default to all courses view" do
it "should default to all courses context", priority: "1", test_id: 197527 do
get_conversations
selected = expect(get_bootstrap_select_value(get_course_filter)).to eq ''
expect(conversation_elements.size).to eq 2
end
it "should truncate long course names" do
it "should truncate long course names", priority: "2", test_id: 197528 do
@course.name = "this is a very long course name that will be truncated"
@course.save!
get_conversations
@ -67,20 +67,20 @@ describe "conversations new" do
expect(button_text[-5..-1]).to eq @course.name[-5..-1]
end
it "should filter by course" do
it "should filter by course", priority: "1", test_id: 197529 do
get_conversations
select_course(@course.id)
expect(conversation_elements.size).to eq 2
end
it "should filter by course plus view" do
it "should filter by course plus view", priority: "1", test_id: 197530 do
get_conversations
select_course(@course.id)
select_view('unread')
expect(conversation_elements.size).to eq 1
end
it "should hide the spinner after deleting the last conversation" do
it "should hide the spinner after deleting the last conversation", priority: "1", test_id: 207164 do
get_conversations
select_view('archived')
expect(conversation_elements.size).to eq 1
@ -103,7 +103,7 @@ describe "conversations new" do
@conv_starred.save!
end
it "should star via star icon" do
it "should star via star icon", priority: "1", test_id: 197532 do
get_conversations
unstarred_elt = conversation_elements[1]
# make star button visible via mouse over
@ -119,7 +119,7 @@ describe "conversations new" do
expect(@conv_unstarred.reload.starred).to be_truthy
end
it "should unstar via star icon" do
it "should unstar via star icon", priority: "1", test_id: 197533 do
get_conversations
starred_elt = conversation_elements[0]
star_btn = f('.star-btn', starred_elt)
@ -132,7 +132,7 @@ describe "conversations new" do
expect(@conv_starred.reload.starred).to be_falsey
end
it "should star via gear menu" do
it "should star via gear menu", priority: "1", test_id: 197534 do
get_conversations
unstarred_elt = conversation_elements[1]
unstarred_elt.click
@ -143,7 +143,7 @@ describe "conversations new" do
expect(@conv_unstarred.reload.starred).to be_truthy
end
it "should unstar via gear menu" do
it "should unstar via gear menu", priority: "1", test_id: 197535 do
get_conversations
starred_elt = conversation_elements[0]
starred_elt.click

View File

@ -36,20 +36,20 @@ describe "conversations new" do
end
describe 'view filter' do
it 'shows submission comments' do
it 'shows submission comments', priority: "2", test_id: 197517 do
get_conversations
select_view('submission_comments')
expect(conversation_elements.size).to eq 2
end
it 'filters by course' do
it 'filters by course', priority: "2", test_id: 197518 do
get_conversations
select_view('submission_comments')
select_course(@course1.id)
expect(conversation_elements.size).to eq 1
end
it 'filters by submitter' do
it 'filters by submitter', priority: "2", test_id: 197519 do
get_conversations
select_view('submission_comments')
name = @s2.name
@ -59,7 +59,7 @@ describe "conversations new" do
end
end
it 'adds new messages to the view' do
it 'adds new messages to the view', priority: "2", test_id: 197520 do
get_conversations
select_view('submission_comments')
initial_message_count = @submission.submission_comments.count
@ -73,7 +73,7 @@ describe "conversations new" do
expect(@submission.reload.submission_comments.count).to eq (initial_message_count + 1)
end
it 'marks unread on click' do
it 'marks unread on click', priority: "2", test_id: 197521 do
expect(@submission.read?(@teacher)).to be_falsey
get_conversations
select_view('submission_comments')
@ -82,7 +82,7 @@ describe "conversations new" do
expect(@submission.read?(@teacher)).to be_truthy
end
it 'marks an read/unread' do
it 'marks an read/unread', priority: "2", test_id: 197522 do
expect(@submission.read?(@teacher)).to be_falsey
get_conversations
select_view('submission_comments')

View File

@ -155,4 +155,22 @@ def run_progress_job
return unless progress = Progress.where(tag: 'conversation_batch_update').first
job = Delayed::Job.find(progress.delayed_job_id)
job.invoke_job
end
def select_conversations(to_select = -1)
driver.action.key_down(modifier).perform
messages = ff('.messages li')
message_count = messages.length
# default of -1 will select all messages. If you enter in too large of number, it defaults to selecting all
to_select = message_count if (to_select == -1) || (to_select > ff('.messages li').length)
index = 0
messages.each do |message|
message.click
break if index > to_select
index += 1
end
driver.action.key_up(modifier).perform
end

View File

@ -1031,7 +1031,14 @@ RSpec.configure do |config|
def conversation(*users)
options = users.last.is_a?(Hash) ? users.pop : {}
@conversation = (options.delete(:sender) || @me || users.shift).initiate_conversation(users, options.delete(:private))
@message = @conversation.add_message('test')
# if the "body" hash is passed in, use that for the message body
if !options[:body].nil?
@message = @conversation.add_message(options[:body].to_s)
else
@message = @conversation.add_message('test')
end
@conversation.update_attributes(options)
@conversation.reload
end