complexqa_frontend_core 1.3.2 → 1.5.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/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "complexqa_frontend_core",
3
- "version": "1.3.2",
3
+ "version": "1.5.1",
4
4
  "description": "core of web ",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": "./publish/index.js"
8
8
  },
9
9
  "files": [
10
- "publish/"
10
+ "./publish"
11
11
  ],
12
12
  "scripts": {
13
- "test": "echo \"Error: no test specified\" && exit 1"
13
+ "test": "echo \"Error: no test specified\" && exit 1",
14
+ "build_package": "rollup -c rollup.config.js"
14
15
  },
15
16
  "repository": {
16
17
  "type": "git",
@@ -28,7 +29,7 @@
28
29
  "@babel/plugin-transform-modules-commonjs": "^7.24.7",
29
30
  "@babel/plugin-transform-runtime": "^7.27.4",
30
31
  "@babel/preset-env": "^7.24.7",
31
- "axios": "^1.7.2",
32
+ "axios": "^1.13.0",
32
33
  "gulp": "^5.0.0",
33
34
  "gulp-babel": "^8.0.0",
34
35
  "gulp-concat": "^2.6.1",
@@ -38,8 +39,8 @@
38
39
  "gulp-rollup": "^2.17.0",
39
40
  "gulp-strip-import-export": "^1.0.0",
40
41
  "gulp-uncomment": "^0.3.0",
41
- "i18next": "^23.11.5",
42
- "query-string": "^9.0.0",
42
+ "i18next": "^23.16.8",
43
+ "query-string": "^9.3.1",
43
44
  "uglify-js": "^3.19.3",
44
45
  "underscore": "^1.13.6"
45
46
  },
@@ -47,6 +48,7 @@
47
48
  "babel": "^6.23.0",
48
49
  "babel-plugin-module-resolver-standalone": "^0.0.2",
49
50
  "gulp-uglify": "^3.0.2",
50
- "requirejs-babel": "^0.0.9"
51
+ "requirejs-babel": "^0.0.9",
52
+ "rollup-plugin-dts": "^6.2.3"
51
53
  }
52
54
  }
@@ -85,9 +85,9 @@ export class ApiAbstractElementClass
85
85
 
86
86
  let url = `/${ this.api_prefix }/${ this.module_prefix }/search`;
87
87
 
88
- payload = this.#handle_request_payload(payload);
89
- let response = this.#api_request(url, payload);
90
- response = this.#handle_response(response);
88
+ payload = this.handle_request_payload(payload);
89
+ let response = this.api_request(url, payload);
90
+ response = this.handle_response(response);
91
91
 
92
92
  return {
93
93
  response: response,
@@ -158,9 +158,9 @@ export class ApiAbstractElementClass
158
158
 
159
159
  let url = `/${ this.api_prefix }/${ this.module_prefix }/create`;
160
160
 
161
- payload = this.#handle_request_payload(payload);
162
- let response = this.#api_request(url, payload);
163
- response = this.#handle_response(response);
161
+ payload = this.handle_request_payload(payload);
162
+ let response = this.api_request(url, payload);
163
+ response = this.handle_response(response);
164
164
 
165
165
  return {
166
166
  response: response,
@@ -206,9 +206,9 @@ export class ApiAbstractElementClass
206
206
 
207
207
  let url = `/${ this.api_prefix }/${ this.module_prefix }/update_property`;
208
208
 
209
- payload = this.#handle_request_payload(payload);
210
- let response = this.#api_request(url, payload);
211
- response = this.#handle_response(response);
209
+ payload = this.handle_request_payload(payload);
210
+ let response = this.api_request(url, payload);
211
+ response = this.handle_response(response);
212
212
 
213
213
  return {
214
214
  response: response,
@@ -239,9 +239,9 @@ export class ApiAbstractElementClass
239
239
 
240
240
  let url = `/${ this.api_prefix }/${ this.module_prefix }/delete`;
241
241
 
242
- payload = this.#handle_request_payload(payload);
243
- let response = this.#api_request(url, payload);
244
- response = this.#handle_response(response);
242
+ payload = this.handle_request_payload(payload);
243
+ let response = this.api_request(url, payload);
244
+ response = this.handle_response(response);
245
245
 
246
246
  return {
247
247
  response: response,
@@ -255,12 +255,12 @@ export class ApiAbstractElementClass
255
255
 
256
256
  /******************************************************************************************/
257
257
 
258
- #handle_request_payload(payload)
258
+ handle_request_payload(payload)
259
259
  {
260
- return this.#object_replace_null_recursively(payload);
260
+ return this.object_replace_null_recursively(payload);
261
261
  }
262
262
 
263
- #object_replace_null_recursively(object)
263
+ object_replace_null_recursively(object)
264
264
  {
265
265
  let result = clone_object(object);
266
266
  for (let key in result)
@@ -271,7 +271,7 @@ export class ApiAbstractElementClass
271
271
  }
272
272
  else if (( result[ key ]?.constructor === Object ) || ( result[ key ]?.constructor === Array ))
273
273
  {
274
- result[ key ] = this.#object_replace_null_recursively(result[ key ]);
274
+ result[ key ] = this.object_replace_null_recursively(result[ key ]);
275
275
  }
276
276
  }
277
277
 
@@ -286,8 +286,9 @@ export class ApiAbstractElementClass
286
286
  * @param method
287
287
  * @returns {Promise<Promise<axios.AxiosResponse<any>> | *>}
288
288
  * @version v.0.2 (26/01/2025)
289
+ * @todo - валидация входящих параметров
289
290
  */
290
- async #api_request(url, payload, method = 'POST')
291
+ async api_request(url, payload, method = 'POST')
291
292
  {
292
293
  let request_params;
293
294
  if (!payload)
@@ -299,9 +300,9 @@ export class ApiAbstractElementClass
299
300
  request_params = clone_object(payload)
300
301
  }
301
302
 
302
- request_params = this.#mixin_service_params(request_params);
303
+ request_params = this.mixin_service_params(request_params);
303
304
 
304
- console.log({payload, request_params});
305
+ //console.log({payload, request_params});
305
306
 
306
307
 
307
308
  if (this.host_api)
@@ -335,6 +336,7 @@ export class ApiAbstractElementClass
335
336
  *
336
337
  * @param object
337
338
  * @returns {string}
339
+ * @todo - валидация входящих параметров
338
340
  */
339
341
  object_to_string(object)
340
342
  {
@@ -344,7 +346,7 @@ export class ApiAbstractElementClass
344
346
  }
345
347
 
346
348
 
347
- #mixin_service_params(params)
349
+ mixin_service_params(params)
348
350
  {
349
351
  params.client = 'webapp';
350
352
  return params;
@@ -357,7 +359,7 @@ export class ApiAbstractElementClass
357
359
  * @returns {Promise<any>}
358
360
  * @version v.0.1 (01/06/2024)
359
361
  */
360
- #handle_response(response)
362
+ handle_response(response)
361
363
  {
362
364
  response = response.then((api_response) =>
363
365
  {
@@ -14,4 +14,29 @@ export class ProjectApi extends ApiAbstractElementClass
14
14
  super(options);
15
15
  this.set_element_class_instance(typeProject);
16
16
  }
17
+
18
+
19
+
20
+
21
+ /**
22
+ *
23
+ * All test cases + suites
24
+ *
25
+ * @version v.1.0 (23/08/2025)
26
+ * @param payload
27
+ * @todo - валидация входящих параметров
28
+ */
29
+ async get_test_structure(payload)
30
+ {
31
+ let url = `/web_api/project/get/test_structure`;
32
+
33
+ payload = this.handle_request_payload(payload);
34
+ let response = this.api_request(url, payload);
35
+ response = this.handle_response(response);
36
+
37
+ return {
38
+ response: response,
39
+ payload : payload
40
+ };
41
+ }
17
42
  }
package/publish/index.js CHANGED
@@ -7,7 +7,7 @@ export { typeProject } from './types/family_elements/typeProject.js';
7
7
  export { typeTestCase } from './types/family_elements/typeTestCase.js';
8
8
  export { typeTestCaseStep } from './types/family_elements/typeTestCaseStep.js';
9
9
  export { UserService } from './services/UserService.js'
10
- export { Api } from "./api";
10
+ export { Api } from "./api/index.js";
11
11
 
12
12
 
13
13
  /**
@@ -1,6 +1,6 @@
1
1
  import { abstractService } from "./abstractService";
2
2
  import i18next from 'i18next';
3
- import { Api } from "../api";
3
+ import { Api } from "../api/index.js";
4
4
  import { echo, in_array } from "../utils/utils.js";
5
5
 
6
6
  /**
@@ -0,0 +1,20 @@
1
+ import { familyGeneralElement } from "./0_familyGeneralElement.js";
2
+
3
+
4
+ /**
5
+ * Семейство типов, относящееся к модулю автоматического тестирования
6
+ *
7
+ * @version v.0.1 (29/11/2025)
8
+ */
9
+ export class familyTestAutomation extends familyGeneralElement
10
+ {
11
+
12
+ /**
13
+ *
14
+ * @param {any} data
15
+ */
16
+ constructor(data = false)
17
+ {
18
+ super();
19
+ }
20
+ }
@@ -0,0 +1,21 @@
1
+ import { familyGeneralElement } from "./0_familyGeneralElement.js";
2
+
3
+
4
+ /**
5
+ * Семейство типов, относящееся к модулю тестовой документации
6
+ *
7
+ * @version v.0.1 (29/11/2025)
8
+ */
9
+ export class familyTestDocumentation extends familyGeneralElement
10
+ {
11
+
12
+ /**
13
+ *
14
+ * @param {any} data
15
+ */
16
+ constructor(data = false)
17
+ {
18
+ super();
19
+ }
20
+
21
+ }
@@ -0,0 +1,71 @@
1
+ import { familyTestAutomation } from "./1_familyTestAutomation.js";
2
+ import { is_object } from "../../utils/utils.js";
3
+
4
+ /**
5
+ *
6
+ * @version v.0.1 (29/11/2025)
7
+ */
8
+ export class typeAutomationTestEnvironment extends familyTestAutomation
9
+ {
10
+ automation_test_environment_id;
11
+ host;
12
+ protocol;
13
+ device_type;
14
+ browser_name;
15
+ browser_version;
16
+ display_preset;
17
+
18
+ primary_key = 'automation_test_environment_id';
19
+
20
+ structure_scheme = {
21
+ automation_test_environment_id: 'integer | require',
22
+ host : 'string | require',
23
+ protocol : 'string | require',
24
+ device_type : 'string | enum | require',
25
+ browser_name : 'string | enum | optional',
26
+ browser_version : 'string | optional',
27
+ display_preset : 'string | enum | optional',
28
+ };
29
+
30
+
31
+ available_enum_values = {
32
+ device_type: [
33
+ 'desktop',
34
+ 'mobile',
35
+ ],
36
+ browser_name: [
37
+ 'chrome',
38
+ 'firefox',
39
+ 'webkit',
40
+ 'edge',
41
+ ],
42
+ display_preset: [
43
+ 'small',
44
+ 'medium',
45
+ 'large',
46
+ ],
47
+ };
48
+
49
+
50
+ /**
51
+ *
52
+ * @param {object|false|undefined} data
53
+ */
54
+ constructor(data = false)
55
+ {
56
+ super();
57
+
58
+ if (data && is_object(data))
59
+ {
60
+ _.mapObject(data, (value, key) =>
61
+ {
62
+ if (this.hasOwnProperty(key))
63
+ {
64
+ this [ key ] = value;
65
+ }
66
+ });
67
+ }
68
+
69
+ return this;
70
+ }
71
+ }
@@ -0,0 +1,12 @@
1
+ import { familyTestAutomation } from "./1_familyTestAutomation.js";
2
+
3
+ /**
4
+ * Пока - просто коллекция typeAutomationTestStep
5
+ * Возможно, также окружение
6
+ *
7
+ * @version v.0.1 (29/11/2025)
8
+ */
9
+ export class typeAutomationTestPlan extends familyTestAutomation
10
+ {
11
+ test_step_ids;
12
+ }
@@ -0,0 +1,62 @@
1
+ import { familyTestAutomation } from "./1_familyTestAutomation.js";
2
+ import { is_object } from "../../utils/utils.js";
3
+
4
+ /**
5
+ *
6
+ * @version v.0.1 (29/11/2025)
7
+ */
8
+ export class typeAutomationTestStep extends familyTestAutomation
9
+ {
10
+ automation_test_step_id;
11
+ target; // typeAutomationTestStepTarget
12
+ action;
13
+ time;
14
+ screenshot;
15
+ url;
16
+
17
+ primary_key = 'automation_test_step_id';
18
+
19
+ structure_scheme = {
20
+ automation_test_step_id: 'integer | require',
21
+ target : 'typeAutomationTestStepTarget | optional',
22
+ action : 'string | enum | require',
23
+ time : 'integer | optional',
24
+ screenshot : 'string | optional',
25
+ url : 'string | optional',
26
+ };
27
+
28
+ available_enum_values = {
29
+ action: [
30
+ 'wait_element_located',
31
+ 'wait',
32
+ 'click',
33
+ 'right_click',
34
+ 'keypress',
35
+ 'keypress_special',
36
+ 'clear',
37
+ 'load_page',
38
+ ]
39
+ };
40
+
41
+ /**
42
+ *
43
+ * @param {object|false|undefined} data
44
+ */
45
+ constructor(data = false)
46
+ {
47
+ super();
48
+
49
+ if (data && is_object(data))
50
+ {
51
+ _.mapObject(data, (value, key) =>
52
+ {
53
+ if (this.hasOwnProperty(key))
54
+ {
55
+ this [ key ] = value;
56
+ }
57
+ });
58
+ }
59
+
60
+ return this;
61
+ }
62
+ }
@@ -0,0 +1,38 @@
1
+ import { familyTestAutomation } from "./1_familyTestAutomation.js";
2
+ import { is_object } from "../../utils/utils.js";
3
+
4
+ /**
5
+ * По сути это enum
6
+ * Но тут есть (будут) проверки на корректность, потому это отдельный тип
7
+ *
8
+ * @version v.0.1 (29/11/2025)
9
+ */
10
+ export class typeAutomationTestStepTarget extends familyTestAutomation
11
+ {
12
+ partial_link_text;
13
+ css;
14
+ id;
15
+ name;
16
+
17
+ /**
18
+ *
19
+ * @param {object|false|undefined} data
20
+ */
21
+ constructor(data = false)
22
+ {
23
+ super();
24
+
25
+ if (data && is_object(data))
26
+ {
27
+ _.mapObject(data, (value, key) =>
28
+ {
29
+ if (this.hasOwnProperty(key))
30
+ {
31
+ this [ key ] = value;
32
+ }
33
+ });
34
+ }
35
+
36
+ return this;
37
+ }
38
+ }
@@ -1,12 +1,13 @@
1
1
  import { familyGeneralElement } from "./0_familyGeneralElement";
2
2
  import { is_object } from "../../utils/utils";
3
+ import { familyTestDocumentation } from "./1_familyTestDocumentation.js";
3
4
 
4
5
 
5
6
  /**
6
7
  *
7
8
  * @version v.0.1 (23/06/2024)
8
9
  */
9
- export class typeFunctional extends familyGeneralElement
10
+ export class typeFunctional extends familyTestDocumentation
10
11
  {
11
12
  functional_id;
12
13
  project_id; // foreign key
@@ -1,11 +1,12 @@
1
1
  import { familyGeneralElement } from "./0_familyGeneralElement";
2
2
  import { is_object } from "../../utils/utils";
3
+ import { familyTestDocumentation } from "./1_familyTestDocumentation.js";
3
4
 
4
5
 
5
6
  /**
6
7
  * @version v.0.2 (25/01/2025)
7
8
  */
8
- export class typeFunctionalGroup extends familyGeneralElement
9
+ export class typeFunctionalGroup extends familyTestDocumentation
9
10
  {
10
11
  functional_group_id;
11
12
  project_id; // foreign key
@@ -21,10 +21,10 @@ export class typeProject extends familyGeneralElement
21
21
  api_key = 'project';
22
22
 
23
23
  structure_scheme = {
24
- project_id : 'integer | require',
25
- project_name : 'string | require',
26
- project_description : 'string | optional',
27
- project_status : 'string | enum | require',
24
+ project_id : 'integer | require',
25
+ project_name : 'string | require',
26
+ project_description: 'string | optional',
27
+ project_status : 'string | enum | require',
28
28
  team_id : 'integer | require',
29
29
  //reference_document_ids: 'array | reference | optional',
30
30
  };
@@ -87,6 +87,48 @@ export class typeProject extends familyGeneralElement
87
87
 
88
88
  /******************************************************************************************/
89
89
 
90
+ /**
91
+ *
92
+ * All test cases + suites
93
+ * @version v.1.0 (23/08/2025)
94
+ * @param project_id
95
+ * @param callback
96
+ * @returns {Promise<any>}
97
+ */
98
+ async get_test_structure(project_id = false, callback = {})
99
+ {
100
+ if (!project_id)
101
+ {
102
+ project_id = this.project_id;
103
+ }
104
+
105
+ let payload = {
106
+ project_id: project_id
107
+ }
108
+ /**
109
+ * {Api} ApiService
110
+ */
111
+ return ApiService[ this.api_key ].get_test_structure(payload).then((response) =>
112
+ {
113
+ if (typeof callback?.success === 'function')
114
+ {
115
+ callback?.success({ response, payload })
116
+ }
117
+ }).catch((error) =>
118
+ {
119
+ echo({ error });
120
+ if (typeof callback?.error === 'function')
121
+ {
122
+ callback?.error({ error, payload })
123
+ }
124
+ }).finally((response) =>
125
+ {
126
+ if (typeof callback?.final === 'function')
127
+ {
128
+ callback?.final({ response, payload })
129
+ }
130
+ });
131
+ }
90
132
 
91
133
  /**
92
134
  *
@@ -1,12 +1,13 @@
1
1
  import { familyGeneralElement } from "./0_familyGeneralElement";
2
2
  import { echo, is_object } from "../../utils/utils";
3
+ import { familyTestDocumentation } from "./1_familyTestDocumentation.js";
3
4
 
4
5
 
5
6
  /**
6
7
  *
7
8
  * @version v.0.2 (10/12/2024)
8
9
  */
9
- export class typeTestCase extends familyGeneralElement
10
+ export class typeTestCase extends familyTestDocumentation
10
11
  {
11
12
  test_case_id;
12
13
  test_suite_id; // foreign key
@@ -1,12 +1,13 @@
1
1
  import { familyGeneralElement } from "./0_familyGeneralElement";
2
2
  import { is_object } from "../../utils/utils";
3
+ import { familyTestDocumentation } from "./1_familyTestDocumentation.js";
3
4
 
4
5
 
5
6
  /**
6
7
  *
7
8
  * @version v.1.1 (26/05/2024)
8
9
  */
9
- export class typeTestCaseStep extends familyGeneralElement
10
+ export class typeTestCaseStep extends familyTestDocumentation
10
11
  {
11
12
  test_case_step_id;
12
13
  test_case_step_type;
@@ -1,5 +1,6 @@
1
1
  import { familyGeneralElement } from "./0_familyGeneralElement";
2
2
  import { is_object } from "../../utils/utils";
3
+ import { familyTestDocumentation } from "./1_familyTestDocumentation.js";
3
4
 
4
5
 
5
6
  /**
@@ -7,7 +8,7 @@ import { is_object } from "../../utils/utils";
7
8
  *
8
9
  * @version v.0.1 (26/05/2024)
9
10
  */
10
- export class typeTestPlan extends familyGeneralElement
11
+ export class typeTestPlan extends familyTestDocumentation
11
12
  {
12
13
 
13
14
 
@@ -1,5 +1,6 @@
1
1
  import { familyGeneralElement } from "./0_familyGeneralElement";
2
2
  import { is_object } from "../../utils/utils";
3
+ import { familyTestDocumentation } from "./1_familyTestDocumentation.js";
3
4
 
4
5
  /**
5
6
  * Коллекция тестов для работы, она же parent для typeTestRunResult
@@ -8,13 +9,13 @@ import { is_object } from "../../utils/utils";
8
9
  *
9
10
  * @version v.0.2 (21/01/2025)
10
11
  */
11
- export class typeTestRun extends familyGeneralElement
12
+ export class typeTestRun extends familyTestDocumentation
12
13
  {
13
14
  test_run_id;
14
15
  test_run_name;
15
16
  test_run_description;
16
17
  milestone_id; /// ??
17
- assigned_to;
18
+ assigned_to; // кому назначили выполнение, пока в той же таблице, только 1 член команды
18
19
  test_case_ids; // массив тестов на запуск
19
20
  test_run_status;
20
21
  test_case_summary_statistic; // массив [key->value] по статусам вложенных тест-кейсов для визуализации
@@ -1,5 +1,6 @@
1
1
  import { familyGeneralElement } from "./0_familyGeneralElement";
2
2
  import { is_object } from "../../utils/utils";
3
+ import { familyTestDocumentation } from "./1_familyTestDocumentation.js";
3
4
 
4
5
  /**
5
6
  * 1 результат по каждому тест кейсу
@@ -8,7 +9,7 @@ import { is_object } from "../../utils/utils";
8
9
  *
9
10
  * @version v.0.4 (10/12/2024)
10
11
  */
11
- export class typeTestRunResult extends familyGeneralElement
12
+ export class typeTestRunResult extends familyTestDocumentation
12
13
  {
13
14
  test_run_result_id;
14
15
  test_case_id;
@@ -1,12 +1,13 @@
1
1
  import { familyGeneralElement } from "./0_familyGeneralElement";
2
2
  import { echo, is_object } from "../../utils/utils";
3
+ import { familyTestDocumentation } from "./1_familyTestDocumentation.js";
3
4
 
4
5
  /**
5
6
  * Структурная коллекция тестов
6
7
  *
7
8
  * @version v.1.1 (23/06/2024)
8
9
  */
9
- export class typeTestSuite extends familyGeneralElement
10
+ export class typeTestSuite extends familyTestDocumentation
10
11
  {
11
12
  test_suite_id;
12
13
  project_id;