Skip to content

Commit

Permalink
IVYPORTAL-18153 Fix GUI tests (#1320) (#1350)
Browse files Browse the repository at this point in the history
* IVYPORTAL-18153 Fix GUI tests

* IVYPORTAL-18153 Fix GUI tests - testDisplayDefaultGrowlAfterFinishTaskWithoutIFrame

* IVYPORTAL-18153 Fix GUI tests - BackNavigationTest#testFinishTaskFromCaseDetailAndGoBack, BackNavigationTest#testNavigateAfterFinishedTaskToCaseDetails

* IVYPORTAL-18153 Fix GUI tests - Try out to fix tests

* IVYPORTAL-18153 Fix GUI tests - Try out to fix tests

* IVYPORTAL-18153 Fix GUI tests - Try out to fix tests

* IVYPORTAL-18153 Fix GUI tests - Try out to fix tests

* IVYPORTAL-18153 Fix GUI tests - Try out to fix tests

(cherry picked from commit cebde2a)

Co-authored-by: Tung Le <[email protected]>
  • Loading branch information
pvthai-axonivy and lttung-axonivy authored Dec 26, 2024
1 parent fd8811f commit 5f15fd3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
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

0 comments on commit 5f15fd3

Please sign in to comment.