artes 1.7.4 → 1.7.6

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 (48) hide show
  1. package/README.md +781 -779
  2. package/assets/styles.css +4 -4
  3. package/cucumber.config.js +253 -253
  4. package/docs/ciExecutors.md +198 -198
  5. package/docs/emulationDevicesList.md +152 -152
  6. package/docs/functionDefinitions.md +2401 -2401
  7. package/docs/stepDefinitions.md +435 -433
  8. package/executer.js +266 -264
  9. package/index.js +50 -50
  10. package/package.json +56 -56
  11. package/src/helper/contextManager/browserManager.js +74 -74
  12. package/src/helper/contextManager/requestManager.js +23 -23
  13. package/src/helper/controller/elementController.js +210 -210
  14. package/src/helper/controller/findDuplicateTestNames.js +69 -69
  15. package/src/helper/controller/getEnvInfo.js +94 -94
  16. package/src/helper/controller/getExecutor.js +109 -109
  17. package/src/helper/controller/pomCollector.js +83 -83
  18. package/src/helper/controller/reportCustomizer.js +485 -485
  19. package/src/helper/controller/screenComparer.js +97 -108
  20. package/src/helper/controller/status-formatter.js +137 -137
  21. package/src/helper/controller/testCoverageCalculator.js +111 -111
  22. package/src/helper/executers/cleaner.js +23 -23
  23. package/src/helper/executers/exporter.js +19 -19
  24. package/src/helper/executers/helper.js +193 -191
  25. package/src/helper/executers/projectCreator.js +226 -222
  26. package/src/helper/executers/reportGenerator.js +91 -91
  27. package/src/helper/executers/testRunner.js +28 -28
  28. package/src/helper/executers/versionChecker.js +31 -31
  29. package/src/helper/imports/commons.js +65 -65
  30. package/src/helper/stepFunctions/APIActions.js +495 -495
  31. package/src/helper/stepFunctions/assertions.js +986 -986
  32. package/src/helper/stepFunctions/browserActions.js +87 -87
  33. package/src/helper/stepFunctions/elementInteractions.js +60 -60
  34. package/src/helper/stepFunctions/exporter.js +19 -19
  35. package/src/helper/stepFunctions/frameActions.js +72 -72
  36. package/src/helper/stepFunctions/keyboardActions.js +66 -66
  37. package/src/helper/stepFunctions/mouseActions.js +84 -84
  38. package/src/helper/stepFunctions/pageActions.js +43 -43
  39. package/src/hooks/context.js +15 -15
  40. package/src/hooks/hooks.js +287 -279
  41. package/src/stepDefinitions/API.steps.js +310 -310
  42. package/src/stepDefinitions/assertions.steps.js +1303 -1280
  43. package/src/stepDefinitions/browser.steps.js +74 -74
  44. package/src/stepDefinitions/frameActions.steps.js +76 -76
  45. package/src/stepDefinitions/keyboardActions.steps.js +264 -264
  46. package/src/stepDefinitions/mouseActions.steps.js +378 -378
  47. package/src/stepDefinitions/page.steps.js +71 -71
  48. package/src/stepDefinitions/random.steps.js +191 -191
@@ -1,87 +1,87 @@
1
- const { page: p } = require("artes/src/helper/stepFunctions/pageActions");
2
- const {
3
- context,
4
- resolveVariable,
5
- expect,
6
- selector,
7
- } = require("../imports/commons");
8
- const { AxeBuilder } = require("@axe-core/playwright");
9
- const {
10
- validateWCAGTags,
11
- } = require("artes/src/helper/controller/validateWCAGTags ");
12
- require("allure-cucumberjs");
13
- const allure = require("allure-js-commons");
14
-
15
- const browser = {
16
- setCookies: async (cookies) => {
17
- cookies = await resolveVariable(cookies);
18
-
19
- let cookieData;
20
- try {
21
- cookieData = JSON.parse(cookies);
22
- } catch {
23
- cookieData = selector(cookies);
24
- }
25
-
26
- cookieData = Array.isArray(cookieData) ? cookieData : [cookieData];
27
-
28
- await context.browserContext.addCookies(cookieData);
29
- },
30
- checkAccessibilityOfPage: async (page, url, element) => {
31
- if (url) {
32
- await p.navigateTo(url);
33
- }
34
-
35
- if (element) {
36
- element = await selector(element);
37
- await page.locator(element).waitFor();
38
- }
39
-
40
- const accessibilityScanResults = await new AxeBuilder({ page })
41
- .include(element)
42
- .analyze();
43
- await allure.attachment(
44
- "Accessibility Results",
45
- JSON.stringify(accessibilityScanResults, null, 2),
46
- "application/json",
47
- );
48
-
49
- try {
50
- expect(accessibilityScanResults.violations).toEqual([]);
51
- } catch (e) {
52
- e.name = "AssertionError";
53
- throw e;
54
- }
55
- },
56
- checkAccessibilityOfPageDueToWCAG: async (page, url, element, tags) => {
57
- if (url) {
58
- await p.navigateTo(url);
59
- }
60
-
61
- if (element) {
62
- element = await selector(element);
63
- await page.locator(element).waitFor();
64
- }
65
- if (tags) {
66
- tags = validateWCAGTags(tags);
67
- }
68
-
69
- expect(accessibilityScanResults.violations).toEqual([]);
70
- await allure.attachment(
71
- "Accessibility Results",
72
- JSON.stringify(accessibilityScanResults, null, 2),
73
- "application/json",
74
- );
75
-
76
- try {
77
- expect(accessibilityScanResults.violations).toEqual([]);
78
- } catch (e) {
79
- e.name = "AssertionError";
80
- throw e;
81
- }
82
- },
83
- };
84
-
85
- module.exports = {
86
- browser,
87
- };
1
+ const { page: p } = require("artes/src/helper/stepFunctions/pageActions");
2
+ const {
3
+ context,
4
+ resolveVariable,
5
+ expect,
6
+ selector,
7
+ } = require("../imports/commons");
8
+ const { AxeBuilder } = require("@axe-core/playwright");
9
+ const {
10
+ validateWCAGTags,
11
+ } = require("artes/src/helper/controller/validateWCAGTags ");
12
+ require("allure-cucumberjs");
13
+ const allure = require("allure-js-commons");
14
+
15
+ const browser = {
16
+ setCookies: async (cookies) => {
17
+ cookies = await resolveVariable(cookies);
18
+
19
+ let cookieData;
20
+ try {
21
+ cookieData = JSON.parse(cookies);
22
+ } catch {
23
+ cookieData = selector(cookies);
24
+ }
25
+
26
+ cookieData = Array.isArray(cookieData) ? cookieData : [cookieData];
27
+
28
+ await context.browserContext.addCookies(cookieData);
29
+ },
30
+ checkAccessibilityOfPage: async (page, url, element) => {
31
+ if (url) {
32
+ await p.navigateTo(url);
33
+ }
34
+
35
+ if (element) {
36
+ element = await selector(element);
37
+ await page.locator(element).waitFor();
38
+ }
39
+
40
+ const accessibilityScanResults = await new AxeBuilder({ page })
41
+ .include(element)
42
+ .analyze();
43
+ await allure.attachment(
44
+ "Accessibility Results",
45
+ JSON.stringify(accessibilityScanResults, null, 2),
46
+ "application/json",
47
+ );
48
+
49
+ try {
50
+ expect(accessibilityScanResults.violations).toEqual([]);
51
+ } catch (e) {
52
+ e.name = "AssertionError";
53
+ throw e;
54
+ }
55
+ },
56
+ checkAccessibilityOfPageDueToWCAG: async (page, url, element, tags) => {
57
+ if (url) {
58
+ await p.navigateTo(url);
59
+ }
60
+
61
+ if (element) {
62
+ element = await selector(element);
63
+ await page.locator(element).waitFor();
64
+ }
65
+ if (tags) {
66
+ tags = validateWCAGTags(tags);
67
+ }
68
+
69
+ expect(accessibilityScanResults.violations).toEqual([]);
70
+ await allure.attachment(
71
+ "Accessibility Results",
72
+ JSON.stringify(accessibilityScanResults, null, 2),
73
+ "application/json",
74
+ );
75
+
76
+ try {
77
+ expect(accessibilityScanResults.violations).toEqual([]);
78
+ } catch (e) {
79
+ e.name = "AssertionError";
80
+ throw e;
81
+ }
82
+ },
83
+ };
84
+
85
+ module.exports = {
86
+ browser,
87
+ };
@@ -1,60 +1,60 @@
1
- const { element, resolveVariable } = require("../imports/commons");
2
-
3
- const elementInteractions = {
4
- isChecked: async (selector, options) => {
5
- options = options ?? {};
6
-
7
- return await element(selector).isChecked(options);
8
- },
9
- isDisabled: async (selector, options) => {
10
- options = options ?? {};
11
-
12
- return await element(selector, options).isDisabled(options);
13
- },
14
- isEditable: async (selector, options) => {
15
- options = options ?? {};
16
-
17
- return await element(selector).isEditable(options);
18
- },
19
- isEnabled: async (selector, options) => {
20
- options = options ?? {};
21
-
22
- return await element(selector).isEnabled(options);
23
- },
24
- isHidden: async (selector, options) => {
25
- options = options ?? {};
26
-
27
- return await element(selector).isHidden(options);
28
- },
29
- isVisible: async (selector, options) => {
30
- options = options ?? {};
31
-
32
- return await element(selector).isVisible(options);
33
- },
34
- getAttribute: async (selector, attribute, options) => {
35
- options = options ?? {};
36
-
37
- attribute = await resolveVariable(attribute);
38
-
39
- return await element(selector).getAttribute(attribute, options);
40
- },
41
- innerHTML: async (selector, options) => {
42
- options = options ?? {};
43
-
44
- return await element(selector).innerHTML(options);
45
- },
46
- innerText: async (selector, options) => {
47
- options = options ?? {};
48
-
49
- return await element(selector).innerText(options);
50
- },
51
- textContent: async (selector, options) => {
52
- options = options ?? {};
53
-
54
- return await element(selector).textContent(options);
55
- },
56
- };
57
-
58
- module.exports = {
59
- elementInteractions,
60
- };
1
+ const { element, resolveVariable } = require("../imports/commons");
2
+
3
+ const elementInteractions = {
4
+ isChecked: async (selector, options) => {
5
+ options = options ?? {};
6
+
7
+ return await element(selector).isChecked(options);
8
+ },
9
+ isDisabled: async (selector, options) => {
10
+ options = options ?? {};
11
+
12
+ return await element(selector, options).isDisabled(options);
13
+ },
14
+ isEditable: async (selector, options) => {
15
+ options = options ?? {};
16
+
17
+ return await element(selector).isEditable(options);
18
+ },
19
+ isEnabled: async (selector, options) => {
20
+ options = options ?? {};
21
+
22
+ return await element(selector).isEnabled(options);
23
+ },
24
+ isHidden: async (selector, options) => {
25
+ options = options ?? {};
26
+
27
+ return await element(selector).isHidden(options);
28
+ },
29
+ isVisible: async (selector, options) => {
30
+ options = options ?? {};
31
+
32
+ return await element(selector).isVisible(options);
33
+ },
34
+ getAttribute: async (selector, attribute, options) => {
35
+ options = options ?? {};
36
+
37
+ attribute = await resolveVariable(attribute);
38
+
39
+ return await element(selector).getAttribute(attribute, options);
40
+ },
41
+ innerHTML: async (selector, options) => {
42
+ options = options ?? {};
43
+
44
+ return await element(selector).innerHTML(options);
45
+ },
46
+ innerText: async (selector, options) => {
47
+ options = options ?? {};
48
+
49
+ return await element(selector).innerText(options);
50
+ },
51
+ textContent: async (selector, options) => {
52
+ options = options ?? {};
53
+
54
+ return await element(selector).textContent(options);
55
+ },
56
+ };
57
+
58
+ module.exports = {
59
+ elementInteractions,
60
+ };
@@ -1,19 +1,19 @@
1
- const { assert } = require("./assertions");
2
- const { mouse } = require("./mouseActions");
3
- const { keyboard } = require("./keyboardActions");
4
- const { frame } = require("./frameActions");
5
- const { elementInteractions } = require("./elementInteractions");
6
- const { page } = require("./pageActions");
7
- const { api } = require("./APIActions");
8
- const { browser } = require("./browserActions");
9
-
10
- module.exports = {
11
- assert,
12
- mouse,
13
- keyboard,
14
- frame,
15
- elementInteractions,
16
- page,
17
- api,
18
- browser,
19
- };
1
+ const { assert } = require("./assertions");
2
+ const { mouse } = require("./mouseActions");
3
+ const { keyboard } = require("./keyboardActions");
4
+ const { frame } = require("./frameActions");
5
+ const { elementInteractions } = require("./elementInteractions");
6
+ const { page } = require("./pageActions");
7
+ const { api } = require("./APIActions");
8
+ const { browser } = require("./browserActions");
9
+
10
+ module.exports = {
11
+ assert,
12
+ mouse,
13
+ keyboard,
14
+ frame,
15
+ elementInteractions,
16
+ page,
17
+ api,
18
+ browser,
19
+ };
@@ -1,72 +1,72 @@
1
- const { element, moduleConfig } = require("../imports/commons");
2
- const path = require("path");
3
-
4
- const frame = {
5
- screenshot: async (selector, options) => {
6
- options = options ?? {};
7
-
8
- return await element(selector).screenshot({
9
- path: path.join(moduleConfig.projectPath, `${selector}.png`),
10
- });
11
- },
12
- contentFrame: async (selector, options) => {
13
- options = options ?? {};
14
-
15
- return await element(selector, options).contentFrame(options);
16
- },
17
- frameLocator: async (selector, options) => {
18
- options = options ?? {};
19
-
20
- return await element(selector, options).frameLocator(options);
21
- },
22
- nth: async (selector, index) => {
23
- return await element(selector).nth(index - 1);
24
- },
25
- first: async (selector) => {
26
- return await element(selector).first();
27
- },
28
- last: async (selector, options) => {
29
- options = options ?? {};
30
-
31
- return await element(selector).last(options);
32
- },
33
- filter: async (selector, filter, options) => {
34
- options = options ?? {};
35
-
36
- return await element(selector).filter(filter, options);
37
- },
38
- count: async (selector, options) => {
39
- options = options ?? {};
40
-
41
- return await element(selector).count(options);
42
- },
43
- getByAltText: async (text, options) => {
44
- options = options ?? {};
45
-
46
- return await element(text).getByAltText(options);
47
- },
48
- getByLabel: async (label, options) => {
49
- options = options ?? {};
50
-
51
- return await element(label).getByLabel(options);
52
- },
53
- getByPlaceholder: async (placeholder, options) => {
54
- options = options ?? {};
55
-
56
- return await element(placeholder).getByPlaceholder(options);
57
- },
58
- getByRole: async (role, options) => {
59
- options = options ?? {};
60
-
61
- return await element(role).getByRole(options);
62
- },
63
- getByTestId: async (testId, options) => {
64
- options = options ?? {};
65
-
66
- return await element(testId).getByTestId(options);
67
- },
68
- };
69
-
70
- module.exports = {
71
- frame,
72
- };
1
+ const { element, moduleConfig } = require("../imports/commons");
2
+ const path = require("path");
3
+
4
+ const frame = {
5
+ screenshot: async (selector, options) => {
6
+ options = options ?? {};
7
+
8
+ return await element(selector).screenshot({
9
+ path: path.join(moduleConfig.projectPath, `${selector}.png`),
10
+ });
11
+ },
12
+ contentFrame: async (selector, options) => {
13
+ options = options ?? {};
14
+
15
+ return await element(selector, options).contentFrame(options);
16
+ },
17
+ frameLocator: async (selector, options) => {
18
+ options = options ?? {};
19
+
20
+ return await element(selector, options).frameLocator(options);
21
+ },
22
+ nth: async (selector, index) => {
23
+ return await element(selector).nth(index - 1);
24
+ },
25
+ first: async (selector) => {
26
+ return await element(selector).first();
27
+ },
28
+ last: async (selector, options) => {
29
+ options = options ?? {};
30
+
31
+ return await element(selector).last(options);
32
+ },
33
+ filter: async (selector, filter, options) => {
34
+ options = options ?? {};
35
+
36
+ return await element(selector).filter(filter, options);
37
+ },
38
+ count: async (selector, options) => {
39
+ options = options ?? {};
40
+
41
+ return await element(selector).count(options);
42
+ },
43
+ getByAltText: async (text, options) => {
44
+ options = options ?? {};
45
+
46
+ return await element(text).getByAltText(options);
47
+ },
48
+ getByLabel: async (label, options) => {
49
+ options = options ?? {};
50
+
51
+ return await element(label).getByLabel(options);
52
+ },
53
+ getByPlaceholder: async (placeholder, options) => {
54
+ options = options ?? {};
55
+
56
+ return await element(placeholder).getByPlaceholder(options);
57
+ },
58
+ getByRole: async (role, options) => {
59
+ options = options ?? {};
60
+
61
+ return await element(role).getByRole(options);
62
+ },
63
+ getByTestId: async (testId, options) => {
64
+ options = options ?? {};
65
+
66
+ return await element(testId).getByTestId(options);
67
+ },
68
+ };
69
+
70
+ module.exports = {
71
+ frame,
72
+ };
@@ -1,66 +1,66 @@
1
- const { element, resolveVariable } = require("../imports/commons");
2
-
3
- const keyboard = {
4
- press: async (selector, key, options) => {
5
- options = options ?? {};
6
-
7
- key = await resolveVariable(key);
8
-
9
- await element(selector).press(key, options);
10
- },
11
- pressSequentially: async (selector, keys, options) => {
12
- options = options ?? {};
13
-
14
- keys = await resolveVariable(keys);
15
-
16
- await element(selector).pressSequentially(keys, options);
17
- },
18
- fill: async (selector, value, options) => {
19
- options = options ?? {};
20
-
21
- value = await resolveVariable(value);
22
-
23
- value !== "" ? await element(selector).fill(value, options) : "";
24
- },
25
- keyDown: async (selector, key, options) => {
26
- options = options ?? {};
27
-
28
- key = await resolveVariable(key);
29
-
30
- await element(selector).down(key, options);
31
- },
32
- keyUp: async (selector, key, options) => {
33
- options = options ?? {};
34
-
35
- key = await resolveVariable(key);
36
-
37
- await element(selector).up(key, options);
38
- },
39
- insertText: async (selector, text, options) => {
40
- options = options ?? {};
41
-
42
- text = await resolveVariable(text);
43
-
44
- await element(selector).insertText(text, options);
45
- },
46
- clear: async (selector, options) => {
47
- options = options ?? {};
48
-
49
- await element(selector).clear(options);
50
- },
51
- selectText: async (selector, options) => {
52
- options = options ?? {};
53
-
54
- await element(selector).selectText(options);
55
- },
56
- setInputFiles: async (selector, files, options) => {
57
- options = options ?? {};
58
-
59
- files = await resolveVariable(files);
60
- await element(selector).setInputFiles(files, options);
61
- },
62
- };
63
-
64
- module.exports = {
65
- keyboard,
66
- };
1
+ const { element, resolveVariable } = require("../imports/commons");
2
+
3
+ const keyboard = {
4
+ press: async (selector, key, options) => {
5
+ options = options ?? {};
6
+
7
+ key = await resolveVariable(key);
8
+
9
+ await element(selector).press(key, options);
10
+ },
11
+ pressSequentially: async (selector, keys, options) => {
12
+ options = options ?? {};
13
+
14
+ keys = await resolveVariable(keys);
15
+
16
+ await element(selector).pressSequentially(keys, options);
17
+ },
18
+ fill: async (selector, value, options) => {
19
+ options = options ?? {};
20
+
21
+ value = await resolveVariable(value);
22
+
23
+ value !== "" ? await element(selector).fill(value, options) : "";
24
+ },
25
+ keyDown: async (selector, key, options) => {
26
+ options = options ?? {};
27
+
28
+ key = await resolveVariable(key);
29
+
30
+ await element(selector).down(key, options);
31
+ },
32
+ keyUp: async (selector, key, options) => {
33
+ options = options ?? {};
34
+
35
+ key = await resolveVariable(key);
36
+
37
+ await element(selector).up(key, options);
38
+ },
39
+ insertText: async (selector, text, options) => {
40
+ options = options ?? {};
41
+
42
+ text = await resolveVariable(text);
43
+
44
+ await element(selector).insertText(text, options);
45
+ },
46
+ clear: async (selector, options) => {
47
+ options = options ?? {};
48
+
49
+ await element(selector).clear(options);
50
+ },
51
+ selectText: async (selector, options) => {
52
+ options = options ?? {};
53
+
54
+ await element(selector).selectText(options);
55
+ },
56
+ setInputFiles: async (selector, files, options) => {
57
+ options = options ?? {};
58
+
59
+ files = await resolveVariable(files);
60
+ await element(selector).setInputFiles(files, options);
61
+ },
62
+ };
63
+
64
+ module.exports = {
65
+ keyboard,
66
+ };