complexqa_frontend_core 1.28.1 → 1.30.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.
Files changed (68) hide show
  1. package/package.json +1 -1
  2. package/publish/api/api_abstract_element_class.js +35 -0
  3. package/publish/api/autotest_case_api.js +78 -0
  4. package/publish/api/autotest_result_api.js +17 -0
  5. package/publish/api/autotest_run_api.js +36 -0
  6. package/publish/api/autotest_step_api.js +88 -0
  7. package/publish/api/autotest_suite_api.js +17 -0
  8. package/publish/api/file_app_api.js +76 -0
  9. package/publish/api/index.js +16 -0
  10. package/publish/api/object_repository_element_api.js +17 -0
  11. package/publish/api/object_repository_folder_api.js +17 -0
  12. package/publish/api/object_repository_page_api.js +17 -0
  13. package/publish/app_configuration/menu_configuration_main.js +14 -0
  14. package/publish/app_configuration/table/helpers/table_element_models.js +16 -0
  15. package/publish/app_configuration/table/sections/autotest_case.js +73 -0
  16. package/publish/app_configuration/table/sections/autotest_result.js +59 -0
  17. package/publish/app_configuration/table/sections/autotest_run.js +66 -0
  18. package/publish/app_configuration/table/sections/autotest_step.js +82 -0
  19. package/publish/app_configuration/table/sections/autotest_suite.js +42 -0
  20. package/publish/app_configuration/table/sections/object_repository_element.js +59 -0
  21. package/publish/app_configuration/table/sections/object_repository_folder.js +41 -0
  22. package/publish/app_configuration/table/sections/object_repository_page.js +55 -0
  23. package/publish/app_configuration/table/sections/test_case_step.js +66 -66
  24. package/publish/app_configuration/table/table_configuration.js +16 -0
  25. package/publish/index.js +28 -0
  26. package/publish/services/FileAppService.js +48 -0
  27. package/publish/types/core/0_familyGeneralElement.js +43 -0
  28. package/publish/types/element_translate/typeAttachment.i18n.js +22 -11
  29. package/publish/types/element_translate/typeAutotestCase.i18n.js +95 -0
  30. package/publish/types/element_translate/typeAutotestResult.i18n.js +77 -0
  31. package/publish/types/element_translate/typeAutotestRun.i18n.js +110 -0
  32. package/publish/types/element_translate/typeAutotestStep.i18n.js +80 -0
  33. package/publish/types/element_translate/typeAutotestSuite.i18n.js +40 -0
  34. package/publish/types/element_translate/typeCustomProperty.i18n.js +21 -6
  35. package/publish/types/element_translate/typeCustomPropertyValue.i18n.js +21 -6
  36. package/publish/types/element_translate/typeFile.i18n.js +21 -15
  37. package/publish/types/element_translate/typeObjectRepositoryElement.i18n.js +92 -0
  38. package/publish/types/element_translate/typeObjectRepositoryFolder.i18n.js +62 -0
  39. package/publish/types/element_translate/typeObjectRepositoryPage.i18n.js +43 -0
  40. package/publish/types/element_translate/typeTagRelation.i18n.js +18 -0
  41. package/publish/types/element_translate/typeTestCase.i18n.js +414 -414
  42. package/publish/types/element_translate/typeTestCaseStep.i18n.js +179 -179
  43. package/publish/types/family_elements/0_familyGeneralElement.js +43 -0
  44. package/publish/types/family_elements/autotest_step_actions/autotestStepActionCatalog.js +54 -0
  45. package/publish/types/family_elements/autotest_step_actions/autotestStepLocatorKind.js +56 -0
  46. package/publish/types/family_elements/autotest_step_actions/autotestStepTargetNormalizer.js +134 -0
  47. package/publish/types/family_elements/autotest_step_actions/typeAutotestStepAction.js +35 -0
  48. package/publish/types/family_elements/autotest_step_actions/typeAutotestStepActionVariants.js +148 -0
  49. package/publish/types/family_elements/autotest_step_actions/typeAutotestStepLocatorAction.js +12 -0
  50. package/publish/types/family_elements/autotest_step_actions/typeAutotestStepLocatorValueAction.js +13 -0
  51. package/publish/types/family_elements/typeAttachment.js +1 -1
  52. package/publish/types/family_elements/typeAutotestCase.js +220 -0
  53. package/publish/types/family_elements/typeAutotestResult.js +81 -0
  54. package/publish/types/family_elements/typeAutotestRun.js +165 -0
  55. package/publish/types/family_elements/typeAutotestStep.js +297 -0
  56. package/publish/types/family_elements/typeAutotestStepTarget.js +50 -0
  57. package/publish/types/family_elements/typeAutotestSuite.js +74 -0
  58. package/publish/types/family_elements/typeCustomProperty.js +1 -1
  59. package/publish/types/family_elements/typeObjectRepositoryElement.js +88 -0
  60. package/publish/types/family_elements/typeObjectRepositoryFolder.js +81 -0
  61. package/publish/types/family_elements/typeObjectRepositoryPage.js +77 -0
  62. package/publish/types/family_elements/typeTestCase.js +5 -6
  63. package/publish/types/family_elements/typeTestCaseStep.js +2 -2
  64. package/publish/types/family_files/familyFile.js +2 -0
  65. package/publish/types/family_files/typeFileAutotestScreenshot.js +33 -0
  66. package/publish/types/family_files/typeFileFactory.js +3 -0
  67. package/publish/types/family_relation/typeCustomPropertyValue.js +7 -2
  68. package/publish/types/family_relation/typeTagRelation.js +30 -0
@@ -0,0 +1,148 @@
1
+ import { typeAutotestStepAction } from './typeAutotestStepAction.js';
2
+ import { typeAutotestStepLocatorAction } from './typeAutotestStepLocatorAction.js';
3
+ import { typeAutotestStepLocatorValueAction } from './typeAutotestStepLocatorValueAction.js';
4
+
5
+
6
+ export class typeAutotestStepGoto extends typeAutotestStepAction
7
+ {
8
+ static action_name = 'goto';
9
+ static value_need = 'optional';
10
+ static value_field_key = 'url';
11
+ }
12
+
13
+ export class typeAutotestStepClick extends typeAutotestStepLocatorAction
14
+ {
15
+ static action_name = 'click';
16
+ }
17
+
18
+ export class typeAutotestStepDblclick extends typeAutotestStepLocatorAction
19
+ {
20
+ static action_name = 'dblclick';
21
+ }
22
+
23
+ export class typeAutotestStepFill extends typeAutotestStepLocatorValueAction
24
+ {
25
+ static action_name = 'fill';
26
+ }
27
+
28
+ export class typeAutotestStepType extends typeAutotestStepLocatorValueAction
29
+ {
30
+ static action_name = 'type';
31
+ }
32
+
33
+ export class typeAutotestStepPress extends typeAutotestStepLocatorValueAction
34
+ {
35
+ static action_name = 'press';
36
+ static value_field_key = 'key';
37
+ }
38
+
39
+ export class typeAutotestStepCheck extends typeAutotestStepLocatorAction
40
+ {
41
+ static action_name = 'check';
42
+ }
43
+
44
+ export class typeAutotestStepUncheck extends typeAutotestStepLocatorAction
45
+ {
46
+ static action_name = 'uncheck';
47
+ }
48
+
49
+ export class typeAutotestStepSelectOption extends typeAutotestStepLocatorValueAction
50
+ {
51
+ static action_name = 'selectOption';
52
+ }
53
+
54
+ export class typeAutotestStepHover extends typeAutotestStepLocatorAction
55
+ {
56
+ static action_name = 'hover';
57
+ }
58
+
59
+ export class typeAutotestStepFocus extends typeAutotestStepLocatorAction
60
+ {
61
+ static action_name = 'focus';
62
+ }
63
+
64
+ export class typeAutotestStepWaitForSelector extends typeAutotestStepLocatorAction
65
+ {
66
+ static action_name = 'waitForSelector';
67
+ }
68
+
69
+ export class typeAutotestStepWaitForURL extends typeAutotestStepAction
70
+ {
71
+ static action_name = 'waitForURL';
72
+ static value_need = 'required';
73
+ static value_field_key = 'url';
74
+ }
75
+
76
+ export class typeAutotestStepWaitForTimeout extends typeAutotestStepAction
77
+ {
78
+ static action_name = 'waitForTimeout';
79
+ static value_need = 'required';
80
+ static value_field_key = 'duration_ms';
81
+ }
82
+
83
+ export class typeAutotestStepGoBack extends typeAutotestStepAction
84
+ {
85
+ static action_name = 'goBack';
86
+ }
87
+
88
+ export class typeAutotestStepGoForward extends typeAutotestStepAction
89
+ {
90
+ static action_name = 'goForward';
91
+ }
92
+
93
+ export class typeAutotestStepReload extends typeAutotestStepAction
94
+ {
95
+ static action_name = 'reload';
96
+ }
97
+
98
+ export class typeAutotestStepToBeVisible extends typeAutotestStepLocatorAction
99
+ {
100
+ static action_name = 'toBeVisible';
101
+ static group = 'expect';
102
+ }
103
+
104
+ export class typeAutotestStepToHaveText extends typeAutotestStepLocatorValueAction
105
+ {
106
+ static action_name = 'toHaveText';
107
+ static group = 'expect';
108
+ }
109
+
110
+ export class typeAutotestStepToHaveURL extends typeAutotestStepAction
111
+ {
112
+ static action_name = 'toHaveURL';
113
+ static group = 'expect';
114
+ static value_need = 'required';
115
+ static value_field_key = 'url';
116
+ }
117
+
118
+ export class typeAutotestStepToHaveAttribute extends typeAutotestStepLocatorValueAction
119
+ {
120
+ static action_name = 'toHaveAttribute';
121
+ static group = 'expect';
122
+ static value_field_key = 'attribute_name';
123
+ static has_expected_value = true;
124
+ }
125
+
126
+ export const AUTOTEST_STEP_ACTION_CLASSES = [
127
+ typeAutotestStepGoto,
128
+ typeAutotestStepClick,
129
+ typeAutotestStepDblclick,
130
+ typeAutotestStepFill,
131
+ typeAutotestStepType,
132
+ typeAutotestStepPress,
133
+ typeAutotestStepCheck,
134
+ typeAutotestStepUncheck,
135
+ typeAutotestStepSelectOption,
136
+ typeAutotestStepHover,
137
+ typeAutotestStepFocus,
138
+ typeAutotestStepWaitForSelector,
139
+ typeAutotestStepWaitForURL,
140
+ typeAutotestStepWaitForTimeout,
141
+ typeAutotestStepGoBack,
142
+ typeAutotestStepGoForward,
143
+ typeAutotestStepReload,
144
+ typeAutotestStepToBeVisible,
145
+ typeAutotestStepToHaveText,
146
+ typeAutotestStepToHaveURL,
147
+ typeAutotestStepToHaveAttribute,
148
+ ];
@@ -0,0 +1,12 @@
1
+ import { typeAutotestStepAction } from './typeAutotestStepAction.js';
2
+
3
+
4
+ /**
5
+ * ACTION with a required locator target.
6
+ *
7
+ * @version v.1.0 (05/09/2026)
8
+ */
9
+ export class typeAutotestStepLocatorAction extends typeAutotestStepAction
10
+ {
11
+ static target_need = 'required';
12
+ }
@@ -0,0 +1,13 @@
1
+ import { typeAutotestStepLocatorAction } from './typeAutotestStepLocatorAction.js';
2
+
3
+
4
+ /**
5
+ * ACTION with locator target and value_text.
6
+ *
7
+ * @version v.1.0 (05/09/2026)
8
+ */
9
+ export class typeAutotestStepLocatorValueAction extends typeAutotestStepLocatorAction
10
+ {
11
+ static value_need = 'required';
12
+ static value_field_key = 'text';
13
+ }
@@ -72,7 +72,7 @@ export class typeAttachment extends familyGeneralElement
72
72
  */
73
73
  static get_element_type_values()
74
74
  {
75
- return [ 'bug' ];
75
+ return [ 'bug', 'autotest_result' ];
76
76
  }
77
77
 
78
78
 
@@ -0,0 +1,220 @@
1
+ import { is_object } from "../../utils/utils.js";
2
+ import { familyTestAutomation } from "../core/1_familyTestAutomation.js";
3
+ import { typeAutotestCase_i18n } from "../element_translate/typeAutotestCase.i18n.js";
4
+ import _ from 'underscore';
5
+
6
+
7
+ /**
8
+ * Исполняемый автотест платформы (не Git-спека).
9
+ *
10
+ * @version v.1.0 (04/09/2026)
11
+ */
12
+ export class typeAutotestCase extends familyTestAutomation
13
+ {
14
+ autotest_case_id;
15
+ team_id;
16
+ project_id;
17
+ autotest_suite_id;
18
+ test_case_id;
19
+ execution_context_id;
20
+ autotest_case_title;
21
+ autotest_case_description;
22
+ autotest_case_status;
23
+ autotest_case_kind;
24
+ test_account_id;
25
+ pre_autotest_case_ids;
26
+ created_at;
27
+ updated_at;
28
+
29
+ primary_key = 'autotest_case_id';
30
+ api_key = 'autotest_case';
31
+
32
+ structure_scheme = {
33
+ autotest_case_id : 'integer | require',
34
+ team_id : 'integer | require',
35
+ project_id : 'integer | require',
36
+ autotest_suite_id : 'integer | optional',
37
+ test_case_id : 'integer | optional',
38
+ execution_context_id : 'integer | optional',
39
+ autotest_case_title : 'string | optional',
40
+ autotest_case_description: 'string | optional',
41
+ autotest_case_status : 'string | enum | optional',
42
+ autotest_case_kind : 'string | enum | optional',
43
+ test_account_id : 'integer | optional',
44
+ pre_autotest_case_ids: 'array | optional',
45
+ created_at : 'timestamp | optional',
46
+ updated_at : 'timestamp | optional',
47
+ };
48
+
49
+ create_scheme = [
50
+ 'project_id',
51
+ 'autotest_case_title',
52
+ 'autotest_suite_id',
53
+ 'test_case_id',
54
+ 'test_account_id',
55
+ 'autotest_case_kind',
56
+ 'pre_autotest_case_ids',
57
+ ];
58
+
59
+ available_enum_values = {
60
+ autotest_case_status: [ 'PENDING', 'READY', 'DISABLED' ],
61
+ autotest_case_kind : [ 'CASE', 'COMMON' ],
62
+ };
63
+
64
+ enum_value_translate_matrix = typeAutotestCase_i18n.enum_value_translate_matrix;
65
+ attribute_name_translate_matrix = typeAutotestCase_i18n.attribute_name_translate_matrix;
66
+
67
+ status_color = {
68
+ PENDING : '#C4B040',
69
+ READY : '#009688',
70
+ DISABLED: '#E0E0E0',
71
+ };
72
+
73
+ kind_color = {
74
+ CASE : '#009688',
75
+ COMMON: '#5C6BC0',
76
+ };
77
+
78
+
79
+ /**
80
+ * @param {object|false|undefined} data
81
+ */
82
+ constructor(data = false)
83
+ {
84
+ super();
85
+
86
+ if (data && is_object(data))
87
+ {
88
+ _.mapObject(data, (value, key) =>
89
+ {
90
+ if (this.hasOwnProperty(key))
91
+ {
92
+ this[ key ] = value;
93
+ }
94
+ });
95
+ }
96
+
97
+ return this;
98
+ }
99
+
100
+
101
+ /**
102
+ * @returns {string}
103
+ */
104
+ get_element_name()
105
+ {
106
+ return this.autotest_case_title;
107
+ }
108
+
109
+
110
+ /**
111
+ * Compile from typeTestCase. Separate entry from empty create.
112
+ *
113
+ * @param {object} payload
114
+ * @param {number} payload.test_case_id
115
+ * @param {object|typeFunctionCallback} callback
116
+ * @returns {Promise<void>}
117
+ */
118
+ async create_from_test_case(payload, callback)
119
+ {
120
+ if (typeof callback?.before === 'function')
121
+ {
122
+ callback.before({ payload });
123
+ }
124
+
125
+ return ApiService[ this.api_key ].create_from_test_case(payload).then((response) =>
126
+ {
127
+ if (typeof callback?.success === 'function')
128
+ {
129
+ callback.success({ response, payload });
130
+ }
131
+ }).catch((error) =>
132
+ {
133
+ if (typeof callback?.error === 'function')
134
+ {
135
+ callback.error({ error, payload });
136
+ }
137
+ }).finally((response) =>
138
+ {
139
+ if (typeof callback?.final === 'function')
140
+ {
141
+ callback.final({ response, payload });
142
+ }
143
+ });
144
+ }
145
+
146
+
147
+ /**
148
+ * Replace explicit predecessors. Dedicated entry: not update_property.
149
+ *
150
+ * @param {object} payload
151
+ * @param {number} payload.autotest_case_id
152
+ * @param {array} payload.pre_autotest_case_ids
153
+ * @param {object} callback
154
+ * @returns {Promise<void>}
155
+ */
156
+ async replace_pre_cases(payload, callback)
157
+ {
158
+ if (typeof callback?.before === 'function')
159
+ {
160
+ callback.before({ payload });
161
+ }
162
+
163
+ return ApiService[ this.api_key ].replace_pre_cases(payload).then((response) =>
164
+ {
165
+ if (typeof callback?.success === 'function')
166
+ {
167
+ callback.success({ response, payload });
168
+ }
169
+ }).catch((error) =>
170
+ {
171
+ if (typeof callback?.error === 'function')
172
+ {
173
+ callback.error({ error, payload });
174
+ }
175
+ }).finally((response) =>
176
+ {
177
+ if (typeof callback?.final === 'function')
178
+ {
179
+ callback.final({ response, payload });
180
+ }
181
+ });
182
+ }
183
+
184
+
185
+ /**
186
+ * Read-only syntax of stored steps. Does not open the target site.
187
+ *
188
+ * @param {object} payload
189
+ * @param {number} payload.autotest_case_id
190
+ * @param {object} callback
191
+ * @returns {Promise<void>}
192
+ */
193
+ async check_syntax(payload, callback)
194
+ {
195
+ if (typeof callback?.before === 'function')
196
+ {
197
+ callback.before({ payload });
198
+ }
199
+
200
+ return ApiService[ this.api_key ].check_syntax(payload).then((response) =>
201
+ {
202
+ if (typeof callback?.success === 'function')
203
+ {
204
+ callback.success({ response, payload });
205
+ }
206
+ }).catch((error) =>
207
+ {
208
+ if (typeof callback?.error === 'function')
209
+ {
210
+ callback.error({ error, payload });
211
+ }
212
+ }).finally((response) =>
213
+ {
214
+ if (typeof callback?.final === 'function')
215
+ {
216
+ callback.final({ response, payload });
217
+ }
218
+ });
219
+ }
220
+ }
@@ -0,0 +1,81 @@
1
+ import { is_object } from "../../utils/utils.js";
2
+ import { familyTestAutomation } from "../core/1_familyTestAutomation.js";
3
+ import { typeAutotestResult_i18n } from "../element_translate/typeAutotestResult.i18n.js";
4
+ import _ from 'underscore';
5
+
6
+
7
+ /**
8
+ * Результат одного автотеста в запуске. FAILED = шаг на странице; ERROR = инфра / allowlist.
9
+ *
10
+ * @version v.1.0 (04/09/2026)
11
+ */
12
+ export class typeAutotestResult extends familyTestAutomation
13
+ {
14
+ autotest_result_id;
15
+ autotest_run_id;
16
+ autotest_case_id;
17
+ team_id;
18
+ autotest_result_status;
19
+ report_json;
20
+ screenshot_file_uuid;
21
+ started_at;
22
+ finished_at;
23
+ created_at;
24
+ updated_at;
25
+
26
+ primary_key = 'autotest_result_id';
27
+ api_key = 'autotest_result';
28
+
29
+ structure_scheme = {
30
+ autotest_result_id : 'integer | require',
31
+ autotest_run_id : 'integer | require',
32
+ autotest_case_id : 'integer | require',
33
+ team_id : 'integer | require',
34
+ autotest_result_status : 'string | enum | optional',
35
+ report_json : 'string | optional',
36
+ screenshot_file_uuid : 'string | optional',
37
+ started_at : 'timestamp | optional',
38
+ finished_at : 'timestamp | optional',
39
+ created_at : 'timestamp | optional',
40
+ updated_at : 'timestamp | optional',
41
+ };
42
+
43
+ create_scheme = [];
44
+
45
+ available_enum_values = {
46
+ autotest_result_status: [ 'PENDING', 'PASSED', 'FAILED', 'SKIPPED', 'ERROR' ],
47
+ };
48
+
49
+ enum_value_translate_matrix = typeAutotestResult_i18n.enum_value_translate_matrix;
50
+ attribute_name_translate_matrix = typeAutotestResult_i18n.attribute_name_translate_matrix;
51
+
52
+ status_color = {
53
+ PENDING: '#C4B040',
54
+ PASSED : '#009688',
55
+ FAILED : '#E53935',
56
+ SKIPPED: '#90A4AE',
57
+ ERROR : '#6A1B9A',
58
+ };
59
+
60
+
61
+ /**
62
+ * @param {object|false|undefined} data
63
+ */
64
+ constructor(data = false)
65
+ {
66
+ super();
67
+
68
+ if (data && is_object(data))
69
+ {
70
+ _.mapObject(data, (value, key) =>
71
+ {
72
+ if (this.hasOwnProperty(key))
73
+ {
74
+ this[ key ] = value;
75
+ }
76
+ });
77
+ }
78
+
79
+ return this;
80
+ }
81
+ }
@@ -0,0 +1,165 @@
1
+ import { echo, is_object } from "../../utils/utils.js";
2
+ import { familyTestAutomation } from "../core/1_familyTestAutomation.js";
3
+ import { typeAutotestRun_i18n } from "../element_translate/typeAutotestRun.i18n.js";
4
+ import _ from 'underscore';
5
+
6
+
7
+ /**
8
+ * Запуск пачки автотестов. Контекст выполнения - браузер; стартовый домен - team_domain_id.
9
+ *
10
+ * @version v.1.0 (04/09/2026)
11
+ */
12
+ export class typeAutotestRun extends familyTestAutomation
13
+ {
14
+ autotest_run_id;
15
+ team_id;
16
+ project_id;
17
+ execution_context_id;
18
+ team_domain_id;
19
+ autotest_run_status;
20
+ pass_percent;
21
+ result_counts;
22
+ autotest_case_ids;
23
+ max_threads;
24
+ retry_count;
25
+ step_timeout_ms;
26
+ case_timeout_ms;
27
+ run_timeout_ms;
28
+ screenshot_on_failure;
29
+ consecutive_error_stop;
30
+ created_by_user_id;
31
+ started_at;
32
+ finished_at;
33
+ created_at;
34
+ updated_at;
35
+
36
+ primary_key = 'autotest_run_id';
37
+ api_key = 'autotest_run';
38
+
39
+ structure_scheme = {
40
+ autotest_run_id : 'integer | require',
41
+ team_id : 'integer | require',
42
+ project_id : 'integer | require',
43
+ execution_context_id : 'integer | require',
44
+ team_domain_id : 'integer | require',
45
+ autotest_run_status : 'string | enum | optional',
46
+ pass_percent : 'integer | optional',
47
+ result_counts : 'array | optional',
48
+ autotest_case_ids : 'array | optional',
49
+ max_threads : 'integer | optional',
50
+ retry_count : 'integer | optional',
51
+ step_timeout_ms : 'integer | optional',
52
+ case_timeout_ms : 'integer | optional',
53
+ run_timeout_ms : 'integer | optional',
54
+ screenshot_on_failure : 'integer | optional',
55
+ consecutive_error_stop : 'integer | optional',
56
+ created_by_user_id : 'integer | optional',
57
+ started_at : 'timestamp | optional',
58
+ finished_at : 'timestamp | optional',
59
+ created_at : 'timestamp | optional',
60
+ updated_at : 'timestamp | optional',
61
+ };
62
+
63
+ create_scheme = [
64
+ 'project_id',
65
+ 'execution_context_id',
66
+ 'team_domain_id',
67
+ 'autotest_case_ids',
68
+ 'max_threads',
69
+ 'retry_count',
70
+ 'step_timeout_ms',
71
+ 'case_timeout_ms',
72
+ 'run_timeout_ms',
73
+ 'screenshot_on_failure',
74
+ 'consecutive_error_stop',
75
+ ];
76
+
77
+ available_enum_values = {
78
+ autotest_run_status: [ 'PENDING', 'IN_PROGRESS', 'COMPLETED', 'CLOSED', 'CANCELLED' ],
79
+ };
80
+
81
+ enum_value_translate_matrix = typeAutotestRun_i18n.enum_value_translate_matrix;
82
+ attribute_name_translate_matrix = typeAutotestRun_i18n.attribute_name_translate_matrix;
83
+
84
+ status_color = {
85
+ PENDING : '#C4B040',
86
+ IN_PROGRESS: '#FD9A4F',
87
+ COMPLETED : '#009688',
88
+ CLOSED : '#E0E0E0',
89
+ CANCELLED : '#9E9E9E',
90
+ };
91
+
92
+
93
+ /**
94
+ * @param {object|false|undefined} data
95
+ */
96
+ constructor(data = false)
97
+ {
98
+ super();
99
+
100
+ if (data && is_object(data))
101
+ {
102
+ _.mapObject(data, (value, key) =>
103
+ {
104
+ if (this.hasOwnProperty(key))
105
+ {
106
+ this[ key ] = value;
107
+ }
108
+ });
109
+ }
110
+
111
+ return this;
112
+ }
113
+
114
+
115
+ /**
116
+ * @returns {string}
117
+ */
118
+ get_element_name()
119
+ {
120
+ return String(this.autotest_run_id ?? '');
121
+ }
122
+
123
+
124
+ /**
125
+ * @param {object|typeFunctionCallback} callback
126
+ * @returns {Promise<void>}
127
+ */
128
+ async cancel(callback)
129
+ {
130
+ if (!this.autotest_run_id)
131
+ {
132
+ throw new Error('Error #165-2216 - element has no autotest_run_id');
133
+ }
134
+
135
+ const payload = {
136
+ autotest_run_id: this.autotest_run_id,
137
+ };
138
+
139
+ if (typeof callback?.before === 'function')
140
+ {
141
+ callback.before({ payload });
142
+ }
143
+
144
+ return ApiService[ this.api_key ].cancel(payload).then((response) =>
145
+ {
146
+ if (typeof callback?.success === 'function')
147
+ {
148
+ callback.success({ response, payload });
149
+ }
150
+ }).catch((error) =>
151
+ {
152
+ echo({ error });
153
+ if (typeof callback?.error === 'function')
154
+ {
155
+ callback.error({ error, payload });
156
+ }
157
+ }).finally((response) =>
158
+ {
159
+ if (typeof callback?.final === 'function')
160
+ {
161
+ callback.final({ response, payload });
162
+ }
163
+ });
164
+ }
165
+ }