-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add E2E skeleton * Fix test and lint * Add verifyEmailSent * fix fe tests
- Loading branch information
Showing
8 changed files
with
130 additions
and
2 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
src/e2e/java/teammates/e2e/cases/sql/RequestPageE2ETest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package teammates.e2e.cases.sql; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
import teammates.common.util.AppUrl; | ||
import teammates.common.util.Const; | ||
import teammates.common.util.EmailType; | ||
import teammates.e2e.pageobjects.RequestPage; | ||
import teammates.e2e.util.TestProperties; | ||
|
||
/** | ||
* SUT: {@link Const.WebPageURIs#ACCOUNT_REQUEST_PAGE}. | ||
*/ | ||
public class RequestPageE2ETest extends BaseE2ETestCase { | ||
|
||
@Override | ||
protected void prepareTestData() { | ||
// No test data needed | ||
} | ||
|
||
@Test | ||
@Override | ||
protected void testAll() { | ||
String name = "arf-test-name"; | ||
String institution = "arf-test-institution"; | ||
String country = "arf-test-country"; | ||
String email = TestProperties.TEST_EMAIL; | ||
String comments = "arf-test-comments"; | ||
|
||
AppUrl url = createFrontendUrl(Const.WebPageURIs.ACCOUNT_REQUEST_PAGE); | ||
RequestPage requestPage = getNewPageInstance(url, RequestPage.class); | ||
|
||
______TS("verify submission with comments"); | ||
requestPage.clickAmInstructorButton(); | ||
requestPage.fillForm(name, institution, country, email, comments); | ||
requestPage.clickSubmitFormButton(); | ||
requestPage.verifySubmittedInfo(name, institution, country, email, comments); | ||
|
||
String expectedEmailSubject = EmailType.NEW_ACCOUNT_REQUEST_ACKNOWLEDGEMENT.toString(); | ||
verifyEmailSent(email, expectedEmailSubject); | ||
|
||
______TS("verify submission without comments"); | ||
requestPage = getNewPageInstance(url, RequestPage.class); | ||
requestPage.clickAmInstructorButton(); | ||
requestPage.fillForm(name, institution, country, email, ""); | ||
requestPage.clickSubmitFormButton(); | ||
requestPage.verifySubmittedInfo(name, institution, country, email, ""); | ||
|
||
expectedEmailSubject = EmailType.NEW_ACCOUNT_REQUEST_ACKNOWLEDGEMENT.toString(); | ||
verifyEmailSent(email, expectedEmailSubject); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package teammates.e2e.pageobjects; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
|
||
/** | ||
* Page Object Model for account request form page. | ||
*/ | ||
public class RequestPage extends AppPage { | ||
|
||
@FindBy(id = "btn-am-instructor") | ||
private WebElement amInstructorButton; | ||
|
||
@FindBy(id = "name") | ||
private WebElement nameBox; | ||
|
||
@FindBy(id = "institution") | ||
private WebElement institutionBox; | ||
|
||
@FindBy(id = "country") | ||
private WebElement countryBox; | ||
|
||
@FindBy(id = "email") | ||
private WebElement emailBox; | ||
|
||
@FindBy(id = "comments") | ||
private WebElement commentsBox; | ||
|
||
@FindBy(id = "submit-button") | ||
private WebElement submitButton; | ||
|
||
public RequestPage(Browser browser) { | ||
super(browser); | ||
} | ||
|
||
@Override | ||
protected boolean containsExpectedPageContents() { | ||
return getPageTitle().contains("Request for an Instructor Account"); | ||
} | ||
|
||
public void clickAmInstructorButton() { | ||
click(amInstructorButton); | ||
waitForPageToLoad(); | ||
} | ||
|
||
public void fillForm(String name, String institution, String country, String email, String comments) { | ||
fillTextBox(nameBox, name); | ||
fillTextBox(institutionBox, institution); | ||
fillTextBox(countryBox, country); | ||
fillTextBox(emailBox, email); | ||
fillTextBox(commentsBox, comments); | ||
} | ||
|
||
public void clickSubmitFormButton() { | ||
click(submitButton); | ||
waitForPageToLoad(); | ||
} | ||
|
||
public void verifySubmittedInfo(String name, String institution, String country, String email, String comments) { | ||
WebElement table = browser.driver.findElement(By.className("table")); | ||
String[][] expected = { | ||
{ name }, | ||
{ institution }, | ||
{ country }, | ||
{ email }, | ||
{ comments }, | ||
}; | ||
verifyTableBodyValues(table, expected); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters