Search in sources :

Example 26 with AppUrl

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();
}
Also used : AppUrl(teammates.common.util.AppUrl)

Example 27 with AppUrl

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");
}
Also used : AppUrl(teammates.common.util.AppUrl)

Example 28 with AppUrl

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;
}
Also used : AppUrl(teammates.common.util.AppUrl) InstructorFeedbackResultsPage(teammates.test.pageobjects.InstructorFeedbackResultsPage)

Example 29 with AppUrl

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);
}
Also used : AppUrl(teammates.common.util.AppUrl) InstructorHomePage(teammates.test.pageobjects.InstructorHomePage)

Example 30 with AppUrl

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);
}
Also used : InstructorCourseStudentDetailsViewPage(teammates.test.pageobjects.InstructorCourseStudentDetailsViewPage) InstructorCourseStudentDetailsEditPage(teammates.test.pageobjects.InstructorCourseStudentDetailsEditPage) InstructorCourseEnrollPage(teammates.test.pageobjects.InstructorCourseEnrollPage) AppUrl(teammates.common.util.AppUrl) InstructorStudentListPage(teammates.test.pageobjects.InstructorStudentListPage) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorStudentRecordsPage(teammates.test.pageobjects.InstructorStudentRecordsPage)

Aggregations

AppUrl (teammates.common.util.AppUrl)52 Test (org.testng.annotations.Test)7 InstructorCourseEnrollPage (teammates.test.pageobjects.InstructorCourseEnrollPage)6 InstructorStudentListPage (teammates.test.pageobjects.InstructorStudentListPage)6 StudentHomePage (teammates.test.pageobjects.StudentHomePage)6 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)4 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)3 InstructorCourseDetailsPage (teammates.test.pageobjects.InstructorCourseDetailsPage)3 InstructorCourseStudentDetailsEditPage (teammates.test.pageobjects.InstructorCourseStudentDetailsEditPage)3 InstructorHomePage (teammates.test.pageobjects.InstructorHomePage)3 Stopwatch (teammates.client.scripts.util.Stopwatch)2 AdminHomePage (teammates.test.pageobjects.AdminHomePage)2 InstructorCourseStudentDetailsViewPage (teammates.test.pageobjects.InstructorCourseStudentDetailsViewPage)2 InstructorCoursesPage (teammates.test.pageobjects.InstructorCoursesPage)2 InstructorFeedbackResultsPage (teammates.test.pageobjects.InstructorFeedbackResultsPage)2 InstructorFeedbackSessionsPage (teammates.test.pageobjects.InstructorFeedbackSessionsPage)2 InstructorStudentRecordsPage (teammates.test.pageobjects.InstructorStudentRecordsPage)2 StudentCourseDetailsPage (teammates.test.pageobjects.StudentCourseDetailsPage)2 BlobInfo (com.google.appengine.api.blobstore.BlobInfo)1 BlobKey (com.google.appengine.api.blobstore.BlobKey)1