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.
- package/README.md +668 -668
- package/cucumber.config.js +223 -223
- package/docs/emulationDevicesList.md +152 -152
- package/docs/functionDefinitions.md +2401 -2401
- package/docs/stepDefinitions.md +402 -402
- package/executer.js +479 -479
- package/index.js +50 -50
- package/package.json +52 -52
- package/src/helper/contextManager/browserManager.js +74 -74
- package/src/helper/contextManager/requestManager.js +23 -23
- package/src/helper/controller/elementController.js +203 -185
- package/src/helper/controller/pomCollector.js +82 -82
- package/src/helper/executers/cleaner.js +19 -19
- package/src/helper/executers/exporter.js +15 -15
- package/src/helper/executers/helper.js +110 -110
- package/src/helper/executers/projectCreator.js +206 -206
- package/src/helper/executers/reportGenerator.js +70 -70
- package/src/helper/executers/testRunner.js +28 -28
- package/src/helper/executers/versionChecker.js +31 -31
- package/src/helper/imports/commons.js +57 -57
- package/src/helper/stepFunctions/APIActions.js +495 -495
- package/src/helper/stepFunctions/assertions.js +989 -989
- package/src/helper/stepFunctions/browserActions.js +22 -22
- package/src/helper/stepFunctions/elementInteractions.js +60 -60
- package/src/helper/stepFunctions/exporter.js +19 -19
- package/src/helper/stepFunctions/frameActions.js +72 -72
- package/src/helper/stepFunctions/keyboardActions.js +66 -66
- package/src/helper/stepFunctions/mouseActions.js +83 -83
- package/src/helper/stepFunctions/pageActions.js +43 -43
- package/src/hooks/context.js +15 -15
- package/src/hooks/hooks.js +215 -215
- package/src/stepDefinitions/API.steps.js +310 -310
- package/src/stepDefinitions/assertions.steps.js +1092 -1092
- package/src/stepDefinitions/browser.steps.js +7 -7
- package/src/stepDefinitions/frameActions.steps.js +76 -76
- package/src/stepDefinitions/keyboardActions.steps.js +265 -265
- package/src/stepDefinitions/mouseActions.steps.js +378 -378
- package/src/stepDefinitions/page.steps.js +71 -71
- package/src/stepDefinitions/random.steps.js +188 -188
- package/status-formatter.js +138 -138
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
const { context, selector, resolveVariable } = require("../imports/commons");
|
|
2
|
-
|
|
3
|
-
const browser = {
|
|
4
|
-
setCookies: async (cookies) => {
|
|
5
|
-
cookies = await resolveVariable(cookies);
|
|
6
|
-
|
|
7
|
-
let cookieData;
|
|
8
|
-
try {
|
|
9
|
-
cookieData = JSON.parse(cookies);
|
|
10
|
-
} catch {
|
|
11
|
-
cookieData = selector(cookies);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
cookieData = Array.isArray(cookieData) ? cookieData : [cookieData];
|
|
15
|
-
|
|
16
|
-
await context.browserContext.addCookies(cookieData);
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
module.exports = {
|
|
21
|
-
browser,
|
|
22
|
-
};
|
|
1
|
+
const { context, selector, resolveVariable } = require("../imports/commons");
|
|
2
|
+
|
|
3
|
+
const browser = {
|
|
4
|
+
setCookies: async (cookies) => {
|
|
5
|
+
cookies = await resolveVariable(cookies);
|
|
6
|
+
|
|
7
|
+
let cookieData;
|
|
8
|
+
try {
|
|
9
|
+
cookieData = JSON.parse(cookies);
|
|
10
|
+
} catch {
|
|
11
|
+
cookieData = selector(cookies);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
cookieData = Array.isArray(cookieData) ? cookieData : [cookieData];
|
|
15
|
+
|
|
16
|
+
await context.browserContext.addCookies(cookieData);
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
module.exports = {
|
|
21
|
+
browser,
|
|
22
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
|
-
const {
|
|
3
|
-
element,
|
|
4
|
-
context,
|
|
5
|
-
selector,
|
|
6
|
-
moduleConfig, resolveVariable
|
|
7
|
-
} = require("../imports/commons");
|
|
8
|
-
|
|
9
|
-
const mouse = {
|
|
10
|
-
click: async (selector, options) => {
|
|
11
|
-
options = options ?? {};
|
|
12
|
-
|
|
13
|
-
await element(selector).click(options);
|
|
14
|
-
},
|
|
15
|
-
doubleClick: async (selector, options) => {
|
|
16
|
-
options = options ?? {};
|
|
17
|
-
|
|
18
|
-
await element(selector).dblclick(options);
|
|
19
|
-
},
|
|
20
|
-
hover: async (selector, options) => {
|
|
21
|
-
options = options ?? {};
|
|
22
|
-
|
|
23
|
-
await element(selector).hover(options);
|
|
24
|
-
},
|
|
25
|
-
focus: async (selector, options) => {
|
|
26
|
-
options = options ?? {};
|
|
27
|
-
|
|
28
|
-
await element(selector).focus(options);
|
|
29
|
-
},
|
|
30
|
-
dragAndDrop: async (sourceSelector, targetSelector, options) => {
|
|
31
|
-
options = options ?? {};
|
|
32
|
-
|
|
33
|
-
const source = await element(sourceSelector);
|
|
34
|
-
const target = await element(targetSelector);
|
|
35
|
-
await source.dragTo(target, options);
|
|
36
|
-
},
|
|
37
|
-
selectByValue: async (selector, value, options) => {
|
|
38
|
-
options = options ?? {};
|
|
39
|
-
|
|
40
|
-
value = await resolveVariable(value);
|
|
41
|
-
|
|
42
|
-
value !== "" ? await element(selector).selectOption(value, options) : "";
|
|
43
|
-
},
|
|
44
|
-
selectByText: async (selector, text, options) => {
|
|
45
|
-
options = options ?? {};
|
|
46
|
-
|
|
47
|
-
text = await resolveVariable(text);
|
|
48
|
-
|
|
49
|
-
text !== "" ? await element(selector).selectOption(text, options) : "";
|
|
50
|
-
},
|
|
51
|
-
check: async (selector, options) => {
|
|
52
|
-
options = options ?? {};
|
|
53
|
-
|
|
54
|
-
await element(selector).check(options);
|
|
55
|
-
},
|
|
56
|
-
uncheck: async (selector, options) => {
|
|
57
|
-
options = options ?? {};
|
|
58
|
-
|
|
59
|
-
await element(selector).uncheck(options);
|
|
60
|
-
},
|
|
61
|
-
scrollIntoViewIfNeeded: async (selector, options) => {
|
|
62
|
-
options = options ?? {};
|
|
63
|
-
|
|
64
|
-
await element(selector).scrollIntoViewIfNeeded(options);
|
|
65
|
-
},
|
|
66
|
-
upload: async (filePath, fileInput, options) => {
|
|
67
|
-
options = options ?? {};
|
|
68
|
-
|
|
69
|
-
filePath = await resolveVariable(filePath);
|
|
70
|
-
const file = selector(filePath);
|
|
71
|
-
const fileChooserPromise = context.page.waitForEvent("filechooser");
|
|
72
|
-
await element(fileInput).click();
|
|
73
|
-
const fileChooser = await fileChooserPromise;
|
|
74
|
-
await fileChooser.setFiles(
|
|
75
|
-
path.join(moduleConfig.projectPath, file),
|
|
76
|
-
options,
|
|
77
|
-
);
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
module.exports = {
|
|
82
|
-
mouse,
|
|
83
|
-
};
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const {
|
|
3
|
+
element,
|
|
4
|
+
context,
|
|
5
|
+
selector,
|
|
6
|
+
moduleConfig, resolveVariable
|
|
7
|
+
} = require("../imports/commons");
|
|
8
|
+
|
|
9
|
+
const mouse = {
|
|
10
|
+
click: async (selector, options) => {
|
|
11
|
+
options = options ?? {};
|
|
12
|
+
|
|
13
|
+
await element(selector).click(options);
|
|
14
|
+
},
|
|
15
|
+
doubleClick: async (selector, options) => {
|
|
16
|
+
options = options ?? {};
|
|
17
|
+
|
|
18
|
+
await element(selector).dblclick(options);
|
|
19
|
+
},
|
|
20
|
+
hover: async (selector, options) => {
|
|
21
|
+
options = options ?? {};
|
|
22
|
+
|
|
23
|
+
await element(selector).hover(options);
|
|
24
|
+
},
|
|
25
|
+
focus: async (selector, options) => {
|
|
26
|
+
options = options ?? {};
|
|
27
|
+
|
|
28
|
+
await element(selector).focus(options);
|
|
29
|
+
},
|
|
30
|
+
dragAndDrop: async (sourceSelector, targetSelector, options) => {
|
|
31
|
+
options = options ?? {};
|
|
32
|
+
|
|
33
|
+
const source = await element(sourceSelector);
|
|
34
|
+
const target = await element(targetSelector);
|
|
35
|
+
await source.dragTo(target, options);
|
|
36
|
+
},
|
|
37
|
+
selectByValue: async (selector, value, options) => {
|
|
38
|
+
options = options ?? {};
|
|
39
|
+
|
|
40
|
+
value = await resolveVariable(value);
|
|
41
|
+
|
|
42
|
+
value !== "" ? await element(selector).selectOption(value, options) : "";
|
|
43
|
+
},
|
|
44
|
+
selectByText: async (selector, text, options) => {
|
|
45
|
+
options = options ?? {};
|
|
46
|
+
|
|
47
|
+
text = await resolveVariable(text);
|
|
48
|
+
|
|
49
|
+
text !== "" ? await element(selector).selectOption(text, options) : "";
|
|
50
|
+
},
|
|
51
|
+
check: async (selector, options) => {
|
|
52
|
+
options = options ?? {};
|
|
53
|
+
|
|
54
|
+
await element(selector).check(options);
|
|
55
|
+
},
|
|
56
|
+
uncheck: async (selector, options) => {
|
|
57
|
+
options = options ?? {};
|
|
58
|
+
|
|
59
|
+
await element(selector).uncheck(options);
|
|
60
|
+
},
|
|
61
|
+
scrollIntoViewIfNeeded: async (selector, options) => {
|
|
62
|
+
options = options ?? {};
|
|
63
|
+
|
|
64
|
+
await element(selector).scrollIntoViewIfNeeded(options);
|
|
65
|
+
},
|
|
66
|
+
upload: async (filePath, fileInput, options) => {
|
|
67
|
+
options = options ?? {};
|
|
68
|
+
|
|
69
|
+
filePath = await resolveVariable(filePath);
|
|
70
|
+
const file = selector(filePath);
|
|
71
|
+
const fileChooserPromise = context.page.waitForEvent("filechooser");
|
|
72
|
+
await element(fileInput).click();
|
|
73
|
+
const fileChooser = await fileChooserPromise;
|
|
74
|
+
await fileChooser.setFiles(
|
|
75
|
+
path.join(moduleConfig.projectPath, file),
|
|
76
|
+
options,
|
|
77
|
+
);
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
module.exports = {
|
|
82
|
+
mouse,
|
|
83
|
+
};
|