From 575f75ccece45776b691fbe3feb027822c35eee6 Mon Sep 17 00:00:00 2001 From: Tung Le Date: Wed, 18 Dec 2024 10:46:17 +0700 Subject: [PATCH 1/8] IVYPORTAL-18153 Fix GUI tests --- .../selenium/test/dashboard/DashboardTaskWidgetFilterTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/dashboard/DashboardTaskWidgetFilterTest.java b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/dashboard/DashboardTaskWidgetFilterTest.java index 538c14dcddc..b522f4b3a0c 100644 --- a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/dashboard/DashboardTaskWidgetFilterTest.java +++ b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/dashboard/DashboardTaskWidgetFilterTest.java @@ -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)); From 851adc52a3ac2963c9af11fbe84be57f301473b9 Mon Sep 17 00:00:00 2001 From: Tung Le Date: Wed, 18 Dec 2024 16:33:21 +0700 Subject: [PATCH 2/8] IVYPORTAL-18153 Fix GUI tests - testDisplayDefaultGrowlAfterFinishTaskWithoutIFrame --- .../axonivy/portal/selenium/page/TaskIFrameTemplatePage.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java index 208d9023cbb..001322d08ca 100644 --- a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java +++ b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java @@ -220,6 +220,9 @@ public void inputValue(String employee, String from, String to, String represent $(By.id("leave-request:substitute")).sendKeys(representation); $(By.id("leave-request:from_input")).sendKeys(from); $(By.id("leave-request:to_input")).sendKeys(to); + clickByJavaScript($("div[id$='content']")); + $("div[id$='from_panel']").shouldBe(Condition.disappear); + $("div[id$='to_panel']").shouldBe(Condition.disappear); } public void inputField(String cssSelector, String value) { From ca2838d525fecc75f10d8602b931e68026549789 Mon Sep 17 00:00:00 2001 From: Tung Le Date: Wed, 18 Dec 2024 22:39:15 +0700 Subject: [PATCH 3/8] IVYPORTAL-18153 Fix GUI tests - BackNavigationTest#testFinishTaskFromCaseDetailAndGoBack, BackNavigationTest#testNavigateAfterFinishedTaskToCaseDetails --- .../com/axonivy/portal/selenium/test/BackNavigationTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/BackNavigationTest.java b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/BackNavigationTest.java index c651ccb316f..87dcffb3812 100644 --- a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/BackNavigationTest.java +++ b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/BackNavigationTest.java @@ -1,5 +1,7 @@ package com.axonivy.portal.selenium.test; +import static com.codeborne.selenide.Selenide.$; + import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -18,6 +20,7 @@ import com.axonivy.portal.selenium.page.TaskDetailsPage; import com.axonivy.portal.selenium.page.TaskIFrameTemplatePage; import com.axonivy.portal.selenium.page.TopMenuTaskWidgetPage; +import com.codeborne.selenide.Condition; @IvyWebTest @@ -139,6 +142,8 @@ public void testNavigateAfterFinishedTaskToCaseDetails() { String today = LocalDateTime.now().format(DateTimeFormatter.ofPattern(DateTimePattern.DATE_TIME_PATTERN)); taskTemplatePage.inputField("[id$='payment-request:from_input']", today); + taskTemplatePage.clickByJavaScript($("div[id$='content']")); + $("div[id$='from_panel']").shouldBe(Condition.disappear); taskTemplatePage.clickOnSubmitButton(); caseDetailsPage = new CaseDetailsPage(); caseDetailsPage.waitPageLoaded(); From f35d5d39682baa637a5cd57523fd4fd0d3cb7cc1 Mon Sep 17 00:00:00 2001 From: Tung Le Date: Wed, 18 Dec 2024 22:53:18 +0700 Subject: [PATCH 4/8] IVYPORTAL-18153 Fix GUI tests - Try out to fix tests --- .../axonivy/portal/selenium/page/TaskIFrameTemplatePage.java | 2 +- .../com/axonivy/portal/selenium/test/BackNavigationTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java index 001322d08ca..25fbdb83178 100644 --- a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java +++ b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java @@ -220,7 +220,7 @@ public void inputValue(String employee, String from, String to, String represent $(By.id("leave-request:substitute")).sendKeys(representation); $(By.id("leave-request:from_input")).sendKeys(from); $(By.id("leave-request:to_input")).sendKeys(to); - clickByJavaScript($("div[id$='content']")); + clickByJavaScript($("form[id$='leave-request']")); $("div[id$='from_panel']").shouldBe(Condition.disappear); $("div[id$='to_panel']").shouldBe(Condition.disappear); } diff --git a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/BackNavigationTest.java b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/BackNavigationTest.java index 87dcffb3812..2b1faaa5f5f 100644 --- a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/BackNavigationTest.java +++ b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/BackNavigationTest.java @@ -142,7 +142,7 @@ public void testNavigateAfterFinishedTaskToCaseDetails() { String today = LocalDateTime.now().format(DateTimeFormatter.ofPattern(DateTimePattern.DATE_TIME_PATTERN)); taskTemplatePage.inputField("[id$='payment-request:from_input']", today); - taskTemplatePage.clickByJavaScript($("div[id$='content']")); + taskTemplatePage.clickByJavaScript($("form[id$='payment-request']")); $("div[id$='from_panel']").shouldBe(Condition.disappear); taskTemplatePage.clickOnSubmitButton(); caseDetailsPage = new CaseDetailsPage(); From b556c315c04a2e038d24627852a6199dd39c2e9c Mon Sep 17 00:00:00 2001 From: Tung Le Date: Thu, 19 Dec 2024 11:07:29 +0700 Subject: [PATCH 5/8] IVYPORTAL-18153 Fix GUI tests - Try out to fix tests --- .../selenium/page/TaskIFrameTemplatePage.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java index 25fbdb83178..959a94d0d93 100644 --- a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java +++ b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java @@ -216,13 +216,22 @@ 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); - clickByJavaScript($("form[id$='leave-request']")); - $("div[id$='from_panel']").shouldBe(Condition.disappear); - $("div[id$='to_panel']").shouldBe(Condition.disappear); + 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); + // clickByJavaScript($("form[id$='leave-request']")); + // $("div[id$='from_panel']").shouldBe(Condition.disappear); + // $("div[id$='to_panel']").shouldBe(Condition.disappear); } public void inputField(String cssSelector, String value) { From 7b485a1ef558a2682c37f5234289443d32299177 Mon Sep 17 00:00:00 2001 From: Tung Le Date: Thu, 19 Dec 2024 11:30:43 +0700 Subject: [PATCH 6/8] IVYPORTAL-18153 Fix GUI tests - Try out to fix tests --- .../portal/selenium/page/TaskIFrameTemplatePage.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java index 959a94d0d93..d0b3bbaf78c 100644 --- a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java +++ b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java @@ -229,13 +229,12 @@ public void inputValue(String employee, String from, String to, String represent SelenideElement toElement = $(By.id("leave-request:to_input")); toElement.click(); toElement.sendKeys(to); - // clickByJavaScript($("form[id$='leave-request']")); - // $("div[id$='from_panel']").shouldBe(Condition.disappear); - // $("div[id$='to_panel']").shouldBe(Condition.disappear); } public void inputField(String cssSelector, String value) { - $(cssSelector).shouldBe(Condition.appear).shouldBe(Condition.editable).sendKeys(value); + SelenideElement element = $(cssSelector).shouldBe(Condition.appear).shouldBe(Condition.editable); + element.click(); + element.sendKeys(value); } public NewDashboardPage clickSubmitButton() { From dfea28dbd4bb526375dee8b3bc36fa7d2056e689 Mon Sep 17 00:00:00 2001 From: Tung Le Date: Thu, 19 Dec 2024 12:29:51 +0700 Subject: [PATCH 7/8] IVYPORTAL-18153 Fix GUI tests - Try out to fix tests --- .../com/axonivy/portal/selenium/test/BackNavigationTest.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/BackNavigationTest.java b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/BackNavigationTest.java index 2b1faaa5f5f..c651ccb316f 100644 --- a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/BackNavigationTest.java +++ b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/BackNavigationTest.java @@ -1,7 +1,5 @@ package com.axonivy.portal.selenium.test; -import static com.codeborne.selenide.Selenide.$; - import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -20,7 +18,6 @@ import com.axonivy.portal.selenium.page.TaskDetailsPage; import com.axonivy.portal.selenium.page.TaskIFrameTemplatePage; import com.axonivy.portal.selenium.page.TopMenuTaskWidgetPage; -import com.codeborne.selenide.Condition; @IvyWebTest @@ -142,8 +139,6 @@ public void testNavigateAfterFinishedTaskToCaseDetails() { String today = LocalDateTime.now().format(DateTimeFormatter.ofPattern(DateTimePattern.DATE_TIME_PATTERN)); taskTemplatePage.inputField("[id$='payment-request:from_input']", today); - taskTemplatePage.clickByJavaScript($("form[id$='payment-request']")); - $("div[id$='from_panel']").shouldBe(Condition.disappear); taskTemplatePage.clickOnSubmitButton(); caseDetailsPage = new CaseDetailsPage(); caseDetailsPage.waitPageLoaded(); From aafc7fcf91f00f2d78900d4354e1357fdb7d960c Mon Sep 17 00:00:00 2001 From: Tung Le Date: Fri, 20 Dec 2024 11:47:34 +0700 Subject: [PATCH 8/8] IVYPORTAL-18153 Fix GUI tests - Try out to fix tests --- .../portal/selenium/page/TaskIFrameTemplatePage.java | 6 ------ .../com/axonivy/portal/selenium/page/TemplatePage.java | 8 +++++++- .../axonivy/portal/selenium/test/BackNavigationTest.java | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java index d0b3bbaf78c..739567137f7 100644 --- a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java +++ b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TaskIFrameTemplatePage.java @@ -231,12 +231,6 @@ public void inputValue(String employee, String from, String to, String represent toElement.sendKeys(to); } - public void inputField(String cssSelector, String value) { - SelenideElement element = $(cssSelector).shouldBe(Condition.appear).shouldBe(Condition.editable); - element.click(); - element.sendKeys(value); - } - public NewDashboardPage clickSubmitButton() { clickOnSubmitButton(); return new NewDashboardPage(); diff --git a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TemplatePage.java b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TemplatePage.java index 952b993f09e..85b6c840b75 100644 --- a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TemplatePage.java +++ b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/page/TemplatePage.java @@ -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; @@ -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); + } } diff --git a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/BackNavigationTest.java b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/BackNavigationTest.java index c651ccb316f..f29f2313f3a 100644 --- a/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/BackNavigationTest.java +++ b/AxonIvyPortal/portal-selenium-test/src_test/com/axonivy/portal/selenium/test/BackNavigationTest.java @@ -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();