artes 1.0.33 → 1.0.35

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 CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  ## 🚀 Summary
8
8
 
9
- Artes is a test runner for Playwright that executes [predefined Cucumber tests](./documents/stepDefinitions.md) and can generate Allure reports for test results. It simplifies setting up Playwright with Cucumber in your automation workflow. With Artes, you can easily run tests without writing step definitions, generate reports, and customize your testing environment.
9
+ Artes is a test runner for Playwright that executes [predefined Cucumber tests](./docs/stepDefinitions.md) and can generate Allure reports for test results. It simplifies setting up Playwright with Cucumber in your automation workflow. With Artes, you can easily run tests without writing step definitions, generate reports, and customize your testing environment.
10
10
 
11
11
  ![artes demonstration](https://github.com/user-attachments/assets/c46172f7-103d-45d1-a37d-8d4267df0967)
12
12
 
@@ -240,7 +240,7 @@ const { mouse, keyboard, frame, elementInteractions, page } = require("artes");
240
240
 
241
241
  ---
242
242
 
243
- For a detailed explanation of each function, please refer to the [functionDefinitions.md](./documents/functionDefinitions.md).
243
+ For a detailed explanation of each function, please refer to the [functionDefinitions.md](./docs/functionDefinitions.md).
244
244
 
245
245
  ---
246
246
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.0.33",
3
+ "version": "1.0.35",
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": {
@@ -0,0 +1,21 @@
1
+ const { context, element } = require("../imports/commons");
2
+
3
+ const browser = {
4
+ setCookies: async (cookies) => {
5
+ let cookieData;
6
+
7
+ try {
8
+ cookieData = JSON.parse(cookies);
9
+ } catch {
10
+ cookieData = element(cookies);
11
+ }
12
+
13
+ cookieData = Array.isArray(cookieData) ? cookieData : [cookieData];
14
+
15
+ await context.browser.addCookies(cookieData);
16
+ },
17
+ };
18
+
19
+ module.exports = {
20
+ browser
21
+ };
@@ -5,6 +5,7 @@ const { frame } = require("./frameActions");
5
5
  const { elementInteractions } = require("./elementInteractions");
6
6
  const { page } = require("./pageActions");
7
7
  const { api } = require("./APIActions");
8
+ const { browser } = require("./browserActions");
8
9
 
9
10
  module.exports = {
10
11
  assert,
@@ -14,4 +15,5 @@ module.exports = {
14
15
  elementInteractions,
15
16
  page,
16
17
  api,
18
+ browser,
17
19
  };
@@ -1,5 +1,6 @@
1
1
  const { element } = require("../imports/commons");
2
2
  const { frame } = require("../stepFunctions/frameActions");
3
+
3
4
  const mouse = {
4
5
  click: async (selector) => {
5
6
  await element(selector).click();
@@ -1,5 +1,6 @@
1
1
  class Context {
2
2
  constructor() {
3
+ this.browser = undefined;
3
4
  this.page = undefined;
4
5
  this.request = undefined;
5
6
  }
@@ -11,7 +11,6 @@ const { pomCollector } = require("../helper/pomController/pomCollector");
11
11
  const cucumberConfig = require("../../cucumber.config");
12
12
  const { context } = require("./context");
13
13
  const fs = require("fs");
14
- const { expect } = require("playwright/test");
15
14
  const { moduleConfig } = require("artes/src/helper/imports/commons");
16
15
  const path = require("path");
17
16
 
@@ -28,6 +27,7 @@ Before(async function () {
28
27
  browser = await invokeBrowser();
29
28
  request = await invokeRequest();
30
29
 
30
+ context.browser = await browser;
31
31
  context.page = await browser.newPage();
32
32
  await context.page.setDefaultTimeout(cucumberConfig.default.timeout * 1000);
33
33
  context.request = await request;
@@ -0,0 +1,7 @@
1
+ const { When } = require("../helper/imports/commons");
2
+ const { browser } = require("../helper/stepFunctions/exporter");
3
+
4
+ // User sets cookies in json format
5
+ When("User sets {string} cookies", async function (cookies) {
6
+ await browser.setCookies(cookies);
7
+ });
File without changes
File without changes