@empiricalrun/playwright-utils 0.0.1-beta.1 → 0.2.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/CHANGELOG.md +13 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +21 -0
- package/dist/email.d.ts +20 -0
- package/dist/email.d.ts.map +1 -0
- package/dist/email.js +41 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -19
- package/package.json +9 -6
package/CHANGELOG.md
ADDED
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,eAAO,MAAM,UAAU,EAAE,oBAiBxB,CAAC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.baseConfig = void 0;
|
|
4
|
+
exports.baseConfig = {
|
|
5
|
+
testDir: "./tests",
|
|
6
|
+
fullyParallel: true,
|
|
7
|
+
forbidOnly: false,
|
|
8
|
+
retries: process.env.CI ? 2 : 0,
|
|
9
|
+
workers: undefined,
|
|
10
|
+
reporter: [["html"], ["json", { outputFile: "test-results/summary.json" }]],
|
|
11
|
+
use: {
|
|
12
|
+
trace: "retain-on-failure",
|
|
13
|
+
video: "on",
|
|
14
|
+
viewport: { width: 1366, height: 768 },
|
|
15
|
+
actionTimeout: 15_000,
|
|
16
|
+
},
|
|
17
|
+
expect: {
|
|
18
|
+
timeout: 15_000,
|
|
19
|
+
},
|
|
20
|
+
timeout: 0,
|
|
21
|
+
};
|
package/dist/email.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import MailosaurClient from "mailosaur";
|
|
2
|
+
type Link = {
|
|
3
|
+
text?: string;
|
|
4
|
+
href?: string;
|
|
5
|
+
};
|
|
6
|
+
export type Email = {
|
|
7
|
+
subject?: string;
|
|
8
|
+
text?: string;
|
|
9
|
+
html?: string;
|
|
10
|
+
links: Link[];
|
|
11
|
+
};
|
|
12
|
+
export declare class EmailClient {
|
|
13
|
+
address: string;
|
|
14
|
+
client: MailosaurClient;
|
|
15
|
+
constructor();
|
|
16
|
+
getAddress(): string;
|
|
17
|
+
waitForEmail(): Promise<Email | undefined>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../src/email.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,WAAW,CAAC;AAExC,KAAK,IAAI,GAAG;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAIF,qBAAa,WAAW;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,eAAe,CAAC;;IAUxB,UAAU;IAIJ,YAAY,IAAI,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;CAqBjD"}
|
package/dist/email.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EmailClient = void 0;
|
|
7
|
+
const mailosaur_1 = __importDefault(require("mailosaur"));
|
|
8
|
+
const serverId = "pnyrwq5o";
|
|
9
|
+
class EmailClient {
|
|
10
|
+
address;
|
|
11
|
+
client;
|
|
12
|
+
constructor() {
|
|
13
|
+
const randomString = [...Array(7)]
|
|
14
|
+
.map(() => Math.random().toString(36)[2])
|
|
15
|
+
.join("");
|
|
16
|
+
this.address = `${randomString}@${serverId}.mailosaur.net`;
|
|
17
|
+
this.client = new mailosaur_1.default("");
|
|
18
|
+
}
|
|
19
|
+
getAddress() {
|
|
20
|
+
return this.address;
|
|
21
|
+
}
|
|
22
|
+
async waitForEmail() {
|
|
23
|
+
try {
|
|
24
|
+
const email = await this.client.messages.get(serverId, {
|
|
25
|
+
sentTo: this.address,
|
|
26
|
+
}, { timeout: 30_000 });
|
|
27
|
+
if (email) {
|
|
28
|
+
return {
|
|
29
|
+
subject: email.subject,
|
|
30
|
+
text: email.text?.body,
|
|
31
|
+
html: email.html?.body,
|
|
32
|
+
links: email.html?.links || [],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.log("Error receiving email");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.EmailClient = EmailClient;
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
17
|
exports.baseConfig = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
forbidOnly: false,
|
|
8
|
-
retries: process.env.CI ? 2 : 0,
|
|
9
|
-
workers: undefined,
|
|
10
|
-
reporter: [["html"], ["json", { outputFile: "test-results/summary.json" }]],
|
|
11
|
-
use: {
|
|
12
|
-
trace: "retain-on-failure",
|
|
13
|
-
video: "on",
|
|
14
|
-
viewport: { width: 1366, height: 768 },
|
|
15
|
-
actionTimeout: 15000,
|
|
16
|
-
},
|
|
17
|
-
expect: {
|
|
18
|
-
timeout: 15000,
|
|
19
|
-
},
|
|
20
|
-
timeout: 0,
|
|
21
|
-
};
|
|
22
|
-
exports.baseConfig = baseConfig;
|
|
18
|
+
var config_1 = require("./config");
|
|
19
|
+
Object.defineProperty(exports, "baseConfig", { enumerable: true, get: function () { return config_1.baseConfig; } });
|
|
20
|
+
__exportStar(require("./email"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/playwright-utils",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -11,16 +11,19 @@
|
|
|
11
11
|
"url": "https://github.com/empirical-run/empirical.git"
|
|
12
12
|
},
|
|
13
13
|
"author": "Empirical Team <hey@empirical.run>",
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@playwright/test": "^1.44.1",
|
|
16
|
+
"@types/node": "^20.14.9"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"mailosaur": "^8.6.1"
|
|
20
|
+
},
|
|
14
21
|
"scripts": {
|
|
15
22
|
"dev": "tsc --build --watch",
|
|
16
|
-
"build": "tsc --build",
|
|
23
|
+
"build": "tsc --build && node ./../../tools/static-env-vars.js dist",
|
|
17
24
|
"clean": "tsc --build --clean",
|
|
18
25
|
"lint": "eslint .",
|
|
19
26
|
"test": "vitest run",
|
|
20
27
|
"test:watch": "vitest"
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@playwright/test": "^1.44.1",
|
|
24
|
-
"@types/node": "^20.14.9"
|
|
25
28
|
}
|
|
26
29
|
}
|