use of teammates.test.pageobjects.StudentHomePage in project teammates by TEAMMATES.
the class StudentCourseJoinConfirmationPageUiTest method testJoinConfirmation.
private void testJoinConfirmation() throws Exception {
logout();
removeAndRestoreDataBundle(testData);
String expectedMsg;
String homePageActionUrl = createUrl(Const.ActionURIs.STUDENT_HOME_PAGE).toAbsoluteString();
String joinLink;
StudentHomePage studentHomePage;
______TS("click join link, skips confirmation and asks for login");
String courseId = testData.courses.get("SCJConfirmationUiT.CS2104").getId();
String courseName = testData.courses.get("SCJConfirmationUiT.CS2104").getName();
String studentEmail = testData.students.get("alice.tmms@SCJConfirmationUiT.CS2104").email;
joinLink = createUrl(Const.ActionURIs.STUDENT_COURSE_JOIN).withRegistrationKey(getKeyFromBackDoor(courseId, studentEmail)).toAbsoluteString();
browser.driver.get(joinLink);
studentHomePage = AppPage.createCorrectLoginPageType(browser).loginAsStudent(TestProperties.TEST_STUDENT1_ACCOUNT, TestProperties.TEST_STUDENT1_PASSWORD);
studentHomePage.waitForTextsForAllStatusMessagesToUserEquals(String.format(Const.StatusMessages.STUDENT_COURSE_JOIN_SUCCESSFUL, "[" + courseId + "] " + courseName), String.format(Const.StatusMessages.HINT_FOR_NO_SESSIONS_STUDENT, "[" + courseId + "] " + courseName), "Meanwhile, you can update your profile here.");
______TS("test student confirmation page content");
courseId = testData.courses.get("SCJConfirmationUiT.CS2103").getId();
courseName = testData.courses.get("SCJConfirmationUiT.CS2103").getName();
studentEmail = testData.students.get("alice.tmms@SCJConfirmationUiT.CS2103").email;
joinLink = createUrl(Const.ActionURIs.STUDENT_COURSE_JOIN).withRegistrationKey(getKeyFromBackDoor(courseId, studentEmail)).toAbsoluteString();
browser.driver.get(joinLink);
confirmationPage = AppPage.getNewPageInstance(browser, StudentCourseJoinConfirmationPage.class);
// this test uses accounts from test.properties
// This is also a HTML verification for Student Course Join Confirmation Page because they use the
// same html file for verification
confirmationPage.verifyHtml("/studentCourseJoinConfirmationHTML.html");
______TS("Cancelling goes to login page");
confirmationPage.clickCancelButton();
______TS("Confirming goes to home page");
browser.driver.get(homePageActionUrl);
studentHomePage = AppPage.createCorrectLoginPageType(browser).loginAsStudent(TestProperties.TEST_STUDENT1_ACCOUNT, TestProperties.TEST_STUDENT1_PASSWORD);
browser.driver.get(joinLink);
confirmationPage = AppPage.getNewPageInstance(browser, StudentCourseJoinConfirmationPage.class);
confirmationPage.clickConfirmButton();
studentHomePage = AppPage.getNewPageInstance(browser, StudentHomePage.class);
studentHomePage.waitForTextsForAllStatusMessagesToUserEquals(String.format(Const.StatusMessages.STUDENT_COURSE_JOIN_SUCCESSFUL, "[" + courseId + "] " + courseName), String.format(Const.StatusMessages.HINT_FOR_NO_SESSIONS_STUDENT, "[" + courseId + "] " + courseName), "Meanwhile, you can update your profile here.");
______TS("already joined, no confirmation page");
browser.driver.get(joinLink);
confirmationPage = AppPage.getNewPageInstance(browser, StudentCourseJoinConfirmationPage.class);
confirmationPage.clickConfirmButton();
studentHomePage = AppPage.getNewPageInstance(browser, StudentHomePage.class);
expectedMsg = "You (" + TestProperties.TEST_STUDENT1_ACCOUNT + ") have already joined this course";
studentHomePage.waitForTextsForAllStatusMessagesToUserEquals(expectedMsg);
assertTrue(browser.driver.getCurrentUrl().contains(Const.ParamsNames.ERROR + "=true"));
}
use of teammates.test.pageobjects.StudentHomePage in project teammates by TEAMMATES.
the class StudentHomePageUiTest method testContentAndLogin.
private void testContentAndLogin() throws Exception {
______TS("content: no courses, 'welcome stranger' message");
String unregUserId = TestProperties.TEST_UNREG_ACCOUNT;
String unregPassword = TestProperties.TEST_UNREG_PASSWORD;
// delete account if it exists
BackDoor.deleteAccount(unregUserId);
logout();
studentHome = getHomePage().clickStudentLogin().loginAsStudent(unregUserId, unregPassword);
// this test uses the accounts from test.properties
// do not do full HTML verification here as the unregistered username is not predictable
studentHome.verifyHtmlMainContent("/studentHomeHTMLEmpty.html");
______TS("persistence check");
loginWithPersistenceProblem();
// This is the full HTML verification for Student Home Page, the rest can all be verifyMainHtml
studentHome.verifyHtml("/studentHomeHTMLPersistenceCheck.html");
______TS("login");
studentHome = getHomePage().clickStudentLogin().loginAsStudent(TestProperties.TEST_STUDENT1_ACCOUNT, TestProperties.TEST_STUDENT1_PASSWORD);
______TS("content: multiple courses");
// this test uses the accounts from test.properties
studentHome.verifyHtmlMainContent("/studentHomeHTML.html");
AppUrl detailsPageUrl = createUrl(Const.ActionURIs.STUDENT_HOME_PAGE).withUserId(testData.students.get("SHomeUiT.charlie.d@SHomeUiT.CS2104").googleId);
StudentHomePage studentHomePage = loginAdminToPage(detailsPageUrl, StudentHomePage.class);
studentHomePage.verifyHtmlMainContent("/studentHomeTypicalHTML.html");
______TS("content: requires sanitization");
detailsPageUrl = createUrl(Const.ActionURIs.STUDENT_HOME_PAGE).withUserId(testData.students.get("SHomeUiT.student1InTestingSanitizationCourse").googleId);
studentHomePage = loginAdminToPage(detailsPageUrl, StudentHomePage.class);
studentHomePage.verifyHtmlMainContent("/studentHomeTypicalTestingSanitization.html");
}
Aggregations