proxymail-qa 0.8.1 → 0.10.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 CHANGED
@@ -1,8 +1,30 @@
1
1
  # proxymail-qa
2
2
 
3
- Disposable test inboxes for Playwright, Cypress and scripts. Create an address,
4
- sign up with it in the app you're testing, and get the verification code or
5
- link from the email in one call that waits for it.
3
+ Test the emails your app sends, end to end, from Playwright, Cypress,
4
+ Puppeteer, Jest, Vitest or any Node script. Create a disposable address, sign
5
+ up with it, and get the verification code or link in one call that waits for
6
+ it. Then:
7
+
8
+ - check an email was sent exactly once, or not at all
9
+ - check each email: SPF, DKIM and DMARC, links to localhost or the wrong host,
10
+ a stated expiry, plain text, language and phone layout
11
+ - sign up with a test persona (name, date of birth, country) and a saved
12
+ password, or an unusual address variant
13
+ - borrow a verified test account for sign-in tests and give it back
14
+ - wait for a coupon, record whether checkout took it, and catch an offer
15
+ given twice to versions of one address
16
+ - test unsubscribing: any marketing email from that sender afterwards fails
17
+ - check marketing emails: unsubscribe headers, a spam score and the consent
18
+ rules where the persona lives
19
+ - check a welcome series or drip campaign came in order and on time
20
+ - find out why an email didn't arrive
21
+ - group tests into a run whose report says which test each email came from
22
+
23
+ Checkout results, offers given twice, unsubscribing, consent, welcome series,
24
+ the marketing checks and the spam score are in
25
+ [Labs](https://proxymail.qa/docs/labs) for now: the key's creator switches
26
+ them on in the app under Account settings → Labs. Until then those methods
27
+ throw with a 403 that says so, and `checkEmail` leaves those checks out.
6
28
 
7
29
  Get an API key in [app.proxymail.qa](https://app.proxymail.qa) → Project
8
30
  settings → API keys (the Free plan includes it), and set it as
@@ -107,6 +129,17 @@ await qa.createAddress({ persona: true, age: 'under13', country: 'GB' });
107
129
  // Find a test account made earlier: an under-18 in GB with a saved password.
108
130
  const [teen] = await qa.listAddresses({ tags: ['age-gate'], country: 'GB', maxAge: 17, hasPassword: true });
109
131
 
132
+ // Sign in again as a saved test account: the one used on this site first, with
133
+ // its password (needs a key with "Can read saved passwords"); null if none fits.
134
+ const account = await qa.signInAccount({ site: 'staging.example.com', tags: ['verified'] });
135
+
136
+ // How many addresses this project can still create: Free has 500 in total
137
+ // and 50 a day (limit null on Team). Past it, createAddress throws a 402.
138
+ const { addresses } = await qa.project();
139
+
140
+ // Testing on localhost? Links to it then pass checkEmail's local-links check.
141
+ await qa.markDevHost('localhost:3000');
142
+
110
143
  // The link that opens a mobile app (myapp://…) when the email also has a web one.
111
144
  const { value: appLink } = await qa.waitForLink(address, { app: true });
112
145
 
@@ -152,6 +185,18 @@ await qa.withAccount(
152
185
  },
153
186
  );
154
187
 
188
+ // Offers (Labs): wait for the coupon (offers can take minutes), apply it at
189
+ // checkout on staging with test payments, then record what the app said.
190
+ const coupon = await qa.waitForCode(address, { type: 'coupon', timeout: 600 });
191
+ await qa.recordCouponResult(address, 'accepted', { code: coupon.value });
192
+
193
+ // Unsubscribing (Labs): after the test unsubscribes in the app (Proxy Mail
194
+ // QA never opens the link), marketing from that sender fails; receipts can
195
+ // still come.
196
+ await qa.markUnsubscribed(address);
197
+ await qa.expectNoEmail(address, { category: 'marketing', since: new Date(), timeout: 300 });
198
+ const { passed } = await qa.checkUnsubscribe(address);
199
+
155
200
  // A run: this client's calls add what they saw, for a report on the pull
156
201
  // request. In GitHub Actions, the Proxy Mail QA action does this for you and
157
202
  // the client picks the run up from PROXYMAIL_QA_RUN.
package/dist/index.d.ts CHANGED
@@ -37,6 +37,17 @@ export interface Address {
37
37
  email_count: number;
38
38
  latest: Omit<Match, 'address' | 'email_id' | 'service_domain'> | null;
39
39
  checked_out_until?: string;
40
+ site?: string;
41
+ environment?: string;
42
+ }
43
+ export interface SignInAccount extends Address {
44
+ password: string;
45
+ used_on_site: boolean;
46
+ }
47
+ export interface SignInOptions {
48
+ site?: string;
49
+ environment?: string;
50
+ tags?: string[];
40
51
  }
41
52
  export interface CheckoutOptions extends Omit<ListAddressesOptions, 'limit' | 'before'> {
42
53
  minutes?: number;
@@ -69,7 +80,7 @@ export interface FormValuesOptions extends Omit<CreateAddressInput, 'password' |
69
80
  }
70
81
  export interface FormValue {
71
82
  id: string;
72
- kind: 'email' | 'confirm_email' | 'first_name' | 'last_name' | 'full_name' | 'username' | 'password' | 'confirm_password' | 'date_of_birth' | 'birth_day' | 'birth_month' | 'birth_year' | 'country' | 'other';
83
+ kind: 'email' | 'confirm_email' | 'first_name' | 'last_name' | 'full_name' | 'username' | 'password' | 'confirm_password' | 'date_of_birth' | 'birth_day' | 'birth_month' | 'birth_year' | 'country' | 'marketing_consent' | 'other';
73
84
  value: string | null;
74
85
  note?: string;
75
86
  }
@@ -115,6 +126,9 @@ export interface Match {
115
126
  received_at: string;
116
127
  expires_at: string | null;
117
128
  email_id: string;
129
+ after_seconds?: number;
130
+ discount?: string | null;
131
+ valid_until?: string | null;
118
132
  }
119
133
  export interface CreateAddressInput {
120
134
  label?: string;
@@ -126,6 +140,8 @@ export interface CreateAddressInput {
126
140
  age?: AgeBand;
127
141
  dateOfBirth?: string;
128
142
  country?: string;
143
+ site?: string;
144
+ environment?: string;
129
145
  }
130
146
  export interface ListAddressesOptions {
131
147
  limit?: number;
@@ -136,6 +152,8 @@ export interface ListAddressesOptions {
136
152
  maxAge?: number;
137
153
  hasPassword?: boolean;
138
154
  search?: string;
155
+ site?: string;
156
+ environment?: string;
139
157
  }
140
158
  export interface AddressPatch {
141
159
  label?: string | null;
@@ -181,7 +199,8 @@ export interface WaitOptions {
181
199
  since?: Date | string;
182
200
  unused?: boolean;
183
201
  }
184
- export type LinkType = 'verify' | 'magic_signin' | 'invite' | 'reset' | 'any';
202
+ export type CodeType = 'otp' | 'coupon' | 'any';
203
+ export type LinkType = 'verify' | 'magic_signin' | 'invite' | 'reset' | 'unsubscribe' | 'list_unsubscribe' | 'any';
185
204
  export interface EmailSummary {
186
205
  received_at: string;
187
206
  service: string | null;
@@ -189,6 +208,16 @@ export interface EmailSummary {
189
208
  type: 'code' | 'link' | null;
190
209
  subtype: string | null;
191
210
  email_id: string;
211
+ after_seconds?: number;
212
+ category?: EmailCategory | null;
213
+ gap_seconds?: number | null;
214
+ attachments?: Array<{
215
+ type: string;
216
+ extension?: string;
217
+ size: number;
218
+ method?: string;
219
+ }>;
220
+ attachment_count?: number | null;
192
221
  }
193
222
  export interface EmailCount {
194
223
  address: string;
@@ -201,13 +230,114 @@ export interface CountOptions {
201
230
  service?: string;
202
231
  type?: 'code' | 'link';
203
232
  subtype?: CountSubtype | CountSubtype[];
233
+ category?: EmailCategory;
204
234
  }
205
- export type CountSubtype = 'otp' | 'coupon' | 'verify' | 'magic_signin' | 'invite' | 'reset' | 'other' | 'any';
206
- export type CheckId = 'spf' | 'dkim' | 'dmarc' | 'local_links' | 'plain_http' | 'expected_host' | 'expiry' | 'plain_text' | 'size' | 'images_only' | 'layout' | 'expected_text' | 'language';
235
+ export type EmailCategory = 'auth' | 'transactional' | 'marketing';
236
+ export type CountSubtype = 'otp' | 'coupon' | 'verify' | 'magic_signin' | 'invite' | 'reset' | 'other' | 'unsubscribe' | 'list_unsubscribe' | 'any';
237
+ export type CheckId = 'spf' | 'dkim' | 'dmarc' | 'local_links' | 'plain_http' | 'expected_host' | 'expiry' | 'coupon_expiry' | 'plain_text' | 'size' | 'images_only' | 'layout' | 'expected_text' | 'language' | 'arrival_time' | 'expected_attachment' | 'list_unsubscribe' | 'one_click_unsubscribe' | 'unsubscribe_link' | 'preheader' | 'after_unsubscribe' | 'offer_reuse' | 'coupon_result' | 'marketing_consent' | 'prechecked_consent' | 'double_opt_in' | 'unsubscribe_deadline' | 'postal_address' | 'sender_identity' | 'minor_marketing' | 'harmful_attachment' | 'spam_risk' | 'misleading_subject' | 'ad_label';
207
238
  export interface EmailCheck {
208
239
  check: CheckId;
209
240
  status: 'pass' | 'fail' | 'warn' | 'skip';
210
241
  detail: string;
242
+ score?: number;
243
+ markers?: Array<{
244
+ id: string;
245
+ points: number;
246
+ }>;
247
+ }
248
+ export interface UnsubscribeWatch {
249
+ id: string;
250
+ sender: string;
251
+ service: string | null;
252
+ unsubscribed_at: string;
253
+ via: 'app' | 'extension' | 'agent' | 'api';
254
+ grace_seconds?: number;
255
+ watching: boolean;
256
+ ended_at: string | null;
257
+ after_unsubscribe: Array<{
258
+ email_id: string;
259
+ received_at: string;
260
+ after_seconds: number;
261
+ }>;
262
+ }
263
+ export interface Consent {
264
+ address: string;
265
+ marketing: 'opted_in' | 'declined' | null;
266
+ prechecked: boolean | null;
267
+ at: string | null;
268
+ double_opt_in: 'confirmed' | 'pending' | null;
269
+ double_opt_in_at: string | null;
270
+ via: string | null;
271
+ country: string | null;
272
+ }
273
+ export interface CouponResults {
274
+ code: string;
275
+ email_id: string;
276
+ discount: string | null;
277
+ valid_until: string | null;
278
+ results: Array<{
279
+ result: 'accepted' | 'rejected' | 'error';
280
+ message: string | null;
281
+ discount_applied: string | null;
282
+ one_time: boolean;
283
+ at: string;
284
+ via: string;
285
+ }>;
286
+ check: EmailCheck | null;
287
+ }
288
+ export interface SequenceStep {
289
+ subject?: string;
290
+ category?: EmailCategory;
291
+ type?: 'code' | 'link';
292
+ after?: string | number;
293
+ within?: string | number;
294
+ }
295
+ export interface SequenceResult {
296
+ address: string;
297
+ since: string;
298
+ passed: boolean;
299
+ done: boolean;
300
+ steps: Array<{
301
+ step: number;
302
+ status: 'pass' | 'early' | 'late' | 'missing' | 'waiting';
303
+ email_id: string | null;
304
+ received_at: string | null;
305
+ expected_at: string | null;
306
+ off_seconds: number | null;
307
+ detail: string;
308
+ }>;
309
+ }
310
+ export interface Offers {
311
+ address: string;
312
+ passed: boolean;
313
+ offers: Array<{
314
+ sender: string;
315
+ service: string | null;
316
+ reused: boolean;
317
+ variants: string[];
318
+ same_code: boolean;
319
+ coupons: Array<{
320
+ variant: string;
321
+ code: string;
322
+ discount: string | null;
323
+ valid_until: string | null;
324
+ received_at: string;
325
+ email_id: string;
326
+ }>;
327
+ }>;
328
+ }
329
+ export interface AddressAllowance {
330
+ limited: boolean;
331
+ used: number;
332
+ limit: number | null;
333
+ left: number | null;
334
+ today: number;
335
+ per_day_limit: number | null;
336
+ }
337
+ export interface UnsubscribeStatus {
338
+ address: string;
339
+ passed: boolean;
340
+ watches: UnsubscribeWatch[];
211
341
  }
212
342
  export interface EmailChecks {
213
343
  address: string;
@@ -229,6 +359,8 @@ export interface CheckOptions extends CountOptions {
229
359
  expectHost?: string;
230
360
  expectText?: string[];
231
361
  expectLanguage?: string;
362
+ expectWithin?: number | string;
363
+ expectAttachment?: string[];
232
364
  }
233
365
  export interface NoEmail {
234
366
  address: string;
@@ -283,13 +415,28 @@ export declare class ProxyMailQA {
283
415
  constructor(options?: ClientOptions);
284
416
  forTest(name: string): ProxyMailQA;
285
417
  private request;
286
- project(): Promise<Record<string, unknown>>;
418
+ project(): Promise<Record<string, unknown> & {
419
+ addresses?: AddressAllowance;
420
+ }>;
421
+ updateProject(patch: {
422
+ name?: string;
423
+ website?: string | null;
424
+ environments?: string[];
425
+ emailPrefix?: string | null;
426
+ mailDomain?: string;
427
+ }): Promise<Record<string, unknown> & {
428
+ addresses?: AddressAllowance;
429
+ }>;
287
430
  createAddress(input: CreateAddressInput & {
288
431
  password: true;
289
432
  }): Promise<CreatedAddressWithPassword>;
290
433
  createAddress(input?: CreateAddressInput): Promise<CreatedAddress>;
291
434
  formValues(options: FormValuesOptions): Promise<FormValues>;
292
435
  listAddresses(options?: ListAddressesOptions): Promise<Address[]>;
436
+ signInAccount(options?: SignInOptions): Promise<SignInAccount | null>;
437
+ markDevHost(host: string): Promise<{
438
+ dev_hosts: string[];
439
+ }>;
293
440
  getAddress(address: string): Promise<Address>;
294
441
  checkOutAccount(options?: CheckoutOptions): Promise<CheckedOutAccount>;
295
442
  extendCheckout(account: CheckedOutAccount, minutes?: number): Promise<{
@@ -308,7 +455,9 @@ export declare class ProxyMailQA {
308
455
  private note;
309
456
  updateAddress(address: string, patch: AddressPatch): Promise<Address>;
310
457
  deleteAddress(address: string): Promise<void>;
311
- waitForCode(address: string, options?: WaitOptions): Promise<Match>;
458
+ waitForCode(address: string, options?: WaitOptions & {
459
+ type?: CodeType;
460
+ }): Promise<Match>;
312
461
  waitForLink(address: string, options?: WaitOptions & {
313
462
  type?: LinkType | LinkType[];
314
463
  app?: boolean;
@@ -323,6 +472,36 @@ export declare class ProxyMailQA {
323
472
  expectNoEmail(address: string, options?: CountOptions & {
324
473
  timeout?: number;
325
474
  }): Promise<NoEmail>;
475
+ markUnsubscribed(address: string, options?: {
476
+ emailId?: string;
477
+ service?: string;
478
+ at?: Date | string;
479
+ grace?: string | number;
480
+ }): Promise<UnsubscribeWatch>;
481
+ markResubscribed(address: string, options?: {
482
+ emailId?: string;
483
+ service?: string;
484
+ }): Promise<UnsubscribeWatch>;
485
+ checkUnsubscribe(address: string): Promise<UnsubscribeStatus>;
486
+ recordConsent(address: string, consent: {
487
+ marketing?: 'opted_in' | 'declined' | null;
488
+ prechecked?: boolean;
489
+ doubleOptIn?: 'confirmed' | 'pending' | null;
490
+ at?: Date | string;
491
+ }): Promise<Consent>;
492
+ consent(address: string): Promise<Consent>;
493
+ recordCouponResult(address: string, result: 'accepted' | 'rejected' | 'error', options?: {
494
+ code?: string;
495
+ emailId?: string;
496
+ message?: string;
497
+ oneTime?: boolean;
498
+ discountApplied?: string;
499
+ at?: Date | string;
500
+ }): Promise<CouponResults>;
501
+ checkSequence(address: string, steps: SequenceStep[], options?: {
502
+ since?: Date | string;
503
+ }): Promise<SequenceResult>;
504
+ offers(address: string): Promise<Offers>;
326
505
  checkDelivery(address: string): Promise<DeliveryStatus>;
327
506
  variants(address: string): Promise<Variants>;
328
507
  setPassword(address: string, options: {
package/dist/index.js CHANGED
@@ -33,6 +33,8 @@ function countQuery(options, extra = {}) {
33
33
  const subtype = [options.subtype ?? []].flat().join(',');
34
34
  if (subtype)
35
35
  query.set('subtype', subtype);
36
+ if (options.category)
37
+ query.set('category', options.category);
36
38
  return query.size ? `?${query}` : '';
37
39
  }
38
40
  const MAX_WAIT_SECONDS = 30;
@@ -86,9 +88,26 @@ export class ProxyMailQA {
86
88
  }
87
89
  return payload;
88
90
  }
91
+ // The key's project: its mail domains, prefix and limits. addresses says
92
+ // how many its space has used and may still create (Free: 500 in total and
93
+ // 50 a day; Team: no limit, so limit is null). Past it, createAddress
94
+ // throws ProxyMailQAError with status 402 and code plan_required.
89
95
  project() {
90
96
  return this.request('GET', '/project');
91
97
  }
98
+ // Changes the key's project, as in Project settings: its name, website,
99
+ // environments, email prefix or default mail domain (one of project()'s
100
+ // mail_domains). Only the fields given change; null clears website or
101
+ // emailPrefix. Needs the project's lead (or an organisation owner or
102
+ // admin), and is in the project's activity log.
103
+ updateProject(patch) {
104
+ const { emailPrefix, mailDomain, ...rest } = patch;
105
+ return this.request('PATCH', '/project', {
106
+ ...rest,
107
+ ...(emailPrefix !== undefined ? { email_prefix: emailPrefix } : {}),
108
+ ...(mailDomain !== undefined ? { mail_domain: mailDomain } : {}),
109
+ });
110
+ }
92
111
  createAddress(input = {}) {
93
112
  return this.request('POST', '/addresses', {
94
113
  label: input.label,
@@ -100,6 +119,8 @@ export class ProxyMailQA {
100
119
  age: input.age,
101
120
  date_of_birth: input.dateOfBirth,
102
121
  country: input.country,
122
+ site: input.site,
123
+ environment: input.environment,
103
124
  });
104
125
  }
105
126
  // What to type or pick in each field of a sign-up form, from a new address
@@ -127,6 +148,8 @@ export class ProxyMailQA {
127
148
  age: options.age,
128
149
  date_of_birth: options.dateOfBirth,
129
150
  country: options.country,
151
+ site: options.site,
152
+ environment: options.environment,
130
153
  });
131
154
  }
132
155
  // Newest first. With filters, finds test accounts made earlier, such as
@@ -149,8 +172,31 @@ export class ProxyMailQA {
149
172
  query.set('has_password', String(options.hasPassword));
150
173
  if (options.search)
151
174
  query.set('search', options.search);
175
+ if (options.site)
176
+ query.set('site', options.site);
177
+ if (options.environment)
178
+ query.set('environment', options.environment);
152
179
  return this.request('GET', `/addresses${query.size ? `?${query}` : ''}`);
153
180
  }
181
+ // The saved test account to sign in with, and its password, in one call:
182
+ // one with a saved password and every tag given, used on this site first,
183
+ // then the one that got mail most recently. null when none fits. Needs a
184
+ // key created with "Can read saved passwords"; every reveal is logged.
185
+ async signInAccount(options = {}) {
186
+ try {
187
+ return await this.request('POST', '/addresses/sign-in', { site: options.site, environment: options.environment, tags: options.tags });
188
+ }
189
+ catch (err) {
190
+ if (err instanceof ProxyMailQAError && err.status === 404)
191
+ return null;
192
+ throw err;
193
+ }
194
+ }
195
+ // Marks a host (localhost:3000, say) as a dev environment of the project:
196
+ // links to it then pass checkEmail's local-links check instead of failing.
197
+ markDevHost(host) {
198
+ return this.request('POST', '/project/dev-hosts', { host });
199
+ }
154
200
  getAddress(address) {
155
201
  return this.request('GET', `/addresses/${encodeURIComponent(address)}`);
156
202
  }
@@ -166,6 +212,8 @@ export class ProxyMailQA {
166
212
  max_age: options.maxAge,
167
213
  has_password: options.hasPassword,
168
214
  search: options.search,
215
+ site: options.site,
216
+ environment: options.environment,
169
217
  minutes: options.minutes,
170
218
  });
171
219
  }
@@ -329,8 +377,12 @@ export class ProxyMailQA {
329
377
  }
330
378
  // Waits for a verification or login code; throws ProxyMailQAError (404) if
331
379
  // none arrives in time.
380
+ // The newest sign-in or verification code; with type: 'coupon', the
381
+ // newest coupon or promo code, with its discount and valid-until date when
382
+ // the email states them. Offers often come minutes later: give a longer
383
+ // timeout (it repeats the request).
332
384
  waitForCode(address, options = {}) {
333
- return this.wait(address, 'code', options);
385
+ return this.wait(address, 'code', options, options.type && options.type !== 'otp' ? options.type : '');
334
386
  }
335
387
  // Waits for a verify, magic sign-in, invite or reset link. When an email has
336
388
  // both a web link and one that opens a mobile app (myapp://…), the web link
@@ -371,9 +423,13 @@ export class ProxyMailQA {
371
423
  extra.expect_host = options.expectHost;
372
424
  if (options.expectLanguage)
373
425
  extra.expect_language = options.expectLanguage;
426
+ if (options.expectWithin !== undefined)
427
+ extra.expect_within = String(options.expectWithin);
374
428
  let query = countQuery(options, extra);
375
429
  for (const phrase of options.expectText ?? [])
376
430
  query += `${query ? '&' : '?'}expect_text=${encodeURIComponent(phrase)}`;
431
+ for (const pattern of options.expectAttachment ?? [])
432
+ query += `${query ? '&' : '?'}expect_attachment=${encodeURIComponent(pattern)}`;
377
433
  return this.request('GET', `/addresses/${encodeURIComponent(address)}/checks${query}`);
378
434
  }
379
435
  // Resolves when no matching email arrives within timeout seconds (default
@@ -396,6 +452,80 @@ export class ProxyMailQA {
396
452
  return { address: result.address, since: result.since, until: result.until };
397
453
  }
398
454
  }
455
+ // markUnsubscribed to offers below are Marketing and offer emails, in Labs:
456
+ // the key's creator switches it on in Account settings → Labs. Until then
457
+ // they throw a 403 that says so.
458
+ // Records that the address unsubscribed from a sender, after the test did
459
+ // it in its own browser (Proxy Mail QA never opens unsubscribe links). Any
460
+ // later marketing email from that sender fails after_unsubscribe, however
461
+ // long after. Name the sender with emailId or service (a name or domain);
462
+ // with neither, the newest marketing email decides. at backdates it.
463
+ // grace ('2h', '1d', or seconds; up to 30 days): marketing within it after
464
+ // unsubscribing doesn't count, for mail already on its way.
465
+ markUnsubscribed(address, options = {}) {
466
+ return this.request('POST', `/addresses/${encodeURIComponent(address)}/unsubscribed`, {
467
+ email_id: options.emailId,
468
+ service: options.service,
469
+ at: options.at instanceof Date ? options.at.toISOString() : options.at,
470
+ grace: options.grace,
471
+ });
472
+ }
473
+ // The address subscribed again: ends the watch for that sender (the only
474
+ // one, when there's one).
475
+ markResubscribed(address, options = {}) {
476
+ const query = new URLSearchParams({ ...(options.service ? { service: options.service } : {}), ...(options.emailId ? { email_id: options.emailId } : {}) });
477
+ return this.request('DELETE', `/addresses/${encodeURIComponent(address)}/unsubscribed${query.size ? `?${query}` : ''}`);
478
+ }
479
+ // Each unsubscribe and the marketing emails that came after it, by id and
480
+ // how long after; passed is false when any came.
481
+ checkUnsubscribe(address) {
482
+ return this.request('GET', `/addresses/${encodeURIComponent(address)}/unsubscribed`);
483
+ }
484
+ // Records what the address agreed to at sign-up: marketing (opted_in or
485
+ // declined), prechecked (the box was ticked when the form loaded) and
486
+ // doubleOptIn (confirmed or pending). Only what's given changes. checkEmail
487
+ // then judges marketing email by the rules where the persona lives.
488
+ recordConsent(address, consent) {
489
+ return this.request('PUT', `/addresses/${encodeURIComponent(address)}/consent`, {
490
+ marketing: consent.marketing,
491
+ prechecked: consent.prechecked,
492
+ double_opt_in: consent.doubleOptIn,
493
+ at: consent.at instanceof Date ? consent.at.toISOString() : consent.at,
494
+ });
495
+ }
496
+ consent(address) {
497
+ return this.request('GET', `/addresses/${encodeURIComponent(address)}/consent`);
498
+ }
499
+ // After applying a coupon at checkout (on staging with test payments: never
500
+ // real card details), records what the app did: accepted, rejected or an
501
+ // error, with its message. The answer's check is the coupon_result verdict:
502
+ // it fails a coupon accepted after its end date, for an offer already given
503
+ // to another version of the address, or twice when oneTime.
504
+ recordCouponResult(address, result, options = {}) {
505
+ return this.request('POST', `/addresses/${encodeURIComponent(address)}/coupon-result`, {
506
+ result,
507
+ code: options.code,
508
+ email_id: options.emailId,
509
+ message: options.message,
510
+ one_time: options.oneTime,
511
+ discount_applied: options.discountApplied,
512
+ at: options.at instanceof Date ? options.at.toISOString() : options.at,
513
+ });
514
+ }
515
+ // Whether a welcome series or drip campaign came in order and on time after
516
+ // since: each step answers pass, early, late, missing or waiting.
517
+ checkSequence(address, steps, options = {}) {
518
+ return this.request('POST', `/addresses/${encodeURIComponent(address)}/sequence`, {
519
+ steps,
520
+ since: options.since instanceof Date ? options.since.toISOString() : options.since,
521
+ });
522
+ }
523
+ // Each sender's coupons and which version of the address each went to.
524
+ // Mail to name+promo1@… and NAME@… reaches one inbox, so passed is false
525
+ // when an offer reached two or more of them: one person got it twice.
526
+ offers(address) {
527
+ return this.request('GET', `/addresses/${encodeURIComponent(address)}/offers`);
528
+ }
399
529
  // What reached the address and what was refused, without waiting: for when
400
530
  // a wait comes back empty.
401
531
  checkDelivery(address) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "proxymail-qa",
3
- "version": "0.8.1",
4
- "description": "Disposable test inboxes for Playwright, Cypress and scripts: create an address, then wait for its verification code or link.",
3
+ "version": "0.10.0",
4
+ "description": "Test every email your app sends from Playwright, Cypress, Jest, Vitest or any Node script: disposable inboxes, sign-up codes, links and coupons, email checks, unsubscribe tests and run reports.",
5
5
  "license": "MIT",
6
6
  "author": "Proxy Mail QA <hello@proxymail.qa> (https://proxymail.qa)",
7
7
  "homepage": "https://proxymail.qa/docs/node",
@@ -20,6 +20,18 @@
20
20
  "email verification",
21
21
  "playwright",
22
22
  "cypress",
23
+ "puppeteer",
24
+ "jest",
25
+ "vitest",
26
+ "e2e",
27
+ "end-to-end testing",
28
+ "email deliverability",
29
+ "spf",
30
+ "dkim",
31
+ "test accounts",
32
+ "coupon",
33
+ "unsubscribe",
34
+ "marketing email",
23
35
  "qa"
24
36
  ],
25
37
  "type": "module",