@Override public void testInputValidation() { ______TS("empty question text"); feedbackEditPage.clickAddQuestionButton(); feedbackEditPage.verifyStatus(Const.StatusMessages.FEEDBACK_QUESTION_TEXTINVALID); ______TS("empty weight test"); feedbackEditPage.fillNewQuestionBox("empty weight test"); feedbackEditPage.fillNewQuestionDescription("more details"); feedbackEditPage.clickAssignWeightsCheckbox(-1); feedbackEditPage.fillRubricWeightBox("", -1, 3); feedbackEditPage.clickAddQuestionButton(); feedbackEditPage.verifyStatus(Const.FeedbackQuestion.RUBRIC_ERROR_INVALID_WEIGHT); }
@Override public void testAddQuestionAction() throws Exception { ______TS("NUMSCALE: add question action success"); assertNull(BackDoor.getFeedbackQuestion(courseId, feedbackSessionName, 1)); feedbackEditPage.enableOtherFeedbackPathOptionsForNewQuestion(); feedbackEditPage.selectRecipientsToBeStudents(); feedbackEditPage.clickAddQuestionButton(); feedbackEditPage.verifyStatus(Const.StatusMessages.FEEDBACK_QUESTION_ADDED); assertNotNull(BackDoor.getFeedbackQuestion(courseId, feedbackSessionName, 1)); feedbackEditPage.verifyHtmlMainContent("/instructorFeedbackNumScaleQuestionAddSuccess.html"); }
@Override public void testAddQuestionAction() throws Exception { ______TS("RUBRIC: add question action success"); feedbackEditPage.clickNewQuestionButton(); feedbackEditPage.selectNewQuestionType("RUBRIC"); feedbackEditPage.fillNewQuestionBox("RUBRIC qn"); feedbackEditPage.fillNewQuestionDescription("more details"); assertNull(BackDoor.getFeedbackQuestion(courseId, feedbackSessionName, 1)); feedbackEditPage.clickAddQuestionButton(); feedbackEditPage.verifyStatus(Const.StatusMessages.FEEDBACK_QUESTION_ADDED); assertNotNull(BackDoor.getFeedbackQuestion(courseId, feedbackSessionName, 1)); feedbackEditPage.verifyHtmlMainContent("/instructorFeedbackRubricQuestionAddSuccess.html"); }
private void testInputJsValidationForRubricQuestion() { // this tests whether the JS validation disallows empty rubric options ______TS("JS validation test"); // add a new question feedbackEditPage.clickNewQuestionButton(); feedbackEditPage.selectNewQuestionType("RUBRIC"); // start editing it feedbackEditPage.fillNewQuestionBox("RUBRIC qn JS validation test"); feedbackEditPage.fillNewQuestionDescription("more details"); feedbackEditPage.clickAddQuestionButton(); feedbackEditPage.clickEditQuestionButton(1); // try to remove everything feedbackEditPage.clickRemoveRubricRowLinkAndConfirm(1, 1); feedbackEditPage.clickRemoveRubricRowLinkAndConfirm(1, 0); feedbackEditPage.clickRemoveRubricColLinkAndConfirm(1, 3); feedbackEditPage.clickRemoveRubricColLinkAndConfirm(1, 2); feedbackEditPage.clickRemoveRubricColLinkAndConfirm(1, 1); feedbackEditPage.clickRemoveRubricColLinkAndConfirm(1, 0); // TODO check if the rubric column and link is indeed empty // add something so that we know that the elements are still there // and so that we don't get empty sub question error feedbackEditPage.fillRubricSubQuestionBox("New sub-question text", 1, 0); feedbackEditPage.fillRubricDescriptionBox("New(0) description", 1, 0, 0); feedbackEditPage.clickSaveExistingQuestionButton(1); feedbackEditPage.verifyStatus( "Too little choices for Rubric question. Minimum number of options is: 2"); }
@Override public void testInputValidation() { ______TS("empty options"); feedbackEditPage.fillNewQuestionBox("NumScale qn"); feedbackEditPage.fillNewQuestionDescription("more details"); feedbackEditPage.fillMinNumScaleBox("", -1); feedbackEditPage.fillStepNumScaleBox("", -1); feedbackEditPage.fillMaxNumScaleBox("", -1); assertEquals( "[Please enter valid numbers for all the options.]", feedbackEditPage.getNumScalePossibleValuesString(-1)); feedbackEditPage.clickAddQuestionButton(); feedbackEditPage.verifyStatus("Please enter valid options. The min/max/step cannot be empty."); ______TS("invalid options"); feedbackEditPage.fillNewQuestionBox("NumScale qn"); feedbackEditPage.fillNewQuestionDescription("more details"); feedbackEditPage.fillMinNumScaleBox("1", -1); feedbackEditPage.fillStepNumScaleBox("0.3", -1); feedbackEditPage.fillMaxNumScaleBox("5", -1); assertEquals( "[The interval 1 - 5 is not divisible by the specified increment.]", feedbackEditPage.getNumScalePossibleValuesString(-1)); feedbackEditPage.clickAddQuestionButton(); feedbackEditPage.verifyStatus( "Please enter valid options. " + "The interval is not divisible by the specified increment."); ______TS("possible floating point error"); feedbackEditPage.fillNewQuestionBox("NumScale qn"); feedbackEditPage.fillNewQuestionDescription("more details"); feedbackEditPage.fillMinNumScaleBox("1", -1); feedbackEditPage.fillStepNumScaleBox("0.001", -1); feedbackEditPage.fillMaxNumScaleBox("5555", -1); assertEquals( "[Based on the above settings, acceptable responses are: 1, 1.001, 1.002, ..., " + "5554.998, 5554.999, 5555]", feedbackEditPage.getNumScalePossibleValuesString(-1)); ______TS("more than three dp step rounding test"); feedbackEditPage.fillMaxNumScaleBox("1002", -1); feedbackEditPage.fillStepNumScaleBox("1.00123456789", -1); assertEquals( "[Based on the above settings, acceptable responses are: 1, 2.001, 3.002, ..., " + "999.998, 1000.999, 1002]", feedbackEditPage.getNumScalePossibleValuesString(-1)); ______TS("NUMSCALE: min >= max test"); // Tests javascript that automatically makes max = min+1 when max is <= min. feedbackEditPage.fillMinNumScaleBox(1, -1); feedbackEditPage.fillStepNumScaleBox(1, -1); feedbackEditPage.fillMaxNumScaleBox(5, -1); assertEquals( "[Based on the above settings, acceptable responses are: 1, 2, 3, 4, 5]", feedbackEditPage.getNumScalePossibleValuesString(-1)); fillNumScaleBoxWithRecheck(true, 6, -1, "7"); fillNumScaleBoxWithRecheck(false, 6, -1, "7"); // Reset values feedbackEditPage.fillMinNumScaleBox(1, -1); feedbackEditPage.fillMaxNumScaleBox(5, -1); }