artes 1.7.14 → 1.7.15
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
|
@@ -93,6 +93,10 @@ function getElement(element) {
|
|
|
93
93
|
return locator;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
function normalizeCrossplatformPath(inputPath) {
|
|
97
|
+
return path.normalize(inputPath.replace(/\\/g, "/"));
|
|
98
|
+
}
|
|
99
|
+
|
|
96
100
|
function pathToCamelCase(path) {
|
|
97
101
|
const cleaned = path.replace(/\[(\d+)\]/g, "_$1");
|
|
98
102
|
const parts = cleaned.split(".");
|
|
@@ -219,6 +223,7 @@ module.exports = {
|
|
|
219
223
|
getSelector,
|
|
220
224
|
extractVarsFromResponse,
|
|
221
225
|
pathToCamelCase,
|
|
226
|
+
normalizeCrossplatformPath,
|
|
222
227
|
saveVar,
|
|
223
228
|
resolveVariable,
|
|
224
229
|
};
|
|
@@ -7,6 +7,7 @@ const {
|
|
|
7
7
|
pathToCamelCase,
|
|
8
8
|
saveVar,
|
|
9
9
|
resolveVariable,
|
|
10
|
+
normalizeCrossplatformPath
|
|
10
11
|
} = require("../controller/elementController");
|
|
11
12
|
const { context } = require("../../hooks/context");
|
|
12
13
|
|
|
@@ -56,6 +57,7 @@ module.exports = {
|
|
|
56
57
|
selector,
|
|
57
58
|
extractVarsFromResponse,
|
|
58
59
|
pathToCamelCase,
|
|
60
|
+
normalizeCrossplatformPath,
|
|
59
61
|
saveVar,
|
|
60
62
|
resolveVariable,
|
|
61
63
|
random,
|
|
@@ -5,6 +5,7 @@ const {
|
|
|
5
5
|
selector,
|
|
6
6
|
resolveVariable,
|
|
7
7
|
moduleConfig,
|
|
8
|
+
normalizeCrossplatformPath
|
|
8
9
|
} = require("../imports/commons");
|
|
9
10
|
|
|
10
11
|
function getMimeType(filePath) {
|
|
@@ -112,7 +113,7 @@ function processForm(requestBody) {
|
|
|
112
113
|
|
|
113
114
|
if (typeof value === "string") {
|
|
114
115
|
|
|
115
|
-
const normalizedValue =
|
|
116
|
+
const normalizedValue = normalizeCrossplatformPath(value);
|
|
116
117
|
|
|
117
118
|
const looksLikeFilePath =
|
|
118
119
|
normalizedValue.endsWith(".pdf") ||
|
|
@@ -122,7 +123,7 @@ function processForm(requestBody) {
|
|
|
122
123
|
normalizedValue.endsWith(".txt") ||
|
|
123
124
|
normalizedValue.endsWith(".doc") ||
|
|
124
125
|
normalizedValue.endsWith(".docx") ||
|
|
125
|
-
normalizedValue.includes(
|
|
126
|
+
normalizedValue.includes("/");
|
|
126
127
|
|
|
127
128
|
if (looksLikeFilePath) {
|
|
128
129
|
try {
|
|
@@ -7,6 +7,7 @@ const {
|
|
|
7
7
|
random,
|
|
8
8
|
moduleConfig,
|
|
9
9
|
resolveVariable,
|
|
10
|
+
normalizeCrossplatformPath
|
|
10
11
|
} = require("../helper/imports/commons");
|
|
11
12
|
const { api } = require("../helper/stepFunctions/exporter");
|
|
12
13
|
const path = require("path");
|
|
@@ -389,14 +390,13 @@ When(
|
|
|
389
390
|
async (file, variable) => {
|
|
390
391
|
file = await resolveVariable(file);
|
|
391
392
|
|
|
392
|
-
const normalizedFile =
|
|
393
|
+
const normalizedFile = normalizeCrossplatformPath(file);
|
|
393
394
|
|
|
394
395
|
const filePath = path.isAbsolute(normalizedFile)
|
|
395
396
|
? normalizedFile
|
|
396
397
|
: path.join(moduleConfig.projectPath, normalizedFile);
|
|
397
398
|
|
|
398
399
|
const fileData = fs.readFileSync(filePath);
|
|
399
|
-
|
|
400
|
-
context.vars[variable] = base64Data;
|
|
400
|
+
context.vars[variable] = fileData.toString("base64");
|
|
401
401
|
},
|
|
402
402
|
);
|