artes 1.1.16 → 1.1.18

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
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,18 +13,28 @@ function addElements(newElements) {
13
13
  // }
14
14
 
15
15
  function selectorSeperator(element) {
16
- if(typeof element !== "string") return element;
17
-
16
+ if (typeof element !== "string") return element;
17
+
18
18
  const selector = element?.split("=");
19
- const validTypes = ["xpath", "name", "placeholder", "text", "label", "role", "alt", "title", "testid"];
19
+ const validTypes = [
20
+ "xpath",
21
+ "name",
22
+ "placeholder",
23
+ "text",
24
+ "label",
25
+ "role",
26
+ "alt",
27
+ "title",
28
+ "testid",
29
+ ];
20
30
 
21
31
  if (selector && validTypes.includes(selector[0]?.trim())) {
22
32
  return [
23
33
  selector[0].trim(),
24
34
  selector[1] !== undefined ? selector[1].trim() : "",
25
35
  ];
26
- }else{
27
- return selector.join("=")
36
+ } else {
37
+ return selector.join("=");
28
38
  }
29
39
  }
30
40
 
@@ -48,7 +58,7 @@ function getElement(element) {
48
58
  locator = context.page.locator(`xpath=${selector[1]}`, { exact: true });
49
59
  break;
50
60
  case "name":
51
- locator = context.page.locator(`[name=${selector[1]}]`, {
61
+ locator = context.page.locator(`[name="${selector[1]}"]`, {
52
62
  exact: true,
53
63
  });
54
64
  break;
@@ -86,7 +96,7 @@ function extractVarsFromResponse(responseBody, vars, customVarName) {
86
96
  const keys = path.split(".");
87
97
  let current = obj;
88
98
 
89
- if(typeof obj == 'string') return obj;
99
+ if (typeof obj == "string") return obj;
90
100
 
91
101
  for (const key of keys) {
92
102
  if (current && typeof current === "object" && key in current) {
@@ -243,7 +243,6 @@ const api = {
243
243
 
244
244
  switch (requestDataType) {
245
245
  case "multipart":
246
-
247
246
  const formRequest = processForm(payloadJSON?.body || {});
248
247
 
249
248
  req = await requestMaker(
@@ -38,11 +38,12 @@ Before(async function () {
38
38
 
39
39
  await context.page.setDefaultTimeout(cucumberConfig.default.timeout);
40
40
 
41
- process.env.TRACE && await context.browserContext.tracing.start({
42
- sources: true,
43
- screenshots: true,
44
- snapshots: true,
45
- });
41
+ process.env.TRACE &&
42
+ (await context.browserContext.tracing.start({
43
+ sources: true,
44
+ screenshots: true,
45
+ snapshots: true,
46
+ }));
46
47
  });
47
48
 
48
49
  BeforeStep(async function ({ pickleStep }) {
@@ -93,9 +94,10 @@ After(async function ({ pickle, result }) {
93
94
  "",
94
95
  );
95
96
 
96
- process.env.TRACE && await context.browserContext.tracing.stop({
97
- path: path.join(moduleConfig.projectPath, "./trace.zip"),
98
- });
97
+ process.env.TRACE &&
98
+ (await context.browserContext.tracing.stop({
99
+ path: path.join(moduleConfig.projectPath, "./trace.zip"),
100
+ }));
99
101
 
100
102
  if (context.response) {
101
103
  for (const [key, value] of Object.entries(context.response)) {