@bigbinary/neeto-playwright-commons 4.1.12 → 4.1.14
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 +20 -26
- package/index.d.ts +2 -2
- package/index.js +38 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# neeto-playwright-commons
|
|
2
2
|
|
|
3
|
-
A library that packages common boilerplate Playwright code necessary for all
|
|
4
|
-
neeto products.
|
|
3
|
+
A library that packages common boilerplate Playwright code necessary for all neeto products.
|
|
5
4
|
|
|
6
5
|
## Installing neeto-playwright-commons in a Playwright Project
|
|
7
6
|
|
|
@@ -13,21 +12,20 @@ Then, install the package using Yarn:
|
|
|
13
12
|
```bash
|
|
14
13
|
yarn add "@bigbinary/neeto-playwright-commons@latest"
|
|
15
14
|
```
|
|
16
|
-
If `neeto-playwright-commons` is already listed in `package.json` of Playwright project, simply install dependencies
|
|
15
|
+
If `neeto-playwright-commons` is already listed in `package.json` of Playwright project, simply install dependencies
|
|
16
|
+
with:
|
|
17
17
|
```bash
|
|
18
18
|
yarn install
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## Dependencies
|
|
22
22
|
|
|
23
|
-
**neeto-playwright-commons** has some peer dependencies which can be installed
|
|
24
|
-
using the commands listed below:
|
|
23
|
+
**neeto-playwright-commons** has some peer dependencies which can be installed using the commands listed below:
|
|
25
24
|
|
|
26
25
|
### `neeto-cist`
|
|
27
26
|
|
|
28
|
-
A collection of common utility functions used across all our
|
|
29
|
-
[
|
|
30
|
-
[neetoCommons REPL](https://neeto-cist.neeto.com/).
|
|
27
|
+
A collection of common utility functions used across all our [neeto](https://www.neeto.com/) products. Try out the
|
|
28
|
+
utility functions live at [neetoCommons REPL](https://neeto-cist.neeto.com/).
|
|
31
29
|
|
|
32
30
|
```
|
|
33
31
|
yarn add @bigbinary/neeto-cist
|
|
@@ -57,8 +55,8 @@ yarn add nano-staged
|
|
|
57
55
|
|
|
58
56
|
### `dotenv-webpack`
|
|
59
57
|
|
|
60
|
-
`dotenv-webpack` is a secure webpack plugin that supports
|
|
61
|
-
|
|
58
|
+
`dotenv-webpack` is a secure webpack plugin that supports [dotenv](https://www.npmjs.com/package/dotenv) and other
|
|
59
|
+
environment variables.
|
|
62
60
|
|
|
63
61
|
```
|
|
64
62
|
yarn add dotenv-webpack
|
|
@@ -66,8 +64,7 @@ yarn add dotenv-webpack
|
|
|
66
64
|
|
|
67
65
|
### `dayjs`
|
|
68
66
|
|
|
69
|
-
Dayjs is a JavaScript library that parses, validates, manipulates, and displays
|
|
70
|
-
dates and times.
|
|
67
|
+
Dayjs is a JavaScript library that parses, validates, manipulates, and displays dates and times.
|
|
71
68
|
|
|
72
69
|
```
|
|
73
70
|
yarn add dayjs
|
|
@@ -75,8 +72,8 @@ yarn add dayjs
|
|
|
75
72
|
|
|
76
73
|
### `ramda`
|
|
77
74
|
|
|
78
|
-
Ramda is a JavaScript library that facilitates functional programming in
|
|
79
|
-
|
|
75
|
+
Ramda is a JavaScript library that facilitates functional programming in JavaScript. It provides a collection of utility
|
|
76
|
+
functions that operate on data.
|
|
80
77
|
|
|
81
78
|
```
|
|
82
79
|
yarn add ramda
|
|
@@ -84,8 +81,7 @@ yarn add ramda
|
|
|
84
81
|
|
|
85
82
|
### `playwright-i18next-fixture`
|
|
86
83
|
|
|
87
|
-
Use your `i18next` translations in Playwright to create multi-language
|
|
88
|
-
selectors.
|
|
84
|
+
Use your `i18next` translations in Playwright to create multi-language selectors.
|
|
89
85
|
|
|
90
86
|
```
|
|
91
87
|
yarn add playwright-i18next-fixture
|
|
@@ -102,29 +98,27 @@ yarn add @bigbinary/neeto-cist @faker-js/faker @playwright/test nano-staged dote
|
|
|
102
98
|
### Methods
|
|
103
99
|
|
|
104
100
|
## MailerUtils
|
|
105
|
-
Note: ENV variables `NEETO_AUTOMATION_FASTMAIL_API_KEY` and
|
|
106
|
-
|
|
101
|
+
Note: ENV variables `NEETO_AUTOMATION_FASTMAIL_API_KEY` and `FASTMAIL_DOMAIN_NAME` are required for this methods to
|
|
102
|
+
work.
|
|
107
103
|
## Slack integration methods
|
|
108
104
|
|
|
109
|
-
Note: Either ENV variables `SLACK_WORKSPACE`, `SLACK_LOGIN_PASSWORD` and
|
|
110
|
-
|
|
111
|
-
`workspace`, `loginPassword` and `loginEmail` must be passed.
|
|
105
|
+
Note: Either ENV variables `SLACK_WORKSPACE`, `SLACK_LOGIN_PASSWORD` and `SLACK_LOGIN_EMAIL` is required for this method
|
|
106
|
+
to work or custom credentials `workspace`, `loginPassword` and `loginEmail` must be passed.
|
|
112
107
|
|
|
113
108
|
## Zapier integration methods
|
|
114
109
|
|
|
115
|
-
Note: ENV variables `NEETO_AUTOMATION_FASTMAIL_API_KEY`, `FASTMAIL_DOMAIN_NAME`, `ZAPIER_LOGIN_EMAIL`,
|
|
110
|
+
Note: ENV variables `NEETO_AUTOMATION_FASTMAIL_API_KEY`, `FASTMAIL_DOMAIN_NAME`, `ZAPIER_LOGIN_EMAIL`,
|
|
111
|
+
`ZAPIER_LOGIN_PASSWORD`, and `ZAP_ID` are required for this methods to work.
|
|
116
112
|
|
|
117
113
|
## Usage
|
|
118
114
|
|
|
119
|
-
You can import the utility functions and constants from the
|
|
120
|
-
`@bigbinary/neeto-playwright-commons` wherever required.
|
|
115
|
+
You can import the utility functions and constants from the `@bigbinary/neeto-playwright-commons` wherever required.
|
|
121
116
|
|
|
122
117
|
```js
|
|
123
118
|
import { COMMON_SELECTORS } from "@bigbinary/neeto-playwright-common";
|
|
124
119
|
```
|
|
125
120
|
|
|
126
|
-
This package is published as ESM-only. Use `import` syntax and avoid
|
|
127
|
-
CommonJS `require()` for package consumption.
|
|
121
|
+
This package is published as ESM-only. Use `import` syntax and avoid CommonJS `require()` for package consumption.
|
|
128
122
|
|
|
129
123
|
## Exported Functions
|
|
130
124
|
|
package/index.d.ts
CHANGED
|
@@ -5076,11 +5076,11 @@ interface VerifyAuditLogProps<T extends ActionDataKey> {
|
|
|
5076
5076
|
declare class AuditLogsPage {
|
|
5077
5077
|
private page;
|
|
5078
5078
|
private neetoPlaywrightUtilities;
|
|
5079
|
-
private product;
|
|
5080
5079
|
private readonly currentDate;
|
|
5081
5080
|
messageBuilders: MessageBuilders;
|
|
5082
5081
|
private admin;
|
|
5083
|
-
constructor(page: Page, neetoPlaywrightUtilities: CustomCommands, product
|
|
5082
|
+
constructor(page: Page, neetoPlaywrightUtilities: CustomCommands, /** @deprecated Audit log messages no longer include the product name. */
|
|
5083
|
+
product?: NeetoProducts);
|
|
5084
5084
|
/**
|
|
5085
5085
|
*
|
|
5086
5086
|
* Verifies an audit log entry by building the expected message based on the action type and data, then checking that the audit log content matches the expected message and current date.
|
package/index.js
CHANGED
|
@@ -116561,6 +116561,11 @@ class ColorPickerUtils {
|
|
|
116561
116561
|
}
|
|
116562
116562
|
|
|
116563
116563
|
const STATIC_ASSET_PATTERN = /\.(js|css|woff2?|ttf|eot|png|svg|ico|gif|webp)(\?.*)?$/;
|
|
116564
|
+
const EXCLUDED_RESPONSE_HEADERS = [
|
|
116565
|
+
"content-encoding",
|
|
116566
|
+
"content-length",
|
|
116567
|
+
"transfer-encoding",
|
|
116568
|
+
];
|
|
116564
116569
|
const assetCache = new Map();
|
|
116565
116570
|
const commands = {
|
|
116566
116571
|
context: async ({ context }, use) => {
|
|
@@ -116571,14 +116576,26 @@ const commands = {
|
|
|
116571
116576
|
if (hit)
|
|
116572
116577
|
return route.fulfill(hit);
|
|
116573
116578
|
try {
|
|
116574
|
-
|
|
116575
|
-
|
|
116576
|
-
|
|
116577
|
-
|
|
116578
|
-
|
|
116579
|
-
|
|
116580
|
-
|
|
116581
|
-
|
|
116579
|
+
// Use Node's native fetch instead of route.fetch() to keep these
|
|
116580
|
+
// requests out of the Playwright trace's Actions tab. Forward the
|
|
116581
|
+
// browser's request headers so cookie/session-scoped assets still
|
|
116582
|
+
// resolve; drop accept-encoding so we only get encodings Node can
|
|
116583
|
+
// decode, and HTTP/2 pseudo-headers which fetch rejects.
|
|
116584
|
+
const requestHeaders = Object.entries(await route.request().allHeaders()).filter(([name]) => name !== "accept-encoding" && !name.startsWith(":"));
|
|
116585
|
+
const response = await fetch(url, {
|
|
116586
|
+
headers: Object.fromEntries(requestHeaders),
|
|
116587
|
+
});
|
|
116588
|
+
const body = Buffer.from(await response.arrayBuffer());
|
|
116589
|
+
// Node's fetch decompresses the body but keeps the original
|
|
116590
|
+
// content-encoding/content-length headers; drop them so the
|
|
116591
|
+
// browser doesn't try to decode the already-decoded body.
|
|
116592
|
+
const headers = {};
|
|
116593
|
+
response.headers.forEach((value, key) => {
|
|
116594
|
+
if (!EXCLUDED_RESPONSE_HEADERS.includes(key))
|
|
116595
|
+
headers[key] = value;
|
|
116596
|
+
});
|
|
116597
|
+
const entry = { body, status: response.status, headers };
|
|
116598
|
+
if (response.ok)
|
|
116582
116599
|
assetCache.set(url, entry);
|
|
116583
116600
|
return route.fulfill(entry);
|
|
116584
116601
|
}
|
|
@@ -120868,25 +120885,26 @@ dayjs.extend(timezone);
|
|
|
120868
120885
|
class AuditLogsPage {
|
|
120869
120886
|
page;
|
|
120870
120887
|
neetoPlaywrightUtilities;
|
|
120871
|
-
product;
|
|
120872
120888
|
currentDate;
|
|
120873
120889
|
messageBuilders;
|
|
120874
120890
|
admin;
|
|
120875
|
-
constructor(page, neetoPlaywrightUtilities,
|
|
120891
|
+
constructor(page, neetoPlaywrightUtilities,
|
|
120892
|
+
/** @deprecated Audit log messages no longer include the product name. */
|
|
120893
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
120894
|
+
product) {
|
|
120876
120895
|
this.page = page;
|
|
120877
120896
|
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
120878
|
-
this.product = product;
|
|
120879
120897
|
this.currentDate = dayjs().tz("Asia/Kolkata").format("MMM D, YYYY");
|
|
120880
120898
|
this.messageBuilders = {
|
|
120881
|
-
[ACTIONS.inviteUsers]: (data) => `${this.admin} added ${data.emails.join(", ").toLowerCase()}
|
|
120882
|
-
[ACTIONS.updatedUser]: (data) => `${this.admin} changed ${data.emails[0].toLowerCase()}'s email from ${data.emails[0].toLowerCase()} to ${data.emails[1].toLowerCase()}
|
|
120883
|
-
[ACTIONS.removedUser]: (data) => `${this.admin} removed ${data.emails[0].toLowerCase()}
|
|
120884
|
-
[ACTIONS.createdRole]: (data) => `${this.admin} created ${data.roleName} role
|
|
120885
|
-
[ACTIONS.addedPermission]: (data) => `${this.admin} added ${data.permissions.join(", ").toLowerCase()} permission to ${data.roleName} role
|
|
120886
|
-
[ACTIONS.removedPermission]: (data) => `${this.admin} removed ${data.permissions.join(", ")} permissions from ${data.roleName} role
|
|
120887
|
-
[ACTIONS.updatedRole]: (data) => `${this.admin} updated ${data.roleName} role
|
|
120888
|
-
[ACTIONS.deletedRole]: (data) => `${this.admin} deleted ${data.roleName} role
|
|
120889
|
-
[ACTIONS.updatedName]: (data) => `${this.admin} changed first name from ${data.name} to ${this.admin.split(" ")[0]}
|
|
120899
|
+
[ACTIONS.inviteUsers]: (data) => `${this.admin} added ${data.emails.join(", ").toLowerCase()}.`,
|
|
120900
|
+
[ACTIONS.updatedUser]: (data) => `${this.admin} changed ${data.emails[0].toLowerCase()}'s email from ${data.emails[0].toLowerCase()} to ${data.emails[1].toLowerCase()}.`,
|
|
120901
|
+
[ACTIONS.removedUser]: (data) => `${this.admin} removed ${data.emails[0].toLowerCase()}.`,
|
|
120902
|
+
[ACTIONS.createdRole]: (data) => `${this.admin} created ${data.roleName} role.`,
|
|
120903
|
+
[ACTIONS.addedPermission]: (data) => `${this.admin} added ${data.permissions.join(", ").toLowerCase()} permission to ${data.roleName} role.`,
|
|
120904
|
+
[ACTIONS.removedPermission]: (data) => `${this.admin} removed ${data.permissions.join(", ")} permissions from ${data.roleName} role.`,
|
|
120905
|
+
[ACTIONS.updatedRole]: (data) => `${this.admin} updated ${data.roleName} role.`,
|
|
120906
|
+
[ACTIONS.deletedRole]: (data) => `${this.admin} deleted ${data.roleName} role.`,
|
|
120907
|
+
[ACTIONS.updatedName]: (data) => `${this.admin} changed first name from ${data.name} to ${this.admin.split(" ")[0]}.`,
|
|
120890
120908
|
[ACTIONS.connectedIntegration]: (data) => data.detail
|
|
120891
120909
|
? `${this.admin} connected ${data.integrationName} using ${data.detail}.`
|
|
120892
120910
|
: `${this.admin} connected ${data.integrationName}.`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-playwright-commons",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.14",
|
|
4
4
|
"description": "A package encapsulating common playwright code across neeto projects.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-playwright-commons.git",
|
|
6
6
|
"license": "apache-2.0",
|