com.polonium.webdriver.example.CloneOnetSearchTest Maven / Gradle / Ivy
package com.polonium.webdriver.example;
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.Browser;
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({Browser.IEXPLORER, Browser.FIREFOX, Browser.CHROME})
public class CloneOnetSearchTest 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());
}
}