Stop tracking chromedriver.exe
This commit is contained in:
parent
d201ad8bfb
commit
3f5847053e
BIN
.gitignore
vendored
BIN
.gitignore
vendored
Binary file not shown.
@ -12,7 +12,7 @@ public class TestPropManager {
|
||||
try (FileInputStream fis = new FileInputStream("environment.properties")) {
|
||||
properties.load(fis);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Не удалось загрузить environment.properties", e);
|
||||
throw new RuntimeException("Неудалось загрузить environment.properties", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
53
src/test/java/ru/ibs/tests/ApplineBusinessTripTest.java
Normal file
53
src/test/java/ru/ibs/tests/ApplineBusinessTripTest.java
Normal file
@ -0,0 +1,53 @@
|
||||
package ru.ibs.tests;
|
||||
|
||||
import org.junit.*;
|
||||
import org.openqa.selenium.By;
|
||||
import ru.ibs.framework.managers.DriverManager;
|
||||
|
||||
public class ApplineBusinessTripTest extends BaseTests {
|
||||
|
||||
private LoginPage loginPage;
|
||||
private DashboardPage dashboardPage;
|
||||
private BusinessTripPage businessTripPage;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
// Получаем драйвер из DriverManager (инициализирован в BaseTests)
|
||||
loginPage = new LoginPage(DriverManager.getDriverManager().getDriver());
|
||||
|
||||
// Открываем страницу логина
|
||||
DriverManager.getDriverManager().getDriver().get("http://training.appline.ru/user/login");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void applineLoginScenario() {
|
||||
dashboardPage = loginPage.login("Irina Filippova", "testing");
|
||||
Assert.assertTrue("Dashboard not loaded", dashboardPage.isDashboardLoaded());
|
||||
|
||||
businessTripPage = dashboardPage.goToBusinessTrip();
|
||||
Assert.assertTrue("Trips page not loaded", businessTripPage.isTripsPageLoaded());
|
||||
|
||||
businessTripPage.openCreateTripForm();
|
||||
|
||||
businessTripPage.selectDepartment("Отдел внутренней разработки");
|
||||
businessTripPage.selectOrganization("Edge");
|
||||
businessTripPage.setTicketsCheckbox(true);
|
||||
businessTripPage.fillCity("Дмитров");
|
||||
|
||||
businessTripPage.fillDate(
|
||||
By.xpath("//input[@placeholder='Укажите дату' and contains(@id, 'departureDatePlan')]"),
|
||||
"01.01.2025"
|
||||
);
|
||||
|
||||
businessTripPage.fillDate(
|
||||
By.xpath("//input[@placeholder='Укажите дату' and contains(@id, 'returnDatePlan')]"),
|
||||
"10.01.2025"
|
||||
);
|
||||
|
||||
businessTripPage.saveAndClose();
|
||||
|
||||
Assert.assertTrue("Expected validation error not shown",
|
||||
businessTripPage.isErrorDisplayed("Список командируемых сотрудников не может быть пустым"));
|
||||
}
|
||||
|
||||
}
|
@ -8,8 +8,8 @@ import org.openqa.selenium.support.ui.*;
|
||||
import java.time.Duration;
|
||||
|
||||
public class BusinessTripPage {
|
||||
private WebDriver driver;
|
||||
private WebDriverWait wait;
|
||||
private final WebDriver driver;
|
||||
private final WebDriverWait wait;
|
||||
|
||||
@FindBy(xpath = "//h1[contains(text(), 'Командировки')]")
|
||||
private WebElement tripsHeader;
|
||||
@ -77,7 +77,6 @@ public class BusinessTripPage {
|
||||
scrollToElement(cityInput);
|
||||
cityInput.clear();
|
||||
cityInput.sendKeys(city);
|
||||
// Optionally assert
|
||||
}
|
||||
|
||||
public void fillDate(By dateLocator, String dateValue) {
|
||||
@ -86,7 +85,6 @@ public class BusinessTripPage {
|
||||
dateInput.clear();
|
||||
dateInput.sendKeys(dateValue);
|
||||
dateInput.sendKeys(Keys.TAB);
|
||||
// Optionally assert
|
||||
}
|
||||
|
||||
public void saveAndClose() {
|
||||
|
@ -1,89 +0,0 @@
|
||||
package ru.ibs.tests;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.openqa.selenium.*;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
public class TestTrainingAppline {
|
||||
|
||||
private WebDriver driver;
|
||||
private WebDriverWait wait;
|
||||
Duration default_timeout = Duration.ofSeconds(10);
|
||||
Duration default_sleep = Duration.ofMillis(500);
|
||||
String fieldXPath = "//input[@id='%s']";
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
// win
|
||||
System.setProperty("webdriver.chrome.driver", "src/test/resources/chromedriver.exe");
|
||||
|
||||
driver = new ChromeDriver();
|
||||
driver.manage().window().maximize();
|
||||
driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(30));
|
||||
driver.manage().timeouts().scriptTimeout(Duration.ofSeconds(30));
|
||||
|
||||
wait = new WebDriverWait(driver, default_timeout, default_sleep);
|
||||
|
||||
String baseUrl = "http://training.appline.ru/user/login";
|
||||
driver.get(baseUrl);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void applineLoginScenario() throws InterruptedException {
|
||||
|
||||
WebElement usernameField = driver.findElement(By.xpath(String.format(fieldXPath, "prependedInput")));
|
||||
fillInputField(usernameField, "Irina Filippova");
|
||||
|
||||
WebElement passwordField = driver.findElement(By.xpath(String.format(fieldXPath, "prependedInput2")));
|
||||
fillInputField(passwordField, "testing");
|
||||
|
||||
// Нажать на кнопку Войти
|
||||
String buttonLocator = "//button[@type='submit']";
|
||||
WebElement loginButton = driver.findElement(By.xpath(buttonLocator));
|
||||
scrollToElementJs(loginButton);
|
||||
waitUtilElementToBeClickable(loginButton);
|
||||
loginButton.click();
|
||||
|
||||
Thread.sleep(5000);
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() {
|
||||
driver.quit();
|
||||
}
|
||||
|
||||
private void scrollToElementJs(WebElement element) {
|
||||
JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver;
|
||||
javascriptExecutor.executeScript("arguments[0].scrollIntoView(true);", element);
|
||||
}
|
||||
|
||||
private void waitUtilElementToBeClickable(WebElement element) {
|
||||
wait.until(ExpectedConditions.elementToBeClickable(element));
|
||||
}
|
||||
|
||||
private void waitUtilElementToBeVisible(By locator) {
|
||||
wait.until(ExpectedConditions.visibilityOfElementLocated(locator));
|
||||
}
|
||||
|
||||
private void waitUtilElementToBeVisible(WebElement element) {
|
||||
wait.until(ExpectedConditions.visibilityOf(element));
|
||||
}
|
||||
|
||||
private void fillInputField(WebElement element, String value) {
|
||||
scrollToElementJs(element);
|
||||
waitUtilElementToBeClickable(element);
|
||||
element.click();
|
||||
element.clear();
|
||||
element.sendKeys(value);
|
||||
boolean checkFlag = wait.until(ExpectedConditions.attributeContains(element, "value", value));
|
||||
Assert.assertTrue("Поле было заполнено некорректно", checkFlag);
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user