artes 1.0.14 → 1.0.16

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.
@@ -74,9 +74,10 @@ module.exports = {
74
74
  browser: {
75
75
  browserType: artesConfig.browserType || "chrome",
76
76
  viewport: {
77
- width: artesConfig.viewport?.width || 1280,
78
- height: artesConfig.viewport?.height || 720,
77
+ width: artesConfig?.width || 1280,
78
+ height: artesConfig?.height || 720,
79
79
  },
80
+ maximizeScreen: true,
80
81
  headless: artesConfig.headless !== undefined ? artesConfig.headless : true,
81
82
  },
82
83
 
package/index.js CHANGED
@@ -5,6 +5,7 @@ const {
5
5
  Then,
6
6
  context,
7
7
  element,
8
+ selector,
8
9
  page,
9
10
  request,
10
11
  } = require("./src/helper/imports/commons");
@@ -22,6 +23,7 @@ module.exports = {
22
23
  When,
23
24
  Then,
24
25
  element,
26
+ selector,
25
27
  context,
26
28
  page,
27
29
  request,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
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": {
@@ -6,13 +6,14 @@ const invokeBrowser = async () => {
6
6
 
7
7
  const options = {
8
8
  headless: cucumberConfig.browser.headless,
9
+ args:[cucumberConfig.browser.maximizeScreen && '--start-maximized']
9
10
  };
10
11
 
11
12
  const browserType =
12
13
  cucumberConfig.browser.browserType.toLowerCase() || "chrome";
13
14
 
14
15
  const browserContextOptions = {
15
- viewport: cucumberConfig.browser.viewport,
16
+ viewport: cucumberConfig.browser.maximizeScreen ? null : cucumberConfig.browser.viewport,
16
17
  recordVideo: {
17
18
  dir: "./test-results/visualReport/",
18
19
  size: cucumberConfig.viewport,
@@ -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, // number - Test timeout in seconds
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,10 @@ 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
56
+ // maximizeScreen: true, // boolean - Open browser in full screen mode
53
57
  // forceExit: false, // boolean - Force process.exit() after tests
54
58
  // failFast: false, // boolean - Stop on first test failure
55
59
  // import: [], // string[] - Support code paths
@@ -1,9 +1,13 @@
1
1
  const { expect } = require("playwright/test");
2
2
  const { Given, When, Then } = require("@cucumber/cucumber");
3
- const { getElement } = require("../pomController/elementController");
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, position) => {
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, position) => {
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, position) => {
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, position) => {
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, position) => {
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, position) => {
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, position) => {
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, position) => {
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) => {