spec: Remove the rce_enhancements flag from canvas - Phase 5b
quizzes specs that have had trouble with flakey spec catcher refs LS-2655 flag=none test plan: it passes jenkins Change-Id: I4193252df38e0997243454604876f65f477115e3 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275867 Reviewed-by: Weston Dransfield <wdransfield@instructure.com> QA-Review: Weston Dransfield <wdransfield@instructure.com> Product-Review: Ed Schiebel <eschiebel@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
parent
b5e77f261f
commit
5258cb1b8e
|
@ -515,8 +515,18 @@ module QuizzesCommon
|
|||
|
||||
def edit_first_question
|
||||
hover_first_question
|
||||
f('.edit_question_link').click
|
||||
wait_for_ajaximations
|
||||
wait_for_animations
|
||||
begin
|
||||
# for some reason in flakey-spec-catcher this will fail 1/10 times
|
||||
# have a backup plan
|
||||
f('.edit_question_link').click
|
||||
rescue Selenium::WebDriver::Error::ElementNotInteractableError
|
||||
# rubocop:disable Specs/NoExecuteScript
|
||||
driver.execute_script "document.querySelector('.edit_question_link').click()"
|
||||
# rubocop:enable Specs/NoExecuteScript
|
||||
ensure
|
||||
wait_for_ajaximations
|
||||
end
|
||||
end
|
||||
|
||||
def save_question
|
||||
|
@ -824,8 +834,9 @@ module QuizzesCommon
|
|||
get quiz_submission_speedgrader_url
|
||||
end
|
||||
|
||||
def open_quiz_edit_form
|
||||
def open_quiz_edit_form(should_wait_for_rce = true)
|
||||
get quiz_edit_form_url
|
||||
wait_for_rce if should_wait_for_rce
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -26,7 +26,6 @@ describe 'quizzes question creation' do
|
|||
|
||||
before(:once) do
|
||||
course_with_teacher(active_all: true)
|
||||
Account.default.enable_feature!(:rce_enhancements)
|
||||
end
|
||||
|
||||
before(:each) do
|
||||
|
|
|
@ -21,12 +21,11 @@ require_relative '../common'
|
|||
require_relative '../helpers/quizzes_common'
|
||||
|
||||
describe 'quizzes question with html answers' do
|
||||
include_context "in-process server selenium tests"
|
||||
include_context 'in-process server selenium tests'
|
||||
include QuizzesCommon
|
||||
|
||||
before(:each) do
|
||||
course_with_teacher_logged_in
|
||||
Account.default.enable_feature!(:rce_enhancements)
|
||||
stub_rcs_config
|
||||
end
|
||||
|
||||
|
@ -44,10 +43,10 @@ describe 'quizzes question with html answers' do
|
|||
def check_for_no_edit_button(option)
|
||||
click_option('.question_form:visible .question_type', option)
|
||||
driver.execute_script "$('.answer').addClass('hover');"
|
||||
expect(f("#content")).not_to contain_jqcss('.edit_html:visible')
|
||||
expect(f('#content')).not_to contain_jqcss('.edit_html:visible')
|
||||
end
|
||||
|
||||
it 'allows HTML answers for multiple choice', priority: "1", test_id: 209356 do
|
||||
it 'allows HTML answers for multiple choice', priority: '1', test_id: 209_356 do
|
||||
quiz_with_new_questions
|
||||
click_questions_tab
|
||||
edit_first_html_answer
|
||||
|
@ -64,13 +63,21 @@ describe 'quizzes question with html answers' do
|
|||
expect(html).to eq '<p>HTML</p>'
|
||||
end
|
||||
|
||||
it 'preserves HTML image answers for multiple choice', priority: "2", test_id: 3103797 do
|
||||
img_url = "http://invalid.nowhere.test/nothing.jpg"
|
||||
img_alt = "sample alt text"
|
||||
img_cls = "sample_image"
|
||||
quiz_with_new_questions(true, { id: 1 }, { id: 2 },
|
||||
{ id: 3, answer_html: %|<img src="#{img_url}" alt="#{img_alt}" class="#{img_cls}">| })
|
||||
dismiss_flash_messages rescue nil # in non-prod environments images that fail to load will cause a flash message
|
||||
it 'preserves HTML image answers for multiple choice', priority: '2', test_id: 3_103_797 do
|
||||
img_url = 'http://invalid.nowhere.test/nothing.jpg'
|
||||
img_alt = 'sample alt text'
|
||||
img_cls = 'sample_image'
|
||||
quiz_with_new_questions(
|
||||
true,
|
||||
{ id: 1 },
|
||||
{ id: 2 },
|
||||
{ id: 3, answer_html: "<img src=\"#{img_url}\" alt=\"#{img_alt}\" class=\"#{img_cls}\">" }
|
||||
)
|
||||
begin
|
||||
dismiss_flash_messages
|
||||
rescue StandardError
|
||||
nil
|
||||
end # in non-prod environments images that fail to load will cause a flash message
|
||||
click_questions_tab
|
||||
edit_first_question
|
||||
alt_before = fj(".#{img_cls}", question_answers[2]).attribute('alt')
|
||||
|
@ -79,7 +86,7 @@ describe 'quizzes question with html answers' do
|
|||
expect(alt_after).to eq alt_before
|
||||
end
|
||||
|
||||
it 'sets focus back to the edit button after editing', priority: "1", test_id: 209357 do
|
||||
it 'sets focus back to the edit button after editing', priority: '1', test_id: 209_357 do
|
||||
quiz_with_new_questions
|
||||
click_questions_tab
|
||||
edit_first_html_answer
|
||||
|
@ -88,7 +95,9 @@ describe 'quizzes question with html answers' do
|
|||
check_element_has_focus(fj('.edit_html:visible'))
|
||||
end
|
||||
|
||||
it 'doesn\'t show the edit html button for question types besides multiple choice and multiple answers', priority: "1", test_id: 209358 do
|
||||
it 'doesn\'t show the edit html button for question types besides multiple choice and multiple answers',
|
||||
priority: '1',
|
||||
test_id: 209_358 do
|
||||
quiz_with_new_questions
|
||||
click_questions_tab
|
||||
edit_first_question
|
||||
|
@ -101,7 +110,7 @@ describe 'quizzes question with html answers' do
|
|||
check_for_no_edit_button 'Numerical Answer'
|
||||
end
|
||||
|
||||
it 'restores normal input when html answer is empty', priority: "1", test_id: 209359 do
|
||||
it 'restores normal input when html answer is empty', priority: '1', test_id: 209_359 do
|
||||
quiz_with_new_questions
|
||||
click_questions_tab
|
||||
edit_first_html_answer
|
||||
|
@ -110,11 +119,12 @@ describe 'quizzes question with html answers' do
|
|||
# clear tiny
|
||||
driver.execute_script "tinyMCE.activeEditor.setContent('')"
|
||||
close_first_html_answer
|
||||
input_length = driver.execute_script "return $('.answer:eq(3) input[name=answer_text]:visible').length"
|
||||
input_length =
|
||||
driver.execute_script "return $('.answer:eq(3) input[name=answer_text]:visible').length"
|
||||
expect(input_length).to eq 1
|
||||
end
|
||||
|
||||
it 'populates the editor and input elements properly', priority: "1", test_id: 209360 do
|
||||
it 'populates the editor and input elements properly', priority: '1', test_id: 209_360 do
|
||||
quiz_with_new_questions
|
||||
click_questions_tab
|
||||
|
||||
|
@ -129,7 +139,7 @@ describe 'quizzes question with html answers' do
|
|||
# open it up in the editor, make sure the text matches the input
|
||||
edit_first_html_answer
|
||||
keep_trying_until do
|
||||
content = driver.execute_script "return tinyMCE.activeEditor.getContent()"
|
||||
content = driver.execute_script 'return tinyMCE.activeEditor.getContent()'
|
||||
expect(content).to eq '<p>ohai</p>'
|
||||
end
|
||||
|
||||
|
@ -140,7 +150,9 @@ describe 'quizzes question with html answers' do
|
|||
expect(value).to eq ''
|
||||
end
|
||||
|
||||
it 'saves open html answers when the question is submitted for multiple choice', priority: "1", test_id: 209361 do
|
||||
it 'saves open html answers when the question is submitted for multiple choice',
|
||||
priority: '1',
|
||||
test_id: 209_361 do
|
||||
quiz_with_new_questions
|
||||
click_questions_tab
|
||||
edit_first_html_answer
|
||||
|
@ -153,7 +165,10 @@ describe 'quizzes question with html answers' do
|
|||
expect(html).to eq '<p>HTML</p>'
|
||||
end
|
||||
|
||||
it 'saves open html answers when the question is submitted for multiple answers', priority: "1", test_id: 209362 do
|
||||
it 'saves open html answers when the question is submitted for multiple answers',
|
||||
priority: '1',
|
||||
test_id: 209_362,
|
||||
custom_timeout: 30 do
|
||||
quiz_with_new_questions
|
||||
click_questions_tab
|
||||
edit_first_html_answer 'Multiple Answers'
|
||||
|
|
|
@ -43,7 +43,7 @@ describe 'quizzes with draft state' do
|
|||
end
|
||||
|
||||
it 'shows an error', priority: "1", test_id: 209419 do
|
||||
open_quiz_edit_form
|
||||
open_quiz_edit_form(false)
|
||||
wait_for_ajaximations
|
||||
expect(f('#unauthorized_message')).to include_text 'Access Denied'
|
||||
end
|
||||
|
|
|
@ -29,23 +29,9 @@ describe 'quiz taking' do
|
|||
@quiz = quiz_with_new_questions(!:goto_edit)
|
||||
end
|
||||
|
||||
it 'allows toggling between RCE and HTML entry on essay questions', custom_timeout: 25 do
|
||||
@quiz = quiz_with_multiple_type_questions
|
||||
get "/courses/#{@course.id}/quizzes/#{@quiz.id}"
|
||||
expect_new_page_load { f('#take_quiz_link').click }
|
||||
wait_for_ajaximations
|
||||
html_link = f('[data-btn-id="rce-edit-btn"]')
|
||||
expect(html_link.text).to include('Switch to the html editor')
|
||||
expect(html_link).to be_displayed
|
||||
html_link.click
|
||||
rce_editor_link = f('[data-btn-id="rce-edit-btn"]')
|
||||
expect(rce_editor_link.text).to include('Switch to the rich text editor')
|
||||
expect(rce_editor_link).to be_displayed
|
||||
end
|
||||
|
||||
it 'toggles only the essay question that was toggled leaving others on the page alone',
|
||||
custom_timeout: 30 do
|
||||
@quiz = quiz_with_essay_questions
|
||||
@quiz = quiz_with_essay_questions(false)
|
||||
get "/courses/#{@course.id}/quizzes/#{@quiz.id}"
|
||||
expect_new_page_load { f('#take_quiz_link').click }
|
||||
wait_for_ajaximations
|
||||
|
|
Loading…
Reference in New Issue