@devitek/mailsink-playwright 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +144 -2
- package/dist/index.d.ts +188 -0
- package/dist/index.js +349 -0
- package/package.json +56 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Devitek
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,145 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @devitek/mailsink-playwright
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[Playwright](https://playwright.dev) fixtures and matchers for
|
|
4
|
+
[Mailsink](https://github.com/Devitek/mailsink), the email sink for staging and CI: every
|
|
5
|
+
worker gets its own ephemeral workspace, every test waits for the emails your application
|
|
6
|
+
sends, opens their links in the page, reads their one-time codes and forces bounces.
|
|
7
|
+
|
|
8
|
+
- Built on the TypeScript SDK [`@devitek/mailsink`](../sdk/README.md): the `mailsink`
|
|
9
|
+
fixture is an SDK client.
|
|
10
|
+
- One ephemeral workspace per worker, created through the Admin API, reset before each test,
|
|
11
|
+
deleted when the worker ends, with an idle TTL as safety net for killed runs.
|
|
12
|
+
- Versioned with the Mailsink server: `x.y.z` matches server `x.y.z`.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install -D @devitek/mailsink-playwright
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`@playwright/test` 1.47 or later is a peer dependency.
|
|
21
|
+
|
|
22
|
+
## Quick start
|
|
23
|
+
|
|
24
|
+
Give the runner the server URL and its admin key (never the application under test):
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
MAILSINK_URL=http://localhost:3000
|
|
28
|
+
MAILSINK_ADMIN_KEY=change-me-in-ci
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
// tests/sign-in.spec.ts
|
|
33
|
+
import { expect, getCode, openLink, test } from '@devitek/mailsink-playwright'
|
|
34
|
+
|
|
35
|
+
test('a magic link signs the user in', async ({ page, expectEmail }) => {
|
|
36
|
+
await page.goto('/sign-in')
|
|
37
|
+
await page.getByLabel('Email').fill('jane@example.com')
|
|
38
|
+
await page.getByRole('button', { name: 'Send me a link' }).click()
|
|
39
|
+
|
|
40
|
+
// Waits for the first email received since the test started.
|
|
41
|
+
const email = await expectEmail({ to: 'jane@example.com', subject: 'Sign in' })
|
|
42
|
+
await expect(email).toHaveLink('/auth/magic')
|
|
43
|
+
await openLink(page, email, '/auth/magic') // page.goto on the link, as a click in a mailbox
|
|
44
|
+
await expect(page.getByRole('heading', { name: 'Welcome back' })).toBeVisible()
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
test('a one-time code', async ({ page, expectEmail }) => {
|
|
48
|
+
// ...the application sends "Your code is 482913"
|
|
49
|
+
const email = await expectEmail({ to: 'jane@example.com', subject: 'Your code' })
|
|
50
|
+
await page.getByLabel('Code').fill(getCode(email))
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The application under test sends with the connection of the worker's workspace. Its
|
|
55
|
+
credentials, as `.env` variables, are on the `mailsinkWorkspace` worker fixture:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
test.extend<{}, { appServer: string }>({
|
|
59
|
+
appServer: [
|
|
60
|
+
async ({ mailsinkWorkspace }, use) => {
|
|
61
|
+
// RESEND_API_KEY and RESEND_BASE_URL, or SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS...
|
|
62
|
+
const server = await startMyApp({ env: mailsinkWorkspace.env })
|
|
63
|
+
await use(server.url)
|
|
64
|
+
await server.close()
|
|
65
|
+
},
|
|
66
|
+
{ scope: 'worker' },
|
|
67
|
+
],
|
|
68
|
+
})
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Fixtures
|
|
72
|
+
|
|
73
|
+
| Fixture | Scope | What |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| `mailsinkOptions` | worker, option | How the workspace is created: `url`, `adminKey`, `name`, `connections`, `idleTtlSeconds` (600), `templates`, `metadata`, `workspace` (any other field), `validate` |
|
|
76
|
+
| `mailsinkWorkspace` | worker | `id`, `slug`, `url`, `workspaceKey`, `connections` (with credentials), `connection(nameOrKind)`, `env`, `client` and `admin` SDK clients |
|
|
77
|
+
| `mailsinkReset` | test, option | What is cleared before each test: `true` (messages, overrides, suppressions), `false`, or `{ messages?, overrides?, suppressions? }` |
|
|
78
|
+
| `mailsinkOverride` | test, option | An override active for the whole test, reset after it |
|
|
79
|
+
| `mailsink` | test | SDK client of the workspace plus `since`, `workspace`, `expectEmail`, `withOverride` |
|
|
80
|
+
| `expectEmail` | test | `mailsink.expectEmail` |
|
|
81
|
+
|
|
82
|
+
Options go in `playwright.config.ts` or `test.use()`; `test.use` replaces the whole object,
|
|
83
|
+
and the keys left out fall back to the environment and the defaults. A file that needs
|
|
84
|
+
other connections gets its own workers:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
test.use({
|
|
88
|
+
mailsinkOptions: {
|
|
89
|
+
connections: [{ kind: 'brevo', name: 'app' }],
|
|
90
|
+
templates, // the Brevo templates of the application (`templateId` sends)
|
|
91
|
+
},
|
|
92
|
+
})
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Waiting for an email
|
|
96
|
+
|
|
97
|
+
`expectEmail(filters, { timeout = 10_000, since })` resolves the full message (bodies,
|
|
98
|
+
links, attachments, recipients, events) of the first email matching the filters received
|
|
99
|
+
since the start of the test. Filters are those of the Capture API: `to`, `from`, `subject`
|
|
100
|
+
(substrings, case-insensitive), `tag`, `status` (one or several), `connectionId`, `q`.
|
|
101
|
+
On a timeout, the error lists the emails that did arrive. Each call is a step in the report.
|
|
102
|
+
|
|
103
|
+
## Matchers
|
|
104
|
+
|
|
105
|
+
The package `expect` is `@playwright/test`'s with three matchers; with your own matchers,
|
|
106
|
+
`mergeExpects(expect, yours)`.
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
expect(email).toHaveLink('/reset') // substring, RegExp or (url: URL) => boolean
|
|
110
|
+
expect(email).toHaveAttachment('invoice.pdf') // or { filename?, contentType? }
|
|
111
|
+
await expect(email).toHaveStatus('delivered') // waits for the delivery simulation
|
|
112
|
+
await expect(email).toHaveStatus('hard_bounce', { recipient: 'jane+bounce@example.com' })
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`toHaveStatus` re-reads an email answered by `expectEmail` until the status matches or the
|
|
116
|
+
expect timeout runs out; on any other message it checks the value as is.
|
|
117
|
+
|
|
118
|
+
## Links and codes
|
|
119
|
+
|
|
120
|
+
- `getLink(email, matcher?)` and `getCode(email, { length = 6, pattern? })`: like the SDK
|
|
121
|
+
`findLink` and `extractCode`, but they throw (listing the links) instead of answering
|
|
122
|
+
`null`.
|
|
123
|
+
- `openLink(page, email, matcher?, { waitUntil?, timeout?, rebase? })`: `page.goto` on the
|
|
124
|
+
link; `rebase` replaces its origin when the application writes another URL in its emails.
|
|
125
|
+
|
|
126
|
+
## Overrides
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
test('a bounce', async ({ mailsink }) => {
|
|
130
|
+
await mailsink.withOverride({ rules: [{ match: '*+bounce@*', status: 'hard_bounce' }] })
|
|
131
|
+
// ...reset when the test ends, pass or fail
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
test.describe('a failing provider', () => {
|
|
135
|
+
test.use({ mailsinkOverride: { rates: { failed: 100 } } })
|
|
136
|
+
// every test of the group runs under the override
|
|
137
|
+
})
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
`withOverride(config, fn)` only lasts for `fn`. Before each test, every override of the
|
|
141
|
+
workspace is reset anyway.
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { ActivateOptions, CreateWorkspaceInput, CreatedConnection, DeliveryStatus, ExtractCodeOptions, ExtractCodeOptions as ExtractCodeOptions$1, LinkMatcher, LinkMatcher as LinkMatcher$1, ListMessagesParams, Mailsink, Mailsink as Mailsink$1, MailsinkError, MessageContent, MessageDetail, MessageDetail as MessageDetail$1, OverrideConfig, OverrideState, StreamEvent, extractCode, extractLinks, findLink, isMailsinkError } from "@devitek/mailsink";
|
|
2
|
+
import { Page, Response } from "@playwright/test";
|
|
3
|
+
/** Filters of `expectEmail`: those of `messages.list`, `status` also as a single value. */
|
|
4
|
+
type EmailFilters = Omit<ListMessagesParams, 'status' | 'since'> & {
|
|
5
|
+
status?: DeliveryStatus | DeliveryStatus[];
|
|
6
|
+
};
|
|
7
|
+
interface ExpectEmailOptions {
|
|
8
|
+
/** Total wait in ms. Default 10 000. */
|
|
9
|
+
timeout?: number;
|
|
10
|
+
/** Oldest message that counts. Default (fixture): the start of the test. */
|
|
11
|
+
since?: Date | string;
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
}
|
|
14
|
+
/** The part of Playwright's matcher state these matchers read. */
|
|
15
|
+
interface MatcherState {
|
|
16
|
+
isNot: boolean;
|
|
17
|
+
timeout: number;
|
|
18
|
+
}
|
|
19
|
+
interface MatcherResult {
|
|
20
|
+
pass: boolean;
|
|
21
|
+
message: () => string;
|
|
22
|
+
name: string;
|
|
23
|
+
expected?: unknown;
|
|
24
|
+
actual?: unknown;
|
|
25
|
+
}
|
|
26
|
+
type AttachmentMatcher = string | RegExp | {
|
|
27
|
+
filename?: string | RegExp;
|
|
28
|
+
contentType?: string | RegExp;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Matchers on a captured email, for `expect.extend` (the package `expect` has them):
|
|
32
|
+
* `toHaveLink`, `toHaveAttachment`, `toHaveStatus`.
|
|
33
|
+
*/
|
|
34
|
+
export declare const mailsinkMatchers: {
|
|
35
|
+
/** The email has a link (matching a substring, a RegExp or a predicate on the URL). */
|
|
36
|
+
toHaveLink(this: MatcherState, message: MessageDetail$1, matcher?: LinkMatcher$1): MatcherResult;
|
|
37
|
+
/** The email has an attachment with this file name (or matching name and content type). */
|
|
38
|
+
toHaveAttachment(this: MatcherState, message: MessageDetail$1, expected: AttachmentMatcher): MatcherResult;
|
|
39
|
+
/**
|
|
40
|
+
* The email (or one recipient) has this delivery status. On an email answered by
|
|
41
|
+
* `expectEmail`, waits for the simulation up to the expect timeout.
|
|
42
|
+
*/
|
|
43
|
+
toHaveStatus(this: MatcherState, message: MessageDetail$1, expected: DeliveryStatus | DeliveryStatus[], options?: {
|
|
44
|
+
recipient?: string;
|
|
45
|
+
timeout?: number;
|
|
46
|
+
}): Promise<MatcherResult>;
|
|
47
|
+
};
|
|
48
|
+
type ConnectionInput = NonNullable<CreateWorkspaceInput['connections']>[number];
|
|
49
|
+
/**
|
|
50
|
+
* Worker-scoped option `mailsinkOptions`: how each worker's ephemeral workspace is
|
|
51
|
+
* created. Every key is optional; set it in `playwright.config.ts` (`use`) or with
|
|
52
|
+
* `test.use()` at the top of a file.
|
|
53
|
+
*/
|
|
54
|
+
interface MailsinkWorkspaceOptions {
|
|
55
|
+
/** Base URL of the Mailsink server. Default: `MAILSINK_URL`. */
|
|
56
|
+
url?: string;
|
|
57
|
+
/** Admin key (creates and deletes the workspace). Default: `MAILSINK_ADMIN_KEY`. */
|
|
58
|
+
adminKey?: string;
|
|
59
|
+
/** Workspace name. Default: `playwright-w<workerIndex>`; the slug gets a random suffix. */
|
|
60
|
+
name?: string;
|
|
61
|
+
/** Connections of the workspace. Default: one Resend connection named `app`. */
|
|
62
|
+
connections?: ConnectionInput[];
|
|
63
|
+
/**
|
|
64
|
+
* Safety net: the server deletes the workspace this many seconds after its last call
|
|
65
|
+
* when the worker never reaches its teardown (killed run). Default 600 (60 to 2 592 000).
|
|
66
|
+
*/
|
|
67
|
+
idleTtlSeconds?: number;
|
|
68
|
+
/** Brevo templates seeded with the workspace (`templateId` sends). */
|
|
69
|
+
templates?: CreateWorkspaceInput['templates'];
|
|
70
|
+
/** Free metadata shown by the web UI; `createdBy` defaults to the worker. */
|
|
71
|
+
metadata?: Record<string, string>;
|
|
72
|
+
/** Any other field of `POST /admin/workspaces` (`simulation`, `rateLimit`, `retention`...). */
|
|
73
|
+
workspace?: Omit<CreateWorkspaceInput, 'name' | 'ephemeral' | 'connections'>;
|
|
74
|
+
/** Validate every answer against its contract (SDK option). Default false. */
|
|
75
|
+
validate?: boolean;
|
|
76
|
+
}
|
|
77
|
+
/** What the `mailsink` fixture clears before each test (option `mailsinkReset`). */
|
|
78
|
+
interface ResetOptions {
|
|
79
|
+
/** Delete the messages (and their logs). Default true. */
|
|
80
|
+
messages?: boolean;
|
|
81
|
+
/** Reset every active override, workspace-wide and per connection. Default true. */
|
|
82
|
+
overrides?: boolean;
|
|
83
|
+
/** Empty the suppression list (bounced and complained addresses). Default true. */
|
|
84
|
+
suppressions?: boolean;
|
|
85
|
+
}
|
|
86
|
+
/** Resets every active override of the workspace: the workspace scope and each connection. */
|
|
87
|
+
export declare function resetOverrides(client: Mailsink$1): Promise<void>;
|
|
88
|
+
/** Back to a blank workspace: by default no message, no override, no suppression. */
|
|
89
|
+
export declare function resetWorkspace(client: Mailsink$1, options?: ResetOptions | boolean): Promise<void>;
|
|
90
|
+
/** The ephemeral workspace of one Playwright worker (fixture `mailsinkWorkspace`). */
|
|
91
|
+
interface MailsinkWorkspace {
|
|
92
|
+
id: string;
|
|
93
|
+
slug: string;
|
|
94
|
+
/** Base URL of the Mailsink server. */
|
|
95
|
+
url: string;
|
|
96
|
+
/** `mskw_` key: Capture API (assertions, overrides, reset). */
|
|
97
|
+
workspaceKey: string;
|
|
98
|
+
/** Every connection with its credentials, in the order of the options. */
|
|
99
|
+
connections: CreatedConnection[];
|
|
100
|
+
/** First connection whose name or kind matches; throws when none does. */
|
|
101
|
+
connection(nameOrKind?: string): CreatedConnection;
|
|
102
|
+
/**
|
|
103
|
+
* `.env` variables of the connections for the application under test
|
|
104
|
+
* (`RESEND_API_KEY`, `RESEND_BASE_URL`, `SMTP_HOST`...). On a name clash, the first
|
|
105
|
+
* connection wins.
|
|
106
|
+
*/
|
|
107
|
+
env: Record<string, string>;
|
|
108
|
+
/** SDK client scoped to the workspace (workspace key). */
|
|
109
|
+
client: Mailsink$1;
|
|
110
|
+
/** SDK client with the admin key, for Admin API calls. */
|
|
111
|
+
admin: Mailsink$1;
|
|
112
|
+
}
|
|
113
|
+
/** The test-scoped `mailsink` fixture: the SDK client of the worker's workspace, plus helpers. */
|
|
114
|
+
interface MailsinkTestClient extends Mailsink$1 {
|
|
115
|
+
/** Start of the test: `expectEmail` only sees emails received from then on. */
|
|
116
|
+
since: Date;
|
|
117
|
+
/** The worker's workspace: ids, connections, `.env` of the application under test. */
|
|
118
|
+
workspace: MailsinkWorkspace;
|
|
119
|
+
/**
|
|
120
|
+
* Waits for the first email matching `filters` received since the start of the test
|
|
121
|
+
* (`options.since` to change it) and resolves its full detail.
|
|
122
|
+
*/
|
|
123
|
+
expectEmail(filters?: EmailFilters, options?: ExpectEmailOptions): Promise<MessageDetail$1>;
|
|
124
|
+
/**
|
|
125
|
+
* Activates an override for the rest of the test; the fixture resets it when the test
|
|
126
|
+
* ends. With a callback, the override only lasts for the callback.
|
|
127
|
+
*/
|
|
128
|
+
withOverride(config: OverrideConfig, options?: ActivateOptions): Promise<OverrideState>;
|
|
129
|
+
withOverride<T>(config: OverrideConfig, fn: () => T | Promise<T>, options?: ActivateOptions): Promise<T>;
|
|
130
|
+
}
|
|
131
|
+
interface MailsinkWorkerFixtures {
|
|
132
|
+
/** Option: how the worker's workspace is created (URL, admin key, connections, TTL). */
|
|
133
|
+
mailsinkOptions: MailsinkWorkspaceOptions;
|
|
134
|
+
/** The ephemeral workspace of the worker, deleted when the worker ends. */
|
|
135
|
+
mailsinkWorkspace: MailsinkWorkspace;
|
|
136
|
+
}
|
|
137
|
+
interface MailsinkTestFixtures {
|
|
138
|
+
/** Option: what is cleared before each test. Default: messages, overrides, suppressions. */
|
|
139
|
+
mailsinkReset: ResetOptions | boolean;
|
|
140
|
+
/** Option: an override active for the whole test (`test.use` per file or describe). */
|
|
141
|
+
mailsinkOverride: OverrideConfig | null;
|
|
142
|
+
/** SDK client of the workspace, `since` set at the start of the test, plus helpers. */
|
|
143
|
+
mailsink: MailsinkTestClient;
|
|
144
|
+
/** `mailsink.expectEmail`: the first email matching the filters since the test started. */
|
|
145
|
+
expectEmail: MailsinkTestClient['expectEmail'];
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* `@playwright/test`'s `test` with the Mailsink fixtures. Combine it with your own with
|
|
149
|
+
* `mergeTests(test, yourTest)`, or extend it: `test.extend({ ... })`.
|
|
150
|
+
*/
|
|
151
|
+
export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & MailsinkTestFixtures, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & MailsinkWorkerFixtures>;
|
|
152
|
+
/** `@playwright/test`'s `expect` with `toHaveLink`, `toHaveAttachment`, `toHaveStatus`. */
|
|
153
|
+
export declare const expect: import("@playwright/test").Expect<{
|
|
154
|
+
toHaveLink(this: MatcherState, message: import("@devitek/mailsink").MessageDetail, matcher?: import("@devitek/mailsink").LinkMatcher): MatcherResult;
|
|
155
|
+
toHaveAttachment(this: MatcherState, message: import("@devitek/mailsink").MessageDetail, expected: AttachmentMatcher): MatcherResult;
|
|
156
|
+
toHaveStatus(this: MatcherState, message: import("@devitek/mailsink").MessageDetail, expected: import("@devitek/mailsink").DeliveryStatus | import("@devitek/mailsink").DeliveryStatus[], options?: {
|
|
157
|
+
recipient?: string;
|
|
158
|
+
timeout?: number;
|
|
159
|
+
}): Promise<MatcherResult>;
|
|
160
|
+
}>;
|
|
161
|
+
type Described = MessageContent & {
|
|
162
|
+
id?: string;
|
|
163
|
+
};
|
|
164
|
+
/** The first link matching `matcher` (any link when omitted); throws listing the links. */
|
|
165
|
+
export declare function getLink(message: Described, matcher?: LinkMatcher$1): string;
|
|
166
|
+
/** The one-time code of the email (6 digits by default); throws when there is none. */
|
|
167
|
+
export declare function getCode(message: Described, options?: ExtractCodeOptions$1): string;
|
|
168
|
+
interface OpenLinkOptions {
|
|
169
|
+
/** `page.goto` wait condition. Default `load`. */
|
|
170
|
+
waitUntil?: 'load' | 'domcontentloaded' | 'networkidle' | 'commit';
|
|
171
|
+
timeout?: number;
|
|
172
|
+
/**
|
|
173
|
+
* Replaces the origin of the link, for an application that writes its production URL
|
|
174
|
+
* in emails while the test runs it elsewhere: `rebase: 'http://127.0.0.1:3000'`.
|
|
175
|
+
*/
|
|
176
|
+
rebase?: string;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Opens a link of the email in the page (`page.goto`), the way a user clicks it in their
|
|
180
|
+
* mailbox. Resolves the URL opened and the main response.
|
|
181
|
+
*/
|
|
182
|
+
export declare function openLink(page: Page, message: Described, matcher?: LinkMatcher$1, options?: OpenLinkOptions): Promise<{
|
|
183
|
+
url: string;
|
|
184
|
+
response: Response | null;
|
|
185
|
+
}>;
|
|
186
|
+
/** `url` with the origin (and base path) of `base`, path, query and hash kept. */
|
|
187
|
+
export declare function rebaseUrl(url: string, base: string): string;
|
|
188
|
+
export { type AttachmentMatcher, type EmailFilters, type ExpectEmailOptions, type ExtractCodeOptions, type LinkMatcher, type Mailsink, MailsinkError, type MailsinkTestClient, type MailsinkTestFixtures, type MailsinkWorkerFixtures, type MailsinkWorkspace, type MailsinkWorkspaceOptions, type MatcherResult, type MatcherState, type MessageDetail, type OpenLinkOptions, type ResetOptions, type StreamEvent, extractCode, extractLinks, findLink, isMailsinkError };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { MailsinkError, createMailsink, extractCode, extractCode as extractCode$1, extractLinks, extractLinks as extractLinks$1, findLink, findLink as findLink$1, isMailsinkError, isMailsinkError as isMailsinkError$1 } from "@devitek/mailsink";
|
|
2
|
+
import { expect as expect$1, test as test$1 } from "@playwright/test";
|
|
3
|
+
// src/refresh.ts
|
|
4
|
+
const sources = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
function rememberSource(message, reload) {
|
|
6
|
+
sources.set(message, reload);
|
|
7
|
+
}
|
|
8
|
+
/** The reload of a message answered by `expectEmail`, `undefined` for any other object. */
|
|
9
|
+
function sourceOf(message) {
|
|
10
|
+
return typeof message === "object" && message !== null ? sources.get(message) : void 0;
|
|
11
|
+
}
|
|
12
|
+
// src/matchers.ts
|
|
13
|
+
const matches = (value, expected) => value !== null && (typeof expected === "string" ? value === expected : expected.test(value));
|
|
14
|
+
const not = (state) => state.isNot ? "not " : "";
|
|
15
|
+
/** Poll interval of `toHaveStatus` on a message answered by `expectEmail`. */
|
|
16
|
+
const POLL_MS = 200;
|
|
17
|
+
/**
|
|
18
|
+
* Matchers on a captured email, for `expect.extend` (the package `expect` has them):
|
|
19
|
+
* `toHaveLink`, `toHaveAttachment`, `toHaveStatus`.
|
|
20
|
+
*/
|
|
21
|
+
const mailsinkMatchers = {
|
|
22
|
+
/** The email has a link (matching a substring, a RegExp or a predicate on the URL). */
|
|
23
|
+
toHaveLink(message, matcher) {
|
|
24
|
+
const links = extractLinks$1(message);
|
|
25
|
+
const pass = matcher === void 0 ? links.length > 0 : findLink$1(message, matcher) !== null;
|
|
26
|
+
const what = matcher === void 0 ? "a link" : `a link matching ${String(matcher)}`;
|
|
27
|
+
return {
|
|
28
|
+
pass,
|
|
29
|
+
name: "toHaveLink",
|
|
30
|
+
expected: matcher,
|
|
31
|
+
actual: links,
|
|
32
|
+
message: () => `Expected the email ${not(this)}to have ${what}.\nLinks: ${links.join(", ") || "(none)"}`
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
/** The email has an attachment with this file name (or matching name and content type). */
|
|
36
|
+
toHaveAttachment(message, expected) {
|
|
37
|
+
const spec = typeof expected === "object" && !(expected instanceof RegExp) ? expected : { filename: expected };
|
|
38
|
+
const pass = message.attachments.some((a) => (spec.filename === void 0 || matches(a.filename, spec.filename)) && (spec.contentType === void 0 || matches(a.contentType, spec.contentType)));
|
|
39
|
+
const actual = message.attachments.map((a) => `${a.filename ?? "(no name)"} (${a.contentType})`);
|
|
40
|
+
return {
|
|
41
|
+
pass,
|
|
42
|
+
name: "toHaveAttachment",
|
|
43
|
+
expected,
|
|
44
|
+
actual,
|
|
45
|
+
message: () => `Expected the email ${not(this)}to have an attachment ${describeSpec(spec)}.\nAttachments: ${actual.join(", ") || "(none)"}`
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* The email (or one recipient) has this delivery status. On an email answered by
|
|
50
|
+
* `expectEmail`, waits for the simulation up to the expect timeout.
|
|
51
|
+
*/
|
|
52
|
+
async toHaveStatus(message, expected, options = {}) {
|
|
53
|
+
const wanted = [expected].flat();
|
|
54
|
+
const reload = sourceOf(message);
|
|
55
|
+
const deadline = Date.now() + (options.timeout ?? this.timeout);
|
|
56
|
+
let current = statusOf(message, options.recipient);
|
|
57
|
+
while (reload && wanted.includes(current) === this.isNot) {
|
|
58
|
+
if (Date.now() >= deadline) break;
|
|
59
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_MS));
|
|
60
|
+
current = statusOf(await reload(), options.recipient);
|
|
61
|
+
}
|
|
62
|
+
const who = options.recipient ? `recipient ${options.recipient}` : "email";
|
|
63
|
+
return {
|
|
64
|
+
pass: wanted.includes(current),
|
|
65
|
+
name: "toHaveStatus",
|
|
66
|
+
expected,
|
|
67
|
+
actual: current,
|
|
68
|
+
message: () => `Expected the ${who} ${not(this)}to have status ${wanted.join(" or ")}.\nReceived: ${current ?? `(no recipient ${options.recipient})`}`
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
function statusOf(message, recipient) {
|
|
73
|
+
if (recipient === void 0) return message.status;
|
|
74
|
+
const email = recipient.toLowerCase();
|
|
75
|
+
return message.recipients.find((r) => r.email.toLowerCase() === email)?.status ?? null;
|
|
76
|
+
}
|
|
77
|
+
function describeSpec(spec) {
|
|
78
|
+
return [spec.filename === void 0 ? null : `named ${String(spec.filename)}`, spec.contentType === void 0 ? null : `of type ${String(spec.contentType)}`].filter(Boolean).join(" ") || "(any)";
|
|
79
|
+
}
|
|
80
|
+
const DEFAULT_CONNECTIONS = [{
|
|
81
|
+
kind: "resend",
|
|
82
|
+
name: "app"
|
|
83
|
+
}];
|
|
84
|
+
/** Applies the defaults (environment included); throws when the URL or the admin key lacks. */
|
|
85
|
+
function resolveWorkspaceOptions(options, context) {
|
|
86
|
+
const env = context.env ?? {};
|
|
87
|
+
const url = options.url ?? env.MAILSINK_URL;
|
|
88
|
+
const adminKey = options.adminKey ?? env.MAILSINK_ADMIN_KEY;
|
|
89
|
+
if (!url) throw new Error(missing("url", "MAILSINK_URL"));
|
|
90
|
+
if (!adminKey) throw new Error(missing("adminKey", "MAILSINK_ADMIN_KEY"));
|
|
91
|
+
const worker = `worker ${context.workerIndex}`;
|
|
92
|
+
return {
|
|
93
|
+
url,
|
|
94
|
+
adminKey,
|
|
95
|
+
validate: options.validate ?? false,
|
|
96
|
+
input: {
|
|
97
|
+
...options.workspace,
|
|
98
|
+
name: options.name ?? `playwright-w${context.workerIndex}`,
|
|
99
|
+
ephemeral: true,
|
|
100
|
+
idleTtlSeconds: options.idleTtlSeconds ?? 600,
|
|
101
|
+
metadata: {
|
|
102
|
+
createdBy: `playwright · ${worker}`,
|
|
103
|
+
...options.metadata
|
|
104
|
+
},
|
|
105
|
+
connections: options.connections ?? DEFAULT_CONNECTIONS,
|
|
106
|
+
...options.templates ? { templates: options.templates } : {}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function missing(option, variable) {
|
|
111
|
+
return `Mailsink: no ${option}. Set ${variable}, or the \`mailsinkOptions\` option (\`use: { mailsinkOptions: { ${option}: ... } }\` in playwright.config.ts).`;
|
|
112
|
+
}
|
|
113
|
+
// src/reset.ts
|
|
114
|
+
/** Resets every active override of the workspace: the workspace scope and each connection. */
|
|
115
|
+
async function resetOverrides(client) {
|
|
116
|
+
const state = await client.overrides.get();
|
|
117
|
+
await Promise.all([...state.workspace ? [client.overrides.reset()] : [], ...state.connections.flatMap((o) => o.connectionId ? [client.overrides.reset({ connectionId: o.connectionId })] : [])]);
|
|
118
|
+
}
|
|
119
|
+
/** Back to a blank workspace: by default no message, no override, no suppression. */
|
|
120
|
+
async function resetWorkspace(client, options = true) {
|
|
121
|
+
if (options === false) return;
|
|
122
|
+
const { messages = true, overrides = true, suppressions = true } = options === true ? {} : options;
|
|
123
|
+
await Promise.all([
|
|
124
|
+
messages ? client.messages.purge() : void 0,
|
|
125
|
+
overrides ? resetOverrides(client) : void 0,
|
|
126
|
+
suppressions ? client.suppressions.clear() : void 0
|
|
127
|
+
]);
|
|
128
|
+
}
|
|
129
|
+
// src/expect-email.ts
|
|
130
|
+
/** How many messages a timeout lists to explain what arrived instead. */
|
|
131
|
+
const RECENT_LIMIT = 10;
|
|
132
|
+
/**
|
|
133
|
+
* Waits for the first email matching `filters` received since `since`, and resolves its
|
|
134
|
+
* full detail. On timeout, throws an error listing the emails that did arrive.
|
|
135
|
+
*/
|
|
136
|
+
async function expectEmail(client, filters, options) {
|
|
137
|
+
const query = toQuery(filters);
|
|
138
|
+
try {
|
|
139
|
+
const message = await client.messages.waitFor(query, options);
|
|
140
|
+
rememberSource(message, () => client.messages.get(message.id));
|
|
141
|
+
return message;
|
|
142
|
+
} catch (error) {
|
|
143
|
+
if (!isMailsinkError$1(error, "wait_timeout")) throw error;
|
|
144
|
+
const recent = await client.messages.list({
|
|
145
|
+
since: options.since,
|
|
146
|
+
limit: RECENT_LIMIT
|
|
147
|
+
}).then((page) => page.data).catch(() => null);
|
|
148
|
+
throw new Error(timeoutMessage(query, options, recent), { cause: error });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function toQuery(filters) {
|
|
152
|
+
const { status, ...rest } = filters;
|
|
153
|
+
return status === void 0 ? rest : {
|
|
154
|
+
...rest,
|
|
155
|
+
status: [status].flat()
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function timeoutMessage(filters, options, recent) {
|
|
159
|
+
const since = options.since instanceof Date ? options.since.toISOString() : options.since;
|
|
160
|
+
const lines = [`expectEmail: no email matched ${describeFilters(filters)} within ${options.timeout ?? 1e4} ms (since ${since}).`];
|
|
161
|
+
if (recent === null) lines.push("Could not list the emails received meanwhile.");
|
|
162
|
+
else if (recent.length === 0) lines.push("No email was received since then.");
|
|
163
|
+
else {
|
|
164
|
+
lines.push(`Emails received since then (newest first, at most ${RECENT_LIMIT}):`);
|
|
165
|
+
for (const m of recent) lines.push(` - ${describeSummary(m)}`);
|
|
166
|
+
}
|
|
167
|
+
return lines.join("\n");
|
|
168
|
+
}
|
|
169
|
+
function describeFilters(filters) {
|
|
170
|
+
const entries = Object.entries(filters).filter(([, v]) => v !== void 0);
|
|
171
|
+
return entries.length ? JSON.stringify(Object.fromEntries(entries)) : "{}";
|
|
172
|
+
}
|
|
173
|
+
function describeSummary(m) {
|
|
174
|
+
return `to ${m.to.map((a) => a.email).join(", ") || "(none)"}: ${JSON.stringify(m.subject)} [${m.status}] ${m.id}`;
|
|
175
|
+
}
|
|
176
|
+
// src/session.ts
|
|
177
|
+
function createTestSession(workspace, since) {
|
|
178
|
+
const base = workspace.client;
|
|
179
|
+
const scopes = /* @__PURE__ */ new Set();
|
|
180
|
+
function withOverride(config, fnOrOptions, maybeOptions) {
|
|
181
|
+
if (typeof fnOrOptions === "function") return base.overrides.with(config, fnOrOptions, maybeOptions);
|
|
182
|
+
const options = fnOrOptions ?? {};
|
|
183
|
+
scopes.add(options.connectionId ?? null);
|
|
184
|
+
return base.overrides.activate(config, options);
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
client: {
|
|
188
|
+
...base,
|
|
189
|
+
since,
|
|
190
|
+
workspace,
|
|
191
|
+
expectEmail: (filters = {}, options = {}) => expectEmail(base, filters, {
|
|
192
|
+
...options,
|
|
193
|
+
since: options.since ?? since
|
|
194
|
+
}),
|
|
195
|
+
withOverride
|
|
196
|
+
},
|
|
197
|
+
async teardown() {
|
|
198
|
+
const pending = [...scopes].map((connectionId) => base.overrides.reset(connectionId === null ? {} : { connectionId }).catch((error) => {
|
|
199
|
+
if (!isMailsinkError$1(error, "not_found") && !isMailsinkError$1(error, "unauthorized")) throw error;
|
|
200
|
+
}));
|
|
201
|
+
scopes.clear();
|
|
202
|
+
await Promise.all(pending);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
// src/workspace.ts
|
|
207
|
+
/** `POST /admin/workspaces`: an ephemeral workspace with its connections. */
|
|
208
|
+
async function provisionWorkspace(options, fetchImpl) {
|
|
209
|
+
const admin = createMailsink({
|
|
210
|
+
url: options.url,
|
|
211
|
+
adminKey: options.adminKey,
|
|
212
|
+
validate: options.validate,
|
|
213
|
+
fetch: fetchImpl
|
|
214
|
+
});
|
|
215
|
+
const created = await admin.admin.workspaces.create(options.input);
|
|
216
|
+
const { workspace, connections } = created;
|
|
217
|
+
return {
|
|
218
|
+
id: workspace.id,
|
|
219
|
+
slug: workspace.slug,
|
|
220
|
+
url: options.url,
|
|
221
|
+
workspaceKey: created.workspaceKey,
|
|
222
|
+
connections,
|
|
223
|
+
connection: (nameOrKind) => pickConnection(connections, nameOrKind),
|
|
224
|
+
env: connectionsEnv(connections),
|
|
225
|
+
client: admin.with({
|
|
226
|
+
key: created.workspaceKey,
|
|
227
|
+
adminKey: void 0
|
|
228
|
+
}),
|
|
229
|
+
admin,
|
|
230
|
+
dispose: () => deleteWorkspace(admin, workspace.id)
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* `DELETE /admin/workspaces/:id`, retried once on a network error (an idle keep-alive
|
|
235
|
+
* socket closed by the server, #118): the call is idempotent and 404 counts as done.
|
|
236
|
+
*/
|
|
237
|
+
async function deleteWorkspace(admin, id) {
|
|
238
|
+
for (let attempt = 1;; attempt++) try {
|
|
239
|
+
await admin.admin.workspaces.delete(id);
|
|
240
|
+
return;
|
|
241
|
+
} catch (error) {
|
|
242
|
+
if (isMailsinkError$1(error, "not_found")) return;
|
|
243
|
+
if (!isMailsinkError$1(error, "network_error") || attempt >= 3) throw error;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
function pickConnection(connections, nameOrKind) {
|
|
247
|
+
const found = nameOrKind === void 0 ? connections[0] : connections.find((c) => c.name === nameOrKind) ?? connections.find((c) => c.kind === nameOrKind);
|
|
248
|
+
if (found) return found;
|
|
249
|
+
const known = connections.map((c) => `${c.name} (${c.kind})`).join(", ") || "none";
|
|
250
|
+
throw new Error(`Mailsink: no connection "${nameOrKind ?? ""}" in the workspace (${known})`);
|
|
251
|
+
}
|
|
252
|
+
/** Merges the `.env` snippets of the connections, the first one winning on a clash. */
|
|
253
|
+
function connectionsEnv(connections) {
|
|
254
|
+
const env = {};
|
|
255
|
+
for (const { envSnippet } of connections) for (const [name, value] of Object.entries(parseEnvSnippet(envSnippet))) if (!(name in env)) env[name] = value;
|
|
256
|
+
return env;
|
|
257
|
+
}
|
|
258
|
+
/** `NAME=value` lines (comments and blank lines skipped). */
|
|
259
|
+
function parseEnvSnippet(snippet) {
|
|
260
|
+
const env = {};
|
|
261
|
+
for (const line of snippet.split(/\r?\n/)) {
|
|
262
|
+
const match = /^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=(.*)$/.exec(line);
|
|
263
|
+
if (match?.[1]) env[match[1]] = (match[2] ?? "").trim();
|
|
264
|
+
}
|
|
265
|
+
return env;
|
|
266
|
+
}
|
|
267
|
+
// src/fixtures.ts
|
|
268
|
+
/**
|
|
269
|
+
* `@playwright/test`'s `test` with the Mailsink fixtures. Combine it with your own with
|
|
270
|
+
* `mergeTests(test, yourTest)`, or extend it: `test.extend({ ... })`.
|
|
271
|
+
*/
|
|
272
|
+
const test = test$1.extend({
|
|
273
|
+
mailsinkOptions: [{}, {
|
|
274
|
+
option: true,
|
|
275
|
+
scope: "worker"
|
|
276
|
+
}],
|
|
277
|
+
mailsinkWorkspace: [async ({ mailsinkOptions }, use, workerInfo) => {
|
|
278
|
+
const workspace = await provisionWorkspace(resolveWorkspaceOptions(mailsinkOptions, {
|
|
279
|
+
workerIndex: workerInfo.workerIndex,
|
|
280
|
+
env: process.env
|
|
281
|
+
}));
|
|
282
|
+
try {
|
|
283
|
+
await use(workspace);
|
|
284
|
+
} finally {
|
|
285
|
+
await workspace.dispose();
|
|
286
|
+
}
|
|
287
|
+
}, {
|
|
288
|
+
scope: "worker",
|
|
289
|
+
box: true
|
|
290
|
+
}],
|
|
291
|
+
mailsinkReset: [true, { option: true }],
|
|
292
|
+
mailsinkOverride: [null, { option: true }],
|
|
293
|
+
mailsink: [async ({ mailsinkWorkspace, mailsinkReset, mailsinkOverride }, use) => {
|
|
294
|
+
await resetWorkspace(mailsinkWorkspace.client, mailsinkReset);
|
|
295
|
+
const session = createTestSession(mailsinkWorkspace, /* @__PURE__ */ new Date());
|
|
296
|
+
const { client } = session;
|
|
297
|
+
const expectEmail = client.expectEmail;
|
|
298
|
+
client.expectEmail = (filters, options) => test$1.step(`expectEmail ${JSON.stringify(filters ?? {})}`, () => expectEmail(filters, options), { box: true });
|
|
299
|
+
if (mailsinkOverride) await client.withOverride(mailsinkOverride);
|
|
300
|
+
try {
|
|
301
|
+
await use(client);
|
|
302
|
+
} finally {
|
|
303
|
+
await session.teardown();
|
|
304
|
+
}
|
|
305
|
+
}, { box: true }],
|
|
306
|
+
expectEmail: async ({ mailsink }, use) => {
|
|
307
|
+
await use(mailsink.expectEmail);
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
/** `@playwright/test`'s `expect` with `toHaveLink`, `toHaveAttachment`, `toHaveStatus`. */
|
|
311
|
+
const expect = expect$1.extend(mailsinkMatchers);
|
|
312
|
+
// src/links.ts
|
|
313
|
+
/** The first link matching `matcher` (any link when omitted); throws listing the links. */
|
|
314
|
+
function getLink(message, matcher) {
|
|
315
|
+
const link = matcher === void 0 ? extractLinks$1(message)[0] ?? null : findLink$1(message, matcher);
|
|
316
|
+
if (link !== null) return link;
|
|
317
|
+
const links = extractLinks$1(message);
|
|
318
|
+
throw new Error(`No link${matcher === void 0 ? "" : ` matching ${String(matcher)}`} in ${label(message)}. ` + (links.length ? `Links: ${links.join(", ")}` : "The email has no link."));
|
|
319
|
+
}
|
|
320
|
+
/** The one-time code of the email (6 digits by default); throws when there is none. */
|
|
321
|
+
function getCode(message, options) {
|
|
322
|
+
const code = extractCode$1(message, options);
|
|
323
|
+
if (code !== null) return code;
|
|
324
|
+
const what = options?.pattern ? `matching ${String(options.pattern)}` : `of ${options?.length ?? 6} digits`;
|
|
325
|
+
throw new Error(`No code ${what} in ${label(message)}.`);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Opens a link of the email in the page (`page.goto`), the way a user clicks it in their
|
|
329
|
+
* mailbox. Resolves the URL opened and the main response.
|
|
330
|
+
*/
|
|
331
|
+
async function openLink(page, message, matcher, options = {}) {
|
|
332
|
+
const { rebase, ...goto } = options;
|
|
333
|
+
const url = rebase ? rebaseUrl(getLink(message, matcher), rebase) : getLink(message, matcher);
|
|
334
|
+
return {
|
|
335
|
+
url,
|
|
336
|
+
response: await page.goto(url, goto)
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
/** `url` with the origin (and base path) of `base`, path, query and hash kept. */
|
|
340
|
+
function rebaseUrl(url, base) {
|
|
341
|
+
const source = new URL(url);
|
|
342
|
+
const target = new URL(base);
|
|
343
|
+
const prefix = target.pathname.replace(/\/$/, "");
|
|
344
|
+
return `${target.origin}${prefix}${source.pathname}${source.search}${source.hash}`;
|
|
345
|
+
}
|
|
346
|
+
function label(message) {
|
|
347
|
+
return `the email${message.subject ? ` ${JSON.stringify(message.subject)}` : ""}${message.id ? ` (${message.id})` : ""}`;
|
|
348
|
+
}
|
|
349
|
+
export { MailsinkError, expect, extractCode, extractLinks, findLink, getCode, getLink, isMailsinkError, mailsinkMatchers, openLink, rebaseUrl, resetOverrides, resetWorkspace, test };
|
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devitek/mailsink-playwright",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Playwright fixtures and matchers for Mailsink: one ephemeral workspace per worker, expectEmail, links, one-time codes and overrides",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mailsink",
|
|
7
|
+
"playwright",
|
|
8
|
+
"email",
|
|
9
|
+
"testing",
|
|
10
|
+
"e2e",
|
|
11
|
+
"fixtures",
|
|
12
|
+
"magic-link",
|
|
13
|
+
"otp"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "Devitek",
|
|
17
|
+
"homepage": "https://github.com/Devitek/mailsink/tree/main/packages/playwright#readme",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/Devitek/mailsink.git",
|
|
21
|
+
"directory": "packages/playwright"
|
|
22
|
+
},
|
|
23
|
+
"bugs": "https://github.com/Devitek/mailsink/issues",
|
|
24
|
+
"type": "module",
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist"
|
|
35
|
+
],
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=20"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@devitek/mailsink": "0.2.0"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@playwright/test": ">=1.47.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@mailsink/core": "0.0.0",
|
|
50
|
+
"@mailsink/db": "0.0.0",
|
|
51
|
+
"@playwright/test": "^1.65.1",
|
|
52
|
+
"tsdown": "^0.23.7"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"typecheck": "tsc --noEmit",
|
|
56
|
+
"build": "tsdown"
|
|
57
|
+
},
|
|
58
|
+
"types": "./dist/index.d.ts"
|
|
6
59
|
}
|