diff --git a/src/e2e/java/teammates/e2e/cases/AdminHomePageE2ETest.java b/src/e2e/java/teammates/e2e/cases/AdminHomePageE2ETest.java index 014913e639c..b1982ab798b 100644 --- a/src/e2e/java/teammates/e2e/cases/AdminHomePageE2ETest.java +++ b/src/e2e/java/teammates/e2e/cases/AdminHomePageE2ETest.java @@ -26,26 +26,25 @@ public void testAll() { AdminHomePage homePage = loginAdminToPage(url, AdminHomePage.class); ______TS("Test adding instructors with both valid and invalid details"); - String name = "AHPUiT Instrúctör WithPlusInEmail"; String email = "AHPUiT+++_.instr1!@gmail.tmt"; String institute = "TEAMMATES Test Institute 1"; - homePage.queueInstructorForAdding(name, email, institute); String singleLineDetails = "Instructor With Invalid Email | invalidemail | TEAMMATES Test Institute 1"; - homePage.queueInstructorForAdding(singleLineDetails); - - homePage.addAllInstructors(); - - String successMessage = homePage.getMessageForInstructor(0); - assertTrue(successMessage.contains( - "Instructor \"AHPUiT Instrúctör WithPlusInEmail\" has been successfully created")); - - String failureMessage = homePage.getMessageForInstructor(1); - assertTrue(failureMessage.contains( - "\"invalidemail\" is not acceptable to TEAMMATES as a/an email because it is not in the correct format.")); + homePage.verifyStatusMessage("\"invalidemail\" is not acceptable to TEAMMATES as a/an email because it is not " + + "in the correct format. An email address contains some text followed by one '@' sign followed by some " + + "more text, and should end with a top level domain address like .com. It cannot be longer than 254 " + + "characters, cannot be empty and cannot contain spaces."); + + ______TS("Verify that newly added instructor appears in account request table"); + homePage.verifyInstructorInAccountRequestTable(name, email, institute); + + ______TS("Test approving a valid account request"); + homePage.clickApproveAccountRequestButton(name, email, institute); + homePage.verifyStatusMessage("Account request was successfully approved. Email has been sent to " + + "AHPUiT+++_.instr1!@gmail.tmt."); } } diff --git a/src/e2e/java/teammates/e2e/cases/sql/AdminHomePageE2ETest.java b/src/e2e/java/teammates/e2e/cases/sql/AdminHomePageE2ETest.java index e4e4d8c3560..4335ab6a226 100644 --- a/src/e2e/java/teammates/e2e/cases/sql/AdminHomePageE2ETest.java +++ b/src/e2e/java/teammates/e2e/cases/sql/AdminHomePageE2ETest.java @@ -23,33 +23,25 @@ public void testAll() { AdminHomePage homePage = loginAdminToPage(url, AdminHomePage.class); ______TS("Test adding instructors with both valid and invalid details"); - String name = "AHPUiT Instrúctör WithPlusInEmail"; String email = "AHPUiT+++_.instr1!@gmail.tmt"; String institute = "TEAMMATES Test Institute 1"; - homePage.queueInstructorForAdding(name, email, institute); String singleLineDetails = "Instructor With Invalid Email | invalidemail | TEAMMATES Test Institute 1"; - homePage.queueInstructorForAdding(singleLineDetails); - - homePage.addAllInstructors(); - - String successMessage = homePage.getMessageForInstructor(0); - assertTrue(successMessage.contains( - "Instructor \"AHPUiT Instrúctör WithPlusInEmail\" has been successfully created")); - - String failureMessage = homePage.getMessageForInstructor(1); - assertTrue(failureMessage.contains( - "\"invalidemail\" is not acceptable to TEAMMATES as a/an email because it is not in the correct format.")); - - homePage.reloadPage(); + homePage.verifyStatusMessage("\"invalidemail\" is not acceptable to TEAMMATES as a/an email because it is not " + + "in the correct format. An email address contains some text followed by one '@' sign followed by some " + + "more text, and should end with a top level domain address like .com. It cannot be longer than 254 " + + "characters, cannot be empty and cannot contain spaces."); ______TS("Verify that newly added instructor appears in account request table"); - homePage.verifyInstructorInAccountRequestTable(name, email, institute); + ______TS("Test approving a valid account request"); + homePage.clickApproveAccountRequestButton(name, email, institute); + homePage.verifyStatusMessage("Account request was successfully approved. Email has been sent to " + + "AHPUiT+++_.instr1!@gmail.tmt."); } } diff --git a/src/e2e/java/teammates/e2e/pageobjects/AdminHomePage.java b/src/e2e/java/teammates/e2e/pageobjects/AdminHomePage.java index 9316f042077..aa9503b45eb 100644 --- a/src/e2e/java/teammates/e2e/pageobjects/AdminHomePage.java +++ b/src/e2e/java/teammates/e2e/pageobjects/AdminHomePage.java @@ -36,9 +36,6 @@ public class AdminHomePage extends AppPage { @FindBy (id = "add-instructor-single-line") private WebElement submitButtonDetailsSingleLineForm; - @FindBy (id = "add-all-instructors") - private WebElement addAllInstructorsButton; - public AdminHomePage(Browser browser) { super(browser); } @@ -69,19 +66,13 @@ public void queueInstructorForAdding(String instructorDetails) { click(submitButtonDetailsSingleLineForm); } - public void addAllInstructors() { - click(addAllInstructorsButton); - waitForElementToBeClickable(addAllInstructorsButton); - } - - public String getMessageForInstructor(int i) { - By by = By.id("message-instructor-" + i); - waitForElementVisibility(by); - WebElement element = browser.driver.findElement(by); - if (element == null) { - return null; - } - return element.getText(); + public void clickApproveAccountRequestButton(String name, String email, String institute) { + WebElement accountRequestRow = getAccountRequestRow(name, email, institute); + waitForElementPresence(By.cssSelector("[id^='approve-account-request-']")); + WebElement approveButton = accountRequestRow.findElement(By.cssSelector("[id^='approve-account-request-']")); + waitForElementToBeClickable(approveButton); + approveButton.click(); + waitForPageToLoad(); } public void clickMoreInfoButtonForRegisteredInstructor(int i) { diff --git a/src/web/app/pages-admin/admin-home-page/__snapshots__/admin-home-page.component.spec.ts.snap b/src/web/app/pages-admin/admin-home-page/__snapshots__/admin-home-page.component.spec.ts.snap index b091996522f..83d1122d34f 100644 --- a/src/web/app/pages-admin/admin-home-page/__snapshots__/admin-home-page.component.spec.ts.snap +++ b/src/web/app/pages-admin/admin-home-page/__snapshots__/admin-home-page.component.spec.ts.snap @@ -11,10 +11,7 @@ exports[`AdminHomePageComponent should snap with default view 1`] = ` instructorEmail="" instructorInstitution="" instructorName="" - instructorsConsolidated={[Function Array]} - isAddingInstructors="false" items$={[Function Observable]} - linkService={[Function LinkService]} pageSize={[Function Number]} statusMessageService={[Function StatusMessageService]} timezoneService={[Function TimezoneService]} @@ -128,21 +125,18 @@ exports[`AdminHomePageComponent should snap with default view 1`] = ` `; -exports[`AdminHomePageComponent should snap with disabled adding instructor button if there are active requests 1`] = ` +exports[`AdminHomePageComponent should snap with some instructors details 1`] = ` -
+
- - Result - -
-
+
+ + Pending Account Requests + +
@@ -280,501 +273,336 @@ exports[`AdminHomePageComponent should snap with disabled adding instructor butt Email + - + - - - - - - - - - -
- Institution + Status - Action + Institute, Country - Status + Created At + + Comments - Message + Options
- - Instructor A - + Instructor A - - instructora@example.com - + instructora@example.com - - Sample Institution A - - + PENDING - ADDING + + Institution and Country A -
- - Instructor B - + Created Time A - - instructorb@example.com - - - - Sample Institution B - + Comment A +
-
+
- Add - + + + +
+
+ + + +
- + + +
- PENDING - -
- -
-
- -
-`; - -exports[`AdminHomePageComponent should snap with some instructors details 1`] = ` - -
-
-
- - Adding Multiple Instructors - -

- - Add Instructor Details in the format: Name | Email | Institution -

-