artes 1.0.32 → 1.0.33
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 +7 -9
- package/package.json +1 -1
- package/src/helper/contextManager/browserManager.js +1 -1
- package/src/helper/pomController/elementController.js +12 -10
- package/src/helper/stepFunctions/frameActions.js +1 -1
- package/src/helper/stepFunctions/mouseActions.js +2 -2
- package/src/stepDefinitions/assertions.steps.js +20 -2
- package/src/stepDefinitions/keyboardActions.steps.js +11 -3
- package/src/stepDefinitions/mouseActions.steps.js +12 -1
package/README.md
CHANGED
|
@@ -10,7 +10,6 @@ Artes is a test runner for Playwright that executes [predefined Cucumber tests](
|
|
|
10
10
|
|
|
11
11
|

|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
## 🧑💻 Installation
|
|
15
14
|
|
|
16
15
|
You can install **Artes** via npm. To install it globally**(RECOMMENDED)**, run the following command:
|
|
@@ -43,14 +42,13 @@ npx artes [options]
|
|
|
43
42
|
|
|
44
43
|
### Options
|
|
45
44
|
|
|
46
|
-
| Option | Description | Usage Example
|
|
47
|
-
|
|
48
|
-
| 🆘 `-h, --help` | Show the usage options | `artes -h` or `artes --help`
|
|
49
|
-
| 🏷️ `-v, --version` | Show the current version of Artes | `artes -v` or `artes --version`
|
|
50
|
-
| 🏗️ `-c, --create` | Create an example project with Artes | `artes -c` or `artes --create`
|
|
51
|
-
| ✅ `-y, --yes` | Skip the confirmation prompt when creating an example project | `artes -c -y` or `artes --create --yes`
|
|
52
|
-
| 📊 `-r, --report` | Run tests and generate Allure report | `artes -r` or `artes --report`
|
|
53
|
-
|
|
45
|
+
| Option | Description | Usage Example |
|
|
46
|
+
| ------------------ | ------------------------------------------------------------- | --------------------------------------- |
|
|
47
|
+
| 🆘 `-h, --help` | Show the usage options | `artes -h` or `artes --help` |
|
|
48
|
+
| 🏷️ `-v, --version` | Show the current version of Artes | `artes -v` or `artes --version` |
|
|
49
|
+
| 🏗️ `-c, --create` | Create an example project with Artes | `artes -c` or `artes --create` |
|
|
50
|
+
| ✅ `-y, --yes` | Skip the confirmation prompt when creating an example project | `artes -c -y` or `artes --create --yes` |
|
|
51
|
+
| 📊 `-r, --report` | Run tests and generate Allure report | `artes -r` or `artes --report` |
|
|
54
52
|
|
|
55
53
|
\*\* To just run the tests: <br>
|
|
56
54
|
Globally: artes <br>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "artes",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.33",
|
|
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": {
|
|
@@ -43,34 +43,36 @@ class Elements {
|
|
|
43
43
|
let locator;
|
|
44
44
|
switch (selector[0]) {
|
|
45
45
|
case "xpath":
|
|
46
|
-
locator = context.page.locator(`xpath=${selector[1]}
|
|
46
|
+
locator = context.page.locator(`xpath=${selector[1]}`, { exact: true });
|
|
47
47
|
break;
|
|
48
48
|
case "name":
|
|
49
|
-
locator = context.page.locator(`[name=${selector[1]}]
|
|
49
|
+
locator = context.page.locator(`[name=${selector[1]}]`, {
|
|
50
|
+
exact: true,
|
|
51
|
+
});
|
|
50
52
|
break;
|
|
51
53
|
case "placeholder":
|
|
52
|
-
locator = context.page.getByPlaceholder(selector[1]);
|
|
54
|
+
locator = context.page.getByPlaceholder(selector[1], { exact: true });
|
|
53
55
|
break;
|
|
54
56
|
case "text":
|
|
55
|
-
locator = context.page.getByText(selector[1]);
|
|
57
|
+
locator = context.page.getByText(selector[1], { exact: true });
|
|
56
58
|
break;
|
|
57
59
|
case "label":
|
|
58
|
-
locator = context.page.getByLabel(selector[1]);
|
|
60
|
+
locator = context.page.getByLabel(selector[1], { exact: true });
|
|
59
61
|
break;
|
|
60
62
|
case "role":
|
|
61
|
-
locator = context.page.getByRole(selector[1]);
|
|
63
|
+
locator = context.page.getByRole(selector[1], { exact: true });
|
|
62
64
|
break;
|
|
63
65
|
case "alt":
|
|
64
|
-
locator = context.page.getByAltText(selector[1]);
|
|
66
|
+
locator = context.page.getByAltText(selector[1], { exact: true });
|
|
65
67
|
break;
|
|
66
68
|
case "title":
|
|
67
|
-
locator = context.page.getByTitle(selector[1]);
|
|
69
|
+
locator = context.page.getByTitle(selector[1], { exact: true });
|
|
68
70
|
break;
|
|
69
71
|
case "testid":
|
|
70
|
-
locator = context.page.getByTestId(selector[1]);
|
|
72
|
+
locator = context.page.getByTestId(selector[1], { exact: true });
|
|
71
73
|
break;
|
|
72
74
|
default:
|
|
73
|
-
locator = context.page.locator(selector[0]);
|
|
75
|
+
locator = context.page.locator(selector[0], { exact: true });
|
|
74
76
|
break;
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -14,7 +14,7 @@ const frame = {
|
|
|
14
14
|
return await element(selector).frameLocator();
|
|
15
15
|
},
|
|
16
16
|
nth: async (selector, index) => {
|
|
17
|
-
return await element(selector).nth(index);
|
|
17
|
+
return await element(selector).nth(index - 1);
|
|
18
18
|
},
|
|
19
19
|
first: async (selector) => {
|
|
20
20
|
return await element(selector).first();
|
|
@@ -96,10 +96,10 @@ const mouse = {
|
|
|
96
96
|
},
|
|
97
97
|
selectByValue: async (selector, value) => {
|
|
98
98
|
const valueArray = value.split(",");
|
|
99
|
-
await element(selector).selectOption(valueArray);
|
|
99
|
+
value !== "" ? await element(selector).selectOption(valueArray) : "";
|
|
100
100
|
},
|
|
101
101
|
selectByText: async (selector, value) => {
|
|
102
|
-
await element(selector).selectOption(value);
|
|
102
|
+
value !== "" ? await element(selector).selectOption(value) : "";
|
|
103
103
|
},
|
|
104
104
|
check: async (selector) => {
|
|
105
105
|
await element(selector).check();
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
const {
|
|
2
|
-
|
|
1
|
+
const {
|
|
2
|
+
Then,
|
|
3
|
+
selector,
|
|
4
|
+
expect,
|
|
5
|
+
element,
|
|
6
|
+
} = require("../helper/imports/commons");
|
|
7
|
+
const { assert, frame } = require("../helper/stepFunctions/exporter");
|
|
3
8
|
|
|
4
9
|
// Check if a selector should be attached
|
|
5
10
|
Then("User expects {string} should be attached", async function (selector) {
|
|
@@ -62,6 +67,14 @@ Then(
|
|
|
62
67
|
},
|
|
63
68
|
);
|
|
64
69
|
|
|
70
|
+
Then(
|
|
71
|
+
"User expects default value of {string} should have {string} text",
|
|
72
|
+
async (selector, text) => {
|
|
73
|
+
const defaultValue = await element(selector).inputValue();
|
|
74
|
+
await expect(defaultValue).toContain(text);
|
|
75
|
+
},
|
|
76
|
+
);
|
|
77
|
+
|
|
65
78
|
Then(
|
|
66
79
|
"User expects multiple {string} should have {string} text",
|
|
67
80
|
async (elements, expectedText) => {
|
|
@@ -795,3 +808,8 @@ Then(
|
|
|
795
808
|
await assert.shouldNotStringMatching(selector, new RegExp(regex));
|
|
796
809
|
},
|
|
797
810
|
);
|
|
811
|
+
|
|
812
|
+
Then("User expects should have {int} {string}", async (count, elements) => {
|
|
813
|
+
const elementCount = await frame.count(elements);
|
|
814
|
+
expect(elementCount).toEqual(count);
|
|
815
|
+
});
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
const { When } = require("../helper/imports/commons");
|
|
2
|
-
const { keyboard } = require("../helper/stepFunctions/exporter");
|
|
2
|
+
const { keyboard, frame } = require("../helper/stepFunctions/exporter");
|
|
3
3
|
|
|
4
4
|
// User presses a key on a specific selector
|
|
5
5
|
When("User presses {string} on {string}", async function (key, selector) {
|
|
6
6
|
await keyboard.press(selector, key);
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
+
When(
|
|
10
|
+
"User types {string} in {int} th of {string}",
|
|
11
|
+
async (text, order, elements) => {
|
|
12
|
+
const nthElement = await frame.nth(elements, order);
|
|
13
|
+
await nthElement.fill(text);
|
|
14
|
+
},
|
|
15
|
+
);
|
|
16
|
+
|
|
9
17
|
// User presses keys sequentially on a specific selector
|
|
10
18
|
When(
|
|
11
19
|
"User presses keys {string} sequentially on {string}",
|
|
@@ -40,8 +48,8 @@ When("User clears {string}", async function (selector) {
|
|
|
40
48
|
});
|
|
41
49
|
|
|
42
50
|
// User selects text in a specific selector
|
|
43
|
-
When("User selects
|
|
44
|
-
await keyboard.selectText(
|
|
51
|
+
When("User selects {string} text", async function (text) {
|
|
52
|
+
await keyboard.selectText(text);
|
|
45
53
|
});
|
|
46
54
|
|
|
47
55
|
// User sets input files for a specific selector
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
const { When } = require("../helper/imports/commons");
|
|
2
|
-
const { mouse } = require("../helper/stepFunctions/exporter");
|
|
2
|
+
const { mouse, frame } = require("../helper/stepFunctions/exporter");
|
|
3
3
|
|
|
4
4
|
// User clicks on a selector
|
|
5
5
|
When("User clicks {string}", async function (selector) {
|
|
6
6
|
await mouse.click(selector);
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
+
When("User clicks last of {string}", async (selector) => {
|
|
10
|
+
const elementCount = await frame.count(selector);
|
|
11
|
+
const lastElement = await frame.nth(selector, elementCount);
|
|
12
|
+
await mouse.click(lastElement);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
When("User clicks {int} th of {string}", async (order, elements) => {
|
|
16
|
+
const nthElement = await frame.nth(elements, order);
|
|
17
|
+
await nthElement.click();
|
|
18
|
+
});
|
|
19
|
+
|
|
9
20
|
When("User clicks multiple {string}", async (elements) => {
|
|
10
21
|
await mouse.multipleElementClick(elements);
|
|
11
22
|
});
|