@bigbinary/neeto-playwright-commons 1.14.2 → 1.15.0
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 +6 -25
- package/index.cjs.js +11 -52
- package/index.cjs.js.map +1 -1
- package/index.d.ts +18 -102
- package/index.js +14 -54
- package/index.js.map +1 -1
- package/package.json +1 -3
package/README.md
CHANGED
|
@@ -57,14 +57,6 @@ yarn add lint-staged
|
|
|
57
57
|
yarn add dotenv-webpack
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
### `mailosaur`
|
|
61
|
-
|
|
62
|
-
Using `Mailosaur` you can automate email and SMS tests.
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
yarn add mailosaur
|
|
66
|
-
```
|
|
67
|
-
|
|
68
60
|
### `dayjs`
|
|
69
61
|
|
|
70
62
|
Dayjs is a JavaScript library that parses, validates, manipulates, and displays
|
|
@@ -95,21 +87,16 @@ yarn add playwright-i18next-fixture
|
|
|
95
87
|
We can install all the above peer dependencies by running a single command.
|
|
96
88
|
|
|
97
89
|
```
|
|
98
|
-
yarn add @bigbinary/neeto-cist @faker-js/faker @playwright/test lint-staged dotenv-webpack
|
|
90
|
+
yarn add @bigbinary/neeto-cist @faker-js/faker @playwright/test lint-staged dotenv-webpack dayjs ramda playwright-i18next-fixture
|
|
99
91
|
```
|
|
100
92
|
|
|
101
93
|
## External dependencies
|
|
102
94
|
|
|
103
95
|
### Methods
|
|
104
96
|
|
|
105
|
-
##
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
this methods to work.
|
|
109
|
-
|
|
110
|
-
We can find `MAILOUSAUR_KEY` by visiting https://mailosaur.com/app/account/keys
|
|
111
|
-
and `MAILOSAUR_SERVER_ID` by visiting https://mailosaur.com/app/servers
|
|
112
|
-
|
|
97
|
+
## MailerUtils
|
|
98
|
+
Note: ENV variables `NEETO_AUTOMATION_FASTMAIL_API_KEY` and
|
|
99
|
+
`FASTMAIL_DOMAIN_NAME` are required for this methods to work.
|
|
113
100
|
## Slack integration methods
|
|
114
101
|
|
|
115
102
|
Note: Either ENV variables `SLACK_WORKSPACE`, `SLACK_LOGIN_PASSWORD` and
|
|
@@ -118,13 +105,7 @@ Note: Either ENV variables `SLACK_WORKSPACE`, `SLACK_LOGIN_PASSWORD` and
|
|
|
118
105
|
|
|
119
106
|
## Zapier integration methods
|
|
120
107
|
|
|
121
|
-
Note: ENV variables `
|
|
122
|
-
`INTEGRATION_MAILOSAUR_SERVER_ID`, `ZAPIER_LOGIN_PASSWORD`,
|
|
123
|
-
`ZAPIER_LOGIN_EMAIL`, and `ZAP_ID` are required for this methods to work.
|
|
124
|
-
|
|
125
|
-
We can find `INTEGRATION_MAILOSAUR_SERVER_ID` by visiting
|
|
126
|
-
https://mailosaur.com/app/servers and `INTEGRATION_MAILOSAUR_API_KEY` by
|
|
127
|
-
visiting https://mailosaur.com/app/servers/ymn2s6kt/keys
|
|
108
|
+
Note: ENV variables `NEETO_AUTOMATION_FASTMAIL_API_KEY`, `FASTMAIL_DOMAIN_NAME`, `ZAPIER_LOGIN_EMAIL`, `ZAPIER_LOGIN_PASSWORD`, and `ZAP_ID` are required for this methods to work.
|
|
128
109
|
|
|
129
110
|
## Usage
|
|
130
111
|
|
|
@@ -141,7 +122,7 @@ import { COMMON_SELECTORS } from "@bigbinary/neeto-playwright-common";
|
|
|
141
122
|
- [Commons and Envs](./docs/common.md)
|
|
142
123
|
- [Routes](./docs/routes.md)
|
|
143
124
|
- [Custom commands](./docs/custom-commands.md)
|
|
144
|
-
- [
|
|
125
|
+
- [MailerUtils](./docs/utils/mailer-utils.md)
|
|
145
126
|
- [Util functions](./docs/utils)
|
|
146
127
|
- [POMs](./docs/poms)
|
|
147
128
|
- [Integration](./docs/integration)
|
package/index.cjs.js
CHANGED
|
@@ -7,7 +7,6 @@ var child_process = require('child_process');
|
|
|
7
7
|
var ramda = require('ramda');
|
|
8
8
|
var require$$0$1 = require('util');
|
|
9
9
|
var faker = require('@faker-js/faker');
|
|
10
|
-
var MailosaurClient = require('mailosaur');
|
|
11
10
|
var dayjs = require('dayjs');
|
|
12
11
|
var require$$0$3 = require('tty');
|
|
13
12
|
var require$$0$2 = require('os');
|
|
@@ -555,6 +554,8 @@ const MEMBER_SELECTORS = {
|
|
|
555
554
|
menubarSubLink: (sublink) => `members-${sublink}-block-sub-link`,
|
|
556
555
|
takeActionStateOption: (option = "") => `ntm-${hyphenize(option)}-members-button`,
|
|
557
556
|
checkboxLabel: (label) => `${hyphenize(label)}-checkbox-label`,
|
|
557
|
+
subscriptionPlanTag: "ntm-member-subscription-plan-tag",
|
|
558
|
+
memberNameCell: (nameOrEmail) => `ntm-member-name-${hyphenize(nameOrEmail)}`,
|
|
558
559
|
};
|
|
559
560
|
const MEMBER_FORM_SELECTORS = {
|
|
560
561
|
emailTextField: "email-select-input-field",
|
|
@@ -12180,59 +12181,16 @@ class MailerUtils {
|
|
|
12180
12181
|
}
|
|
12181
12182
|
}
|
|
12182
12183
|
|
|
12183
|
-
class MailosaurUtils {
|
|
12184
|
-
constructor(mailosaur) {
|
|
12185
|
-
this.getEmailContent = ({ email, subjectSubstring = "", timeout = 2 * 60 * 1000, receivedAfter = new Date(), }) => this.mailosaur.messages.get(this.serverId, { sentTo: email, subject: subjectSubstring }, { timeout, receivedAfter });
|
|
12186
|
-
this.fetchOtpFromEmail = async ({ email, subjectSubstring = OTP_EMAIL_PATTERN, timeout = 2 * 60 * 1000, receivedAfter = new Date(), }) => {
|
|
12187
|
-
var _a, _b, _c;
|
|
12188
|
-
const receivedEmail = await this.getEmailContent({
|
|
12189
|
-
email,
|
|
12190
|
-
subjectSubstring,
|
|
12191
|
-
timeout,
|
|
12192
|
-
receivedAfter,
|
|
12193
|
-
});
|
|
12194
|
-
const otp = (_c = (_b = (_a = receivedEmail === null || receivedEmail === void 0 ? void 0 : receivedEmail.text) === null || _a === void 0 ? void 0 : _a.codes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.value;
|
|
12195
|
-
if (ramda.isNil(otp)) {
|
|
12196
|
-
throw new Error(`No codes found in the email with subject: ${receivedEmail === null || receivedEmail === void 0 ? void 0 : receivedEmail.subject}. Please re-evaluate the filtering parameters.`);
|
|
12197
|
-
}
|
|
12198
|
-
return otp;
|
|
12199
|
-
};
|
|
12200
|
-
this.generateRandomMailosaurEmail = () => faker.faker.internet.email({ provider: `${this.serverId}.mailosaur.net` });
|
|
12201
|
-
this.mailosaur = mailosaur;
|
|
12202
|
-
if (ramda.isNotNil(process.env.MAILOSAUR_SERVER_ID)) {
|
|
12203
|
-
this.serverId = process.env.MAILOSAUR_SERVER_ID;
|
|
12204
|
-
}
|
|
12205
|
-
else {
|
|
12206
|
-
throw new Error("ENV variable MAILOSAUR_SERVER_ID is not defined. Please add the Server ID to use this method. Please visit https://mailosaur.com/app/servers to find the Server ID.");
|
|
12207
|
-
}
|
|
12208
|
-
}
|
|
12209
|
-
}
|
|
12210
|
-
|
|
12211
12184
|
const commands = {
|
|
12212
12185
|
neetoPlaywrightUtilities: async ({ page, request, baseURL }, use) => {
|
|
12213
12186
|
const commands = new CustomCommands(page, request, baseURL);
|
|
12214
12187
|
await use(commands);
|
|
12215
12188
|
},
|
|
12216
|
-
mailosaur: async ({}, use) => {
|
|
12217
|
-
skipTest.forAllExceptStagingEnv();
|
|
12218
|
-
if (ramda.isNotNil(process.env.MAILOSAUR_API_KEY)) {
|
|
12219
|
-
const mailosaur = new MailosaurClient(process.env.MAILOSAUR_API_KEY);
|
|
12220
|
-
await use(mailosaur);
|
|
12221
|
-
}
|
|
12222
|
-
else {
|
|
12223
|
-
throw new Error("ENV variable MAILOSAUR_API_KEY is not defined. Please add the API key to use this fixture. Please visit https://mailosaur.com/app/account/keys to find the API key.");
|
|
12224
|
-
}
|
|
12225
|
-
},
|
|
12226
12189
|
page: async ({ page }, use) => {
|
|
12227
12190
|
await page.goto("/", { timeout: 20000 });
|
|
12228
12191
|
await page.waitForLoadState();
|
|
12229
12192
|
await use(page);
|
|
12230
12193
|
},
|
|
12231
|
-
mailosaurUtils: async ({ mailosaur }, use) => {
|
|
12232
|
-
skipTest.forAllExceptStagingEnv();
|
|
12233
|
-
const mailosaurUtils = new MailosaurUtils(mailosaur);
|
|
12234
|
-
await use(mailosaurUtils);
|
|
12235
|
-
},
|
|
12236
12194
|
mailerUtils: async ({ neetoPlaywrightUtilities }, use) => {
|
|
12237
12195
|
const mailerUtils = new MailerUtils(neetoPlaywrightUtilities);
|
|
12238
12196
|
await mailerUtils.fastmailApi.authorizeAndSetAccountId();
|
|
@@ -24197,7 +24155,7 @@ class MemberApis {
|
|
|
24197
24155
|
class Member {
|
|
24198
24156
|
constructor(neetoPlaywrightUtilities) {
|
|
24199
24157
|
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
24200
|
-
this.addMemberViaRequest = async ({ email, role = MEMBER_TEXTS.agent, appName, }) => {
|
|
24158
|
+
this.addMemberViaRequest = async ({ email, role = MEMBER_TEXTS.agent, appName, subscriptionPlan = "free", }) => {
|
|
24201
24159
|
let response;
|
|
24202
24160
|
await test$1.expect
|
|
24203
24161
|
.poll(async () => {
|
|
@@ -24207,6 +24165,7 @@ class Member {
|
|
|
24207
24165
|
app_roles: [
|
|
24208
24166
|
{ app_name: appName, active_role: role, is_enabled: true },
|
|
24209
24167
|
],
|
|
24168
|
+
subscription_plan: subscriptionPlan,
|
|
24210
24169
|
});
|
|
24211
24170
|
return response === null || response === void 0 ? void 0 : response.status();
|
|
24212
24171
|
}, { timeout: 30000 })
|
|
@@ -24220,21 +24179,22 @@ class Member {
|
|
|
24220
24179
|
const responseBodyBuffer = await (jobResponse === null || jobResponse === void 0 ? void 0 : jobResponse.body());
|
|
24221
24180
|
const { is_completed: isCompleted } = JSON.parse(String(responseBodyBuffer));
|
|
24222
24181
|
return isCompleted;
|
|
24223
|
-
}, { timeout:
|
|
24182
|
+
}, { timeout: 60000 })
|
|
24224
24183
|
.toBe(true);
|
|
24225
24184
|
};
|
|
24226
|
-
this.editMemberViaRequest = async ({ email, firstName, lastName, newRole, }) => {
|
|
24185
|
+
this.editMemberViaRequest = async ({ email, firstName, lastName, newRole, subscriptionPlan, }) => {
|
|
24227
24186
|
const responseBody = (await this.memberApis
|
|
24228
24187
|
.fetch({ search: email })
|
|
24229
24188
|
.then(response => response === null || response === void 0 ? void 0 : response.json()));
|
|
24230
24189
|
const memberDetails = responseBody === null || responseBody === void 0 ? void 0 : responseBody.members.find(({ email }) => email === email.toLowerCase());
|
|
24231
24190
|
memberDetails &&
|
|
24232
|
-
(await this.memberApis.update(memberDetails.id, {
|
|
24191
|
+
(await this.memberApis.update(memberDetails.id, neetoCist.keysToSnakeCase({
|
|
24233
24192
|
active: true,
|
|
24234
|
-
|
|
24235
|
-
|
|
24193
|
+
firstName,
|
|
24194
|
+
lastName,
|
|
24236
24195
|
organization_role: newRole,
|
|
24237
|
-
|
|
24196
|
+
subscriptionPlan,
|
|
24197
|
+
})));
|
|
24238
24198
|
};
|
|
24239
24199
|
this.deactivateMemberViaRequest = (email) => this.memberApis.bulkUpdate({ active: false, emails: [email] });
|
|
24240
24200
|
this.generateRandomTeamMembers = ({ count = 1, role = "standard" }) => neetoCist.dynamicArray(count, () => ({
|
|
@@ -158645,7 +158605,6 @@ exports.MEMBER_SELECTORS = MEMBER_SELECTORS;
|
|
|
158645
158605
|
exports.MEMBER_TEXTS = MEMBER_TEXTS;
|
|
158646
158606
|
exports.MERGE_TAGS_SELECTORS = MERGE_TAGS_SELECTORS;
|
|
158647
158607
|
exports.MailerUtils = MailerUtils;
|
|
158648
|
-
exports.MailosaurUtils = MailosaurUtils;
|
|
158649
158608
|
exports.Member = Member;
|
|
158650
158609
|
exports.NEETO_AUTH_BASE_URL = NEETO_AUTH_BASE_URL;
|
|
158651
158610
|
exports.NEETO_EDITOR_SELECTORS = NEETO_EDITOR_SELECTORS;
|