58 lines
1.6 KiB
Java
58 lines
1.6 KiB
Java
import PageHelpers.CalculatorPageHelper;
|
|
import Pages.CalculatorPage;
|
|
import context.ChromeContext;
|
|
import context.Context;
|
|
import org.junit.After;
|
|
import org.junit.Assert;
|
|
import org.junit.Before;
|
|
import org.junit.Test;
|
|
import org.openqa.selenium.Dimension;
|
|
import org.openqa.selenium.support.PageFactory;
|
|
|
|
import java.util.logging.Logger;
|
|
|
|
import static java.util.logging.Level.INFO;
|
|
|
|
public class CalculatorTest {
|
|
|
|
private final static String APP_URL = "http://www.gazprom.ru/investors/stock/investor-tools/calc/";
|
|
private static Logger log = Logger.getLogger(CalculatorTest.class.getName());
|
|
private static Context context;
|
|
|
|
@Before
|
|
public void setup() {
|
|
context = new ChromeContext();
|
|
context.start();
|
|
context.getDriver().manage().window().setSize(new Dimension(1600, 900));
|
|
|
|
context.getDriver().get(APP_URL);
|
|
}
|
|
|
|
@After
|
|
public void quit() {
|
|
|
|
context.close();
|
|
}
|
|
|
|
@Test
|
|
public void countInvestor() throws InterruptedException {
|
|
log.logp(INFO, getClass().getName(), "countInvestor", "Investor's count test");
|
|
|
|
CalculatorPage calculatorPage = PageFactory.initElements(context.getDriver(), CalculatorPage.class);
|
|
calculatorPage.switchToCalcFrame();
|
|
|
|
CalculatorPageHelper calculatorPageHelper = new CalculatorPageHelper(calculatorPage);
|
|
|
|
calculatorPageHelper.waitAndInsertFromDate("30.09.2011");
|
|
calculatorPageHelper.waitAndInsertToDate("01.02.2018");
|
|
calculatorPageHelper.waitAndInsertAmount("1");
|
|
|
|
calculatorPage.clickCalcBtn();
|
|
|
|
Thread.sleep(1000);
|
|
|
|
|
|
Assert.assertTrue(calculatorPageHelper.isCalculationRight());
|
|
}
|
|
}
|