From 6038b407a33329a580a4928b3a97ca7900e7c203 Mon Sep 17 00:00:00 2001 From: Jasper de Vries Date: Sun, 7 Jan 2024 14:32:01 +0100 Subject: [PATCH] Check either clickable or loading --- .../confirmdialog/ConfirmDialog001Test.java | 7 ++----- .../confirmdialog/ConfirmDialog002Test.java | 7 ++----- .../org/primefaces/selenium/AbstractPrimePageTest.java | 6 ++++++ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/primefaces-integration-tests/src/test/java/org/primefaces/integrationtests/confirmdialog/ConfirmDialog001Test.java b/primefaces-integration-tests/src/test/java/org/primefaces/integrationtests/confirmdialog/ConfirmDialog001Test.java index bb1c50c552..c6aedae9e0 100644 --- a/primefaces-integration-tests/src/test/java/org/primefaces/integrationtests/confirmdialog/ConfirmDialog001Test.java +++ b/primefaces-integration-tests/src/test/java/org/primefaces/integrationtests/confirmdialog/ConfirmDialog001Test.java @@ -186,8 +186,6 @@ void nonAjaxYes(Page page) { PrimeSelenium.guardHttp(dialog.getYesButton().getRoot()).click(); // Assert - //PrimeSelenium.waitGui().until(PrimeExpectedConditions.visibleInViewport(page.message)); - //assertEquals("Full page submitted", page.message.getMessage(0).getDetail()); assertDialog(page, false); } @@ -209,9 +207,8 @@ private void assertDialog(Page page, boolean visible) { } } else { - waitAjaxMinLoadAnimation(); - assertClickable(page.confirm); - assertClickable(page.delete); + assertClickableOrLoading(page.confirm); + assertClickableOrLoading(page.delete); } assertConfiguration(dialog.getWidgetConfiguration()); diff --git a/primefaces-integration-tests/src/test/java/org/primefaces/integrationtests/confirmdialog/ConfirmDialog002Test.java b/primefaces-integration-tests/src/test/java/org/primefaces/integrationtests/confirmdialog/ConfirmDialog002Test.java index 3d1be58fd4..d9036a2a10 100644 --- a/primefaces-integration-tests/src/test/java/org/primefaces/integrationtests/confirmdialog/ConfirmDialog002Test.java +++ b/primefaces-integration-tests/src/test/java/org/primefaces/integrationtests/confirmdialog/ConfirmDialog002Test.java @@ -186,8 +186,6 @@ void nonAjaxYes(Page page) { dialog.getYesButton().click(); // Assert - //PrimeSelenium.waitGui().until(PrimeExpectedConditions.visibleInViewport(page.message)); - //assertEquals("Full page submitted", page.message.getMessage(0).getDetail()); assertDialog(page, false); } @@ -209,9 +207,8 @@ private void assertDialog(Page page, boolean visible) { } } else { - waitAjaxMinLoadAnimation(); - assertClickable(page.confirm); - assertClickable(page.delete); + assertClickableOrLoading(page.confirm); + assertClickableOrLoading(page.delete); } assertConfiguration(dialog.getWidgetConfiguration()); diff --git a/primefaces-selenium/primefaces-selenium-core/src/main/java/org/primefaces/selenium/AbstractPrimePageTest.java b/primefaces-selenium/primefaces-selenium-core/src/main/java/org/primefaces/selenium/AbstractPrimePageTest.java index 43b33fa1a1..224b2571ec 100644 --- a/primefaces-selenium/primefaces-selenium-core/src/main/java/org/primefaces/selenium/AbstractPrimePageTest.java +++ b/primefaces-selenium/primefaces-selenium-core/src/main/java/org/primefaces/selenium/AbstractPrimePageTest.java @@ -167,6 +167,12 @@ protected void assertClickable(WebElement element) { } } + protected void assertClickableOrLoading(WebElement element) { + if (!PrimeSelenium.isElementClickable(element) && !PrimeSelenium.hasCssClass(element, "ui-state-loading")) { + fail("Element should be clickable or loading!"); + } + } + protected void assertNotClickable(WebElement element) { if (PrimeSelenium.isElementClickable(element)) { fail("Element should not be clickable!");