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 testEditQuestionAction() throws Exception { ______TS("RUBRIC: edit question success"); // Click edit button feedbackEditPage.clickEditQuestionButton(1); // Check that fields are editable feedbackEditPage.verifyHtmlMainContent("/instructorFeedbackRubricQuestionEdit.html"); feedbackEditPage.fillEditQuestionBox("edited RUBRIC qn text", 1); feedbackEditPage.fillEditQuestionDescription("more details", 1); feedbackEditPage.clickSaveExistingQuestionButton(1); feedbackEditPage.verifyStatus(Const.StatusMessages.FEEDBACK_QUESTION_EDITED); // Check question text is updated feedbackEditPage.verifyHtmlMainContent("/instructorFeedbackRubricQuestionEditSuccess.html"); ______TS("RUBRIC: edit sub-questions success"); feedbackEditPage.clickEditQuestionButton(1); // Edit sub-question for row 1 feedbackEditPage.fillRubricSubQuestionBox("New(0) sub-question text", 1, 0); // Add new sub-question feedbackEditPage.clickAddRubricRowLink(1); feedbackEditPage.fillRubricSubQuestionBox("New(1) sub-question text", 1, 2); // Remove existing sub-questions feedbackEditPage.clickRemoveRubricRowLinkAndConfirm(1, 0); feedbackEditPage.clickRemoveRubricRowLinkAndConfirm(1, 1); // Add new sub-question feedbackEditPage.clickAddRubricRowLink(1); feedbackEditPage.fillRubricSubQuestionBox("New(2) sub-question text", 1, 3); // Remove new sub-question feedbackEditPage.clickRemoveRubricRowLinkAndConfirm(1, 2); // Should end up with 1 question feedbackEditPage.clickSaveExistingQuestionButton(1); feedbackEditPage.verifyHtmlMainContent( "/instructorFeedbackRubricQuestionEditSubQuestionSuccess.html"); ______TS("RUBRIC: edit choices success"); feedbackEditPage.clickEditQuestionButton(1); // Edit choice for col 1 feedbackEditPage.fillRubricChoiceBox("New(0) choice", 1, 0); // Add new choice feedbackEditPage.clickAddRubricColLink(1); feedbackEditPage.fillRubricChoiceBox("New(1) choice", 1, 4); // Remove existing choice feedbackEditPage.clickRemoveRubricColLinkAndConfirm(1, 0); // Add new choice feedbackEditPage.clickAddRubricColLink(1); feedbackEditPage.fillRubricChoiceBox("New(2) choice", 1, 5); // Remove new choice feedbackEditPage.clickRemoveRubricColLinkAndConfirm(1, 4); // Should end up with 4 choices, including (1) and (2) feedbackEditPage.clickSaveExistingQuestionButton(1); feedbackEditPage.verifyHtmlMainContent( "/instructorFeedbackRubricQuestionEditChoiceSuccess.html"); ______TS("RUBRIC: edit weight success"); feedbackEditPage.clickEditQuestionButton(1); // Edit the weight of the first choice feedbackEditPage.clickAssignWeightsCheckbox(1); feedbackEditPage.fillRubricWeightBox("2.25", 1, 0); feedbackEditPage.clickSaveExistingQuestionButton(1); feedbackEditPage.verifyHtmlMainContent( "/instructorFeedbackRubricQuestionEditWeightSuccess.html"); ______TS("RUBRIC: edit descriptions success"); feedbackEditPage.clickEditQuestionButton(1); // Edit description for 0-0 feedbackEditPage.fillRubricDescriptionBox("New(0) description", 1, 0, 0); // Edit description for a new row, to test if the js generated html works. feedbackEditPage.clickAddRubricRowLink(1); feedbackEditPage.fillRubricSubQuestionBox("New sub-question text", 1, 1); feedbackEditPage.fillRubricDescriptionBox("New(1) description", 1, 1, 0); // Should end up with 2 rubric descriptions, (0) and (1) feedbackEditPage.clickSaveExistingQuestionButton(1); feedbackEditPage.verifyHtmlMainContent( "/instructorFeedbackRubricQuestionEditDescriptionSuccess.html"); }