artes 1.0.13 → 1.0.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/cucumber.config.js +2 -2
- package/index.js +2 -0
- package/package.json +1 -1
- package/src/helper/executers/projectCreator.js +5 -2
- package/src/helper/imports/commons.js +6 -1
- package/src/helper/pomController/elementController.js +7 -0
- package/src/helper/stepFunctions/mouseActions.js +8 -16
- package/src/stepDefinitions/API.steps.js +2 -2
- package/src/stepDefinitions/frameActions.steps.js +2 -2
- package/src/stepDefinitions/keyboardActions.steps.js +2 -2
- package/src/stepDefinitions/mouseActions.steps.js +2 -2
- package/src/stepDefinitions/page.steps.js +2 -2
package/cucumber.config.js
CHANGED
|
@@ -74,8 +74,8 @@ module.exports = {
|
|
|
74
74
|
browser: {
|
|
75
75
|
browserType: artesConfig.browserType || "chrome",
|
|
76
76
|
viewport: {
|
|
77
|
-
width: artesConfig
|
|
78
|
-
height: artesConfig
|
|
77
|
+
width: artesConfig?.width || 1280,
|
|
78
|
+
height: artesConfig?.height || 720,
|
|
79
79
|
},
|
|
80
80
|
headless: artesConfig.headless !== undefined ? artesConfig.headless : true,
|
|
81
81
|
},
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "artes",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
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": {
|
|
@@ -42,7 +42,7 @@ function createProject(createYes) {
|
|
|
42
42
|
// paths: [], // string[] - Paths to feature files
|
|
43
43
|
// steps: "", // string - Step definitions files
|
|
44
44
|
// pomPath: "", // string - Path to POM files
|
|
45
|
-
// timeout : 0,
|
|
45
|
+
// timeout : 0, // number - Test timeout in seconds
|
|
46
46
|
// parallel: 0, // number - Number of parallel workers
|
|
47
47
|
// format: [], // string[] - Formatter names/paths
|
|
48
48
|
// formatOptions: {}, // object - Formatter options
|
|
@@ -50,6 +50,9 @@ function createProject(createYes) {
|
|
|
50
50
|
// tags: "", // string - Tag expression to filter scenarios
|
|
51
51
|
// backtrace: false, // boolean - Show full backtrace for errors
|
|
52
52
|
// dryRun: false, // boolean - Prepare test run without execution
|
|
53
|
+
// browser: "chrome", // "chrome", "firefox", "webkit"
|
|
54
|
+
// width: 1280, // number - Browser width
|
|
55
|
+
// height: 720, // number - Browser height
|
|
53
56
|
// forceExit: false, // boolean - Force process.exit() after tests
|
|
54
57
|
// failFast: false, // boolean - Stop on first test failure
|
|
55
58
|
// import: [], // string[] - Support code paths
|
|
@@ -68,7 +71,7 @@ function createProject(createYes) {
|
|
|
68
71
|
const featureContent = `Feature: Shopping on SauceDemo 🛒
|
|
69
72
|
|
|
70
73
|
Background: Login on SauceDemo
|
|
71
|
-
Given User
|
|
74
|
+
Given User is on home page of SauceDemo
|
|
72
75
|
And User types "standard_user" in "username_input"
|
|
73
76
|
And User types "secret_sauce" in "password_input"
|
|
74
77
|
And User clicks "#login-button"
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
const { expect } = require("playwright/test");
|
|
2
2
|
const { Given, When, Then } = require("@cucumber/cucumber");
|
|
3
|
-
const {
|
|
3
|
+
const {
|
|
4
|
+
getElement,
|
|
5
|
+
getSelector,
|
|
6
|
+
} = require("../pomController/elementController");
|
|
4
7
|
const { context } = require("../../hooks/context");
|
|
5
8
|
|
|
6
9
|
const element = getElement;
|
|
10
|
+
const selector = getSelector;
|
|
7
11
|
const page = context.page;
|
|
8
12
|
const request = context.request;
|
|
9
13
|
|
|
@@ -30,6 +34,7 @@ module.exports = {
|
|
|
30
34
|
When,
|
|
31
35
|
Then,
|
|
32
36
|
element,
|
|
37
|
+
selector,
|
|
33
38
|
page,
|
|
34
39
|
request,
|
|
35
40
|
context,
|
|
@@ -16,9 +16,16 @@ class Elements {
|
|
|
16
16
|
const waitTime = this.elements[element]?.waitTime * 1000 || 0;
|
|
17
17
|
return context.page.locator(selector);
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
static getSelector(element) {
|
|
21
|
+
const selector =
|
|
22
|
+
this.elements?.[element]?.selector || this.elements?.[element] || element;
|
|
23
|
+
return selector;
|
|
24
|
+
}
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
module.exports = {
|
|
22
28
|
getElement: Elements.getElement.bind(Elements),
|
|
23
29
|
addElements: Elements.addElements.bind(Elements),
|
|
30
|
+
getSelector: Elements.getSelector.bind(Elements),
|
|
24
31
|
};
|
|
@@ -7,12 +7,10 @@ const mouse = {
|
|
|
7
7
|
forceClick: async (selector) => {
|
|
8
8
|
await element(selector).click({ force: true });
|
|
9
9
|
},
|
|
10
|
-
clickPosition: async (selector,
|
|
11
|
-
const [x, y] = position.split(",").map(Number);
|
|
10
|
+
clickPosition: async (selector, x, y) => {
|
|
12
11
|
await element(selector).click({ position: { x: x, y: y } });
|
|
13
12
|
},
|
|
14
|
-
forceClickPosition: async (selector,
|
|
15
|
-
const [x, y] = position.split(",").map(Number);
|
|
13
|
+
forceClickPosition: async (selector, x, y) => {
|
|
16
14
|
await element(selector).click({ force: true, position: { x: x, y: y } });
|
|
17
15
|
},
|
|
18
16
|
rightClick: async (selector) => {
|
|
@@ -33,8 +31,7 @@ const mouse = {
|
|
|
33
31
|
forceDoubleClick: async (selector) => {
|
|
34
32
|
await element(selector).dblclick({ force: true });
|
|
35
33
|
},
|
|
36
|
-
forceDoubleClickPosition: async (selector,
|
|
37
|
-
const [x, y] = position.split(",").map(Number);
|
|
34
|
+
forceDoubleClickPosition: async (selector, x, y) => {
|
|
38
35
|
await element(selector).dblclick({ force: true, position: { x: x, y: y } });
|
|
39
36
|
},
|
|
40
37
|
hover: async (selector) => {
|
|
@@ -43,12 +40,10 @@ const mouse = {
|
|
|
43
40
|
forceHover: async (selector) => {
|
|
44
41
|
await element(selector).hover({ force: true });
|
|
45
42
|
},
|
|
46
|
-
hoverPosition: async (selector,
|
|
47
|
-
const [x, y] = position.split(",").map(Number);
|
|
43
|
+
hoverPosition: async (selector, x, y) => {
|
|
48
44
|
await element(selector).hover({ x: x, y: y });
|
|
49
45
|
},
|
|
50
|
-
forceHoverPosition: async (selector,
|
|
51
|
-
const [x, y] = position.split(",").map(Number);
|
|
46
|
+
forceHoverPosition: async (selector, x, y) => {
|
|
52
47
|
await element(selector).hover({ force: true, x: x, y: y });
|
|
53
48
|
},
|
|
54
49
|
focus: async (selector) => {
|
|
@@ -57,12 +52,10 @@ const mouse = {
|
|
|
57
52
|
forceFocus: async (selector) => {
|
|
58
53
|
await element(selector).focus({ force: true });
|
|
59
54
|
},
|
|
60
|
-
focusPosition: async (selector,
|
|
61
|
-
const [x, y] = position.split(",").map(Number);
|
|
55
|
+
focusPosition: async (selector, x, y) => {
|
|
62
56
|
await element(selector).focus({ x: x, y: y });
|
|
63
57
|
},
|
|
64
|
-
forceFocusPosition: async (selector,
|
|
65
|
-
const [x, y] = position.split(",").map(Number);
|
|
58
|
+
forceFocusPosition: async (selector, x, y) => {
|
|
66
59
|
await element(selector).focus({ force: true, x: x, y: y });
|
|
67
60
|
},
|
|
68
61
|
dragAndDrop: async (sourceSelector, targetSelector) => {
|
|
@@ -70,8 +63,7 @@ const mouse = {
|
|
|
70
63
|
const target = await element(targetSelector);
|
|
71
64
|
await source.dragTo(target);
|
|
72
65
|
},
|
|
73
|
-
dragAndDropPosition: async (sourceSelector,
|
|
74
|
-
const [x, y] = position.split(",").map(Number);
|
|
66
|
+
dragAndDropPosition: async (sourceSelector, x, y) => {
|
|
75
67
|
await element(sourceSelector).dragTo({ targetPosition: { x: x, y: y } });
|
|
76
68
|
},
|
|
77
69
|
selectByValue: async (selector, value) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const { When, context } = require("
|
|
2
|
-
const { api, assert } = require("
|
|
1
|
+
const { When, context } = require("../helper/imports/commons");
|
|
2
|
+
const { api, assert } = require("../helper/stepFunctions/exporter");
|
|
3
3
|
|
|
4
4
|
When("User sends GET request to {string}", async function (url) {
|
|
5
5
|
await api.get(url);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const { When } = require("
|
|
2
|
-
const { frame } = require("
|
|
1
|
+
const { When } = require("../helper/imports/commons");
|
|
2
|
+
const { frame } = require("../helper/stepFunctions/exporter");
|
|
3
3
|
|
|
4
4
|
// User takes a screenshot of a specific selector
|
|
5
5
|
When("User takes a screenshot of {string}", async function (selector) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const { When } = require("
|
|
2
|
-
const { keyboard } = require("
|
|
1
|
+
const { When } = require("../helper/imports/commons");
|
|
2
|
+
const { keyboard } = 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) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const { When } = require("
|
|
2
|
-
const { mouse } = require("
|
|
1
|
+
const { When } = require("../helper/imports/commons");
|
|
2
|
+
const { mouse } = require("../helper/stepFunctions/exporter");
|
|
3
3
|
|
|
4
4
|
// User clicks on a selector
|
|
5
5
|
When("User clicks {string}", async function (selector) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const { When, context } = require("
|
|
2
|
-
const { page } = require("
|
|
1
|
+
const { When, context } = require("../helper/imports/commons");
|
|
2
|
+
const { page } = require("../helper/stepFunctions/exporter");
|
|
3
3
|
|
|
4
4
|
When("User navigates to {string} page", async function (url) {
|
|
5
5
|
await page.navigateTo(url);
|