artes 1.4.7 → 1.4.9

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 (40) hide show
  1. package/README.md +668 -668
  2. package/cucumber.config.js +223 -223
  3. package/docs/emulationDevicesList.md +152 -152
  4. package/docs/functionDefinitions.md +2401 -2401
  5. package/docs/stepDefinitions.md +402 -402
  6. package/executer.js +479 -479
  7. package/index.js +50 -50
  8. package/package.json +52 -52
  9. package/src/helper/contextManager/browserManager.js +74 -74
  10. package/src/helper/contextManager/requestManager.js +23 -23
  11. package/src/helper/controller/elementController.js +203 -185
  12. package/src/helper/controller/pomCollector.js +82 -82
  13. package/src/helper/executers/cleaner.js +19 -19
  14. package/src/helper/executers/exporter.js +15 -15
  15. package/src/helper/executers/helper.js +110 -110
  16. package/src/helper/executers/projectCreator.js +206 -206
  17. package/src/helper/executers/reportGenerator.js +70 -70
  18. package/src/helper/executers/testRunner.js +28 -28
  19. package/src/helper/executers/versionChecker.js +31 -31
  20. package/src/helper/imports/commons.js +57 -57
  21. package/src/helper/stepFunctions/APIActions.js +495 -495
  22. package/src/helper/stepFunctions/assertions.js +989 -989
  23. package/src/helper/stepFunctions/browserActions.js +22 -22
  24. package/src/helper/stepFunctions/elementInteractions.js +60 -60
  25. package/src/helper/stepFunctions/exporter.js +19 -19
  26. package/src/helper/stepFunctions/frameActions.js +72 -72
  27. package/src/helper/stepFunctions/keyboardActions.js +66 -66
  28. package/src/helper/stepFunctions/mouseActions.js +83 -83
  29. package/src/helper/stepFunctions/pageActions.js +43 -43
  30. package/src/hooks/context.js +15 -15
  31. package/src/hooks/hooks.js +215 -215
  32. package/src/stepDefinitions/API.steps.js +310 -310
  33. package/src/stepDefinitions/assertions.steps.js +1092 -1092
  34. package/src/stepDefinitions/browser.steps.js +7 -7
  35. package/src/stepDefinitions/frameActions.steps.js +76 -76
  36. package/src/stepDefinitions/keyboardActions.steps.js +265 -265
  37. package/src/stepDefinitions/mouseActions.steps.js +378 -378
  38. package/src/stepDefinitions/page.steps.js +71 -71
  39. package/src/stepDefinitions/random.steps.js +188 -188
  40. package/status-formatter.js +138 -138
@@ -1,138 +1,138 @@
1
- const { Formatter } = require('@cucumber/cucumber');
2
- const fs = require('fs');
3
- const path = require('path');
4
-
5
- class StatusFormatter extends Formatter {
6
- constructor(options) {
7
- super(options);
8
-
9
- const outputDir = './test-status';
10
- if (!fs.existsSync(outputDir)) {
11
- fs.mkdirSync(outputDir, { recursive: true });
12
- }
13
-
14
- const workerId = process.env.CUCUMBER_WORKER_ID || '0';
15
- this.workerId = workerId;
16
- this.outputFile = path.join(outputDir, `test-results-${workerId}.txt`);
17
- this.outputDir = outputDir;
18
-
19
- fs.writeFileSync(this.outputFile, '', 'utf8');
20
-
21
- this.pickles = new Map();
22
- this.testCases = new Map();
23
- this.testCaseStartedIdToAttempt = new Map();
24
-
25
- const { eventBroadcaster } = options;
26
-
27
- eventBroadcaster.on('envelope', (envelope) => {
28
- if (envelope.pickle) {
29
- this.pickles.set(envelope.pickle.id, envelope.pickle);
30
- }
31
-
32
- if (envelope.testCase) {
33
- this.testCases.set(envelope.testCase.id, envelope.testCase);
34
- }
35
-
36
- if (envelope.testCaseStarted) {
37
- this.testCaseStartedIdToAttempt.set(
38
- envelope.testCaseStarted.id,
39
- envelope.testCaseStarted.testCaseId
40
- );
41
- }
42
-
43
- if (envelope.testCaseFinished) {
44
- this.handleTestCaseFinished(envelope.testCaseFinished);
45
- }
46
-
47
- if (envelope.testRunFinished) {
48
- this.handleTestRunFinished();
49
- }
50
- });
51
- }
52
-
53
- getFormattedTimestamp() {
54
- const now = new Date();
55
- const YYYY = now.getFullYear();
56
- const MM = String(now.getMonth() + 1).padStart(2, '0');
57
- const DD = String(now.getDate()).padStart(2, '0');
58
- const hh = String(now.getHours()).padStart(2, '0');
59
- const mm = String(now.getMinutes()).padStart(2, '0');
60
- const ss = String(now.getSeconds()).padStart(2, '0');
61
- const ms = String(now.getMilliseconds()).padStart(3, '0');
62
-
63
- return `${YYYY}${MM}${DD}-${hh}${mm}${ss}-${ms}`;
64
- }
65
-
66
- handleTestCaseFinished(testCaseFinished) {
67
- try {
68
- const timestamp = this.getFormattedTimestamp();
69
-
70
- const testCaseId = this.testCaseStartedIdToAttempt.get(
71
- testCaseFinished.testCaseStartedId
72
- );
73
-
74
- if (!testCaseId) return;
75
-
76
- const testCase = this.testCases.get(testCaseId);
77
- if (!testCase) return;
78
-
79
- const pickle = this.pickles.get(testCase.pickleId);
80
- if (!pickle) return;
81
-
82
- const testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(
83
- testCaseFinished.testCaseStartedId
84
- );
85
-
86
- const status = testCaseAttempt?.worstTestStepResult?.status || 'UNKNOWN';
87
-
88
- const info = {
89
- name: pickle.name,
90
- id: pickle.id,
91
- uri: pickle.uri
92
- };
93
-
94
- const line = `${timestamp} | ${status.toUpperCase()} | ${info.name} | ${info.id} | ${info.uri}\n`;
95
-
96
- fs.appendFileSync(this.outputFile, line, 'utf8');
97
-
98
- } catch (error) {
99
- console.error('Error in handleTestCaseFinished:', error);
100
- }
101
- }
102
-
103
- handleTestRunFinished() {
104
- if (this.workerId !== '0') {
105
- return;
106
- }
107
-
108
- setTimeout(() => {
109
- this.mergeResults();
110
- }, 1000);
111
- }
112
-
113
- mergeResults() {
114
- try {
115
- const testStatusFile = path.join(this.outputDir, 'test-status.txt');
116
-
117
- const files = fs.readdirSync(this.outputDir)
118
- .filter(f => f.startsWith('test-results-') && f.endsWith('.txt'))
119
- .sort();
120
-
121
- if (files.length === 0) {
122
- console.log('No result files found to merge');
123
- return;
124
- }
125
-
126
- const combined = files
127
- .map(f => fs.readFileSync(path.join(this.outputDir, f), 'utf8'))
128
- .join('');
129
-
130
- fs.writeFileSync(testStatusFile, combined, 'utf8');
131
-
132
- } catch (error) {
133
- console.error('Error merging results:', error);
134
- }
135
- }
136
- }
137
-
138
- module.exports = StatusFormatter;
1
+ const { Formatter } = require('@cucumber/cucumber');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ class StatusFormatter extends Formatter {
6
+ constructor(options) {
7
+ super(options);
8
+
9
+ const outputDir = './test-status';
10
+ if (!fs.existsSync(outputDir)) {
11
+ fs.mkdirSync(outputDir, { recursive: true });
12
+ }
13
+
14
+ const workerId = process.env.CUCUMBER_WORKER_ID || '0';
15
+ this.workerId = workerId;
16
+ this.outputFile = path.join(outputDir, `test-results-${workerId}.txt`);
17
+ this.outputDir = outputDir;
18
+
19
+ fs.writeFileSync(this.outputFile, '', 'utf8');
20
+
21
+ this.pickles = new Map();
22
+ this.testCases = new Map();
23
+ this.testCaseStartedIdToAttempt = new Map();
24
+
25
+ const { eventBroadcaster } = options;
26
+
27
+ eventBroadcaster.on('envelope', (envelope) => {
28
+ if (envelope.pickle) {
29
+ this.pickles.set(envelope.pickle.id, envelope.pickle);
30
+ }
31
+
32
+ if (envelope.testCase) {
33
+ this.testCases.set(envelope.testCase.id, envelope.testCase);
34
+ }
35
+
36
+ if (envelope.testCaseStarted) {
37
+ this.testCaseStartedIdToAttempt.set(
38
+ envelope.testCaseStarted.id,
39
+ envelope.testCaseStarted.testCaseId
40
+ );
41
+ }
42
+
43
+ if (envelope.testCaseFinished) {
44
+ this.handleTestCaseFinished(envelope.testCaseFinished);
45
+ }
46
+
47
+ if (envelope.testRunFinished) {
48
+ this.handleTestRunFinished();
49
+ }
50
+ });
51
+ }
52
+
53
+ getFormattedTimestamp() {
54
+ const now = new Date();
55
+ const YYYY = now.getFullYear();
56
+ const MM = String(now.getMonth() + 1).padStart(2, '0');
57
+ const DD = String(now.getDate()).padStart(2, '0');
58
+ const hh = String(now.getHours()).padStart(2, '0');
59
+ const mm = String(now.getMinutes()).padStart(2, '0');
60
+ const ss = String(now.getSeconds()).padStart(2, '0');
61
+ const ms = String(now.getMilliseconds()).padStart(3, '0');
62
+
63
+ return `${YYYY}${MM}${DD}-${hh}${mm}${ss}-${ms}`;
64
+ }
65
+
66
+ handleTestCaseFinished(testCaseFinished) {
67
+ try {
68
+ const timestamp = this.getFormattedTimestamp();
69
+
70
+ const testCaseId = this.testCaseStartedIdToAttempt.get(
71
+ testCaseFinished.testCaseStartedId
72
+ );
73
+
74
+ if (!testCaseId) return;
75
+
76
+ const testCase = this.testCases.get(testCaseId);
77
+ if (!testCase) return;
78
+
79
+ const pickle = this.pickles.get(testCase.pickleId);
80
+ if (!pickle) return;
81
+
82
+ const testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(
83
+ testCaseFinished.testCaseStartedId
84
+ );
85
+
86
+ const status = testCaseAttempt?.worstTestStepResult?.status || 'UNKNOWN';
87
+
88
+ const info = {
89
+ name: pickle.name,
90
+ id: pickle.id,
91
+ uri: pickle.uri
92
+ };
93
+
94
+ const line = `${timestamp} | ${status.toUpperCase()} | ${info.name} | ${info.id} | ${info.uri}\n`;
95
+
96
+ fs.appendFileSync(this.outputFile, line, 'utf8');
97
+
98
+ } catch (error) {
99
+ console.error('Error in handleTestCaseFinished:', error);
100
+ }
101
+ }
102
+
103
+ handleTestRunFinished() {
104
+ if (this.workerId !== '0') {
105
+ return;
106
+ }
107
+
108
+ setTimeout(() => {
109
+ this.mergeResults();
110
+ }, 1000);
111
+ }
112
+
113
+ mergeResults() {
114
+ try {
115
+ const testStatusFile = path.join(this.outputDir, 'test-status.txt');
116
+
117
+ const files = fs.readdirSync(this.outputDir)
118
+ .filter(f => f.startsWith('test-results-') && f.endsWith('.txt'))
119
+ .sort();
120
+
121
+ if (files.length === 0) {
122
+ console.log('No result files found to merge');
123
+ return;
124
+ }
125
+
126
+ const combined = files
127
+ .map(f => fs.readFileSync(path.join(this.outputDir, f), 'utf8'))
128
+ .join('');
129
+
130
+ fs.writeFileSync(testStatusFile, combined, 'utf8');
131
+
132
+ } catch (error) {
133
+ console.error('Error merging results:', error);
134
+ }
135
+ }
136
+ }
137
+
138
+ module.exports = StatusFormatter;