artes 1.0.23 → 1.0.25

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,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "The package provide step definitions and user writes feature files, and the package handles automation, with optional POM files and custom step definitions.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -27,6 +27,9 @@
27
27
  "dependencies": {
28
28
  "@cucumber/cucumber": "^11.0.1",
29
29
  "@cucumber/messages": "^26.0.1",
30
+ "@gatling.io/core": "3.12.0",
31
+ "@gatling.io/cli": "3.12.0",
32
+ "@gatling.io/http": "3.12.0",
30
33
  "@types/node": "^22.9.0",
31
34
  "allure-commandline": "^2.30.0",
32
35
  "allure-cucumberjs": "^3.0.5",
@@ -1,79 +1,135 @@
1
1
  const { expect, element, context } = require("../imports/commons");
2
2
  const { elementInteractions } = require("./elementInteractions");
3
+ const { frame } = require("../stepFunctions/frameActions");
3
4
 
4
5
  const assert = {
5
6
  // Element Assertion
6
7
  shouldBeAttached: async (selector) => {
7
- await expect(element(selector)).toBeAttached();
8
+ await expect(
9
+ typeof selector === "string" ? element(selector) : await selector,
10
+ ).toBeAttached();
8
11
  },
9
12
  shouldBeChecked: async (selector) => {
10
- await expect(element(selector)).toBeChecked();
13
+ await expect(
14
+ typeof selector === "string" ? element(selector) : await selector,
15
+ ).toBeChecked();
11
16
  },
12
17
  shouldBeDisabled: async (selector) => {
13
- await expect(element(selector)).toBeDisabled();
18
+ await expect(
19
+ typeof selector === "string" ? element(selector) : await selector,
20
+ ).toBeDisabled();
14
21
  },
15
22
  shouldBeEditable: async (selector) => {
16
- await expect(element(selector)).toBeEditable();
23
+ await expect(
24
+ typeof selector === "string" ? element(selector) : await selector,
25
+ ).toBeEditable();
17
26
  },
18
27
  shouldBeEmpty: async (selector) => {
19
- await expect(element(selector)).toBeEmpty();
28
+ await expect(
29
+ typeof selector === "string" ? element(selector) : await selector,
30
+ ).toBeEmpty();
20
31
  },
21
32
  shouldBeEnabled: async (selector) => {
22
- await expect(element(selector)).toBeEnabled();
33
+ await expect(
34
+ typeof selector === "string" ? element(selector) : await selector,
35
+ ).toBeEnabled();
23
36
  },
24
37
  shouldBeFocused: async (selector) => {
25
- await expect(element(selector)).toBeFocused();
38
+ await expect(
39
+ typeof selector === "string" ? element(selector) : await selector,
40
+ ).toBeFocused();
26
41
  },
27
42
  shouldBeHidden: async (selector) => {
28
- await expect(element(selector)).toBeHidden();
43
+ await expect(
44
+ typeof selector === "string" ? element(selector) : await selector,
45
+ ).toBeHidden();
29
46
  },
30
47
  shouldBeInViewport: async (selector) => {
31
- await expect(element(selector)).toBeInViewport();
48
+ await expect(
49
+ typeof selector === "string" ? element(selector) : await selector,
50
+ ).toBeInViewport();
32
51
  },
33
52
  shouldBeVisible: async (selector) => {
34
- await expect(element(selector)).toBeVisible();
53
+ await expect(
54
+ typeof selector === "string" ? element(selector) : await selector,
55
+ ).toBeVisible();
35
56
  },
36
57
  shouldContainText: async (selector, text) => {
37
- await expect(element(selector)).toContainText(text);
58
+ await expect(
59
+ typeof selector === "string" ? element(selector) : await selector,
60
+ ).toContainText(text);
61
+ },
62
+ multipleElementsShouldContainText: async (elements, expectedText) => {
63
+ const count = await frame.count(elements);
64
+
65
+ for (let i = 0; i < count; i++) {
66
+ await assert.shouldContainText(frame.nth(elements, i), expectedText);
67
+ }
38
68
  },
39
69
  shouldHaveAccessibleDescription: async (selector, description) => {
40
- await expect(element(selector)).toHaveAccessibleDescription(description);
70
+ await expect(
71
+ typeof selector === "string" ? element(selector) : await selector,
72
+ ).toHaveAccessibleDescription(description);
41
73
  },
42
74
  shouldHaveAccessibleName: async (selector, name) => {
43
- await expect(element(selector)).toHaveAccessibleName(name);
75
+ await expect(
76
+ typeof selector === "string" ? element(selector) : await selector,
77
+ ).toHaveAccessibleName(name);
44
78
  },
45
79
  shouldHaveAttribute: async (selector, attribute, value) => {
46
- await expect(element(selector)).toHaveAttribute(attribute, value);
80
+ await expect(
81
+ typeof selector === "string" ? element(selector) : await selector,
82
+ ).toHaveAttribute(attribute, value);
47
83
  },
48
84
  shouldHaveClass: async (selector, className) => {
49
- await expect(element(selector)).toHaveClass(className);
85
+ await expect(
86
+ typeof selector === "string" ? element(selector) : await selector,
87
+ ).toHaveClass(className);
50
88
  },
51
89
  shouldHaveCount: async (selector, count) => {
52
- await expect(element(selector)).toHaveCount(count);
90
+ await expect(
91
+ typeof selector === "string" ? element(selector) : await selector,
92
+ ).toHaveCount(count);
53
93
  },
54
94
  shouldHaveCSS: async (selector, property, value) => {
55
- await expect(element(selector)).toHaveCSS(property, value);
95
+ await expect(
96
+ typeof selector === "string" ? element(selector) : await selector,
97
+ ).toHaveCSS(property, value);
56
98
  },
57
99
  shouldHaveId: async (selector, id) => {
58
- await expect(element(selector)).toHaveId(id);
100
+ await expect(
101
+ typeof selector === "string" ? element(selector) : await selector,
102
+ ).toHaveId(id);
59
103
  },
60
104
  shouldHaveJSProperty: async (selector, property, value) => {
61
- await expect(element(selector)).toHaveJSProperty(property, value);
105
+ await expect(
106
+ typeof selector === "string" ? element(selector) : await selector,
107
+ ).toHaveJSProperty(property, value);
62
108
  },
63
109
  shouldHaveRole: async (selector, role) => {
64
- await expect(element(selector)).toHaveRole(role);
110
+ await expect(
111
+ typeof selector === "string" ? element(selector) : await selector,
112
+ ).toHaveRole(role);
65
113
  },
66
114
  shouldHaveScreenshot: async (selector) => {
67
- await expect(element(selector)).toHaveScreenshot();
115
+ await expect(
116
+ typeof selector === "string" ? element(selector) : await selector,
117
+ ).toHaveScreenshot();
68
118
  },
69
119
  shouldHaveText: async (selector, text) => {
70
- await expect(element(selector)).toHaveText(text);
120
+ await expect(
121
+ typeof selector === "string" ? element(selector) : await selector,
122
+ ).toHaveText(text);
71
123
  },
72
124
  shouldHaveValue: async (selector, value) => {
73
- await expect(element(selector)).toHaveValue(value);
125
+ await expect(
126
+ typeof selector === "string" ? element(selector) : await selector,
127
+ ).toHaveValue(value);
74
128
  },
75
129
  shouldHaveValues: async (selector, values) => {
76
- await expect(element(selector)).toHaveValues(values);
130
+ await expect(
131
+ typeof selector === "string" ? element(selector) : await selector,
132
+ ).toHaveValues(values);
77
133
  },
78
134
  shouldPageHaveScreenshot: async () => {
79
135
  await expect(context.page).toHaveScreenshot();
@@ -90,78 +146,124 @@ const assert = {
90
146
 
91
147
  // Negative Element Assertion
92
148
  shouldNotBeAttached: async (selector) => {
93
- await expect(element(selector)).not.toBeAttached();
149
+ await expect(
150
+ typeof selector === "string" ? element(selector) : await selector,
151
+ ).not.toBeAttached();
94
152
  },
95
153
  shouldNotBeChecked: async (selector) => {
96
- await expect(element(selector)).not.toBeChecked();
154
+ await expect(
155
+ typeof selector === "string" ? element(selector) : await selector,
156
+ ).not.toBeChecked();
97
157
  },
98
158
  shouldNotBeDisabled: async (selector) => {
99
- await expect(element(selector)).not.toBeDisabled();
159
+ await expect(
160
+ typeof selector === "string" ? element(selector) : await selector,
161
+ ).not.toBeDisabled();
100
162
  },
101
163
  shouldNotBeEditable: async (selector) => {
102
- await expect(element(selector)).not.toBeEditable();
164
+ await expect(
165
+ typeof selector === "string" ? element(selector) : await selector,
166
+ ).not.toBeEditable();
103
167
  },
104
168
  shouldNotBeEmpty: async (selector) => {
105
- await expect(element(selector)).not.toBeEmpty();
169
+ await expect(
170
+ typeof selector === "string" ? element(selector) : await selector,
171
+ ).not.toBeEmpty();
106
172
  },
107
173
  shouldNotBeEnabled: async (selector) => {
108
- await expect(element(selector)).not.toBeEnabled();
174
+ await expect(
175
+ typeof selector === "string" ? element(selector) : await selector,
176
+ ).not.toBeEnabled();
109
177
  },
110
178
  shouldNotBeFocused: async (selector) => {
111
- await expect(element(selector)).not.toBeFocused();
179
+ await expect(
180
+ typeof selector === "string" ? element(selector) : await selector,
181
+ ).not.toBeFocused();
112
182
  },
113
183
  shouldNotBeHidden: async (selector) => {
114
- await expect(element(selector)).not.toBeHidden();
184
+ await expect(
185
+ typeof selector === "string" ? element(selector) : await selector,
186
+ ).not.toBeHidden();
115
187
  },
116
188
  shouldNotBeInViewport: async (selector) => {
117
- await expect(element(selector)).not.toBeInViewport();
189
+ await expect(
190
+ typeof selector === "string" ? element(selector) : await selector,
191
+ ).not.toBeInViewport();
118
192
  },
119
193
  shouldNotBeVisible: async (selector) => {
120
- await expect(element(selector)).not.toBeVisible();
194
+ await expect(
195
+ typeof selector === "string" ? element(selector) : await selector,
196
+ ).not.toBeVisible();
121
197
  },
122
198
  shouldNotContainText: async (selector, text) => {
123
- await expect(element(selector)).not.toContainText(text);
199
+ await expect(
200
+ typeof selector === "string" ? element(selector) : await selector,
201
+ ).not.toContainText(text);
124
202
  },
125
203
  shouldNotHaveAccessibleDescription: async (selector, description) => {
126
- await expect(element(selector)).not.toHaveAccessibleDescription(
127
- description,
128
- );
204
+ await expect(
205
+ typeof selector === "string" ? element(selector) : await selector,
206
+ ).not.toHaveAccessibleDescription(description);
129
207
  },
130
208
  shouldNotHaveAccessibleName: async (selector, name) => {
131
- await expect(element(selector)).not.toHaveAccessibleName(name);
209
+ await expect(
210
+ typeof selector === "string" ? element(selector) : await selector,
211
+ ).not.toHaveAccessibleName(name);
132
212
  },
133
213
  shouldNotHaveAttribute: async (selector, attribute, value) => {
134
- await expect(element(selector)).not.toHaveAttribute(attribute, value);
214
+ await expect(
215
+ typeof selector === "string" ? element(selector) : await selector,
216
+ ).not.toHaveAttribute(attribute, value);
135
217
  },
136
218
  shouldNotHaveClass: async (selector, className) => {
137
- await expect(element(selector)).not.toHaveClass(className);
219
+ await expect(
220
+ typeof selector === "string" ? element(selector) : await selector,
221
+ ).not.toHaveClass(className);
138
222
  },
139
223
  shouldNotHaveCount: async (selector, count) => {
140
- await expect(element(selector)).not.toHaveCount(count);
224
+ await expect(
225
+ typeof selector === "string" ? element(selector) : await selector,
226
+ ).not.toHaveCount(count);
141
227
  },
142
228
  shouldNotHaveCSS: async (selector, property, value) => {
143
- await expect(element(selector)).not.toHaveCSS(property, value);
229
+ await expect(
230
+ typeof selector === "string" ? element(selector) : await selector,
231
+ ).not.toHaveCSS(property, value);
144
232
  },
145
233
  shouldNotHaveId: async (selector, id) => {
146
- await expect(element(selector)).not.toHaveId(id);
234
+ await expect(
235
+ typeof selector === "string" ? element(selector) : await selector,
236
+ ).not.toHaveId(id);
147
237
  },
148
238
  shouldNotHaveJSProperty: async (selector, property, value) => {
149
- await expect(element(selector)).not.toHaveJSProperty(property, value);
239
+ await expect(
240
+ typeof selector === "string" ? element(selector) : await selector,
241
+ ).not.toHaveJSProperty(property, value);
150
242
  },
151
243
  shouldNotHaveRole: async (selector, role) => {
152
- await expect(element(selector)).not.toHaveRole(role);
244
+ await expect(
245
+ typeof selector === "string" ? element(selector) : await selector,
246
+ ).not.toHaveRole(role);
153
247
  },
154
248
  shouldNotHaveScreenshot: async (selector) => {
155
- await expect(element(selector)).not.toHaveScreenshot();
249
+ await expect(
250
+ typeof selector === "string" ? element(selector) : await selector,
251
+ ).not.toHaveScreenshot();
156
252
  },
157
253
  shouldNotHaveText: async (selector, text) => {
158
- await expect(element(selector)).not.toHaveText(text);
254
+ await expect(
255
+ typeof selector === "string" ? element(selector) : await selector,
256
+ ).not.toHaveText(text);
159
257
  },
160
258
  shouldNotHaveValue: async (selector, value) => {
161
- await expect(element(selector)).not.toHaveValue(value);
259
+ await expect(
260
+ typeof selector === "string" ? element(selector) : await selector,
261
+ ).not.toHaveValue(value);
162
262
  },
163
263
  shouldNotHaveValues: async (selector, values) => {
164
- await expect(element(selector)).not.toHaveValues(values);
264
+ await expect(
265
+ typeof selector === "string" ? element(selector) : await selector,
266
+ ).not.toHaveValues(values);
165
267
  },
166
268
  shouldNotPageHaveScreenshot: async () => {
167
269
  await expect(context.page).not.toHaveScreenshot();
@@ -1,8 +1,15 @@
1
1
  const { element } = require("../imports/commons");
2
-
2
+ const { frame } = require("../stepFunctions/frameActions");
3
3
  const mouse = {
4
4
  click: async (selector) => {
5
- await element(selector).click(selector);
5
+ await element(selector).click();
6
+ },
7
+ multipleElementClick: async (elements) => {
8
+ const elementCount = await frame.count(elements);
9
+
10
+ for (let i = 0; i < elementCount; i++) {
11
+ await frame.nth(elements, i).click();
12
+ }
6
13
  },
7
14
  forceClick: async (selector) => {
8
15
  await element(selector).click({ force: true });
@@ -16,12 +23,26 @@ const mouse = {
16
23
  rightClick: async (selector) => {
17
24
  await element(selector).click({ button: "right" });
18
25
  },
26
+ multipleElementRightClick: async (elements) => {
27
+ const elementCount = await frame.count(elements);
28
+
29
+ for (let i = 0; i < elementCount; i++) {
30
+ await frame.nth(elements, i).click({ button: "right" });
31
+ }
32
+ },
19
33
  forceRightClick: async (selector) => {
20
34
  await element(selector).click({ force: true, button: "right" });
21
35
  },
22
36
  leftClick: async (selector) => {
23
37
  await element(selector).click({ button: "left" });
24
38
  },
39
+ multipleElementLeftClick: async (elements) => {
40
+ const elementCount = await frame.count(elements);
41
+
42
+ for (let i = 0; i < elementCount; i++) {
43
+ await frame.nth(elements, i).click({ button: "left" });
44
+ }
45
+ },
25
46
  forceLeftClick: async (selector) => {
26
47
  await element(selector).click({ force: true, button: "left" });
27
48
  },
@@ -62,6 +62,13 @@ Then(
62
62
  },
63
63
  );
64
64
 
65
+ Then(
66
+ "User expects multiple {string} should have {string} text",
67
+ async (elements, expectedText) => {
68
+ await assert.multipleElementsShouldContainText(elements, expectedText);
69
+ }
70
+ );
71
+
65
72
  // Check if a selector should have an accessible description
66
73
  Then(
67
74
  "User expects {string} should have {string} description",