Merge branch 'feature/sprint-27' into feature/custom-filter-panel

This commit is contained in:
2023-06-20 10:17:56 -05:00
committed by GitHub
23 changed files with 3387 additions and 2275 deletions

View File

@ -74,7 +74,8 @@ public class QBaseSeleniumTest
.withRouteToFile("/metaData", "metaData/index.json")
.withRouteToFile("/metaData/authentication", "metaData/authentication.json")
.withRouteToFile("/metaData/table/person", "metaData/table/person.json")
.withRouteToFile("/metaData/table/city", "metaData/table/person.json");
.withRouteToFile("/metaData/table/city", "metaData/table/person.json")
.withRouteToFile("/processes/querySavedFilter/init", "processes/querySavedFilter/init.json");
}

View File

@ -3,10 +3,11 @@ package com.kingsrook.qqq.materialdashboard.lib.javalin;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.kingsrook.qqq.materialdashboard.lib.QSeleniumLib;
import io.javalin.Javalin;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.jetty.server.Connector;
@ -25,8 +26,8 @@ public class QSeleniumJavalin
private long WAIT_SECONDS = 10;
private List<Pair<String, String>> routesToFiles = new ArrayList<>();
private List<Pair<String, String>> routesToStrings = new ArrayList<>();
private Map<String, String> routesToFiles = new LinkedHashMap<>();
private Map<String, String> routesToStrings = new LinkedHashMap<>();
private Javalin javalin;
@ -71,9 +72,9 @@ public class QSeleniumJavalin
{
if(this.routesToFiles == null)
{
this.routesToFiles = new ArrayList<>();
this.routesToFiles = new LinkedHashMap<>();
}
this.routesToFiles.add(Pair.of(path, fixtureFilePath));
this.routesToFiles.put(path, fixtureFilePath);
return (this);
}
@ -86,9 +87,9 @@ public class QSeleniumJavalin
{
if(this.routesToStrings == null)
{
this.routesToStrings = new ArrayList<>();
this.routesToStrings = new LinkedHashMap<>();
}
this.routesToStrings.add(Pair.of(path, responseString));
this.routesToStrings.put(path, responseString);
return (this);
}
@ -105,11 +106,11 @@ public class QSeleniumJavalin
{
javalin.routes(() ->
{
for(Pair<String, String> routeToFile : routesToFiles)
for(Map.Entry<String, String> routeToFile : routesToFiles.entrySet())
{
LOG.debug("Setting up route for [" + routeToFile.getKey() + "] => [" + routeToFile.getValue() + "]");
get(routeToFile.getKey(), new RouteFromFileHandler(this, routeToFile));
post(routeToFile.getKey(), new RouteFromFileHandler(this, routeToFile));
get(routeToFile.getKey(), new RouteFromFileHandler(this, routeToFile.getKey(), routeToFile.getValue()));
post(routeToFile.getKey(), new RouteFromFileHandler(this, routeToFile.getKey(), routeToFile.getValue()));
}
});
}
@ -118,11 +119,11 @@ public class QSeleniumJavalin
{
javalin.routes(() ->
{
for(Pair<String, String> routeToString : routesToStrings)
for(Map.Entry<String, String> routeToString : routesToStrings.entrySet())
{
LOG.debug("Setting up route for [" + routeToString.getKey() + "] => [" + routeToString.getValue() + "]");
get(routeToString.getKey(), new RouteFromStringHandler(this, routeToString));
post(routeToString.getKey(), new RouteFromStringHandler(this, routeToString));
get(routeToString.getKey(), new RouteFromStringHandler(this, routeToString.getKey(), routeToString.getValue()));
post(routeToString.getKey(), new RouteFromStringHandler(this, routeToString.getKey(), routeToString.getValue()));
}
});
}

View File

@ -6,7 +6,6 @@ import java.util.List;
import io.javalin.http.Context;
import io.javalin.http.Handler;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -28,11 +27,11 @@ public class RouteFromFileHandler implements Handler
** Constructor
**
*******************************************************************************/
public RouteFromFileHandler(QSeleniumJavalin qSeleniumJavalin, Pair<String, String> routeToFilePath)
public RouteFromFileHandler(QSeleniumJavalin qSeleniumJavalin, String route, String filePath)
{
this.qSeleniumJavalin = qSeleniumJavalin;
this.route = routeToFilePath.getKey();
this.filePath = routeToFilePath.getValue();
this.route = route;
this.filePath = filePath;
}

View File

@ -3,7 +3,6 @@ package com.kingsrook.qqq.materialdashboard.lib.javalin;
import io.javalin.http.Context;
import io.javalin.http.Handler;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -25,11 +24,11 @@ public class RouteFromStringHandler implements Handler
** Constructor
**
*******************************************************************************/
public RouteFromStringHandler(QSeleniumJavalin qSeleniumJavalin, Pair<String, String> routeToStringPath)
public RouteFromStringHandler(QSeleniumJavalin qSeleniumJavalin, String route, String responseString)
{
this.qSeleniumJavalin = qSeleniumJavalin;
this.route = routeToStringPath.getKey();
this.responseString = routeToStringPath.getValue();
this.route = route;
this.responseString = responseString;
}

View File

@ -0,0 +1,115 @@
/*
* QQQ - Low-code Application Framework for Engineers.
* Copyright (C) 2021-2022. Kingsrook, LLC
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
* contact@kingsrook.com
* https://github.com/Kingsrook/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.materialdashboard.tests;
import com.kingsrook.qqq.materialdashboard.lib.QBaseSeleniumTest;
import com.kingsrook.qqq.materialdashboard.lib.javalin.QSeleniumJavalin;
import org.junit.jupiter.api.Test;
/*******************************************************************************
** Test for the scripts table
*******************************************************************************/
public class BulkEditTest extends QBaseSeleniumTest
{
/*******************************************************************************
**
*******************************************************************************/
@Override
protected void addJavalinRoutes(QSeleniumJavalin qSeleniumJavalin)
{
addCommonRoutesForThisTest(qSeleniumJavalin);
qSeleniumJavalin
.withRouteToFile("/metaData/process/person.bulkEdit", "metaData/process/person.bulkEdit.json")
.withRouteToFile("/processes/person.bulkEdit/init", "/processes/person.bulkEdit/init.json")
.withRouteToFile("/processes/person.bulkEdit/74a03a7d-2f53-4784-9911-3a21f7646c43/step/edit", "/processes/person.bulkEdit/step/edit.json")
.withRouteToFile("/processes/person.bulkEdit/74a03a7d-2f53-4784-9911-3a21f7646c43/step/review", "/processes/person.bulkEdit/step/review.json")
;
}
/*******************************************************************************
**
*******************************************************************************/
private void addCommonRoutesForThisTest(QSeleniumJavalin qSeleniumJavalin)
{
super.addJavalinRoutes(qSeleniumJavalin);
qSeleniumJavalin.withRouteToFile("/data/person/count", "data/person/count.json");
qSeleniumJavalin.withRouteToFile("/data/person/query", "data/person/index.json");
qSeleniumJavalin.withRouteToString("/processes/person.bulkEdit/74a03a7d-2f53-4784-9911-3a21f7646c43/records", "[]");
}
/*******************************************************************************
**
*******************************************************************************/
@Test
// @RepeatedTest(100)
void test()
{
qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person", "Person");
qSeleniumLib.waitForSelectorContaining("button", "selection").click();
qSeleniumLib.waitForSelectorContaining("li", "This page").click();
qSeleniumLib.waitForSelectorContaining("div", "records on this page are selected");
qSeleniumLib.waitForSelectorContaining("button", "action").click();
qSeleniumLib.waitForSelectorContaining("li", "bulk edit").click();
/////////////////
// edit screen //
/////////////////
qSeleniumLib.waitForSelector("#bulkEditSwitch-firstName").click();
qSeleniumLib.waitForSelector("input[name=firstName]").click();
qSeleniumLib.waitForSelector("input[name=firstName]").sendKeys("John");
qSeleniumLib.waitForSelectorContaining("button", "next").click();
///////////////////////
// validation screen //
///////////////////////
qSeleniumLib.waitForSelectorContaining("span", "How would you like to proceed").click();
qSeleniumLib.waitForSelectorContaining("button", "next").click();
//////////////////////////////////////////////////////////////
// need to change the result of the 'review' step this time //
//////////////////////////////////////////////////////////////
qSeleniumLib.waitForSelectorContaining("div", "Person Bulk Edit: Review").click();
qSeleniumJavalin.clearRoutes();
qSeleniumJavalin.stop();
addCommonRoutesForThisTest(qSeleniumJavalin);
qSeleniumJavalin.withRouteToFile("/processes/person.bulkEdit/74a03a7d-2f53-4784-9911-3a21f7646c43/step/review", "/processes/person.bulkEdit/step/review-result.json");
qSeleniumJavalin.restart();
qSeleniumLib.waitForSelectorContaining("button", "submit").click();
///////////////////
// result screen //
///////////////////
qSeleniumLib.waitForSelectorContaining("div", "Person Bulk Edit: Result").click();
qSeleniumLib.waitForSelectorContaining("button", "close").click();
// qSeleniumLib.waitForever();
}
}

View File

@ -46,7 +46,6 @@ public class SavedFiltersTest extends QBaseSeleniumTest
protected void addJavalinRoutes(QSeleniumJavalin qSeleniumJavalin)
{
addStandardRoutesForThisTest(qSeleniumJavalin);
qSeleniumJavalin.withRouteToFile("/processes/querySavedFilter/init", "processes/querySavedFilter/init.json");
}