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
import org.junit.After; | |
import org.junit.Before; | |
/** | |
* Base class for all tests | |
*/ | |
public class TestBase { | |
@Before | |
public void setUp() throws Exception { |
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
import io.github.bonigarcia.wdm.ChromeDriverManager; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.WebElement; | |
import org.openqa.selenium.chrome.ChromeDriver; | |
import org.openqa.selenium.support.PageFactory; | |
import org.openqa.selenium.support.pagefactory.DefaultElementLocatorFactory; | |
import org.openqa.selenium.support.ui.WebDriverWait; | |
/** | |
* Base class for all pages and page fragments |
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
import org.openqa.selenium.WebElement; | |
import org.openqa.selenium.support.FindBy; | |
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf; | |
public class FacebookPostFragment extends PageBase{ | |
@FindBy(className = "profileLink") | |
private WebElement poster; |
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
import org.openqa.selenium.By; | |
import org.openqa.selenium.WebElement; | |
import org.openqa.selenium.support.FindBy; | |
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf; | |
public class FacebookSportPostsPage extends PageBase{ | |
@FindBy(id = "facebook") | |
private WebElement facebookContent; |
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
import org.junit.Test; | |
public class PageFragmentsExampleTest extends TestBase { | |
@Test | |
public void shareSecondPost() { | |
FacebookSportPostsPage facebookPage = FacebookSportPostsPage.open(); | |
FacebookPostFragment secondPost = facebookPage.getPostByIndex(2); | |
secondPost.share(); | |
} |