CQS: selenium spec for canvas integration
Added a selenium spec that visits the statistics_cqs page and verifies that the client app has loaded and mounted successfully. Closes CNVS-15363 Change-Id: I4a87b5af78343d51ef8e4c0b1e30065eff9e7d6b Reviewed-on: https://gerrit.instructure.com/40775 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Derek DeVries <ddevries@instructure.com> QA-Review: Derek DeVries <ddevries@instructure.com> Product-Review: Ahmad Amireh <ahmad@instructure.com>
This commit is contained in:
parent
79d634a0f8
commit
fd4bbbf91c
|
@ -33,6 +33,7 @@ define(function(require) {
|
|||
|
||||
parseQuestion = function(participantCount, question) {
|
||||
var attrs = pickAndNormalize(question, K.QUESTION_STATISTICS_ATTRS);
|
||||
var correctAnswerPointBiserials;
|
||||
|
||||
wrap(attrs.answers).forEach(decorateAnswer.bind(null, participantCount));
|
||||
wrap(attrs.answerSets).forEach(decorateAnswerSet.bind(null, participantCount));
|
||||
|
@ -42,9 +43,11 @@ define(function(require) {
|
|||
return pickAndNormalize(pointBiserial, K.POINT_BISERIAL_ATTRS);
|
||||
});
|
||||
|
||||
attrs.discriminationIndex = findWhere(attrs.pointBiserials, {
|
||||
correctAnswerPointBiserials = findWhere(attrs.pointBiserials, {
|
||||
correct: true
|
||||
}).pointBiserial;
|
||||
}) || {};
|
||||
|
||||
attrs.discriminationIndex = correctAnswerPointBiserials.pointBiserial;
|
||||
}
|
||||
|
||||
return attrs;
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/helpers/quizzes_common')
|
||||
|
||||
describe "canvas quiz statistics" do
|
||||
include_examples "quizzes selenium tests"
|
||||
|
||||
before do
|
||||
quiz_with_graded_submission([
|
||||
{:question_data => {:name => 'question 1', :points_possible => 1, 'question_type' => 'true_false_question'}},
|
||||
{:question_data => {:name => 'question 2', :points_possible => 1, 'question_type' => 'true_false_question'}}
|
||||
])
|
||||
|
||||
course_with_teacher_logged_in(:active_all => true, :course => @course)
|
||||
end
|
||||
|
||||
it 'should mount' do
|
||||
get "/courses/#{@course.id}/quizzes/#{@quiz.id}/statistics_cqs"
|
||||
|
||||
status = driver.execute_script <<-JS
|
||||
var mountStatus = document.body.appendChild(document.createElement('div'));
|
||||
|
||||
require([ 'jquery', 'canvas_quiz_statistics' ], function($, app) {
|
||||
if (app.isMounted()) {
|
||||
$(mountStatus).text('success');
|
||||
} else {
|
||||
$(mountStatus).text('error');
|
||||
}
|
||||
});
|
||||
|
||||
return mountStatus;
|
||||
JS
|
||||
|
||||
wait = Selenium::WebDriver::Wait.new(timeout: 5)
|
||||
wait.until { status.text.present? } # require call is async
|
||||
|
||||
status.text.should match('success')
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue