@bigbinary/neeto-playwright-commons 1.14.3 → 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 +0 -45
- package/index.cjs.js.map +1 -1
- package/index.d.ts +5 -100
- package/index.js +2 -46
- 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');
|
|
@@ -12182,59 +12181,16 @@ class MailerUtils {
|
|
|
12182
12181
|
}
|
|
12183
12182
|
}
|
|
12184
12183
|
|
|
12185
|
-
class MailosaurUtils {
|
|
12186
|
-
constructor(mailosaur) {
|
|
12187
|
-
this.getEmailContent = ({ email, subjectSubstring = "", timeout = 2 * 60 * 1000, receivedAfter = new Date(), }) => this.mailosaur.messages.get(this.serverId, { sentTo: email, subject: subjectSubstring }, { timeout, receivedAfter });
|
|
12188
|
-
this.fetchOtpFromEmail = async ({ email, subjectSubstring = OTP_EMAIL_PATTERN, timeout = 2 * 60 * 1000, receivedAfter = new Date(), }) => {
|
|
12189
|
-
var _a, _b, _c;
|
|
12190
|
-
const receivedEmail = await this.getEmailContent({
|
|
12191
|
-
email,
|
|
12192
|
-
subjectSubstring,
|
|
12193
|
-
timeout,
|
|
12194
|
-
receivedAfter,
|
|
12195
|
-
});
|
|
12196
|
-
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;
|
|
12197
|
-
if (ramda.isNil(otp)) {
|
|
12198
|
-
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.`);
|
|
12199
|
-
}
|
|
12200
|
-
return otp;
|
|
12201
|
-
};
|
|
12202
|
-
this.generateRandomMailosaurEmail = () => faker.faker.internet.email({ provider: `${this.serverId}.mailosaur.net` });
|
|
12203
|
-
this.mailosaur = mailosaur;
|
|
12204
|
-
if (ramda.isNotNil(process.env.MAILOSAUR_SERVER_ID)) {
|
|
12205
|
-
this.serverId = process.env.MAILOSAUR_SERVER_ID;
|
|
12206
|
-
}
|
|
12207
|
-
else {
|
|
12208
|
-
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.");
|
|
12209
|
-
}
|
|
12210
|
-
}
|
|
12211
|
-
}
|
|
12212
|
-
|
|
12213
12184
|
const commands = {
|
|
12214
12185
|
neetoPlaywrightUtilities: async ({ page, request, baseURL }, use) => {
|
|
12215
12186
|
const commands = new CustomCommands(page, request, baseURL);
|
|
12216
12187
|
await use(commands);
|
|
12217
12188
|
},
|
|
12218
|
-
mailosaur: async ({}, use) => {
|
|
12219
|
-
skipTest.forAllExceptStagingEnv();
|
|
12220
|
-
if (ramda.isNotNil(process.env.MAILOSAUR_API_KEY)) {
|
|
12221
|
-
const mailosaur = new MailosaurClient(process.env.MAILOSAUR_API_KEY);
|
|
12222
|
-
await use(mailosaur);
|
|
12223
|
-
}
|
|
12224
|
-
else {
|
|
12225
|
-
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.");
|
|
12226
|
-
}
|
|
12227
|
-
},
|
|
12228
12189
|
page: async ({ page }, use) => {
|
|
12229
12190
|
await page.goto("/", { timeout: 20000 });
|
|
12230
12191
|
await page.waitForLoadState();
|
|
12231
12192
|
await use(page);
|
|
12232
12193
|
},
|
|
12233
|
-
mailosaurUtils: async ({ mailosaur }, use) => {
|
|
12234
|
-
skipTest.forAllExceptStagingEnv();
|
|
12235
|
-
const mailosaurUtils = new MailosaurUtils(mailosaur);
|
|
12236
|
-
await use(mailosaurUtils);
|
|
12237
|
-
},
|
|
12238
12194
|
mailerUtils: async ({ neetoPlaywrightUtilities }, use) => {
|
|
12239
12195
|
const mailerUtils = new MailerUtils(neetoPlaywrightUtilities);
|
|
12240
12196
|
await mailerUtils.fastmailApi.authorizeAndSetAccountId();
|
|
@@ -158649,7 +158605,6 @@ exports.MEMBER_SELECTORS = MEMBER_SELECTORS;
|
|
|
158649
158605
|
exports.MEMBER_TEXTS = MEMBER_TEXTS;
|
|
158650
158606
|
exports.MERGE_TAGS_SELECTORS = MERGE_TAGS_SELECTORS;
|
|
158651
158607
|
exports.MailerUtils = MailerUtils;
|
|
158652
|
-
exports.MailosaurUtils = MailosaurUtils;
|
|
158653
158608
|
exports.Member = Member;
|
|
158654
158609
|
exports.NEETO_AUTH_BASE_URL = NEETO_AUTH_BASE_URL;
|
|
158655
158610
|
exports.NEETO_EDITOR_SELECTORS = NEETO_EDITOR_SELECTORS;
|