artes 1.0.37 → 1.0.39
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.
|
|
3
|
+
"version": "1.0.39",
|
|
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": {
|
|
@@ -3,17 +3,17 @@ const { context, selector } = require("../imports/commons");
|
|
|
3
3
|
const browser = {
|
|
4
4
|
setCookies: async (cookies) => {
|
|
5
5
|
let cookieData;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
try {
|
|
7
|
+
cookieData = JSON.parse(cookies);
|
|
8
|
+
} catch {
|
|
9
|
+
cookieData = selector(cookies);
|
|
10
|
+
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
cookieData = Array.isArray(cookieData) ? cookieData : [cookieData];
|
|
13
|
+
await context.browser.addCookies(cookieData);
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
module.exports = {
|
|
18
|
-
browser
|
|
18
|
+
browser,
|
|
19
19
|
};
|
|
@@ -11,7 +11,7 @@ const keyboard = {
|
|
|
11
11
|
await element(selector).pressSequentially(keys, { delay: delay });
|
|
12
12
|
},
|
|
13
13
|
fill: async (selector, value) => {
|
|
14
|
-
|
|
14
|
+
value !== "" ? await element(selector).fill(value) : "";
|
|
15
15
|
},
|
|
16
16
|
multipleElementFill: async (selectors, value) => {
|
|
17
17
|
const elementCount = await frame.count(selectors);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const { element, context, selector, moduleConfig } = require("../imports/commons");
|
|
2
3
|
const { frame } = require("../stepFunctions/frameActions");
|
|
3
4
|
|
|
4
5
|
const mouse = {
|
|
@@ -125,6 +126,13 @@ const mouse = {
|
|
|
125
126
|
scrollIntoViewIfNeeded: async (selector) => {
|
|
126
127
|
await element(selector).scrollIntoViewIfNeeded();
|
|
127
128
|
},
|
|
129
|
+
upload: async (filePath, fileInput) => {
|
|
130
|
+
const file = selector(filePath)
|
|
131
|
+
const fileChooserPromise = context.page.waitForEvent("filechooser");
|
|
132
|
+
await element(fileInput).click();
|
|
133
|
+
const fileChooser = await fileChooserPromise;
|
|
134
|
+
await fileChooser.setFiles(path.join(moduleConfig.projectPath, file));
|
|
135
|
+
},
|
|
128
136
|
};
|
|
129
137
|
|
|
130
138
|
module.exports = {
|
|
@@ -249,3 +249,8 @@ When("User unchecks multiple {string}", async function (selectors) {
|
|
|
249
249
|
When("User scrolls {string} into view", async function (selector) {
|
|
250
250
|
await mouse.scrollIntoViewIfNeeded(selector);
|
|
251
251
|
});
|
|
252
|
+
|
|
253
|
+
// User uploads file
|
|
254
|
+
When("User uploads {string} file to {string}", async (filePath, fileInput) => {
|
|
255
|
+
await mouse.upload(filePath, fileInput);
|
|
256
|
+
});
|