spec: add additional isolated View Quoting/reply specs
For isolated view the only way to reply within a thread is to make a quote Change-Id: Ia5fbe0176e01c7c186c6407c45df5ceee6b93d62 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/305510 Reviewed-by: Caleb Guanzon <cguanzon@instructure.com> QA-Review: Caleb Guanzon <cguanzon@instructure.com> Product-Review: Caleb Guanzon <cguanzon@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
parent
b36d7fd88d
commit
34a8ad6e6d
|
@ -290,11 +290,9 @@ describe "threaded discussions" do
|
||||||
Account.site_admin.enable_feature! :react_discussions_post
|
Account.site_admin.enable_feature! :react_discussions_post
|
||||||
end
|
end
|
||||||
|
|
||||||
context "Inline Thread mode" do
|
context "reply flow" do
|
||||||
# When redesign is on and split-screen and isolated view are off
|
|
||||||
# This should be updated to have split-screen on and the setting off with VICE-3116
|
|
||||||
before do
|
before do
|
||||||
@threaded_topic = create_discussion("inline view thread", "threaded")
|
@threaded_topic = create_discussion("threaded discussion", "threaded")
|
||||||
@first_reply = @threaded_topic.discussion_entries.create!(
|
@first_reply = @threaded_topic.discussion_entries.create!(
|
||||||
user: @student,
|
user: @student,
|
||||||
message: "1st level reply"
|
message: "1st level reply"
|
||||||
|
@ -322,11 +320,20 @@ describe "threaded discussions" do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "reply flow" do
|
context "isolated view" do
|
||||||
it "replies correctly to discussion topic" do
|
# These tests should verify that isolated view quotes/eplies are not affected by split-screen code
|
||||||
|
# They will be removed with VICE-3227
|
||||||
|
# Note there is no way to reply in a thread without quoting in isolated view
|
||||||
|
before :once do
|
||||||
|
Account.site_admin.enable_feature!(:isolated_view)
|
||||||
|
end
|
||||||
|
|
||||||
|
before do
|
||||||
user_session(@student)
|
user_session(@student)
|
||||||
get "/courses/#{@course.id}/discussion_topics/#{@threaded_topic.id}"
|
get "/courses/#{@course.id}/discussion_topics/#{@threaded_topic.id}"
|
||||||
expect(fj("div:contains(#{@threaded_topic.title})")).to be_present
|
end
|
||||||
|
|
||||||
|
it "replies correctly to discussion topic" do
|
||||||
f("button[data-testid='discussion-topic-reply']").click
|
f("button[data-testid='discussion-topic-reply']").click
|
||||||
wait_for_ajaximations
|
wait_for_ajaximations
|
||||||
type_in_tiny("textarea", "replying to topic")
|
type_in_tiny("textarea", "replying to topic")
|
||||||
|
@ -344,10 +351,110 @@ describe "threaded discussions" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "replies correctly to first_reply" do
|
it "replies correctly to first_reply" do
|
||||||
|
f("button[data-testid='threading-toolbar-reply']").click
|
||||||
|
wait_for_ajaximations
|
||||||
|
type_in_tiny("textarea", "replying to 1st level reply")
|
||||||
|
f("button[data-testid='DiscussionEdit-submit'").click
|
||||||
|
wait_for_ajaximations
|
||||||
|
|
||||||
|
new_reply = DiscussionEntry.last
|
||||||
|
# Verify new entry data is correct
|
||||||
|
expect(new_reply.depth).to eq 2
|
||||||
|
expect(new_reply.parent_id).to eq @first_reply.id
|
||||||
|
# Verify that reply was posted
|
||||||
|
expect(fj("div:contains(#{new_reply.summary})")).to be_present
|
||||||
|
# Verify that the correct level is opened
|
||||||
|
expect(fj("div:contains(#{new_reply.summary})")).to be_present
|
||||||
|
end
|
||||||
|
|
||||||
|
it "replies correctly to second reply" do
|
||||||
|
f("button[data-testid='expand-button']").click
|
||||||
|
wait_for_ajaximations
|
||||||
|
ff("button[data-testid='threading-toolbar-reply']")[2].click
|
||||||
|
wait_for_ajaximations
|
||||||
|
type_in_tiny("textarea", "replying to 2nd level reply")
|
||||||
|
f("button[data-testid='DiscussionEdit-submit'").click
|
||||||
|
wait_for_ajaximations
|
||||||
|
|
||||||
|
new_reply = DiscussionEntry.last
|
||||||
|
|
||||||
|
# Verify new entry data is correct
|
||||||
|
expect(new_reply.depth).to eq 3
|
||||||
|
expect(new_reply.parent_id).to eq @second_reply.id
|
||||||
|
# Verify that reply was posted
|
||||||
|
expect(fj("div:contains(#{new_reply.summary})")).to be_present
|
||||||
|
# Verify that the correct reply is quoted
|
||||||
|
expect(fj("div[data-testid='reply-preview']:contains('#{@second_reply.summary}')")).to be_present
|
||||||
|
end
|
||||||
|
|
||||||
|
it "replies correctly to third reply" do
|
||||||
|
f("button[data-testid='expand-button']").click
|
||||||
|
wait_for_ajaximations
|
||||||
|
ff("button[data-testid='threading-toolbar-reply']")[3].click
|
||||||
|
wait_for_ajaximations
|
||||||
|
type_in_tiny("textarea", "replying to 3rd level reply")
|
||||||
|
f("button[data-testid='DiscussionEdit-submit'").click
|
||||||
|
wait_for_ajaximations
|
||||||
|
|
||||||
|
new_reply = DiscussionEntry.last
|
||||||
|
|
||||||
|
# Verify new entry data is correct
|
||||||
|
expect(new_reply.depth).to eq 4
|
||||||
|
expect(new_reply.parent_id).to eq @third_reply.id
|
||||||
|
# Verify that reply was posted
|
||||||
|
expect(fj("div:contains(#{new_reply.summary})")).to be_present
|
||||||
|
# Verify that the correct reply is quoted
|
||||||
|
expect(fj("div[data-testid='reply-preview']:contains('#{@third_reply.summary}')")).to be_present
|
||||||
|
end
|
||||||
|
|
||||||
|
it "replies correctly to fourth reply" do
|
||||||
|
f("button[data-testid='expand-button']").click
|
||||||
|
wait_for_ajaximations
|
||||||
|
ff("button[data-testid='threading-toolbar-reply']")[4].click
|
||||||
|
wait_for_ajaximations
|
||||||
|
type_in_tiny("textarea", "replying to 4th level reply")
|
||||||
|
f("button[data-testid='DiscussionEdit-submit'").click
|
||||||
|
wait_for_ajaximations
|
||||||
|
|
||||||
|
new_reply = DiscussionEntry.last
|
||||||
|
|
||||||
|
# Verify new entry data is correct
|
||||||
|
expect(new_reply.depth).to eq 5
|
||||||
|
expect(new_reply.parent_id).to eq @fourth_reply.id
|
||||||
|
# Verify that reply was posted
|
||||||
|
expect(fj("div:contains(#{new_reply.summary})")).to be_present
|
||||||
|
# Verify that the correct reply is quoted
|
||||||
|
expect(fj("div[data-testid='reply-preview']:contains('#{@fourth_reply.summary}')")).to be_present
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "Inline Thread mode" do
|
||||||
|
# When redesign is on and split-screen and isolated view are off
|
||||||
|
# This should be updated to have split-screen on and the setting off with VICE-3116
|
||||||
|
|
||||||
|
before do
|
||||||
user_session(@student)
|
user_session(@student)
|
||||||
get "/courses/#{@course.id}/discussion_topics/#{@threaded_topic.id}"
|
get "/courses/#{@course.id}/discussion_topics/#{@threaded_topic.id}"
|
||||||
expect(fj("div:contains(#{@threaded_topic.title})")).to be_present
|
end
|
||||||
|
|
||||||
|
it "replies correctly to discussion topic" do
|
||||||
|
f("button[data-testid='discussion-topic-reply']").click
|
||||||
|
wait_for_ajaximations
|
||||||
|
type_in_tiny("textarea", "replying to topic")
|
||||||
|
f("button[data-testid='DiscussionEdit-submit'").click
|
||||||
|
wait_for_ajaximations
|
||||||
|
|
||||||
|
new_reply = DiscussionEntry.last
|
||||||
|
# Verify new entry data is correct
|
||||||
|
expect(new_reply.depth).to eq 1
|
||||||
|
expect(new_reply.parent_id).to eq nil
|
||||||
|
expect(new_reply.discussion_topic_id).to eq @threaded_topic.id
|
||||||
|
# Verify that the correct level is opened
|
||||||
|
expect(fj("div:contains(#{new_reply.summary})")).to be_present
|
||||||
|
expect(fj("div:contains(#{@first_reply.summary})")).to be_present
|
||||||
|
end
|
||||||
|
|
||||||
|
it "replies correctly to first_reply" do
|
||||||
f("button[data-testid='threading-toolbar-reply']").click
|
f("button[data-testid='threading-toolbar-reply']").click
|
||||||
wait_for_ajaximations
|
wait_for_ajaximations
|
||||||
type_in_tiny("textarea", "replying to 1st level reply")
|
type_in_tiny("textarea", "replying to 1st level reply")
|
||||||
|
@ -364,10 +471,6 @@ describe "threaded discussions" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "replies correctly to second reply" do
|
it "replies correctly to second reply" do
|
||||||
user_session(@student)
|
|
||||||
get "/courses/#{@course.id}/discussion_topics/#{@threaded_topic.id}"
|
|
||||||
expect(fj("div:contains(#{@threaded_topic.title})")).to be_present
|
|
||||||
|
|
||||||
f("button[data-testid='expand-button']").click
|
f("button[data-testid='expand-button']").click
|
||||||
wait_for_ajaximations
|
wait_for_ajaximations
|
||||||
ff("button[data-testid='threading-toolbar-reply']")[2].click
|
ff("button[data-testid='threading-toolbar-reply']")[2].click
|
||||||
|
@ -387,10 +490,6 @@ describe "threaded discussions" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "replies correctly to third reply" do
|
it "replies correctly to third reply" do
|
||||||
user_session(@student)
|
|
||||||
get "/courses/#{@course.id}/discussion_topics/#{@threaded_topic.id}"
|
|
||||||
expect(fj("div:contains(#{@threaded_topic.title})")).to be_present
|
|
||||||
|
|
||||||
f("button[data-testid='expand-button']").click
|
f("button[data-testid='expand-button']").click
|
||||||
wait_for_ajaximations
|
wait_for_ajaximations
|
||||||
ff("button[data-testid='threading-toolbar-reply']")[2].click
|
ff("button[data-testid='threading-toolbar-reply']")[2].click
|
||||||
|
@ -414,9 +513,6 @@ describe "threaded discussions" do
|
||||||
it "replies correctly to fourth reply" do
|
it "replies correctly to fourth reply" do
|
||||||
# Should set the parent reply to be the root entry
|
# Should set the parent reply to be the root entry
|
||||||
skip("Skip until work on VICE-3239 is done")
|
skip("Skip until work on VICE-3239 is done")
|
||||||
user_session(@student)
|
|
||||||
get "/courses/#{@course.id}/discussion_topics/#{@threaded_topic.id}"
|
|
||||||
expect(fj("div:contains(#{@threaded_topic.title})")).to be_present
|
|
||||||
|
|
||||||
f("button[data-testid='expand-button']").click
|
f("button[data-testid='expand-button']").click
|
||||||
wait_for_ajaximations
|
wait_for_ajaximations
|
||||||
|
@ -438,120 +534,105 @@ describe "threaded discussions" do
|
||||||
expect(fj("div:contains(#{@second_reply.summary})")).to be_present
|
expect(fj("div:contains(#{@second_reply.summary})")).to be_present
|
||||||
expect(new_reply.message).to eq "<p><span class=\"mceNonEditable mention\" data-mention=\"1\" data-reactroot=\"\">@#{@fourth_reply.author_name}</span>replying to 4th level reply</p>"
|
expect(new_reply.message).to eq "<p><span class=\"mceNonEditable mention\" data-mention=\"1\" data-reactroot=\"\">@#{@fourth_reply.author_name}</span>replying to 4th level reply</p>"
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
describe "quote flow" do
|
describe "when quoting" do
|
||||||
it "quotes first_reply correctly" do
|
it "quotes first_reply correctly" do
|
||||||
user_session(@student)
|
f("button[data-testid='thread-actions-menu']").click
|
||||||
get "/courses/#{@course.id}/discussion_topics/#{@threaded_topic.id}"
|
f("span[data-testid='quote']").click
|
||||||
expect(fj("div:contains(#{@threaded_topic.title})")).to be_present
|
wait_for_ajaximations
|
||||||
|
|
||||||
f("button[data-testid='thread-actions-menu']").click
|
# Verify that it says it'll quote the correct entry
|
||||||
f("span[data-testid='quote']").click
|
expect(fj("div[data-testid='reply-preview']:contains('#{@first_reply.summary}')")).to be_present
|
||||||
wait_for_ajaximations
|
|
||||||
|
|
||||||
# Verify that it says it'll quote the correct entry
|
type_in_tiny("textarea", "quoting 1st level reply")
|
||||||
expect(fj("div[data-testid='reply-preview']:contains('#{@first_reply.summary}')")).to be_present
|
f("button[data-testid='DiscussionEdit-submit'").click
|
||||||
|
wait_for_ajaximations
|
||||||
|
|
||||||
type_in_tiny("textarea", "quoting 1st level reply")
|
new_reply = DiscussionEntry.last
|
||||||
f("button[data-testid='DiscussionEdit-submit'").click
|
# Verify new entry data is correct
|
||||||
wait_for_ajaximations
|
expect(new_reply.depth).to eq 2
|
||||||
|
expect(new_reply.parent_id).to eq @first_reply.id
|
||||||
|
# Verify that the correct quote is created after submission
|
||||||
|
expect(fj("div[data-testid='reply-preview']:contains('#{@first_reply.summary}')")).to be_present
|
||||||
|
end
|
||||||
|
|
||||||
new_reply = DiscussionEntry.last
|
it "quotes second_reply correctly" do
|
||||||
# Verify new entry data is correct
|
f("button[data-testid='expand-button']").click
|
||||||
expect(new_reply.depth).to eq 2
|
wait_for_ajaximations
|
||||||
expect(new_reply.parent_id).to eq @first_reply.id
|
ff("button[data-testid='thread-actions-menu']")[1].click
|
||||||
# Verify that the correct quote is created after submission
|
f("span[data-testid='quote']").click
|
||||||
expect(fj("div[data-testid='reply-preview']:contains('#{@first_reply.summary}')")).to be_present
|
wait_for_ajaximations
|
||||||
end
|
|
||||||
|
|
||||||
it "quotes second_reply correctly" do
|
# Verify that it says it'll quote the correct entry
|
||||||
user_session(@student)
|
expect(fj("div[data-testid='reply-preview']:contains('#{@second_reply.summary}')")).to be_present
|
||||||
get "/courses/#{@course.id}/discussion_topics/#{@threaded_topic.id}"
|
|
||||||
expect(fj("div:contains(#{@threaded_topic.title})")).to be_present
|
|
||||||
|
|
||||||
f("button[data-testid='expand-button']").click
|
type_in_tiny("textarea", "Quoting 2nd level reply")
|
||||||
wait_for_ajaximations
|
f("button[data-testid='DiscussionEdit-submit'").click
|
||||||
ff("button[data-testid='thread-actions-menu']")[1].click
|
wait_for_ajaximations
|
||||||
f("span[data-testid='quote']").click
|
|
||||||
wait_for_ajaximations
|
|
||||||
|
|
||||||
# Verify that it says it'll quote the correct entry
|
new_reply = DiscussionEntry.last
|
||||||
expect(fj("div[data-testid='reply-preview']:contains('#{@second_reply.summary}')")).to be_present
|
|
||||||
|
|
||||||
type_in_tiny("textarea", "Quoting 2nd level reply")
|
# Verify new entry data is correct
|
||||||
f("button[data-testid='DiscussionEdit-submit'").click
|
expect(new_reply.depth).to eq 3
|
||||||
wait_for_ajaximations
|
expect(new_reply.parent_id).to eq @second_reply.id
|
||||||
|
|
||||||
new_reply = DiscussionEntry.last
|
# Verify that the correct quote is created after submission
|
||||||
|
expect(fj("div[data-testid='reply-preview']:contains('#{@second_reply.summary}')")).to be_present
|
||||||
|
end
|
||||||
|
|
||||||
# Verify new entry data is correct
|
it "quotes third_reply correctly" do
|
||||||
expect(new_reply.depth).to eq 3
|
skip("Until problems with VICE-3112 are fixed")
|
||||||
expect(new_reply.parent_id).to eq @second_reply.id
|
f("button[data-testid='expand-button']").click
|
||||||
|
wait_for_ajaximations
|
||||||
|
ff("button[data-testid='thread-actions-menu']")[2].click
|
||||||
|
f("span[data-testid='quote']").click
|
||||||
|
wait_for_ajaximations
|
||||||
|
|
||||||
# Verify that the correct quote is created after submission
|
# Verify that it says it'll quote the correct entry
|
||||||
expect(fj("div[data-testid='reply-preview']:contains('#{@second_reply.summary}')")).to be_present
|
expect(fj("div[data-testid='reply-preview']:contains('#{@third_reply.summary}')")).to be_present
|
||||||
end
|
|
||||||
|
|
||||||
it "quotes third_reply correctly" do
|
type_in_tiny("textarea", "quoting 3rd level reply")
|
||||||
skip("Until problems with VICE-3112 are fixed")
|
f("button[data-testid='DiscussionEdit-submit'").click
|
||||||
user_session(@student)
|
wait_for_ajaximations
|
||||||
get "/courses/#{@course.id}/discussion_topics/#{@threaded_topic.id}"
|
|
||||||
expect(fj("div:contains(#{@threaded_topic.title})")).to be_present
|
|
||||||
|
|
||||||
f("button[data-testid='expand-button']").click
|
new_reply = DiscussionEntry.last
|
||||||
wait_for_ajaximations
|
|
||||||
ff("button[data-testid='thread-actions-menu']")[2].click
|
|
||||||
f("span[data-testid='quote']").click
|
|
||||||
wait_for_ajaximations
|
|
||||||
|
|
||||||
# Verify that it says it'll quote the correct entry
|
# Verify new entry data is correct
|
||||||
expect(fj("div[data-testid='reply-preview']:contains('#{@third_reply.summary}')")).to be_present
|
expect(new_reply.depth).to eq 3
|
||||||
|
expect(new_reply.parent_id).to eq @second_reply.id
|
||||||
|
|
||||||
type_in_tiny("textarea", "quoting 3rd level reply")
|
# Verify that the correct quote is created after submission
|
||||||
f("button[data-testid='DiscussionEdit-submit'").click
|
expect(fj("div[data-testid='reply-preview']:contains('#{@third_reply.summary}')")).to be_present
|
||||||
wait_for_ajaximations
|
expect(new_reply.message).to eq "<p><span class=\"mceNonEditable mention\" data-mention=\"1\" data-reactroot=\"\">@#{@third_reply.author_name}</span>replying to 3rd level reply</p>"
|
||||||
|
end
|
||||||
|
|
||||||
new_reply = DiscussionEntry.last
|
it "quotes fourth_reply correctly" do
|
||||||
|
skip("Until problems with VICE-3112 and VICE-3229 are fixed")
|
||||||
|
|
||||||
# Verify new entry data is correct
|
f("button[data-testid='expand-button']").click
|
||||||
expect(new_reply.depth).to eq 3
|
wait_for_ajaximations
|
||||||
expect(new_reply.parent_id).to eq @second_reply.id
|
wait_for_ajaximations
|
||||||
|
ff("button[data-testid='thread-actions-menu']")[3].click
|
||||||
|
f("span[data-testid='quote']").click
|
||||||
|
wait_for_ajaximations
|
||||||
|
|
||||||
# Verify that the correct quote is created after submission
|
# Verify that it says it'll quote the correct entry
|
||||||
expect(fj("div[data-testid='reply-preview']:contains('#{@third_reply.summary}')")).to be_present
|
expect(fj("div[data-testid='reply-preview']:contains('#{@fourth_reply.summary}')")).to be_present
|
||||||
expect(new_reply.message).to eq "<p><span class=\"mceNonEditable mention\" data-mention=\"1\" data-reactroot=\"\">@#{@third_reply.author_name}</span>replying to 3rd level reply</p>"
|
|
||||||
end
|
|
||||||
|
|
||||||
it "quotes fourth_reply correctly" do
|
type_in_tiny("textarea", "quoting 4th level reply")
|
||||||
skip("Until problems with VICE-3112 and VICE-3229 are fixed")
|
f("button[data-testid='DiscussionEdit-submit'").click
|
||||||
user_session(@student)
|
wait_for_ajaximations
|
||||||
get "/courses/#{@course.id}/discussion_topics/#{@threaded_topic.id}"
|
|
||||||
expect(fj("div:contains(#{@threaded_topic.title})")).to be_present
|
|
||||||
|
|
||||||
f("button[data-testid='expand-button']").click
|
new_reply = DiscussionEntry.last
|
||||||
wait_for_ajaximations
|
|
||||||
wait_for_ajaximations
|
|
||||||
ff("button[data-testid='thread-actions-menu']")[3].click
|
|
||||||
f("span[data-testid='quote']").click
|
|
||||||
wait_for_ajaximations
|
|
||||||
|
|
||||||
# Verify that it says it'll quote the correct entry
|
# Verify new entry data is correct
|
||||||
expect(fj("div[data-testid='reply-preview']:contains('#{@fourth_reply.summary}')")).to be_present
|
expect(new_reply.depth).to eq 2
|
||||||
|
expect(new_reply.parent_id).to eq @first_reply.id
|
||||||
|
|
||||||
type_in_tiny("textarea", "quoting 4th level reply")
|
# Verify that the correct quote is created after submission
|
||||||
f("button[data-testid='DiscussionEdit-submit'").click
|
expect(fj("div[data-testid='reply-preview']:contains('#{@fourth_reply.summary}')")).to be_present
|
||||||
wait_for_ajaximations
|
expect(new_reply.message).to eq "<p><span class=\"mceNonEditable mention\" data-mention=\"1\" data-reactroot=\"\">@#{@fourth_reply.author_name}</span>quoting 4th level reply</p>"
|
||||||
|
end
|
||||||
new_reply = DiscussionEntry.last
|
|
||||||
|
|
||||||
# Verify new entry data is correct
|
|
||||||
expect(new_reply.depth).to eq 2
|
|
||||||
expect(new_reply.parent_id).to eq @first_reply.id
|
|
||||||
|
|
||||||
# Verify that the correct quote is created after submission
|
|
||||||
expect(fj("div[data-testid='reply-preview']:contains('#{@fourth_reply.summary}')")).to be_present
|
|
||||||
expect(new_reply.message).to eq "<p><span class=\"mceNonEditable mention\" data-mention=\"1\" data-reactroot=\"\">@#{@fourth_reply.author_name}</span>quoting 4th level reply</p>"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue