Revert "v2-1"
This reverts commit b3e391167ba3987bd41454f442d38223155c6cea.
This commit is contained in:
parent
c9ecb2466a
commit
d201ad8bfb
54
pom.xml
54
pom.xml
@ -1,58 +1,30 @@
|
|||||||
<project
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
|
||||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>ru.ibs</groupId>
|
<groupId>ru.ibs</groupId>
|
||||||
<artifactId>appline-test-project</artifactId>
|
<artifactId>sel1</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<name>Archetype - sel1</name>
|
||||||
<properties>
|
<url>https://git.goodtester.ru</url>
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- JUnit -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<version>4.13.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Selenium -->
|
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.seleniumhq.selenium</groupId>
|
<groupId>org.seleniumhq.selenium</groupId>
|
||||||
<artifactId>selenium-java</artifactId>
|
<artifactId>selenium-java</artifactId>
|
||||||
<version>4.33.0</version>
|
<version>4.33.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/junit/junit -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-configuration</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>commons-configuration</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>1.10</version>
|
<version>4.13.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<version>3.1.2</version>
|
|
||||||
<configuration>
|
|
||||||
<includes>
|
|
||||||
<include>**/*Test.java</include>
|
|
||||||
</includes>
|
|
||||||
<systemPropertyVariables>
|
|
||||||
<env.properties>src/test/resources/environment.properties</env.properties>
|
|
||||||
</systemPropertyVariables>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
package ru.ibs.tests;
|
|
||||||
|
|
||||||
import org.junit.*;
|
|
||||||
import org.openqa.selenium.By;
|
|
||||||
import org.openqa.selenium.WebDriver;
|
|
||||||
import org.openqa.selenium.chrome.ChromeDriver;
|
|
||||||
|
|
||||||
import java.time.Duration;
|
|
||||||
|
|
||||||
public class ApplineBusinessTripTest {
|
|
||||||
|
|
||||||
private WebDriver driver;
|
|
||||||
private LoginPage loginPage;
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setUp() {
|
|
||||||
System.setProperty("webdriver.chrome.driver", "src/test/resources/chromedriver.exe");
|
|
||||||
|
|
||||||
driver = new ChromeDriver();
|
|
||||||
driver.manage().window().maximize();
|
|
||||||
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
|
|
||||||
|
|
||||||
driver.get("http://training.appline.ru/user/login");
|
|
||||||
|
|
||||||
loginPage = new LoginPage(driver);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void applineLoginScenario() {
|
|
||||||
DashboardPage dashboardPage = loginPage.login("Irina Filippova", "testing");
|
|
||||||
Assert.assertTrue("Dashboard not loaded", dashboardPage.isDashboardLoaded());
|
|
||||||
|
|
||||||
BusinessTripPage 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("Список командируемых сотрудников не может быть пустым"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
public void tearDown() {
|
|
||||||
if (driver != null) {
|
|
||||||
driver.quit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
89
src/test/java/ru/ibs/tests/TestTrainingAppline.java
Normal file
89
src/test/java/ru/ibs/tests/TestTrainingAppline.java
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user