com.polonium.webdriver.example.OnetSearchTest Maven / Gradle / Ivy
package com.polonium.webdriver.example;
import static com.polonium.webdriver.Browser.FIREFOX;
import static com.polonium.webdriver.Browser.IEXPLORER;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import org.junit.Test;
import com.polonium.core.annotations.DetailedDescription;
import com.polonium.core.annotations.Given;
import com.polonium.core.annotations.Then;
import com.polonium.core.annotations.When;
import com.polonium.webdriver.PoloniumWebdriver;
import com.polonium.webdriver.annotations.TargetBrowser;
import com.polonium.webdriver.example.pages.OnetMainPage;
import com.polonium.webdriver.example.pages.SearchResultsPage;
@DetailedDescription
@TargetBrowser({ FIREFOX, IEXPLORER })
public class OnetSearchTest extends PoloniumWebdriver{
@Given("main onet.pl page")
@When("enter phase and click search")
@Then("at least result is displayed")
@Test
public void shouldDisplaySomeResults(){
OnetMainPage onetMainPage = new OnetMainPage();
SearchResultsPage searchResultsPage = onetMainPage
.fillSearchField()
.clickSearchButton();
assertTrue(searchResultsPage.isAnyResultDisplayed());
}
@Given("main onet.pl page")
@When("click search without entering phase")
@Then("no results are displayed")
@Test
public void shouldNotDisplayAnyResult(){
OnetMainPage onetMainPage = new OnetMainPage();
SearchResultsPage searchResultsPage = onetMainPage
.clickSearchButton();
assertFalse(searchResultsPage.isAnyResultDisplayed());
}
}