diff --git a/src/qqq/components/query/BasicAndAdvancedQueryControls.tsx b/src/qqq/components/query/BasicAndAdvancedQueryControls.tsx index 2a6e563..907476a 100644 --- a/src/qqq/components/query/BasicAndAdvancedQueryControls.tsx +++ b/src/qqq/components/query/BasicAndAdvancedQueryControls.tsx @@ -710,13 +710,13 @@ const BasicAndAdvancedQueryControls = forwardRef((props: BasicAndAdvancedQueryCo Filter Builder { countValidCriteria(queryFilter) > 0 && - + {countValidCriteria(queryFilter) } } { - hasValidFilters && setShowClearFiltersWarning(true)} /> + hasValidFilters && setShowClearFiltersWarning(true)} /> } diff --git a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/lib/QQQMaterialDashboardSelectors.java b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/lib/QQQMaterialDashboardSelectors.java index 654f278..559bce2 100755 --- a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/lib/QQQMaterialDashboardSelectors.java +++ b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/lib/QQQMaterialDashboardSelectors.java @@ -28,7 +28,7 @@ package com.kingsrook.qqq.frontend.materialdashboard.selenium.lib; public interface QQQMaterialDashboardSelectors { String SIDEBAR_ITEM = ".MuiDrawer-paperAnchorDockedLeft li.MuiListItem-root"; - String BREADCRUMB_HEADER = ".MuiToolbar-root h3"; + String BREADCRUMB_HEADER = "h3"; String QUERY_GRID_CELL = ".MuiDataGrid-root .MuiDataGrid-cellContent"; String QUERY_FILTER_INPUT = ".customFilterPanel input.MuiInput-input"; diff --git a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/lib/QSeleniumLib.java b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/lib/QSeleniumLib.java index 37a9351..10781d7 100755 --- a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/lib/QSeleniumLib.java +++ b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/lib/QSeleniumLib.java @@ -43,7 +43,7 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; -import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.fail; @@ -196,7 +196,7 @@ public class QSeleniumLib /******************************************************************************* ** *******************************************************************************/ - public void gotoAndWaitForBreadcrumbHeader(String path, String headerText) + public void gotoAndWaitForBreadcrumbHeaderToContain(String path, String expectedHeaderText) { driver.get(BASE_URL + path); @@ -204,7 +204,7 @@ public class QSeleniumLib .until(ExpectedConditions.presenceOfElementLocated(By.cssSelector(QQQMaterialDashboardSelectors.BREADCRUMB_HEADER))); LOG.debug("Navigated to [" + path + "]. Breadcrumb Header: " + header.getText()); - assertEquals(headerText, header.getText()); + assertThat(header.getText()).contains(expectedHeaderText); } diff --git a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/lib/QueryScreenLib.java b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/lib/QueryScreenLib.java index 5fcf36a..9b08715 100644 --- a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/lib/QueryScreenLib.java +++ b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/lib/QueryScreenLib.java @@ -52,7 +52,7 @@ public class QueryScreenLib *******************************************************************************/ public WebElement assertFilterButtonBadge(int valueInBadge) { - return qSeleniumLib.waitForSelectorContaining(".MuiBadge-root", String.valueOf(valueInBadge)); + return qSeleniumLib.waitForSelectorContaining(".filterBuilderCountBadge", String.valueOf(valueInBadge)); } @@ -62,7 +62,7 @@ public class QueryScreenLib *******************************************************************************/ public void assertNoFilterButtonBadge(int valueInBadge) { - qSeleniumLib.waitForSelectorContainingToNotExist(".MuiBadge-root", String.valueOf(valueInBadge)); + qSeleniumLib.waitForSelectorContainingToNotExist(".filterBuilderCountBadge", String.valueOf(valueInBadge)); } diff --git a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/AppPageNavTest.java b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/AppPageNavTest.java index 8daf188..9d62a96 100755 --- a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/AppPageNavTest.java +++ b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/AppPageNavTest.java @@ -57,7 +57,7 @@ public class AppPageNavTest extends QBaseSeleniumTest @Test void testHomeToAppPageViaLeftNav() { - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/", "Greetings App"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/", "Greetings App"); qSeleniumLib.waitForSelectorContaining(QQQMaterialDashboardSelectors.SIDEBAR_ITEM, "People App").click(); qSeleniumLib.waitForSelectorContaining(QQQMaterialDashboardSelectors.SIDEBAR_ITEM, "Greetings App").click(); } @@ -70,7 +70,7 @@ public class AppPageNavTest extends QBaseSeleniumTest @Test void testAppPageToTablePage() { - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp", "Greetings App"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp", "Greetings App"); qSeleniumLib.tryMultiple(3, () -> qSeleniumLib.waitForSelectorContaining("a", "Person").click()); qSeleniumLib.waitForSelectorContaining(QQQMaterialDashboardSelectors.BREADCRUMB_HEADER, "Person"); } diff --git a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/AssociatedRecordScriptTest.java b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/AssociatedRecordScriptTest.java index fbbce56..89c7085 100755 --- a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/AssociatedRecordScriptTest.java +++ b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/AssociatedRecordScriptTest.java @@ -53,7 +53,7 @@ public class AssociatedRecordScriptTest extends QBaseSeleniumTest @Test void testNavigatingBackAndForth() { - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person/1", "John Doe"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person/1", "John Doe"); qSeleniumLib.waitForSelectorContaining("BUTTON", "actions").click(); qSeleniumLib.waitForSelectorContaining("LI", "Developer Mode").click(); diff --git a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/AuditTest.java b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/AuditTest.java index b7443a0..4aff845 100755 --- a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/AuditTest.java +++ b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/AuditTest.java @@ -63,7 +63,7 @@ public class AuditTest extends QBaseSeleniumTest qSeleniumJavalin.withRouteToFile("/data/audit/query", "data/audit/query-empty.json"); qSeleniumJavalin.restart(); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person/1701", "John Doe"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person/1701", "John Doe"); qSeleniumLib.waitForSelectorContaining("BUTTON", "Actions").click(); qSeleniumLib.waitForSelectorContaining("LI", "Audit").click(); @@ -90,7 +90,7 @@ public class AuditTest extends QBaseSeleniumTest qSeleniumJavalin.withRouteToFile(auditQueryPath, "data/audit/query.json"); qSeleniumJavalin.restart(); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person/1701", "John Doe"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person/1701", "John Doe"); qSeleniumLib.waitForSelectorContaining("BUTTON", "Actions").click(); qSeleniumLib.waitForSelectorContaining("LI", "Audit").click(); @@ -121,7 +121,7 @@ public class AuditTest extends QBaseSeleniumTest qSeleniumJavalin.withRouteToFile(auditQueryPath, "data/audit/query.json"); qSeleniumJavalin.restart(); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person/1701", "John Doe"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person/1701", "John Doe"); qSeleniumLib.waitForSelectorContaining("BUTTON", "Actions").click(); qSeleniumLib.waitForSelectorContaining("LI", "Audit").click(); diff --git a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/BulkEditTest.java b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/BulkEditTest.java index 2a247dd..e0a49ac 100755 --- a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/BulkEditTest.java +++ b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/BulkEditTest.java @@ -71,7 +71,7 @@ public class BulkEditTest extends QBaseSeleniumTest // @RepeatedTest(100) void test() { - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person", "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person", "Person"); qSeleniumLib.waitForSelectorContaining("button", "selection").click(); qSeleniumLib.waitForSelectorContaining("li", "This page").click(); qSeleniumLib.waitForSelectorContaining("div", "records on this page are selected"); diff --git a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/ClickLinkOnRecordThenEditShortcutTest.java b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/ClickLinkOnRecordThenEditShortcutTest.java index 35ed7dd..28f11c6 100755 --- a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/ClickLinkOnRecordThenEditShortcutTest.java +++ b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/ClickLinkOnRecordThenEditShortcutTest.java @@ -55,7 +55,7 @@ public class ClickLinkOnRecordThenEditShortcutTest extends QBaseSeleniumTest @Test void testClickLinkOnRecordThenEditShortcutTest() { - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/developer/script/1", "Hello, Script"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/developer/script/1", "Hello, Script"); qSeleniumLib.waitForSelectorContaining("A", "100").click(); qSeleniumLib.waitForSelectorContaining("BUTTON", "actions").sendKeys("e"); diff --git a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/DashboardTableWidgetExportTest.java b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/DashboardTableWidgetExportTest.java index 04cc731..f9d4779 100755 --- a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/DashboardTableWidgetExportTest.java +++ b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/DashboardTableWidgetExportTest.java @@ -76,7 +76,7 @@ public class DashboardTableWidgetExportTest extends QBaseSeleniumTest @Test void testDashboardTableWidgetExport() throws IOException { - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/", "Greetings App"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/", "Greetings App"); //////////////////////////////////////////////////////////////////////// // assert that the table widget rendered its header and some contents // diff --git a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/QueryScreenFilterInUrlAdvancedModeTest.java b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/QueryScreenFilterInUrlAdvancedModeTest.java index d7be415..23ccaed 100755 --- a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/QueryScreenFilterInUrlAdvancedModeTest.java +++ b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/QueryScreenFilterInUrlAdvancedModeTest.java @@ -71,7 +71,7 @@ public class QueryScreenFilterInUrlAdvancedModeTest extends QBaseSeleniumTest //////////////////////////////// // put table in advanced mode // //////////////////////////////// - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person", "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person", "Person"); queryScreenLib.gotoAdvancedMode(); //////////////////////////////////////// @@ -79,7 +79,7 @@ public class QueryScreenFilterInUrlAdvancedModeTest extends QBaseSeleniumTest //////////////////////////////////////// String filterJSON = JsonUtils.toJson(new QQueryFilter() .withCriteria(new QFilterCriteria("annualSalary", QCriteriaOperator.IS_NOT_BLANK))); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); queryScreenLib.waitForQueryToHaveRan(); queryScreenLib.assertFilterButtonBadge(1); queryScreenLib.clickFilterButton(); @@ -90,7 +90,7 @@ public class QueryScreenFilterInUrlAdvancedModeTest extends QBaseSeleniumTest /////////////////////////////// filterJSON = JsonUtils.toJson(new QQueryFilter() .withCriteria(new QFilterCriteria("annualSalary", QCriteriaOperator.BETWEEN, 1701, 74656))); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); queryScreenLib.waitForQueryToHaveRan(); queryScreenLib.assertFilterButtonBadge(1); queryScreenLib.clickFilterButton(); @@ -103,7 +103,7 @@ public class QueryScreenFilterInUrlAdvancedModeTest extends QBaseSeleniumTest ////////////////////////////////////// filterJSON = JsonUtils.toJson(new QQueryFilter() .withCriteria(new QFilterCriteria("homeCityId", QCriteriaOperator.IN, 1, 2))); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); queryScreenLib.waitForQueryToHaveRan(); queryScreenLib.assertFilterButtonBadge(1); queryScreenLib.clickFilterButton(); @@ -116,7 +116,7 @@ public class QueryScreenFilterInUrlAdvancedModeTest extends QBaseSeleniumTest ///////////////////////////////////////// filterJSON = JsonUtils.toJson(new QQueryFilter() .withCriteria(new QFilterCriteria("createDate", QCriteriaOperator.GREATER_THAN, NowWithOffset.minus(5, ChronoUnit.DAYS)))); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); queryScreenLib.waitForQueryToHaveRan(); queryScreenLib.assertFilterButtonBadge(1); queryScreenLib.clickFilterButton(); @@ -129,7 +129,7 @@ public class QueryScreenFilterInUrlAdvancedModeTest extends QBaseSeleniumTest filterJSON = JsonUtils.toJson(new QQueryFilter() .withCriteria(new QFilterCriteria("firstName", QCriteriaOperator.STARTS_WITH, "Dar")) .withCriteria(new QFilterCriteria("createDate", QCriteriaOperator.LESS_THAN_OR_EQUALS, ThisOrLastPeriod.this_(ChronoUnit.YEARS)))); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); queryScreenLib.waitForQueryToHaveRan(); queryScreenLib.assertFilterButtonBadge(2); queryScreenLib.clickFilterButton(); @@ -152,7 +152,7 @@ public class QueryScreenFilterInUrlAdvancedModeTest extends QBaseSeleniumTest ////////////////////////////////////////// filterJSON = JsonUtils.toJson(new QQueryFilter() .withCriteria(new QFilterCriteria("homeCityId", QCriteriaOperator.NOT_EQUALS, 1))); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); queryScreenLib.waitForQueryToHaveRan(); queryScreenLib.assertFilterButtonBadge(1); queryScreenLib.clickFilterButton(); @@ -162,7 +162,8 @@ public class QueryScreenFilterInUrlAdvancedModeTest extends QBaseSeleniumTest //////////////// // remove one // //////////////// - qSeleniumLib.waitForSelectorContaining(".MuiIcon-root", "close").click(); + qSeleniumLib.tryMultiple(3, () -> qSeleniumLib.waitForSelector(".filterBuilderXIcon BUTTON").click()); + qSeleniumLib.waitForSelectorContaining("BUTTON", "Yes").click(); queryScreenLib.assertNoFilterButtonBadge(1); // qSeleniumLib.waitForever(); diff --git a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/QueryScreenFilterInUrlBasicModeTest.java b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/QueryScreenFilterInUrlBasicModeTest.java index 9b59351..d2a5f9e 100755 --- a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/QueryScreenFilterInUrlBasicModeTest.java +++ b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/QueryScreenFilterInUrlBasicModeTest.java @@ -73,7 +73,7 @@ public class QueryScreenFilterInUrlBasicModeTest extends QBaseSeleniumTest //////////////////////////////////////// String filterJSON = JsonUtils.toJson(new QQueryFilter() .withCriteria(new QFilterCriteria("annualSalary", QCriteriaOperator.IS_NOT_BLANK))); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); queryScreenLib.waitForQueryToHaveRan(); queryScreenLib.assertQuickFilterButtonIndicatesActiveFilter("annualSalary"); queryScreenLib.clickQuickFilterButton("annualSalary"); @@ -84,7 +84,7 @@ public class QueryScreenFilterInUrlBasicModeTest extends QBaseSeleniumTest /////////////////////////////// filterJSON = JsonUtils.toJson(new QQueryFilter() .withCriteria(new QFilterCriteria("annualSalary", QCriteriaOperator.BETWEEN, 1701, 74656))); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); queryScreenLib.waitForQueryToHaveRan(); queryScreenLib.assertQuickFilterButtonIndicatesActiveFilter("annualSalary"); queryScreenLib.clickQuickFilterButton("annualSalary"); @@ -97,7 +97,7 @@ public class QueryScreenFilterInUrlBasicModeTest extends QBaseSeleniumTest ////////////////////////////////////////// filterJSON = JsonUtils.toJson(new QQueryFilter() .withCriteria(new QFilterCriteria("homeCityId", QCriteriaOperator.NOT_EQUALS, 1))); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); queryScreenLib.waitForQueryToHaveRan(); queryScreenLib.assertQuickFilterButtonIndicatesActiveFilter("homeCityId"); queryScreenLib.clickQuickFilterButton("homeCityId"); @@ -109,7 +109,7 @@ public class QueryScreenFilterInUrlBasicModeTest extends QBaseSeleniumTest ////////////////////////////////////// filterJSON = JsonUtils.toJson(new QQueryFilter() .withCriteria(new QFilterCriteria("homeCityId", QCriteriaOperator.IN, 1, 2))); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); queryScreenLib.waitForQueryToHaveRan(); queryScreenLib.assertQuickFilterButtonIndicatesActiveFilter("homeCityId"); queryScreenLib.clickQuickFilterButton("homeCityId"); @@ -122,7 +122,7 @@ public class QueryScreenFilterInUrlBasicModeTest extends QBaseSeleniumTest ///////////////////////////////////////// filterJSON = JsonUtils.toJson(new QQueryFilter() .withCriteria(new QFilterCriteria("createDate", QCriteriaOperator.GREATER_THAN, NowWithOffset.minus(5, ChronoUnit.DAYS)))); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); queryScreenLib.waitForQueryToHaveRan(); queryScreenLib.assertQuickFilterButtonIndicatesActiveFilter("createDate"); queryScreenLib.clickQuickFilterButton("createDate"); @@ -135,7 +135,7 @@ public class QueryScreenFilterInUrlBasicModeTest extends QBaseSeleniumTest filterJSON = JsonUtils.toJson(new QQueryFilter() .withCriteria(new QFilterCriteria("firstName", QCriteriaOperator.STARTS_WITH, "Dar")) .withCriteria(new QFilterCriteria("createDate", QCriteriaOperator.LESS_THAN_OR_EQUALS, ThisOrLastPeriod.this_(ChronoUnit.YEARS)))); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filterJSON, StandardCharsets.UTF_8), "Person"); queryScreenLib.waitForQueryToHaveRan(); queryScreenLib.assertQuickFilterButtonIndicatesActiveFilter("firstName"); queryScreenLib.assertQuickFilterButtonIndicatesActiveFilter("createDate"); diff --git a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/QueryScreenTest.java b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/QueryScreenTest.java index 25520d1..24d33d9 100755 --- a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/QueryScreenTest.java +++ b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/QueryScreenTest.java @@ -61,7 +61,7 @@ public class QueryScreenTest extends QBaseSeleniumTest { QueryScreenLib queryScreenLib = new QueryScreenLib(qSeleniumLib); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person", "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person", "Person"); queryScreenLib.waitForQueryToHaveRan(); queryScreenLib.gotoAdvancedMode(); queryScreenLib.clickFilterButton(); @@ -86,13 +86,13 @@ public class QueryScreenTest extends QBaseSeleniumTest /////////////////////////////////////// qSeleniumLib.waitForSeconds(1); // todo grr. qSeleniumLib.waitForSelector(QQQMaterialDashboardSelectors.BREADCRUMB_HEADER).click(); - qSeleniumLib.waitForSelectorContaining(".MuiBadge-root", "1"); + qSeleniumLib.waitForSelectorContaining(".filterBuilderCountBadge", "1"); /////////////////////////////////////////////////////////////////// // click the 'x' clear icon, then yes, then expect another query // /////////////////////////////////////////////////////////////////// qSeleniumJavalin.beginCapture(); - qSeleniumLib.tryMultiple(3, () -> qSeleniumLib.waitForSelector("#clearFiltersButton").click()); + qSeleniumLib.tryMultiple(3, () -> qSeleniumLib.waitForSelector(".filterBuilderXIcon BUTTON").click()); qSeleniumLib.waitForSelectorContaining("BUTTON", "Yes").click(); //////////////////////////////////////////////////////////////////// @@ -115,7 +115,7 @@ public class QueryScreenTest extends QBaseSeleniumTest { QueryScreenLib queryScreenLib = new QueryScreenLib(qSeleniumLib); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person", "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person", "Person"); queryScreenLib.waitForQueryToHaveRan(); queryScreenLib.gotoAdvancedMode(); queryScreenLib.clickFilterButton(); diff --git a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/SavedViewsTest.java b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/SavedViewsTest.java index 3d3c0ee..99e8702 100755 --- a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/SavedViewsTest.java +++ b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/SavedViewsTest.java @@ -22,10 +22,15 @@ package com.kingsrook.qqq.frontend.materialdashboard.selenium.tests; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import com.kingsrook.qqq.frontend.materialdashboard.selenium.lib.QBaseSeleniumTest; import com.kingsrook.qqq.frontend.materialdashboard.selenium.lib.QueryScreenLib; +import com.kingsrook.qqq.frontend.materialdashboard.selenium.lib.javalin.CapturedContext; import com.kingsrook.qqq.frontend.materialdashboard.selenium.lib.javalin.QSeleniumJavalin; import org.junit.jupiter.api.Test; +import org.openqa.selenium.WebElement; +import static org.junit.jupiter.api.Assertions.assertTrue; /******************************************************************************* @@ -66,9 +71,9 @@ public class SavedViewsTest extends QBaseSeleniumTest { QueryScreenLib queryScreenLib = new QueryScreenLib(qSeleniumLib); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person", "Person"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person", "Person"); - qSeleniumLib.waitForSelectorContaining("BUTTON", "Saved Views").click(); + qSeleniumLib.waitForSelectorContaining("BUTTON", "Views").click(); qSeleniumLib.waitForSelectorContaining("LI", "Some People"); //////////////////////////////////////// @@ -85,7 +90,7 @@ public class SavedViewsTest extends QBaseSeleniumTest ///////////////////////////////////////////////////// qSeleniumLib.waitForSelectorContaining("LI", "Some People").click(); qSeleniumLib.waitForCondition("Current URL should have view id", () -> driver.getCurrentUrl().endsWith("/person/savedView/2")); - qSeleniumLib.waitForSelectorContaining("DIV", "Current View: Some People"); + qSeleniumLib.waitForSelectorContaining("BUTTON", "Some People"); ////////////////////////////// // click into a view screen // @@ -100,19 +105,20 @@ public class SavedViewsTest extends QBaseSeleniumTest /////////////////////////////////////////////////// qSeleniumLib.waitForSelectorContaining("A", "Person").click(); qSeleniumLib.waitForCondition("Current URL should have View id", () -> driver.getCurrentUrl().endsWith("/person/savedView/2")); - qSeleniumLib.waitForSelectorContaining("DIV", "Current View: Some People"); + qSeleniumLib.waitForSelectorContaining("BUTTON", "Some People"); queryScreenLib.assertQuickFilterButtonIndicatesActiveFilter("firstName"); ////////////////////// // modify the query // ////////////////////// - /* todo - right now - this is changed - but - working through it with Views story... revisit before merge! - queryScreenLib.clickFilterButton(); - queryScreenLib.addQueryFilterInput(qSeleniumLib, 1, "First Name", "contains", "Jam", "Or"); - qSeleniumLib.waitForSelectorContaining("H3", "Person").click(); - qSeleniumLib.waitForSelectorContaining("DIV", "Current Filter: Some People") - .findElement(By.cssSelector("CIRCLE")); - qSeleniumLib.waitForSelectorContaining(".MuiBadge-badge", "2"); + queryScreenLib.clickQuickFilterButton("lastName"); + WebElement valueInput = qSeleniumLib.waitForSelector(".filterValuesColumn INPUT"); + valueInput.click(); + valueInput.sendKeys("Kelkhoff"); + qSeleniumLib.waitForMillis(100); + + qSeleniumLib.clickBackdrop(); + qSeleniumLib.waitForSelectorContaining("DIV", "Unsaved Changes"); ////////////////////////////// // click into a view screen // @@ -127,16 +133,15 @@ public class SavedViewsTest extends QBaseSeleniumTest qSeleniumJavalin.beginCapture(); qSeleniumLib.waitForSelectorContaining("A", "Person").click(); qSeleniumLib.waitForCondition("Current URL should have filter id", () -> driver.getCurrentUrl().endsWith("/person/savedView/2")); - qSeleniumLib.waitForSelectorContaining("DIV", "Current View: Some People") - .findElement(By.cssSelector("CIRCLE")); - qSeleniumLib.waitForSelectorContaining(".MuiBadge-badge", "2"); + qSeleniumLib.waitForSelectorContaining("BUTTON", "Some People"); + qSeleniumLib.waitForSelectorContaining("DIV", "Unsaved Changes"); CapturedContext capturedContext = qSeleniumJavalin.waitForCapturedPath("/data/person/query"); - assertTrue(capturedContext.getBody().contains("Jam")); + assertTrue(capturedContext.getBody().contains("Kelkhoff")); qSeleniumJavalin.endCapture(); - //////////////////////////////////////////////////// + ////////////////////////////////////////////////// // navigate to the table with a View in the URL // - //////////////////////////////////////////////////// + ////////////////////////////////////////////////// String filter = """ { "criteria": @@ -149,9 +154,8 @@ public class SavedViewsTest extends QBaseSeleniumTest ] } """.replace('\n', ' ').replaceAll(" ", ""); - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filter, StandardCharsets.UTF_8), "Person"); - qSeleniumLib.waitForSelectorContaining(".MuiBadge-badge", "1"); - qSeleniumLib.waitForSelectorContainingToNotExist("DIV", "Current View"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/peopleApp/greetingsApp/person?filter=" + URLEncoder.encode(filter, StandardCharsets.UTF_8), "Person"); + qSeleniumLib.waitForSelectorContaining("BUTTON", "Save View As"); ////////////////////////////// // click into a view screen // @@ -166,11 +170,10 @@ public class SavedViewsTest extends QBaseSeleniumTest qSeleniumJavalin.beginCapture(); qSeleniumLib.waitForSelectorContaining("A", "Person").click(); qSeleniumLib.waitForCondition("Current URL should not have filter id", () -> !driver.getCurrentUrl().endsWith("/person/savedView/2")); - qSeleniumLib.waitForSelectorContaining(".MuiBadge-badge", "1"); + qSeleniumLib.waitForSelectorContaining("BUTTON", "Save View As"); capturedContext = qSeleniumJavalin.waitForCapturedPath("/data/person/query"); assertTrue(capturedContext.getBody().matches("(?s).*id.*LESS_THAN.*10.*")); qSeleniumJavalin.endCapture(); - */ } } diff --git a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/ScriptTableTest.java b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/ScriptTableTest.java index e935d45..39f7062 100755 --- a/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/ScriptTableTest.java +++ b/src/test/java/com/kingsrook/qqq/frontend/materialdashboard/selenium/tests/ScriptTableTest.java @@ -59,7 +59,7 @@ public class ScriptTableTest extends QBaseSeleniumTest @Test void test() { - qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/developer/script/1", "Hello, Script"); + qSeleniumLib.gotoAndWaitForBreadcrumbHeaderToContain("/developer/script/1", "Hello, Script"); qSeleniumLib.waitForSelectorContaining("DIV.ace_line", "var hello;"); qSeleniumLib.waitForSelectorContaining("DIV", "2nd commit");