use of teammates.common.util.AppUrl in project teammates by TEAMMATES.
the class InstructorFeedbackEditPageUiTest method testEditNonExistentQuestion.
private void testEditNonExistentQuestion() throws MaximumRetriesExceededException {
______TS("test editing a non-existent question");
// Create a new question and save
feedbackEditPage.clickNewQuestionButton();
feedbackEditPage.selectNewQuestionType("TEXT");
feedbackEditPage.fillQuestionTextBoxForNewQuestion("new question");
feedbackEditPage.fillQuestionDescriptionForNewQuestion("more details");
feedbackEditPage.clickAddQuestionButton();
// Delete the new question through the backdoor so that it still appears in the browser
String questionId = getFeedbackQuestionWithRetry(courseId, feedbackSessionName, 1).getId();
String status = BackDoor.deleteFeedbackQuestion(questionId);
assertEquals(Const.StatusCodes.BACKDOOR_STATUS_SUCCESS, status);
// Edit the deleted question and save
feedbackEditPage.clickEditQuestionButton(1);
feedbackEditPage.fillQuestionTextBox("non-existent question", 1);
feedbackEditPage.fillQuestionDescription("more details", 1);
feedbackEditPage.clickSaveExistingQuestionButton(1);
AppUrl expectedRedirectUrl = createUrl("/entityNotFoundPage.jsp");
expectedRedirectUrl.withParam(Const.ParamsNames.ERROR_FEEDBACK_URL_REQUESTED, Const.ActionURIs.INSTRUCTOR_FEEDBACK_QUESTION_EDIT);
assertTrue(browser.driver.getCurrentUrl().contains(expectedRedirectUrl.toAbsoluteString()));
// Restore feedbackEditPage
feedbackEditPage = getFeedbackEditPage();
}
use of teammates.common.util.AppUrl in project teammates by TEAMMATES.
the class InstructorFeedbackResultsPageUiTest method testDownloadAction.
private void testDownloadAction() {
______TS("Typical case: download report");
AppUrl reportUrl = createUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_RESULTS_DOWNLOAD).withUserId("CFResultsUiT.instr").withCourseId("CFResultsUiT.CS2104").withSessionName("First Session");
resultsPage.verifyDownloadLink(reportUrl);
______TS("Typical case: download report for one question");
reportUrl = createUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_RESULTS_DOWNLOAD).withUserId("CFResultsUiT.instr").withCourseId("CFResultsUiT.CS2104").withSessionName("First Session").withQuestionNumber("2");
resultsPage.verifyDownloadLink(reportUrl);
______TS("Typical case: download report unsuccessfully");
reportUrl = createUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_RESULTS_DOWNLOAD).withUserId("CFResultsUiT.instr");
browser.driver.get(reportUrl.toAbsoluteString());
String afterReportDownloadUrl = browser.driver.getCurrentUrl();
assertFalse(reportUrl.toString().equals(afterReportDownloadUrl));
// Get an error page due to missing parameters in URL
// If admin is an instructor, expected url is InstructorHomePage
// otherwise, expected url is unauthorised.jsp
assertTrue("Expected url is InstructorHomePage or Unauthorised page, but is " + afterReportDownloadUrl, afterReportDownloadUrl.contains(Const.ActionURIs.INSTRUCTOR_HOME_PAGE) || afterReportDownloadUrl.contains(Const.ViewURIs.UNAUTHORIZED));
// return to the previous page
loginToInstructorFeedbackResultsPage("CFResultsUiT.instr", "Open Session");
}
use of teammates.common.util.AppUrl in project teammates by TEAMMATES.
the class InstructorFeedbackResultsPageUiTest method loginToInstructorFeedbackResultsPageWithViewType.
private InstructorFeedbackResultsPage loginToInstructorFeedbackResultsPageWithViewType(String instructorName, String fsName, boolean needAjax, String viewType) {
AppUrl resultsUrl = createUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_RESULTS_PAGE).withUserId(testData.instructors.get(instructorName).googleId).withCourseId(testData.feedbackSessions.get(fsName).getCourseId()).withSessionName(testData.feedbackSessions.get(fsName).getFeedbackSessionName());
if (needAjax) {
resultsUrl = resultsUrl.withParam(Const.ParamsNames.FEEDBACK_RESULTS_NEED_AJAX, String.valueOf(needAjax));
}
if (viewType != null) {
resultsUrl = resultsUrl.withParam(Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, viewType);
}
InstructorFeedbackResultsPage resultsPage = loginAdminToPage(resultsUrl, InstructorFeedbackResultsPage.class);
if (needAjax) {
resultsPage.waitForPageStructureToLoad();
} else {
resultsPage.waitForPageToLoad();
}
return resultsPage;
}
use of teammates.common.util.AppUrl in project teammates by TEAMMATES.
the class InstructorHomePageUiTest method loginWithPersistenceProblem.
private void loginWithPersistenceProblem() {
AppUrl homeUrl = ((AppUrl) createUrl(Const.ActionURIs.INSTRUCTOR_HOME_PAGE).withParam(Const.ParamsNames.CHECK_PERSISTENCE_COURSE, "something")).withUserId("unreg_user");
homePage = loginAdminToPage(homeUrl, InstructorHomePage.class);
}
use of teammates.common.util.AppUrl in project teammates by TEAMMATES.
the class InstructorStudentListPageUiTest method testLinks.
private void testLinks() {
String instructorId = testData.instructors.get("instructorOfCourse2").googleId;
AppUrl viewPageUrl = createUrl(Const.ActionURIs.INSTRUCTOR_STUDENT_LIST_PAGE).withUserId(instructorId);
viewPage = loginAdminToPage(viewPageUrl, InstructorStudentListPage.class);
______TS("link: enroll");
String courseId = testData.courses.get("course2").getId();
InstructorCourseEnrollPage enrollPage = viewPage.clickEnrollStudents(courseId);
enrollPage.verifyIsCorrectPage(courseId);
viewPage = enrollPage.goToPreviousPage(InstructorStudentListPage.class);
______TS("link: view");
StudentAttributes student1 = testData.students.get("Student2Course2");
viewPage.checkCourse(0);
viewPage.checkCourse(1);
ThreadHelper.waitFor(500);
InstructorCourseStudentDetailsViewPage studentDetailsPage = viewPage.clickViewStudent(student1.course, student1.name);
studentDetailsPage.verifyIsCorrectPage(student1.email);
studentDetailsPage.closeCurrentWindowAndSwitchToParentWindow();
viewPage = loginAdminToPage(viewPageUrl, InstructorStudentListPage.class);
______TS("link: edit");
StudentAttributes student2 = testData.students.get("Student3Course3");
viewPage.checkCourse(0);
viewPage.checkCourse(1);
ThreadHelper.waitFor(500);
InstructorCourseStudentDetailsEditPage studentEditPage = viewPage.clickEditStudent(student2.course, student2.name);
studentEditPage.verifyIsCorrectPage(student2.email);
studentEditPage.submitButtonClicked();
studentEditPage.closeCurrentWindowAndSwitchToParentWindow();
viewPage = loginAdminToPage(viewPageUrl, InstructorStudentListPage.class);
______TS("link: view records");
viewPage.checkCourse(0);
viewPage.checkCourse(1);
ThreadHelper.waitFor(500);
InstructorStudentRecordsPage studentRecordsPage = viewPage.clickViewRecordsStudent(student2.course, student2.name);
studentRecordsPage.verifyIsCorrectPage(student2.name);
studentRecordsPage.closeCurrentWindowAndSwitchToParentWindow();
viewPage = loginAdminToPage(viewPageUrl, InstructorStudentListPage.class);
}
Aggregations