bugfix
This commit is contained in:
parent
181581f3bc
commit
7e349a72ec
@ -24,7 +24,7 @@ public class ExternalLinks {
|
||||
context.close();
|
||||
}
|
||||
@Test
|
||||
public void OpenMapTest()
|
||||
public void OpenMapTest()
|
||||
{
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
@ -52,6 +52,9 @@ public class ExternalLinks {
|
||||
AboutCompanyPage aboutPage = PageFactory.initElements(context.getDriver(), AboutCompanyPage.class);
|
||||
aboutPage.clickShareElement();
|
||||
aboutPage.isPageDisplaySubmitButton();
|
||||
Assertions.assertTrue(aboutPage.isPageDisplaySubmitButton());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ import page.*;
|
||||
public class Search {
|
||||
private final static String APP_URL = "http://www.sberbank-ast.ru/";
|
||||
private static Context context;
|
||||
|
||||
String search = "Поставка";
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() {
|
||||
@ -29,31 +29,31 @@ public class Search {
|
||||
public void searchHeaderTest() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.insertSearchHeaderText("Поставка");
|
||||
page.insertSearchHeaderText(search);
|
||||
page.submitSearchHeader();
|
||||
SearchPage searchPage = PageFactory.initElements(context.getDriver(), SearchPage.class);
|
||||
Assertions.assertTrue(searchPage.checkSearch());
|
||||
Assertions.assertTrue(searchPage.checkSearch(search));
|
||||
}
|
||||
@Test
|
||||
public void searchHeaderTestWithFilter() {
|
||||
public void searchHeaderTestWithFilter() throws RuntimeException{
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.insertSearchHeaderText("Поставка");
|
||||
page.insertSearchHeaderText(search);
|
||||
page.submitSearchHeader();
|
||||
SearchPage searchPage = PageFactory.initElements(context.getDriver(), SearchPage.class);
|
||||
searchPage.clickSearchFilter();
|
||||
Assertions.assertTrue(searchPage.checkSearch());
|
||||
Assertions.assertTrue(searchPage.checkSearch(search));
|
||||
Assertions.assertTrue(searchPage.checkFilter());
|
||||
}
|
||||
@Test
|
||||
public void searchHeaderTestWithSorting() {
|
||||
context.getDriver().get(APP_URL);
|
||||
MainPage page = PageFactory.initElements(context.getDriver(), MainPage.class);
|
||||
page.insertSearchHeaderText("Поставка");
|
||||
page.insertSearchHeaderText(search);
|
||||
page.submitSearchHeader();
|
||||
SearchPage searchPage = PageFactory.initElements(context.getDriver(), SearchPage.class);
|
||||
searchPage.clickSearchSortingElement();
|
||||
Assertions.assertTrue(searchPage.checkSearch());
|
||||
Assertions.assertTrue(searchPage.checkSearch(search));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -4,30 +4,35 @@ import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
|
||||
public class AboutCompanyPage {
|
||||
WebDriver driver;
|
||||
private WebDriver driver ;
|
||||
private WebDriverWait wait;
|
||||
public AboutCompanyPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
wait = new WebDriverWait(driver,30,500);
|
||||
}
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"blockFacebook\"]/div/span/iframe")
|
||||
private WebElement shareFrame;
|
||||
|
||||
@FindBy(css = "#u_0_3 > button")
|
||||
private WebElement shareButton;
|
||||
|
||||
public void clickShareElement() {
|
||||
public void clickShareElement(){
|
||||
|
||||
wait.until(ExpectedConditions.visibilityOf(shareFrame));
|
||||
driver.switchTo().frame(shareFrame);
|
||||
sleep();
|
||||
shareButton.click();
|
||||
sleep();
|
||||
for (String winHandle : driver.getWindowHandles()) {
|
||||
driver.switchTo().window(winHandle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public AboutCompanyPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public boolean isPageDisplayQuality() {
|
||||
return driver.findElement(By.cssSelector("#ctl00_phWorkZone_ContentItem_lblbody")).isDisplayed();
|
||||
@ -38,12 +43,5 @@ public class AboutCompanyPage {
|
||||
return driver.findElement(By.cssSelector("#u_0_0")).isDisplayed();
|
||||
}
|
||||
|
||||
public void sleep() {
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,10 +4,13 @@ import org.junit.jupiter.api.Assertions;
|
||||
import org.openqa.selenium.*;
|
||||
import org.openqa.selenium.interactions.Actions;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
|
||||
public class MainPage {
|
||||
String headline = "";
|
||||
WebDriver driver;
|
||||
private WebDriverWait wait;
|
||||
@FindBy(css = "#response_slider_wrap iframe")
|
||||
private WebElement feedbackFrame;
|
||||
|
||||
@ -119,6 +122,7 @@ public class MainPage {
|
||||
private WebElement documentsSubmenuElement;
|
||||
public MainPage(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
wait = new WebDriverWait(driver,30,5000);
|
||||
}
|
||||
|
||||
public void clickMoreInformation() {
|
||||
@ -160,13 +164,10 @@ public class MainPage {
|
||||
}
|
||||
public void clickFeedbackElement() {
|
||||
FeedbackElement.click();
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
driver.switchTo().frame(feedbackFrame);
|
||||
AllFeedbackElement.click();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
wait.until(ExpectedConditions.visibilityOf(feedbackFrame));
|
||||
driver.switchTo().frame(feedbackFrame);
|
||||
AllFeedbackElement.click();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -259,11 +260,11 @@ public class MainPage {
|
||||
}
|
||||
|
||||
|
||||
public boolean isPageDisplayTender()
|
||||
{
|
||||
String checkNumber = checkNumberElement.getText();
|
||||
return checkNumber.equals(clickFzElement());
|
||||
}
|
||||
public boolean isPageDisplayTender()
|
||||
{
|
||||
String checkNumber = checkNumberElement.getText();
|
||||
return checkNumber.equals(clickFzElement());
|
||||
}
|
||||
|
||||
|
||||
public boolean isPageDisplayArticle()
|
||||
@ -288,7 +289,7 @@ public class MainPage {
|
||||
" > div > h2:nth-child(2)")).isDisplayed();
|
||||
}
|
||||
public boolean isPageDisplayMain() {
|
||||
try {
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -56,15 +56,12 @@ public class SearchPage {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void clickSearchSortingElement() {
|
||||
searchSortingElement.click();
|
||||
}
|
||||
public boolean checkSearch() {
|
||||
public boolean checkSearch(String strSearch) {
|
||||
boolean checkSearch = false;
|
||||
int count = listResultSearch.size();
|
||||
String strSearch = searchHeaderElement.getAttribute("value");
|
||||
for (int i = 0; i < count - 1; i++) {
|
||||
if (listResultSearch.get(i).getText().contains(strSearch))
|
||||
checkSearch = true;
|
||||
@ -75,10 +72,9 @@ public class SearchPage {
|
||||
|
||||
public boolean checkFilter()
|
||||
{
|
||||
double b = Math.round(Double.parseDouble(resultElement.getText().replaceAll(" ", "")));
|
||||
if (b > pr)
|
||||
return true;
|
||||
else return false;
|
||||
double b = Math.round(Double.parseDouble(resultElement.getText().replaceAll(" ", "")));
|
||||
return b > pr;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user