mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-18 13:20:43 +00:00
Initial checkin - record scripts WIP
This commit is contained in:
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Test for Associated Record Scripts functionality.
|
||||
*******************************************************************************/
|
||||
public class AssociatedRecordScriptTest extends QBaseSeleniumTest
|
||||
{
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
protected void addJavalinRoutes(QSeleniumJavalin qSeleniumJavalin)
|
||||
{
|
||||
super.addJavalinRoutes(qSeleniumJavalin);
|
||||
qSeleniumJavalin.withRouteToFile("/data/person/1", "data/person/1701.json");
|
||||
qSeleniumJavalin.withRouteToFile("/data/person/1/developer", "data/person/1701.json");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Test
|
||||
void testNavigatingBackAndForth()
|
||||
{
|
||||
qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/peopleApp/greetingsApp/person/1", "John Doe");
|
||||
qSeleniumLib.waitForSelectorContaining("BUTTON", "actions").click();
|
||||
|
||||
qSeleniumLib.waitForSelectorContaining("LI", "Developer Mode").click();
|
||||
assertTrue(qSeleniumLib.driver.getCurrentUrl().endsWith("/1/dev"));
|
||||
|
||||
qSeleniumLib.waitForever();
|
||||
}
|
||||
|
||||
}
|
66
src/test/java/com/kingsrook/qqq/materialdashboard/tests/ScriptTableTest.java
Executable file
66
src/test/java/com/kingsrook/qqq/materialdashboard/tests/ScriptTableTest.java
Executable file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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 ScriptTableTest extends QBaseSeleniumTest
|
||||
{
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
protected void addJavalinRoutes(QSeleniumJavalin qSeleniumJavalin)
|
||||
{
|
||||
super.addJavalinRoutes(qSeleniumJavalin);
|
||||
qSeleniumJavalin
|
||||
.withRouteToFile("/data/script/1", "data/script/1.json")
|
||||
.withRouteToFile("/metaData/table/script", "metaData/table/script.json")
|
||||
.withRouteToFile("/widget/scriptViewer", "widget/scriptViewer.json")
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Test
|
||||
void test()
|
||||
{
|
||||
qSeleniumLib.gotoAndWaitForBreadcrumbHeader("/developer/script/1", "Hello, Script");
|
||||
|
||||
qSeleniumLib.waitForSelectorContaining("span", "uh, script");
|
||||
|
||||
qSeleniumLib.takeScreenshotToFile();
|
||||
// qSeleniumLib.waitForever();
|
||||
}
|
||||
|
||||
}
|
276
src/test/resources/fixtures/data/person/developer.json
Normal file
276
src/test/resources/fixtures/data/person/developer.json
Normal file
@ -0,0 +1,276 @@
|
||||
{
|
||||
"record": {
|
||||
"tableName": "client",
|
||||
"recordLabel": "John Doe",
|
||||
"values": {
|
||||
"name": "John Doe",
|
||||
"id": 120,
|
||||
"deposcoOrderOptimizationCoolingScriptId": 2,
|
||||
"createDate": "2022-08-30T00:31:00Z",
|
||||
"modifyDate": "2023-02-19T01:28:30Z",
|
||||
"isFulfillmentCenter": false,
|
||||
"infoplusLobId": 18698,
|
||||
"deposcoBusinessUnitName": "TRIFECTA",
|
||||
"deposcoBusinessUnitId": 77,
|
||||
"optimizationConfigId": 1,
|
||||
"nfCode": "Client 224"
|
||||
},
|
||||
"displayValues": {
|
||||
"optimizationConfigId": "Client: 120",
|
||||
"name": "John Doe",
|
||||
"id": "120",
|
||||
"deposcoOrderOptimizationCoolingScriptId": "2",
|
||||
"createDate": "2022-08-30T00:31:00Z",
|
||||
"modifyDate": "2023-02-19T01:28:30Z",
|
||||
"isFulfillmentCenter": "No",
|
||||
"infoplusLobId": "18698",
|
||||
"deposcoBusinessUnitName": "TRIFECTA",
|
||||
"deposcoBusinessUnitId": "77",
|
||||
"nfCode": "Client 224"
|
||||
}
|
||||
},
|
||||
"associatedScripts": [
|
||||
{
|
||||
"testInputFields": [
|
||||
{
|
||||
"name": "selectedTimeInTransitDays",
|
||||
"label": "Selected Time In Transit Days",
|
||||
"type": "INTEGER",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"isHeavy": false,
|
||||
"displayFormat": "%s"
|
||||
},
|
||||
{
|
||||
"name": "standardTimeInTransitDays",
|
||||
"label": "Standard Time In Transit Days",
|
||||
"type": "INTEGER",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"isHeavy": false,
|
||||
"displayFormat": "%s"
|
||||
}
|
||||
],
|
||||
"scriptType": {
|
||||
"tableName": "scriptType",
|
||||
"values": {
|
||||
"name": "Deposco Order Optimization Cooling",
|
||||
"id": 2,
|
||||
"createDate": "2022-10-31T19:06:50Z",
|
||||
"modifyDate": "2022-10-31T19:06:50Z"
|
||||
}
|
||||
},
|
||||
"scriptRevisions": [
|
||||
{
|
||||
"tableName": "scriptRevision",
|
||||
"values": {
|
||||
"id": 1,
|
||||
"contents": "1;",
|
||||
"createDate": "2023-02-19T01:28:30Z",
|
||||
"modifyDate": "2023-02-19T01:28:30Z",
|
||||
"scriptId": 2,
|
||||
"sequenceNo": 1,
|
||||
"commitMessage": "Initial version",
|
||||
"author": "Darin Kelkhoff"
|
||||
}
|
||||
}
|
||||
],
|
||||
"testOutputFields": [
|
||||
{
|
||||
"name": "sku",
|
||||
"label": "Sku",
|
||||
"type": "STRING",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"isHeavy": false,
|
||||
"displayFormat": "%s"
|
||||
},
|
||||
{
|
||||
"name": "quantityPerCarton",
|
||||
"label": "Quantity Per Carton",
|
||||
"type": "INTEGER",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"isHeavy": false,
|
||||
"displayFormat": "%s"
|
||||
},
|
||||
{
|
||||
"name": "useClientProvidedCoolingSolution",
|
||||
"label": "Use Client Provided Cooling Solution",
|
||||
"type": "BOOLEAN",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"isHeavy": false,
|
||||
"displayFormat": "%s"
|
||||
},
|
||||
{
|
||||
"name": "reason",
|
||||
"label": "Reason",
|
||||
"type": "STRING",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"isHeavy": false,
|
||||
"displayFormat": "%s"
|
||||
}
|
||||
],
|
||||
"script": {
|
||||
"tableName": "script",
|
||||
"values": {
|
||||
"name": "John Doe - Deposco Order Optimization Cooling",
|
||||
"id": 2,
|
||||
"scriptTypeId": 2,
|
||||
"createDate": "2023-02-19T01:28:30Z",
|
||||
"modifyDate": "2023-02-19T01:28:30Z",
|
||||
"currentScriptRevisionId": 1
|
||||
}
|
||||
},
|
||||
"associatedScript": {
|
||||
"fieldName": "deposcoOrderOptimizationCoolingScriptId",
|
||||
"scriptTypeId": 2,
|
||||
"scriptTester": {
|
||||
"name": "com.nutrifresh.one.processes.deposco.RunDeposcoOrderOptimizationCoolingScript",
|
||||
"codeType": "JAVA",
|
||||
"codeUsage": "SCRIPT_TESTER"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"testInputFields": [
|
||||
{
|
||||
"name": "selectedTimeInTransitDays",
|
||||
"label": "Selected Time In Transit Days",
|
||||
"type": "INTEGER",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"isHeavy": false,
|
||||
"displayFormat": "%s"
|
||||
},
|
||||
{
|
||||
"name": "standardTimeInTransitDays",
|
||||
"label": "Standard Time In Transit Days",
|
||||
"type": "INTEGER",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"isHeavy": false,
|
||||
"displayFormat": "%s"
|
||||
},
|
||||
{
|
||||
"name": "runtimeWeekday",
|
||||
"label": "Runtime Weekday",
|
||||
"type": "INTEGER",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"isHeavy": false,
|
||||
"displayFormat": "%s"
|
||||
}
|
||||
],
|
||||
"scriptType": {
|
||||
"tableName": "scriptType",
|
||||
"values": {
|
||||
"name": "Deposco Order Optimization Batch Name",
|
||||
"id": 1,
|
||||
"createDate": "2022-10-31T19:06:50Z",
|
||||
"modifyDate": "2022-10-31T19:06:50Z"
|
||||
}
|
||||
},
|
||||
"testOutputFields": [
|
||||
{
|
||||
"name": "batchName",
|
||||
"label": "Batch Name",
|
||||
"type": "STRING",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"isHeavy": false,
|
||||
"displayFormat": "%s"
|
||||
},
|
||||
{
|
||||
"name": "reason",
|
||||
"label": "Reason",
|
||||
"type": "STRING",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"isHeavy": false,
|
||||
"displayFormat": "%s"
|
||||
}
|
||||
],
|
||||
"associatedScript": {
|
||||
"fieldName": "deposcoOrderOptimizationBatchNameScriptId",
|
||||
"scriptTypeId": 1,
|
||||
"scriptTester": {
|
||||
"name": "com.nutrifresh.one.processes.deposco.RunDeposcoOrderOptimizationBatchNameScript",
|
||||
"codeType": "JAVA",
|
||||
"codeUsage": "SCRIPT_TESTER"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"testInputFields": [
|
||||
{
|
||||
"name": "selectedTimeInTransitDays",
|
||||
"label": "Selected Time In Transit Days",
|
||||
"type": "INTEGER",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"isHeavy": false,
|
||||
"displayFormat": "%s"
|
||||
},
|
||||
{
|
||||
"name": "standardTimeInTransitDays",
|
||||
"label": "Standard Time In Transit Days",
|
||||
"type": "INTEGER",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"isHeavy": false,
|
||||
"displayFormat": "%s"
|
||||
},
|
||||
{
|
||||
"name": "runtimeWeekday",
|
||||
"label": "Runtime Weekday",
|
||||
"type": "INTEGER",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"isHeavy": false,
|
||||
"displayFormat": "%s"
|
||||
}
|
||||
],
|
||||
"scriptType": {
|
||||
"tableName": "scriptType",
|
||||
"values": {
|
||||
"name": "Deposco Order Optimization Batch Name",
|
||||
"id": 1,
|
||||
"createDate": "2022-10-31T19:06:50Z",
|
||||
"modifyDate": "2022-10-31T19:06:50Z"
|
||||
}
|
||||
},
|
||||
"testOutputFields": [
|
||||
{
|
||||
"name": "batchName",
|
||||
"label": "Batch Name",
|
||||
"type": "STRING",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"isHeavy": false,
|
||||
"displayFormat": "%s"
|
||||
},
|
||||
{
|
||||
"name": "reason",
|
||||
"label": "Reason",
|
||||
"type": "STRING",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"isHeavy": false,
|
||||
"displayFormat": "%s"
|
||||
}
|
||||
],
|
||||
"associatedScript": {
|
||||
"fieldName": "deposcoOrderOptimizationCartonizationScriptId",
|
||||
"scriptTypeId": 1,
|
||||
"scriptTester": {
|
||||
"name": "com.nutrifresh.one.processes.deposco.RunDeposcoOrderOptimizationBatchNameScript",
|
||||
"codeType": "JAVA",
|
||||
"codeUsage": "SCRIPT_TESTER"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
20
src/test/resources/fixtures/data/script/1.json
Normal file
20
src/test/resources/fixtures/data/script/1.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"tableName": "script",
|
||||
"recordLabel": "Hello, Script",
|
||||
"values": {
|
||||
"name": "Hello, Script",
|
||||
"id": 1,
|
||||
"tableName": "client",
|
||||
"createDate": "2023-02-18T00:47:51Z",
|
||||
"modifyDate": "2023-02-18T00:47:51Z",
|
||||
"scriptTypeId": 1
|
||||
},
|
||||
"displayValues": {
|
||||
"tableName": "Client",
|
||||
"scriptTypeId": "Unknown",
|
||||
"name": "Hello, Script",
|
||||
"id": "1",
|
||||
"createDate": "2023-02-18T00:47:51Z",
|
||||
"modifyDate": "2023-02-18T00:47:51Z"
|
||||
}
|
||||
}
|
139
src/test/resources/fixtures/metaData/table/script.json
Normal file
139
src/test/resources/fixtures/metaData/table/script.json
Normal file
@ -0,0 +1,139 @@
|
||||
{
|
||||
"table": {
|
||||
"name": "script",
|
||||
"label": "Script",
|
||||
"isHidden": false,
|
||||
"primaryKeyField": "id",
|
||||
"iconName": "data_object",
|
||||
"fields": {
|
||||
"modifyDate": {
|
||||
"name": "modifyDate",
|
||||
"label": "Modify Date",
|
||||
"type": "DATE_TIME",
|
||||
"isRequired": false,
|
||||
"isEditable": false,
|
||||
"displayFormat": "%s"
|
||||
},
|
||||
"name": {
|
||||
"name": "name",
|
||||
"label": "Name",
|
||||
"type": "STRING",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"displayFormat": "%s"
|
||||
},
|
||||
"currentScriptRevisionId": {
|
||||
"name": "currentScriptRevisionId",
|
||||
"label": "Current Script Revision",
|
||||
"type": "INTEGER",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"possibleValueSourceName": "scriptRevision",
|
||||
"displayFormat": "%s",
|
||||
"adornments": [
|
||||
{
|
||||
"type": "LINK",
|
||||
"values": {
|
||||
"toRecordFromTable": "scriptRevision"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"name": "id",
|
||||
"label": "Id",
|
||||
"type": "INTEGER",
|
||||
"isRequired": false,
|
||||
"isEditable": false,
|
||||
"displayFormat": "%s"
|
||||
},
|
||||
"tableName": {
|
||||
"name": "tableName",
|
||||
"label": "Table Name",
|
||||
"type": "STRING",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"possibleValueSourceName": "tables",
|
||||
"displayFormat": "%s"
|
||||
},
|
||||
"createDate": {
|
||||
"name": "createDate",
|
||||
"label": "Create Date",
|
||||
"type": "DATE_TIME",
|
||||
"isRequired": false,
|
||||
"isEditable": false,
|
||||
"displayFormat": "%s"
|
||||
},
|
||||
"scriptTypeId": {
|
||||
"name": "scriptTypeId",
|
||||
"label": "Script Type",
|
||||
"type": "INTEGER",
|
||||
"isRequired": false,
|
||||
"isEditable": true,
|
||||
"possibleValueSourceName": "scriptType",
|
||||
"displayFormat": "%s",
|
||||
"adornments": [
|
||||
{
|
||||
"type": "LINK",
|
||||
"values": {
|
||||
"toRecordFromTable": "scriptType"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"sections": [
|
||||
{
|
||||
"name": "identity",
|
||||
"label": "Identity",
|
||||
"tier": "T1",
|
||||
"fieldNames": [
|
||||
"id",
|
||||
"name",
|
||||
"scriptTypeId",
|
||||
"tableName",
|
||||
"currentScriptRevisionId"
|
||||
],
|
||||
"icon": {
|
||||
"name": "badge"
|
||||
},
|
||||
"isHidden": false
|
||||
},
|
||||
{
|
||||
"name": "contents",
|
||||
"label": "Contents",
|
||||
"tier": "T2",
|
||||
"widgetName": "scriptViewer",
|
||||
"icon": {
|
||||
"name": "data_object"
|
||||
},
|
||||
"isHidden": false
|
||||
},
|
||||
{
|
||||
"name": "dates",
|
||||
"label": "Dates",
|
||||
"tier": "T3",
|
||||
"fieldNames": [
|
||||
"createDate",
|
||||
"modifyDate"
|
||||
],
|
||||
"icon": {
|
||||
"name": "calendar_month"
|
||||
},
|
||||
"isHidden": false
|
||||
}
|
||||
],
|
||||
"capabilities": [
|
||||
"TABLE_COUNT",
|
||||
"TABLE_GET",
|
||||
"TABLE_QUERY",
|
||||
"TABLE_INSERT",
|
||||
"TABLE_DELETE",
|
||||
"TABLE_UPDATE"
|
||||
],
|
||||
"readPermission": true,
|
||||
"insertPermission": true,
|
||||
"editPermission": true,
|
||||
"deletePermission": true
|
||||
}
|
||||
}
|
7
src/test/resources/fixtures/widget/scriptViewer.json
Normal file
7
src/test/resources/fixtures/widget/scriptViewer.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"type": "scriptViewer",
|
||||
"queryParams": {
|
||||
"id": "1",
|
||||
"tableName": "script"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user