Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IVYPORTAL-18153 Fix GUI tests #1320

Merged
merged 8 commits into from
Dec 23, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,19 @@ public void startSideStep() {
}

public void inputValue(String employee, String from, String to, String representation) {
$(By.id("leave-request:fullname")).shouldBe(Condition.appear).shouldBe(Condition.editable).sendKeys(employee);
$(By.id("leave-request:substitute")).sendKeys(representation);
$(By.id("leave-request:from_input")).sendKeys(from);
$(By.id("leave-request:to_input")).sendKeys(to);
}

public void inputField(String cssSelector, String value) {
$(cssSelector).shouldBe(Condition.appear).shouldBe(Condition.editable).sendKeys(value);
SelenideElement fullNameElement =
$(By.id("leave-request:fullname")).shouldBe(Condition.appear).shouldBe(Condition.editable);
fullNameElement.click();
fullNameElement.sendKeys(employee);
SelenideElement representationElement = $(By.id("leave-request:substitute"));
representationElement.click();
representationElement.sendKeys(representation);
SelenideElement fromElement = $(By.id("leave-request:from_input"));
fromElement.click();
fromElement.sendKeys(from);
SelenideElement toElement = $(By.id("leave-request:to_input"));
toElement.click();
toElement.sendKeys(to);
}

public NewDashboardPage clickSubmitButton() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import com.codeborne.selenide.WebDriverConditions;
import com.codeborne.selenide.WebDriverRunner;
import com.codeborne.selenide.WebElementCondition;
import com.codeborne.selenide.conditions.Not;

public abstract class TemplatePage extends AbstractPage {
private static final int IFRAME_SCREENSHOT_FILE_SIZE_AT_MINIMUM = 10000;
Expand Down Expand Up @@ -541,4 +540,11 @@ public QRCodePage openQRCode() {
$("[id='mobile-app-item']").shouldBe(appear, DEFAULT_TIMEOUT).click();
return new QRCodePage();
}

public void sendKeys(String cssSelector, String value) {
SelenideElement element = $(cssSelector).shouldBe(Condition.appear).shouldBe(Condition.editable);
element.click();
element.clear();
element.sendKeys(value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ public void testNavigateAfterFinishedTaskToCaseDetails() {
taskDetailsPage = caseDetailsPage.openTasksOfCasePage(PAYMENT_TASK_NAME);

TaskIFrameTemplatePage taskTemplatePage = taskDetailsPage.clickStartTask();
taskTemplatePage.inputField("[id$='payment-request:fullname']", "Demo");
taskTemplatePage.sendKeys("[id$='payment-request:fullname']", "Demo");
String today = LocalDateTime.now().format(DateTimeFormatter.ofPattern(DateTimePattern.DATE_TIME_PATTERN));
taskTemplatePage.inputField("[id$='payment-request:from_input']", today);
taskTemplatePage.sendKeys("[id$='payment-request:from_input']", today);

taskTemplatePage.clickOnSubmitButton();
caseDetailsPage = new CaseDetailsPage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public void testFilterDateOnCustomFields() {
taskWidget = newDashboardPage.selectTaskWidget(YOUR_TASK_WIDGET);
taskWidget.openFilterWidget();
taskWidget.addFilter("Shipment date", FilterOperator.BETWEEN);
taskWidget.inputValueOnLatestFilter(FilterValueType.DATE_BETWEEN, "01/01/2024","12/12/2024");
taskWidget.inputValueOnLatestFilter(FilterValueType.DATE_BETWEEN, "01/01/2024", "12/12/2124");
taskWidget.clickOnWidgetFilterHeader();
taskWidget.applyFilter();
taskWidget.countAllTasks().shouldHave(CollectionCondition.size(2));
Expand Down
Loading