systemview 1.0.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/Connections.js +36 -0
- package/api/connections.txt +1 -0
- package/api/index.js +78 -0
- package/babel.config.js +12 -0
- package/cli/launchApp.js +0 -0
- package/cli/runTest.js +0 -0
- package/cli/utils/cli.js +48 -0
- package/cli/utils/init.js +17 -0
- package/cli/utils/log.js +11 -0
- package/package.json +6 -3
- package/plugin/SystemViewModule.js +97 -0
- package/plugin/getAllTest.js +21 -0
- package/plugin/index.js +40 -0
- package/src/App.css +38 -0
- package/src/App.js +30 -0
- package/src/ServiceContext.js +9 -0
- package/src/assets/arrow.png +0 -0
- package/src/assets/check.svg +1 -0
- package/src/assets/clear.png +0 -0
- package/src/assets/edit.png +0 -0
- package/src/assets/error.svg +1 -0
- package/src/assets/eval-icon.svg +10 -0
- package/src/assets/expand-arrow.svg +41 -0
- package/src/assets/expand-button.svg +41 -0
- package/src/assets/fonts/FontsFree-Net-SFMono-Regular.ttf +0 -0
- package/src/assets/fonts/Malkor-Regular.ttf +0 -0
- package/src/assets/iconfinder-icon (1).svg +14 -0
- package/src/assets/iconfinder-icon.svg +14 -0
- package/src/assets/icons-save-60.png +0 -0
- package/src/assets/loading.gif +0 -0
- package/src/assets/missing-doc.png +0 -0
- package/src/assets/saved-doc.png +0 -0
- package/src/assets/sysly.png +0 -0
- package/src/assets/test-icon.svg +10 -0
- package/src/assets/test-missing.png +0 -0
- package/src/assets/test-saved.png +0 -0
- package/src/assets/x.svg +1 -0
- package/src/atoms/Button/Button.js +20 -0
- package/src/atoms/Button/Button.test.js +27 -0
- package/src/atoms/Button/__snapshots__/Button.test.js.snap +9 -0
- package/src/atoms/Button/styles.scss +35 -0
- package/src/atoms/Count/index.js +10 -0
- package/src/atoms/Count/styles.scss +25 -0
- package/src/atoms/DataTable/DataTable.js +27 -0
- package/src/atoms/DataTable/DataTable.test.js +55 -0
- package/src/atoms/DataTable/__snapshots__/DataTable.test.js.snap +36 -0
- package/src/atoms/DataTable/styles.scss +28 -0
- package/src/atoms/DescriptionBox/DescriptionBox.js +24 -0
- package/src/atoms/DescriptionBox/DescriptionBox.test.js +36 -0
- package/src/atoms/DescriptionBox/__snapshots__/DescriptionBox.test.js.snap +14 -0
- package/src/atoms/DescriptionBox/styles.scss +24 -0
- package/src/atoms/DescriptionText/DescriptionText.js +12 -0
- package/src/atoms/DescriptionText/DescriptionText.test.js +22 -0
- package/src/atoms/DescriptionText/styles.scss +10 -0
- package/src/atoms/DocsIcon/DocsIcon.js +20 -0
- package/src/atoms/DocsIcon/DocsIcon.test.js +23 -0
- package/src/atoms/DocsIcon/styles.scss +7 -0
- package/src/atoms/ExpandableIcon/ExpandableIcon.js +30 -0
- package/src/atoms/ExpandableIcon/ExpandableIcon.test.js +18 -0
- package/src/atoms/ExpandableIcon/styles.scss +5 -0
- package/src/atoms/JsonTextBox/JsonTextBox.js +61 -0
- package/src/atoms/JsonTextBox/JsonTextBox.test.js +0 -0
- package/src/atoms/JsonTextBox/styles.scss +41 -0
- package/src/atoms/Link/Link.js +17 -0
- package/src/atoms/Link/Link.test.js +33 -0
- package/src/atoms/Link/styles.scss +8 -0
- package/src/atoms/List/List.js +8 -0
- package/src/atoms/List/List.test.js +26 -0
- package/src/atoms/List/styles.scss +9 -0
- package/src/atoms/Markdown/Markdown.js +48 -0
- package/src/atoms/Markdown/styles.scss +414 -0
- package/src/atoms/RunTestIcon/index.js +41 -0
- package/src/atoms/RunTestIcon/styles.scss +16 -0
- package/src/atoms/SaveIcon/SaveIcon.js +6 -0
- package/src/atoms/SaveIcon/styles.scss +3 -0
- package/src/atoms/Selector/Selector.js +28 -0
- package/src/atoms/Selector/Selector.test.js +0 -0
- package/src/atoms/Selector/styles.scss +1 -0
- package/src/atoms/StatusIndicator/StatusIndicator.js +16 -0
- package/src/atoms/StatusIndicator/styles.scss +33 -0
- package/src/atoms/TestsIcon/TestsIcon.js +17 -0
- package/src/atoms/TestsIcon/TestsIcon.test.js +18 -0
- package/src/atoms/TestsIcon/styles.scss +0 -0
- package/src/atoms/Text/Text.js +8 -0
- package/src/atoms/Text/Text.test.js +21 -0
- package/src/atoms/Text/styles.scss +0 -0
- package/src/atoms/Textbox/Textbox.js +33 -0
- package/src/atoms/Textbox/Textbox.test.js +23 -0
- package/src/atoms/Textbox/styles.scss +14 -0
- package/src/atoms/Title/Title.js +12 -0
- package/src/atoms/Title/Title.test.js +0 -0
- package/src/atoms/Title/styles.scss +6 -0
- package/src/atoms/Toggle/Toggle.js +13 -0
- package/src/atoms/Toggle/Toggle.test.js +0 -0
- package/src/atoms/Toggle/styles.scss +62 -0
- package/src/atoms/TypeSelector/TypeSelector.js +28 -0
- package/src/atoms/TypeSelector/TypeSelector.test.js +0 -0
- package/src/atoms/TypeSelector/styles.scss +9 -0
- package/src/index.css +20 -0
- package/src/index.js +24 -0
- package/src/logo.svg +7 -0
- package/src/molecules/Args/Args.js +302 -0
- package/src/molecules/Args/Args.test.js +0 -0
- package/src/molecules/Args/styles.scss +166 -0
- package/src/molecules/AutoCompleteBox/AutoCompleteBox.js +101 -0
- package/src/molecules/AutoCompleteBox/AutoCompleteBox.test.js +0 -0
- package/src/molecules/AutoCompleteBox/styles.scss +35 -0
- package/src/molecules/DataTableForm/DataTableForm.js +167 -0
- package/src/molecules/DataTableForm/DataTableForm.test.js +0 -0
- package/src/molecules/DataTableForm/styles.scss +51 -0
- package/src/molecules/EditBox/EditBox.js +49 -0
- package/src/molecules/EditBox/EditBox.test.js +0 -0
- package/src/molecules/EditBox/styles.scss +38 -0
- package/src/molecules/ExpandableList/ExpandableList.js +26 -0
- package/src/molecules/ExpandableList/ExpandableList.test.js +33 -0
- package/src/molecules/ExpandableList/styles.scss +18 -0
- package/src/molecules/ExpandableSection/ExpandableSection.js +36 -0
- package/src/molecules/ExpandableSection/ExpandableSection.test.js +0 -0
- package/src/molecules/ExpandableSection/styles.scss +22 -0
- package/src/molecules/ServerModulesList/ServerModulesList.js +75 -0
- package/src/molecules/ServerModulesList/styles.scss +28 -0
- package/src/molecules/TargetSelector/TargetSelector.js +34 -0
- package/src/molecules/TargetSelector/TargetSelector.test.js +0 -0
- package/src/molecules/TargetSelector/styles.scss +0 -0
- package/src/molecules/TestCaption/TestCaption.js +26 -0
- package/src/molecules/TestCaption/TestCaption.test.js +0 -0
- package/src/molecules/TestCaption/styles.scss +40 -0
- package/src/molecules/TestSummary/index.js +212 -0
- package/src/molecules/TestSummary/styles.scss +83 -0
- package/src/molecules/TextWith2Links/TextWith2Links.js +10 -0
- package/src/molecules/TextWith2Links/styles.scss +0 -0
- package/src/molecules/ValidationInput/ValidationInput.js +64 -0
- package/src/molecules/ValidationInput/ValidationInput.test.js +0 -0
- package/src/molecules/ValidationInput/ValidationMessages.js +178 -0
- package/src/molecules/ValidationInput/ValidationOptions.js +113 -0
- package/src/molecules/ValidationInput/styles.scss +74 -0
- package/src/molecules/ValidationInput/validator.js +244 -0
- package/src/organisms/Documentation/Documentation.js +128 -0
- package/src/organisms/Documentation/Documentation.test.js +0 -0
- package/src/organisms/Documentation/styles.scss +22 -0
- package/src/organisms/MultiTestSection/MultiTestSection.js +85 -0
- package/src/organisms/MultiTestSection/MultiTestSection.test.js +0 -0
- package/src/organisms/MultiTestSection/styles.scss +22 -0
- package/src/organisms/SavedTests/SavedTests.js +209 -0
- package/src/organisms/SavedTests/SavedTests.test.js +0 -0
- package/src/organisms/SavedTests/styles.scss +76 -0
- package/src/organisms/SavedTests/transformTests.js +51 -0
- package/src/organisms/ScratchPad/ScratchPad.js +128 -0
- package/src/organisms/ScratchPad/ScratchPad.test.js +0 -0
- package/src/organisms/ScratchPad/styles.scss +100 -0
- package/src/organisms/SystemNavigator/SystemNavigator.js +148 -0
- package/src/organisms/SystemNavigator/SystemNavigator.test.js +24 -0
- package/src/organisms/SystemNavigator/styles.scss +38 -0
- package/src/organisms/TestContainer/TestContainer.js +72 -0
- package/src/organisms/TestContainer/TestContainer.test.js +0 -0
- package/src/organisms/TestContainer/styles.scss +20 -0
- package/src/organisms/TestPanel/AfterTest/AfterTest.js +16 -0
- package/src/organisms/TestPanel/AfterTest/AfterTest.test.js +0 -0
- package/src/organisms/TestPanel/AfterTest/styles.scss +0 -0
- package/src/organisms/TestPanel/BeforeTest/BeforeTest.js +16 -0
- package/src/organisms/TestPanel/BeforeTest/BeforeTest.test.js +0 -0
- package/src/organisms/TestPanel/BeforeTest/styles.scss +0 -0
- package/src/organisms/TestPanel/Evaluations.js +369 -0
- package/src/organisms/TestPanel/EventsTest/EventsTest.js +19 -0
- package/src/organisms/TestPanel/EventsTest/styles.scss +0 -0
- package/src/organisms/TestPanel/MainTest/MainTest.js +20 -0
- package/src/organisms/TestPanel/MainTest/MainTest.test.js +0 -0
- package/src/organisms/TestPanel/MainTest/styles.scss +143 -0
- package/src/organisms/TestPanel/TestPanel.js +170 -0
- package/src/organisms/TestPanel/TestPanel.test.js +0 -0
- package/src/organisms/TestPanel/components/Argument.class.js +94 -0
- package/src/organisms/TestPanel/components/FullTestController.js +78 -0
- package/src/organisms/TestPanel/components/Test.class.js +162 -0
- package/src/organisms/TestPanel/components/TestController.class.js +135 -0
- package/src/organisms/TestPanel/components/test-helpers.js +109 -0
- package/src/organisms/TestPanel/styles.scss +45 -0
- package/src/pages/SystemView/SystemView.js +68 -0
- package/src/pages/SystemView/styles.scss +81 -0
- package/src/reportWebVitals.js +13 -0
- package/src/sass/bootstrap/_alert.scss +51 -0
- package/src/sass/bootstrap/_badge.scss +47 -0
- package/src/sass/bootstrap/_breadcrumb.scss +38 -0
- package/src/sass/bootstrap/_button-group.scss +166 -0
- package/src/sass/bootstrap/_buttons.scss +143 -0
- package/src/sass/bootstrap/_card.scss +270 -0
- package/src/sass/bootstrap/_carousel.scss +191 -0
- package/src/sass/bootstrap/_close.scss +34 -0
- package/src/sass/bootstrap/_code.scss +56 -0
- package/src/sass/bootstrap/_custom-forms.scss +297 -0
- package/src/sass/bootstrap/_dropdown.scss +131 -0
- package/src/sass/bootstrap/_forms.scss +333 -0
- package/src/sass/bootstrap/_functions.scss +86 -0
- package/src/sass/bootstrap/_grid.scss +52 -0
- package/src/sass/bootstrap/_images.scss +42 -0
- package/src/sass/bootstrap/_input-group.scss +159 -0
- package/src/sass/bootstrap/_jumbotron.scss +16 -0
- package/src/sass/bootstrap/_list-group.scss +115 -0
- package/src/sass/bootstrap/_media.scss +8 -0
- package/src/sass/bootstrap/_mixins.scss +42 -0
- package/src/sass/bootstrap/_modal.scss +168 -0
- package/src/sass/bootstrap/_nav.scss +118 -0
- package/src/sass/bootstrap/_navbar.scss +311 -0
- package/src/sass/bootstrap/_pagination.scss +77 -0
- package/src/sass/bootstrap/_popover.scss +183 -0
- package/src/sass/bootstrap/_print.scss +124 -0
- package/src/sass/bootstrap/_progress.scss +33 -0
- package/src/sass/bootstrap/_reboot.scss +482 -0
- package/src/sass/bootstrap/_root.scss +19 -0
- package/src/sass/bootstrap/_tables.scss +180 -0
- package/src/sass/bootstrap/_tooltip.scss +115 -0
- package/src/sass/bootstrap/_transitions.scss +36 -0
- package/src/sass/bootstrap/_type.scss +125 -0
- package/src/sass/bootstrap/_utilities.scss +14 -0
- package/src/sass/bootstrap/_variables.scss +894 -0
- package/src/sass/bootstrap/bootstrap-grid.scss +32 -0
- package/src/sass/bootstrap/bootstrap-reboot.scss +12 -0
- package/src/sass/bootstrap/bootstrap.scss +42 -0
- package/src/sass/bootstrap/mixins/_alert.scss +13 -0
- package/src/sass/bootstrap/mixins/_background-variant.scss +21 -0
- package/src/sass/bootstrap/mixins/_badge.scss +12 -0
- package/src/sass/bootstrap/mixins/_border-radius.scss +35 -0
- package/src/sass/bootstrap/mixins/_box-shadow.scss +5 -0
- package/src/sass/bootstrap/mixins/_breakpoints.scss +123 -0
- package/src/sass/bootstrap/mixins/_buttons.scss +109 -0
- package/src/sass/bootstrap/mixins/_caret.scss +65 -0
- package/src/sass/bootstrap/mixins/_clearfix.scss +7 -0
- package/src/sass/bootstrap/mixins/_float.scss +11 -0
- package/src/sass/bootstrap/mixins/_forms.scss +137 -0
- package/src/sass/bootstrap/mixins/_gradients.scss +45 -0
- package/src/sass/bootstrap/mixins/_grid-framework.scss +67 -0
- package/src/sass/bootstrap/mixins/_grid.scss +52 -0
- package/src/sass/bootstrap/mixins/_hover.scss +39 -0
- package/src/sass/bootstrap/mixins/_image.scss +36 -0
- package/src/sass/bootstrap/mixins/_list-group.scss +21 -0
- package/src/sass/bootstrap/mixins/_lists.scss +7 -0
- package/src/sass/bootstrap/mixins/_nav-divider.scss +10 -0
- package/src/sass/bootstrap/mixins/_navbar-align.scss +10 -0
- package/src/sass/bootstrap/mixins/_pagination.scss +22 -0
- package/src/sass/bootstrap/mixins/_reset-text.scss +17 -0
- package/src/sass/bootstrap/mixins/_resize.scss +6 -0
- package/src/sass/bootstrap/mixins/_screen-reader.scss +35 -0
- package/src/sass/bootstrap/mixins/_size.scss +6 -0
- package/src/sass/bootstrap/mixins/_table-row.scss +30 -0
- package/src/sass/bootstrap/mixins/_text-emphasis.scss +14 -0
- package/src/sass/bootstrap/mixins/_text-hide.scss +9 -0
- package/src/sass/bootstrap/mixins/_text-truncate.scss +8 -0
- package/src/sass/bootstrap/mixins/_transition.scss +9 -0
- package/src/sass/bootstrap/mixins/_visibility.scss +7 -0
- package/src/sass/bootstrap/utilities/_align.scss +8 -0
- package/src/sass/bootstrap/utilities/_background.scss +19 -0
- package/src/sass/bootstrap/utilities/_borders.scss +59 -0
- package/src/sass/bootstrap/utilities/_clearfix.scss +3 -0
- package/src/sass/bootstrap/utilities/_display.scss +38 -0
- package/src/sass/bootstrap/utilities/_embed.scss +52 -0
- package/src/sass/bootstrap/utilities/_flex.scss +46 -0
- package/src/sass/bootstrap/utilities/_float.scss +9 -0
- package/src/sass/bootstrap/utilities/_position.scss +36 -0
- package/src/sass/bootstrap/utilities/_screenreaders.scss +11 -0
- package/src/sass/bootstrap/utilities/_sizing.scss +12 -0
- package/src/sass/bootstrap/utilities/_spacing.scss +51 -0
- package/src/sass/bootstrap/utilities/_text.scss +52 -0
- package/src/sass/bootstrap/utilities/_visibility.scss +11 -0
- package/src/setupTests.js +5 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import React, { useState, useContext, useEffect } from "react";
|
|
2
|
+
import BeforeTest from "./BeforeTest/BeforeTest";
|
|
3
|
+
import AfterTest from "./AfterTest/AfterTest";
|
|
4
|
+
import MainTest from "./MainTest/MainTest";
|
|
5
|
+
import EventsTest from "./EventsTest/EventsTest";
|
|
6
|
+
import ServiceContext from "../../ServiceContext";
|
|
7
|
+
import Test from "./components/Test.class";
|
|
8
|
+
import TestController from "./components/TestController.class";
|
|
9
|
+
import "./styles.scss";
|
|
10
|
+
import RunTestIcon from "../../atoms/RunTestIcon";
|
|
11
|
+
import SaveIcon from "../../atoms/SaveIcon/SaveIcon";
|
|
12
|
+
import SavedTests from "../SavedTests/SavedTests";
|
|
13
|
+
import { Client } from "systemlynx";
|
|
14
|
+
import FullTestController from "./components/FullTestController";
|
|
15
|
+
import Title from "../../atoms/Title/Title";
|
|
16
|
+
import { CurrentTest } from "../../atoms/StatusIndicator/StatusIndicator";
|
|
17
|
+
|
|
18
|
+
const FullTest = ({ serviceId, moduleName, methodName }) => {
|
|
19
|
+
const namespace = { serviceId, moduleName, methodName };
|
|
20
|
+
const { connectedServices } = useContext(ServiceContext);
|
|
21
|
+
const serviceData = connectedServices.find(
|
|
22
|
+
(service) => service.serviceId === serviceId
|
|
23
|
+
);
|
|
24
|
+
const { Plugin } = serviceData
|
|
25
|
+
? Client.createService(serviceData.system.connectionData)
|
|
26
|
+
: {};
|
|
27
|
+
const [Before, setTestBefore] = useState([]);
|
|
28
|
+
const [After, setTestAfter] = useState([]);
|
|
29
|
+
const [Main, setTestMain] = useState([new Test({ namespace, shouldValidate: true })]);
|
|
30
|
+
const eventNamespace = { serviceId, moduleName, methodName: "on" };
|
|
31
|
+
const [Events, setEventTest] = useState([]);
|
|
32
|
+
const FullTest = [Before, Main, Events, After];
|
|
33
|
+
const [savedTests, setSavedTests] = useState([]);
|
|
34
|
+
const [saveResponse, setMessage] = useState({ message: "", error: false });
|
|
35
|
+
window.Tests = FullTest;
|
|
36
|
+
const testCtrl = (TestSection, setState, section, FullTest) =>
|
|
37
|
+
new TestController({
|
|
38
|
+
TestSection,
|
|
39
|
+
setState,
|
|
40
|
+
section,
|
|
41
|
+
FullTest,
|
|
42
|
+
connectedServices,
|
|
43
|
+
});
|
|
44
|
+
const MainCtrl = testCtrl(Main, setTestMain, 1, FullTest);
|
|
45
|
+
const BeforeCtrl = testCtrl(Before, setTestBefore, 0, FullTest);
|
|
46
|
+
const EventCtrl = testCtrl(Events, setEventTest, 2, FullTest);
|
|
47
|
+
const AfterCtrl = testCtrl(After, setTestAfter, 3, FullTest);
|
|
48
|
+
|
|
49
|
+
const { runFullTest, saveTests } = new FullTestController({
|
|
50
|
+
FullTest,
|
|
51
|
+
connectedServices,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const runTest = async () => {
|
|
55
|
+
const tests = await runFullTest();
|
|
56
|
+
setFullTest(tests);
|
|
57
|
+
};
|
|
58
|
+
const setFullTest = ([Before, Main, Events, After]) => {
|
|
59
|
+
setTestMain([...Main]);
|
|
60
|
+
setTestBefore([...Before]);
|
|
61
|
+
setEventTest([...Events]);
|
|
62
|
+
setTestAfter([...After]);
|
|
63
|
+
};
|
|
64
|
+
const clearMessage = () => setMessage({ error: false, message: "" });
|
|
65
|
+
const save = async () => {
|
|
66
|
+
const { error, message } = await saveTests();
|
|
67
|
+
|
|
68
|
+
if (!error) {
|
|
69
|
+
resetTests();
|
|
70
|
+
//fetchTests();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
setMessage({ error, message });
|
|
74
|
+
setTimeout(clearMessage, 4000);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const fetchTests = async () => {
|
|
78
|
+
try {
|
|
79
|
+
if (Plugin) {
|
|
80
|
+
const results = await Plugin.getTests(namespace);
|
|
81
|
+
setSavedTests(results);
|
|
82
|
+
}
|
|
83
|
+
} catch (error) {
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const resetTests = () => {
|
|
88
|
+
setTestBefore([]);
|
|
89
|
+
setTestAfter([]);
|
|
90
|
+
setEventTest([]);
|
|
91
|
+
//get connection for the main test and set state
|
|
92
|
+
const test = new Test({ namespace, shouldValidate: true }).getConnection(
|
|
93
|
+
connectedServices
|
|
94
|
+
);
|
|
95
|
+
setTestMain([test]);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
resetTests();
|
|
100
|
+
fetchTests();
|
|
101
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
102
|
+
}, [serviceId, moduleName, methodName, connectedServices]);
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<section className="test-panel">
|
|
106
|
+
<div className="container">
|
|
107
|
+
<div className="row">
|
|
108
|
+
<Title text="Scratch Pad" />
|
|
109
|
+
{typeof Main[0].index === "number" && (
|
|
110
|
+
<CurrentTest name={`Saved Test ${1 + Main[0].index}`} onClick={resetTests} />
|
|
111
|
+
)}
|
|
112
|
+
</div>
|
|
113
|
+
<div>
|
|
114
|
+
<span className="row test__buttons">
|
|
115
|
+
<span
|
|
116
|
+
className={`test-panel__error-message test-panel__error-message--hide-${!saveResponse.message} test-panel__error-message--error-${
|
|
117
|
+
saveResponse.error
|
|
118
|
+
} `}
|
|
119
|
+
>
|
|
120
|
+
<span>{saveResponse.message}</span>
|
|
121
|
+
<span onClick={clearMessage} className="test-panel__clear-error btn">
|
|
122
|
+
×
|
|
123
|
+
</span>
|
|
124
|
+
</span>
|
|
125
|
+
|
|
126
|
+
<span>
|
|
127
|
+
<span className="btn" onClick={runTest}>
|
|
128
|
+
<RunTestIcon />
|
|
129
|
+
</span>
|
|
130
|
+
<span className="btn" onClick={save}>
|
|
131
|
+
<SaveIcon />
|
|
132
|
+
</span>
|
|
133
|
+
</span>
|
|
134
|
+
</span>
|
|
135
|
+
|
|
136
|
+
<div className="row test-panel__section">
|
|
137
|
+
<BeforeTest TestController={BeforeCtrl} TestSection={Before} />
|
|
138
|
+
</div>
|
|
139
|
+
<div className="row test-panel__section">
|
|
140
|
+
<MainTest TestController={MainCtrl} TestSection={Main} />
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<div className="row test-panel__section">
|
|
144
|
+
<AfterTest TestController={AfterCtrl} TestSection={After} />
|
|
145
|
+
</div>
|
|
146
|
+
<div className="row test-panel__section">
|
|
147
|
+
<EventsTest
|
|
148
|
+
TestController={EventCtrl}
|
|
149
|
+
TestSection={Events}
|
|
150
|
+
namespace={eventNamespace}
|
|
151
|
+
FullTest={FullTest}
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
154
|
+
<div className="row test-panel__section">
|
|
155
|
+
<SavedTests
|
|
156
|
+
savedTests={savedTests}
|
|
157
|
+
connectedServices={connectedServices}
|
|
158
|
+
setFullTest={setFullTest}
|
|
159
|
+
Plugin={Plugin}
|
|
160
|
+
fetchTests={fetchTests}
|
|
161
|
+
/>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
<div className="scroll-buffer"></div>
|
|
166
|
+
</section>
|
|
167
|
+
);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export default FullTest;
|
|
File without changes
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isTargetValueFn,
|
|
3
|
+
isTargetNamespace,
|
|
4
|
+
targetValueFnRegex,
|
|
5
|
+
obj,
|
|
6
|
+
isEqualArrays,
|
|
7
|
+
isFunction,
|
|
8
|
+
strFn,
|
|
9
|
+
} from "./test-helpers";
|
|
10
|
+
|
|
11
|
+
export function TargetValue(target_namespace, source_map = [], source_index = 0) {
|
|
12
|
+
this.target_namespace = target_namespace;
|
|
13
|
+
this.source_map = source_map;
|
|
14
|
+
this.source_index = source_index;
|
|
15
|
+
}
|
|
16
|
+
export default function Argument(
|
|
17
|
+
name,
|
|
18
|
+
FullTest,
|
|
19
|
+
input_type = "undefined",
|
|
20
|
+
input,
|
|
21
|
+
targetValues = []
|
|
22
|
+
) {
|
|
23
|
+
this.name = name;
|
|
24
|
+
this.input = input;
|
|
25
|
+
this.input_type = input_type;
|
|
26
|
+
this.data_type = "";
|
|
27
|
+
this.targetValues = targetValues;
|
|
28
|
+
|
|
29
|
+
this.value = () => {
|
|
30
|
+
return this.targetValues.reduce((arg, { source_map, target_namespace: nsp }) => {
|
|
31
|
+
const [value, placeholder, key] = obj(arg).parse(source_map);
|
|
32
|
+
|
|
33
|
+
if (isTargetValueFn(nsp)) {
|
|
34
|
+
placeholder[key] = value
|
|
35
|
+
.trim()
|
|
36
|
+
.replace(nsp, getTargetValue(nsp.substring(3, nsp.length - 1)));
|
|
37
|
+
} else if (isTargetNamespace(nsp)) {
|
|
38
|
+
placeholder[key] = getTargetValue(nsp);
|
|
39
|
+
} else {
|
|
40
|
+
placeholder[key] = strFn(nsp);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return arg;
|
|
44
|
+
//creating a deep copy in order to lose refs to original
|
|
45
|
+
}, obj(this).clone()).input;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
this.parseTargetValues = (input, source_map) => {
|
|
49
|
+
//extract one or more target replacer text from string (i.e. "tv(beforeTest.Action1.error)")
|
|
50
|
+
Array.from(input.matchAll(targetValueFnRegex)).forEach((match) => {
|
|
51
|
+
this.addTargetValue(match[0], source_map, match.index);
|
|
52
|
+
});
|
|
53
|
+
if (isTargetNamespace(input) || isFunction(input))
|
|
54
|
+
this.addTargetValue(input, source_map, 0);
|
|
55
|
+
|
|
56
|
+
return this;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
this.checkTargetNamespaces = () => {
|
|
60
|
+
// check target namespaces against current input for deletion
|
|
61
|
+
//keep if the target value string still exist on this.input...
|
|
62
|
+
this.targetValues = this.targetValues.filter(
|
|
63
|
+
({ target_namespace, source_map, source_index }) => {
|
|
64
|
+
const value = obj(this).valueAt(source_map);
|
|
65
|
+
return (
|
|
66
|
+
typeof value === "string" &&
|
|
67
|
+
value.indexOf(target_namespace, source_index) === source_index
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
return this;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
this.addTargetValue = (target_namespace, source_map = [], source_index) => {
|
|
75
|
+
//check to see if target value already exists first
|
|
76
|
+
this.targetValues.findIndex(
|
|
77
|
+
(tv) =>
|
|
78
|
+
tv.target_namespace === target_namespace &&
|
|
79
|
+
isEqualArrays(tv.source_map, source_map) &&
|
|
80
|
+
tv.source_index === source_index
|
|
81
|
+
) === -1 &&
|
|
82
|
+
this.targetValues.push(new TargetValue(target_namespace, source_map, source_index));
|
|
83
|
+
return this;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const getTargetValue = (input) => {
|
|
87
|
+
const [test, action] = input.split(".");
|
|
88
|
+
const nsp = input
|
|
89
|
+
.replace(test, { beforeTest: 0, mainTest: 1, Events: 2, afterTest: 3 }[test])
|
|
90
|
+
.replace(action, parseInt(action.replace("Action", "")) - 1)
|
|
91
|
+
.replace("error", "results");
|
|
92
|
+
return obj(FullTest).valueAtNsp(nsp);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import Test from "./Test.class";
|
|
2
|
+
|
|
3
|
+
const sections = ["Before", "Main", "Events", "After"];
|
|
4
|
+
|
|
5
|
+
export default function FullTestController({ FullTest, connectedServices }) {
|
|
6
|
+
this.runFullTest = async ([Before, Main, Events, After] = FullTest) => {
|
|
7
|
+
Events.forEach((test) => test.runTest());
|
|
8
|
+
|
|
9
|
+
await new Promise((resolve) => {
|
|
10
|
+
function recursiveRunTest(tests, i = 0) {
|
|
11
|
+
if (i === tests.length) resolve();
|
|
12
|
+
else tests[i].runTest().then(() => recursiveRunTest(tests, i + 1));
|
|
13
|
+
}
|
|
14
|
+
recursiveRunTest([...Before, ...Main, ...After]);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return [Before, Main, Events, After];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
function validateTest({ title, evaluations, shouldValidate }, section, index) {
|
|
21
|
+
if (!title)
|
|
22
|
+
return {
|
|
23
|
+
message: `${sections[section]}: Action ${index + 1} description is required`,
|
|
24
|
+
error: true,
|
|
25
|
+
};
|
|
26
|
+
if (shouldValidate && !evaluations.filter((e) => e.save).length)
|
|
27
|
+
return {
|
|
28
|
+
message: `${sections[section]}: Action ${index + 1} validations required`,
|
|
29
|
+
error: true,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return { error: false };
|
|
33
|
+
}
|
|
34
|
+
this.saveTests = async (Tests = FullTest) => {
|
|
35
|
+
const { title, getConnection, namespace, index } = Tests[1][0];
|
|
36
|
+
|
|
37
|
+
for (let i = 0; i < Tests.length; i++) {
|
|
38
|
+
for (let x = 0; x < Tests.length; x++) {
|
|
39
|
+
const res = Tests[i][x] ? validateTest(Tests[i][x], i, x) : {};
|
|
40
|
+
if (res.error) return res;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const { connection } = getConnection(connectedServices);
|
|
45
|
+
|
|
46
|
+
const { Plugin } = connection[namespace.serviceId];
|
|
47
|
+
|
|
48
|
+
if (Plugin) {
|
|
49
|
+
const [Before, Main, Events, After] = Tests.map((testSection) =>
|
|
50
|
+
testSection.map((test) => {
|
|
51
|
+
const { args, evaluations, namespace, title } = test;
|
|
52
|
+
//resetting scope of test
|
|
53
|
+
Object.assign(test, new Test(test));
|
|
54
|
+
return {
|
|
55
|
+
args,
|
|
56
|
+
namespace,
|
|
57
|
+
title,
|
|
58
|
+
savedEvaluations: evaluations
|
|
59
|
+
.filter((e) => e.save)
|
|
60
|
+
.map(({ namespace, expected_type, validations, save, indexed }) => ({
|
|
61
|
+
namespace,
|
|
62
|
+
expected_type,
|
|
63
|
+
validations,
|
|
64
|
+
save,
|
|
65
|
+
indexed,
|
|
66
|
+
})),
|
|
67
|
+
};
|
|
68
|
+
})
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const testIndex = await Plugin.saveTest(
|
|
72
|
+
{ Before, Main, Events, After, title, namespace },
|
|
73
|
+
index
|
|
74
|
+
);
|
|
75
|
+
return { message: "Test Saved!", error: false, testIndex };
|
|
76
|
+
} else return { message: "Plugin Plugin not connected!", error: true };
|
|
77
|
+
};
|
|
78
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { validateResults } from "../../../molecules/ValidationInput/validator";
|
|
2
|
+
import { Client } from "systemlynx";
|
|
3
|
+
import moment from "moment";
|
|
4
|
+
import { getArrayNamespaces, getLastArrayNamespace, obj } from "./test-helpers";
|
|
5
|
+
|
|
6
|
+
export default function Test({
|
|
7
|
+
namespace,
|
|
8
|
+
args,
|
|
9
|
+
title,
|
|
10
|
+
shouldValidate = false,
|
|
11
|
+
savedEvaluations = [],
|
|
12
|
+
index,
|
|
13
|
+
editMode = true,
|
|
14
|
+
}) {
|
|
15
|
+
const logger = new TestLogger(this);
|
|
16
|
+
this.index = index;
|
|
17
|
+
this.connection = {};
|
|
18
|
+
this.title = title;
|
|
19
|
+
this.args = args || [];
|
|
20
|
+
this.editMode = editMode;
|
|
21
|
+
this.shouldValidate = shouldValidate || !!savedEvaluations.length;
|
|
22
|
+
this.namespace = namespace || {
|
|
23
|
+
serviceId: "",
|
|
24
|
+
moduleName: "",
|
|
25
|
+
methodName: "",
|
|
26
|
+
};
|
|
27
|
+
this.clearResults = () => {
|
|
28
|
+
this.results = null;
|
|
29
|
+
this.response_type = "";
|
|
30
|
+
this.test_start = null;
|
|
31
|
+
this.test_end = null;
|
|
32
|
+
this.evaluations = [];
|
|
33
|
+
this.savedEvaluations = obj(savedEvaluations).clone();
|
|
34
|
+
this.errors = [];
|
|
35
|
+
return this;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
this.clearResults();
|
|
39
|
+
|
|
40
|
+
this.getErrors = () => {
|
|
41
|
+
this.errors = this.evaluations
|
|
42
|
+
.filter(({ save }) => save)
|
|
43
|
+
.reduce(
|
|
44
|
+
(sum, { errors, namespace }) =>
|
|
45
|
+
sum.concat(errors.map((e) => ({ ...e, namespace }))),
|
|
46
|
+
[]
|
|
47
|
+
);
|
|
48
|
+
return this.errors;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
this.validate = validateResults.bind(this);
|
|
52
|
+
|
|
53
|
+
this.runTest = async () => {
|
|
54
|
+
const { serviceId, moduleName, methodName } = this.namespace;
|
|
55
|
+
const args = this.args.map((arg) => arg.value());
|
|
56
|
+
|
|
57
|
+
this.test_start = moment().toJSON();
|
|
58
|
+
const Module = this.connection[serviceId][moduleName];
|
|
59
|
+
if (methodName === "on") {
|
|
60
|
+
const eventTest = (e) => {
|
|
61
|
+
this.results = e;
|
|
62
|
+
this.test_end = moment().toJSON();
|
|
63
|
+
this.response_type = "event";
|
|
64
|
+
this.shouldValidate && this.validate();
|
|
65
|
+
logger.end();
|
|
66
|
+
Module.$clearEvent(args[0], "eventTest");
|
|
67
|
+
};
|
|
68
|
+
logger.start(args);
|
|
69
|
+
Module.on(args[0], eventTest);
|
|
70
|
+
} else {
|
|
71
|
+
try {
|
|
72
|
+
logger.start(args);
|
|
73
|
+
this.results = await Module[methodName](...args);
|
|
74
|
+
this.test_end = moment().toJSON();
|
|
75
|
+
this.response_type = "results";
|
|
76
|
+
this.shouldValidate && this.validate();
|
|
77
|
+
logger.end();
|
|
78
|
+
} catch (error) {
|
|
79
|
+
this.test_end = moment().toJSON();
|
|
80
|
+
this.results = error;
|
|
81
|
+
this.response_type = "error";
|
|
82
|
+
this.shouldValidate && this.validate();
|
|
83
|
+
logger.end();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return this;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
this.getConnection = (connectedServices) => {
|
|
90
|
+
const { serviceId } = this.namespace;
|
|
91
|
+
|
|
92
|
+
if (connectedServices.length > 0) {
|
|
93
|
+
const service = connectedServices.find(
|
|
94
|
+
(service) => service.serviceId === serviceId
|
|
95
|
+
);
|
|
96
|
+
if (!service) {
|
|
97
|
+
console.warn("connection data not found");
|
|
98
|
+
return this;
|
|
99
|
+
}
|
|
100
|
+
const { connectionData } = service.system;
|
|
101
|
+
|
|
102
|
+
this.connection[serviceId] = Client.createService(connectionData);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return this;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
this.addEvaluation = (evaluation) => {
|
|
109
|
+
const savedEval = this.savedEvaluations.find(
|
|
110
|
+
({ namespace }) => namespace === evaluation.namespace
|
|
111
|
+
);
|
|
112
|
+
if (savedEval) Object.assign(savedEval, evaluation);
|
|
113
|
+
else this.savedEvaluations.push(evaluation);
|
|
114
|
+
};
|
|
115
|
+
this.removeEvaluation = (namespace) => {
|
|
116
|
+
const index = this.savedEvaluations.findIndex((e) => e.namespace === namespace);
|
|
117
|
+
if (index > -1) return this.savedEvaluations.splice(index, 1)[0];
|
|
118
|
+
else return {};
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
this.addSavedIndices = (arrayNamespace, newArrayNamespace) => {
|
|
122
|
+
//break namespace into multiple array namespaces
|
|
123
|
+
const nspList = getArrayNamespaces(arrayNamespace);
|
|
124
|
+
this.evaluations.forEach((e) => {
|
|
125
|
+
if (nspList.includes(getLastArrayNamespace(e.namespace))) {
|
|
126
|
+
e.namespace = e.namespace.replace(arrayNamespace, newArrayNamespace);
|
|
127
|
+
e.indexed = true;
|
|
128
|
+
e.expected_type = undefined;
|
|
129
|
+
this.addEvaluation(e);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
this.removeSavedIndices = (namespace) => {
|
|
134
|
+
this.savedEvaluations = this.savedEvaluations.filter(
|
|
135
|
+
(e) => !e.namespace.includes(namespace) //|| !e.indexed
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function TestLogger(test) {
|
|
141
|
+
this.start = (args) => {
|
|
142
|
+
const { serviceId, moduleName, methodName } = test.namespace;
|
|
143
|
+
|
|
144
|
+
console.log(
|
|
145
|
+
`[${moment(this.test_start).format(
|
|
146
|
+
"L LTS"
|
|
147
|
+
)}]> [invoking]:${serviceId}.${moduleName}.${methodName}()`
|
|
148
|
+
);
|
|
149
|
+
console.log.apply({}, ["args:"].concat(args));
|
|
150
|
+
};
|
|
151
|
+
this.end = () => {
|
|
152
|
+
const { serviceId, moduleName, methodName } = test.namespace;
|
|
153
|
+
const { results, response_type } = test;
|
|
154
|
+
console.log(
|
|
155
|
+
`[${moment(this.test_end).format(
|
|
156
|
+
"L LTS"
|
|
157
|
+
)}]> [${response_type}]:${serviceId}.${moduleName}.${methodName}()`,
|
|
158
|
+
`${response_type}:`,
|
|
159
|
+
results
|
|
160
|
+
);
|
|
161
|
+
};
|
|
162
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { getType } from "../../../molecules/ValidationInput/validator";
|
|
2
|
+
import Test from "./Test.class";
|
|
3
|
+
import Argument, { TargetValue } from "./Argument.class";
|
|
4
|
+
export default function TestController({
|
|
5
|
+
TestSection,
|
|
6
|
+
setState,
|
|
7
|
+
section,
|
|
8
|
+
FullTest,
|
|
9
|
+
connectedServices,
|
|
10
|
+
}) {
|
|
11
|
+
this.runTest = async (testIndex) => {
|
|
12
|
+
const test = TestSection[testIndex];
|
|
13
|
+
//run only one test
|
|
14
|
+
await test.runTest();
|
|
15
|
+
setState([...TestSection]);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
this.runAllTest = async () => {};
|
|
19
|
+
|
|
20
|
+
this.updateNamespace = (index, namespace) => {
|
|
21
|
+
TestSection[index].namespace = namespace;
|
|
22
|
+
TestSection[index].getConnection(connectedServices);
|
|
23
|
+
setState([...TestSection]);
|
|
24
|
+
};
|
|
25
|
+
this.addTest = (namespace, args, title) => {
|
|
26
|
+
TestSection.push(new Test({ namespace, args, title, editMode: true }));
|
|
27
|
+
setState([...TestSection]);
|
|
28
|
+
if (namespace) this.updateNamespace(TestSection.length - 1, namespace);
|
|
29
|
+
};
|
|
30
|
+
this.deleteTest = (index) => {
|
|
31
|
+
TestSection.splice(index, 1);
|
|
32
|
+
setState([...TestSection]);
|
|
33
|
+
};
|
|
34
|
+
this.addArg = (index) => {
|
|
35
|
+
const name = "arg" + (TestSection[0].args.length + 1);
|
|
36
|
+
TestSection[index].args.push(new Argument(name, FullTest));
|
|
37
|
+
setState([...TestSection]);
|
|
38
|
+
};
|
|
39
|
+
this.deleteArg = (index, arg_index) => {
|
|
40
|
+
TestSection[index].args.splice(arg_index, 1);
|
|
41
|
+
setState([...TestSection]);
|
|
42
|
+
};
|
|
43
|
+
this.editArg = (index, arg_index, arg) => {
|
|
44
|
+
arg.data_type = getType(arg.input);
|
|
45
|
+
TestSection[index].args[arg_index] = arg;
|
|
46
|
+
setState([...TestSection]);
|
|
47
|
+
};
|
|
48
|
+
this.resetResults = (index) => {
|
|
49
|
+
TestSection[index].clearResults();
|
|
50
|
+
setState([...TestSection]);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
this.addTargetValue = (
|
|
54
|
+
testIndex,
|
|
55
|
+
arg_index,
|
|
56
|
+
target_namespace,
|
|
57
|
+
source_map,
|
|
58
|
+
source_index
|
|
59
|
+
) => {
|
|
60
|
+
//check to see if target value already exists first
|
|
61
|
+
const arg = TestSection[testIndex].args[arg_index];
|
|
62
|
+
arg.addTargetValue(target_namespace, source_map, source_index);
|
|
63
|
+
setState([...TestSection]);
|
|
64
|
+
};
|
|
65
|
+
this.setTargetValue = (
|
|
66
|
+
testIndex,
|
|
67
|
+
arg_index,
|
|
68
|
+
target_index,
|
|
69
|
+
target_namespace,
|
|
70
|
+
source_map,
|
|
71
|
+
source_index
|
|
72
|
+
) => {
|
|
73
|
+
const arg = TestSection[testIndex].args[arg_index];
|
|
74
|
+
|
|
75
|
+
arg.targetValues[target_index] = new TargetValue(
|
|
76
|
+
target_namespace.trim(),
|
|
77
|
+
source_map,
|
|
78
|
+
source_index
|
|
79
|
+
);
|
|
80
|
+
setState([...TestSection]);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
this.parseTargetValues = (testIndex, arg_index, input, source_map) => {
|
|
84
|
+
const arg = TestSection[testIndex].args[arg_index];
|
|
85
|
+
arg.parseTargetValues(input, source_map).checkTargetNamespaces();
|
|
86
|
+
setState([...TestSection]);
|
|
87
|
+
};
|
|
88
|
+
this.checkTargetValues = (testIndex, arg_index) => {
|
|
89
|
+
const arg = TestSection[testIndex].args[arg_index];
|
|
90
|
+
arg.checkTargetNamespaces();
|
|
91
|
+
setState([...TestSection]);
|
|
92
|
+
};
|
|
93
|
+
this.updateTitle = (testIndex, title) => {
|
|
94
|
+
TestSection[testIndex].title = title;
|
|
95
|
+
setState([...TestSection]);
|
|
96
|
+
};
|
|
97
|
+
this.updateEvaluations = (testIndex, evaluations) => {
|
|
98
|
+
TestSection[testIndex].evaluations = evaluations;
|
|
99
|
+
setState([...TestSection]);
|
|
100
|
+
};
|
|
101
|
+
this.updateTests = () => {
|
|
102
|
+
setState([...TestSection]);
|
|
103
|
+
};
|
|
104
|
+
this.updateValidationStatus = (testIndex) => {
|
|
105
|
+
if (section !== 1) {
|
|
106
|
+
TestSection[testIndex].shouldValidate = !TestSection[testIndex].shouldValidate;
|
|
107
|
+
if (TestSection[testIndex].shouldValidate) TestSection[testIndex].validate();
|
|
108
|
+
else TestSection[testIndex].evaluations = [];
|
|
109
|
+
setState([...TestSection]);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
this.getTargetSuggestions = (testIndex) => {
|
|
113
|
+
//get target value suggestion (namespaces) for previous test including sub test
|
|
114
|
+
const suggestions = [];
|
|
115
|
+
const test_names = ["beforeTest", "mainTest", "afterTest"];
|
|
116
|
+
//exclude all test sections following current section
|
|
117
|
+
const targetTests = FullTest.slice(0, section + 1);
|
|
118
|
+
|
|
119
|
+
targetTests.forEach((test_section, sIndex) => {
|
|
120
|
+
//also exclude current test and the tests that follow from the suggestions
|
|
121
|
+
const count = sIndex === section ? testIndex : test_section.length;
|
|
122
|
+
for (let i = 0; i < count; i++) {
|
|
123
|
+
suggestions.push(
|
|
124
|
+
`${test_names[sIndex]}.${"Action" + (i + 1) + "."}${
|
|
125
|
+
test_section[i].response_type || "results"
|
|
126
|
+
}`
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
return suggestions;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
return this;
|
|
135
|
+
}
|