- добавлены методы для поиска по древо-видным полям КП
This commit is contained in:
parent
08461b6c92
commit
84be994715
@ -1,16 +1,35 @@
|
||||
package page;
|
||||
|
||||
import com.codeborne.selenide.ElementsCollection;
|
||||
import com.codeborne.selenide.SelenideElement;
|
||||
import org.openqa.selenium.By;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
import static com.codeborne.selenide.Selenide.$;
|
||||
import static com.codeborne.selenide.Selenide.getSelectedText;
|
||||
import static com.codeborne.selenide.Condition.*;
|
||||
|
||||
public class DialogPage {
|
||||
public static final By dialogPopUp = By.cssSelector("[test*='popup-search-text']");
|
||||
public static final By dialogPopUp = By.cssSelector("[class*='popupFrame']:not([class*='popupFrameContainer'])");
|
||||
public static final By inputSearchLine = By.cssSelector("[class*='x-input__field']");
|
||||
public static final By searchBtn = By.cssSelector("[class='x-search-box__search-button']");
|
||||
public static final By primaryBtn = By.cssSelector("[test*='ok-button']");
|
||||
public static final By oneItem = By.cssSelector("[class*='x-list__item']");
|
||||
|
||||
public static void searchInFieldByQuery(String query) {
|
||||
$(inputSearchLine).sendKeys(query);
|
||||
$(searchBtn).click();
|
||||
}
|
||||
|
||||
public static void searchInFieldWithTreeByQuery(String query) {
|
||||
$(inputSearchLine).sendKeys(query);
|
||||
$(searchBtn).click();
|
||||
ElementsCollection response = $(dialogPopUp).$$(oneItem);
|
||||
SelenideElement line = response.findBy(text(query));
|
||||
line.shouldBe(visible, Duration.of(10, ChronoUnit.SECONDS));
|
||||
$(dialogPopUp).$(primaryBtn).click();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,22 +3,27 @@ package page;
|
||||
import com.codeborne.selenide.ElementsCollection;
|
||||
import com.codeborne.selenide.SelenideElement;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.NotFoundException;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
import static com.codeborne.selenide.Selenide.*;
|
||||
import static com.codeborne.selenide.Condition.*;
|
||||
|
||||
public class KpPage {
|
||||
public static final By cardBlock = By.cssSelector("[class='x-tabs__content x-page-card-tabs__page']");
|
||||
public static final By fieldsList = By.cssSelector("[test='card-field-list-table']");
|
||||
public static final By fieldsList = By.cssSelector("[test*='card-field-row']");
|
||||
public static final By clearCardBtn = By.cssSelector("[test='card-clear-button']");
|
||||
public static final By cardTabMain = By.cssSelector("[test*='card-tab-0']");
|
||||
|
||||
// Исправить, тк всегда открывает Текст документа
|
||||
public static void openSearchDialogByFieldName(String fieldName) {
|
||||
ElementsCollection list = $$(fieldsList);
|
||||
System.out.println(list.texts());
|
||||
SelenideElement oneField = list.findBy(text(fieldName));
|
||||
oneField.$("[test='card-field-value-content']").click();
|
||||
$(DialogPage.dialogPopUp).shouldBe(visible);
|
||||
System.out.println(oneField.text());
|
||||
oneField.$("[test='card-field-value-content']").doubleClick();
|
||||
$(DialogPage.dialogPopUp).shouldBe(visible, Duration.of(3, ChronoUnit.SECONDS));
|
||||
}
|
||||
|
||||
public static void checkValueInFieldAfterSearch(String fieldName, String query) {
|
||||
@ -33,4 +38,9 @@ public class KpPage {
|
||||
checkValueInFieldAfterSearch(fieldName, query);
|
||||
}
|
||||
|
||||
public static void searchInFieldWithTree(String fieldName, String query) {
|
||||
openSearchDialogByFieldName(fieldName);
|
||||
DialogPage.searchInFieldWithTreeByQuery(query);
|
||||
checkValueInFieldAfterSearch(fieldName, query);
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,9 +41,22 @@ public class ConsultantTest extends BaseTest{
|
||||
BpPage.openFullTreeList();
|
||||
}
|
||||
|
||||
@Test(description = "Проверка поиска в КП по полю текст документа")
|
||||
public void searchInKp() {
|
||||
@Test(description = "Проверка поиска в КП по полю Название документа")
|
||||
public void searchInKpByName() {
|
||||
StartPage.openKP();
|
||||
KpPage.searchInFieldWithoutTree("Название документа", "Закон о полиции");
|
||||
}
|
||||
|
||||
@Test(description = "Проверка поиска в КП по полю Текст документа")
|
||||
public void searchInKpByText() {
|
||||
StartPage.openKP();
|
||||
KpPage.searchInFieldWithoutTree("Текст документа", "Закон о полиции");
|
||||
}
|
||||
|
||||
@Test(description = "Проверка поиска в КП по полю Вид документа")
|
||||
public void searchInKpByNumber() {
|
||||
StartPage.openKP();
|
||||
KpPage.searchInFieldWithTree("Вид документа", "Заключение");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user