-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
94 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package selenium.contributor; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
import selenium.util.ErrorHelper; | ||
|
||
public class ContributorPage { | ||
|
||
private WebDriver driver; | ||
|
||
public ContributorPage(WebDriver driver) { | ||
this.driver = driver; | ||
|
||
driver.findElement(By.id("contributorPage")); | ||
|
||
ErrorHelper.verifyNoScriptOrMarkupError(driver); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
src/test/java/selenium/contributor/ContributorPageTest.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,55 @@ | ||
package selenium.contributor; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.chrome.ChromeDriver; | ||
import org.openqa.selenium.chrome.ChromeOptions; | ||
|
||
import selenium.util.DomainHelper; | ||
|
||
public class ContributorPageTest { | ||
|
||
private final Logger logger = LogManager.getLogger(); | ||
|
||
private WebDriver driver; | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
logger.info("setUp"); | ||
|
||
ChromeOptions chromeOptions = new ChromeOptions(); | ||
|
||
// Read "headless" property set on the command line: | ||
// mvn clean verify -P regression-test-ui -D headless=true | ||
String headlessSystemProperty = System.getProperty("headless"); | ||
logger.info("headlessSystemProperty: \"" + headlessSystemProperty + "\""); | ||
if ("true".equals(headlessSystemProperty)) { | ||
chromeOptions.addArguments("headless"); | ||
} | ||
|
||
driver = new ChromeDriver(chromeOptions); | ||
|
||
driver.get(DomainHelper.getBaseUrl() + "/contributor/list"); | ||
} | ||
|
||
@AfterEach | ||
public void tearDown() { | ||
logger.info("tearDown"); | ||
|
||
driver.quit(); | ||
} | ||
|
||
@Test | ||
public void testContributorPage() { | ||
logger.info("testContributorPage"); | ||
|
||
ContributorListPage contributorListPage = new ContributorListPage(driver); | ||
contributorListPage.pressRandomContributor(); | ||
|
||
ContributorPage contributorPage = new ContributorPage(driver); | ||
} | ||
} |