artes 1.1.1 → 1.1.3
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.
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Node.js Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
outputs:
|
|
11
|
+
node-modules-cache: ${{ steps.cache-node-modules.outputs.cache-hit }}
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: actions/setup-node@v4
|
|
15
|
+
with:
|
|
16
|
+
node-version: 20
|
|
17
|
+
- run: npm ci
|
|
18
|
+
- run: npm test
|
|
19
|
+
|
|
20
|
+
publish-npm:
|
|
21
|
+
needs: build
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
- uses: actions/setup-node@v4
|
|
26
|
+
with:
|
|
27
|
+
node-version: 20
|
|
28
|
+
registry-url: https://registry.npmjs.org/
|
|
29
|
+
- run: npm ci
|
|
30
|
+
- run: npm publish
|
|
31
|
+
env:
|
|
32
|
+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "artes",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,15 +13,9 @@
|
|
|
13
13
|
"bin": {
|
|
14
14
|
"artes": "./executer.js"
|
|
15
15
|
},
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"playwright",
|
|
20
|
-
"cucumber",
|
|
21
|
-
"test automation",
|
|
22
|
-
"end-to-end",
|
|
23
|
-
"API testing"
|
|
24
|
-
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"registry": "https://registry.npmjs.org/"
|
|
18
|
+
},
|
|
25
19
|
"author": "VhdAghyv",
|
|
26
20
|
"license": "ISC",
|
|
27
21
|
"dependencies": {
|
|
@@ -47,5 +41,14 @@
|
|
|
47
41
|
"bugs": {
|
|
48
42
|
"url": "https://github.com/4gayev1/Artes/issues"
|
|
49
43
|
},
|
|
50
|
-
"homepage": "https://github.com/4gayev1/Artes/blob/main/README.md"
|
|
44
|
+
"homepage": "https://github.com/4gayev1/Artes/blob/main/README.md",
|
|
45
|
+
"keywords": [
|
|
46
|
+
"kdt",
|
|
47
|
+
"automation",
|
|
48
|
+
"playwright",
|
|
49
|
+
"cucumber",
|
|
50
|
+
"test automation",
|
|
51
|
+
"end-to-end",
|
|
52
|
+
"API testing"
|
|
53
|
+
]
|
|
51
54
|
}
|
|
@@ -128,7 +128,13 @@ class Elements {
|
|
|
128
128
|
static resolveVariable(template) {
|
|
129
129
|
if (typeof template !== "string") return template;
|
|
130
130
|
return template.replace(/{{\s*(\w+)\s*}}/g, (_, varName) => {
|
|
131
|
-
|
|
131
|
+
let value = context.vars[varName];
|
|
132
|
+
if (typeof value === "string") {
|
|
133
|
+
value = value
|
|
134
|
+
.replace(/\n/g, "\\n")
|
|
135
|
+
.replace(/\r/g, "\\r")
|
|
136
|
+
.replace(/\t/g, "\\t");
|
|
137
|
+
}
|
|
132
138
|
return value !== undefined ? value : `{{${varName}}}`;
|
|
133
139
|
});
|
|
134
140
|
}
|
|
@@ -293,7 +293,9 @@ const api = {
|
|
|
293
293
|
const resolvedPayload = (await payload) && resolveVariable(payload);
|
|
294
294
|
const payloadJSON = (await resolvedPayload) && JSON.parse(resolvedPayload);
|
|
295
295
|
|
|
296
|
-
const req = await requestMaker(
|
|
296
|
+
const req = await requestMaker(
|
|
297
|
+
payloadJSON?.headers || {},
|
|
298
|
+
payloadJSON?.body || {});
|
|
297
299
|
|
|
298
300
|
const requestStarts = performance.now();
|
|
299
301
|
|
package/src/hooks/hooks.js
CHANGED
|
@@ -145,7 +145,7 @@ AfterAll(async function () {
|
|
|
145
145
|
const successRate =
|
|
146
146
|
successPercentage.toFixed(2) >= cucumberConfig.default.testPercentage;
|
|
147
147
|
|
|
148
|
-
if (!isNaN(successPercentage)) {
|
|
148
|
+
if (cucumberConfig.default.testPercentage !=0 && !isNaN(successPercentage)) {
|
|
149
149
|
if (successRate) {
|
|
150
150
|
console.log(
|
|
151
151
|
`Tests passed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}% !`,
|
|
@@ -1,8 +1,33 @@
|
|
|
1
1
|
const { Given, context, random } = require("../helper/imports/commons");
|
|
2
2
|
const { api } = require("../helper/stepFunctions/exporter");
|
|
3
3
|
|
|
4
|
+
Given("User sets random word as {string} variable", async (key) => {
|
|
5
|
+
const word = random.lorem.word();
|
|
6
|
+
context.vars[key] = word;
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
Given("User sets random word that has {int} character as {string} variable", async (key, count) => {
|
|
10
|
+
const word = random.lorem.word(count);
|
|
11
|
+
context.vars[key] = word;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
Given("User sets random word that has character between {int} and {int} as {string} variable", async (key, from, to) => {
|
|
15
|
+
const word = random.lorem.word({length: { min: from, max: to }});
|
|
16
|
+
context.vars[key] = word;
|
|
17
|
+
});
|
|
18
|
+
|
|
4
19
|
Given("User sets random words as {string} variable", async (key) => {
|
|
5
|
-
const words = random.lorem.words(
|
|
20
|
+
const words = random.lorem.words();
|
|
21
|
+
context.vars[key] = words;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
Given("User sets random {int} words as {string} variable", async (key, count) => {
|
|
25
|
+
const words = random.lorem.words({ wordCount: count });
|
|
26
|
+
context.vars[key] = words;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
Given("User sets random words that range between {int} and {int} as {string} variable", async (key,from,to) => {
|
|
30
|
+
const words = random.lorem.words({ min: from, max: to });
|
|
6
31
|
context.vars[key] = words;
|
|
7
32
|
});
|
|
8
33
|
|