proxymail-qa 0.13.0 → 0.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 CHANGED
@@ -14,17 +14,23 @@ it. Then:
14
14
  - wait for a coupon, record whether checkout took it, and catch an offer
15
15
  given twice to versions of one address
16
16
  - test unsubscribing: any marketing email from that sender afterwards fails
17
- - check marketing emails: unsubscribe headers, a spam score and the consent
17
+ - check marketing emails: unsubscribe headers, an inbox score and the consent
18
18
  rules where the persona lives
19
19
  - check a welcome series or drip campaign came in order and on time
20
20
  - find out why an email didn't arrive
21
21
  - group tests into a run whose report says which test each email came from
22
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.
23
+ The coupon and marketing checks come with projects that test offers or
24
+ marketing, and the inbox score (out of 10, where 10 is good) and the
25
+ attachment check with the project's spam checks: both are set in the app under
26
+ Project settings → What you test, or with
27
+ `updateProject({ areas, spamChecks })`. `checkEmail` leaves out the checks of
28
+ what the project has off.
29
+
30
+ A site's journey (`journey()`, with its five good-practice checks) is in
31
+ [Labs](https://proxymail.qa/docs/labs) for now: the key's creator switches it
32
+ on in the app under Account settings → Labs. Until then `journey()` throws
33
+ with a 403 that says so, and `checkEmail` leaves those checks out.
28
34
 
29
35
  Get an API key in [app.proxymail.qa](https://app.proxymail.qa) → Project
30
36
  settings → API keys (the Free plan includes it), and set it as
@@ -270,12 +276,12 @@ await qa.withAccount(
270
276
  },
271
277
  );
272
278
 
273
- // Offers (Labs): wait for the coupon (offers can take minutes), apply it at
279
+ // Offers: wait for the coupon (offers can take minutes), apply it at
274
280
  // checkout on staging with test payments, then record what the app said.
275
281
  const coupon = await qa.waitForCode(address, { type: 'coupon', timeout: 600 });
276
282
  await qa.recordCouponResult(address, 'accepted', { code: coupon.value });
277
283
 
278
- // Unsubscribing (Labs): after the test unsubscribes in the app (Proxy Mail
284
+ // Unsubscribing: after the test unsubscribes in the app (Proxy Mail
279
285
  // QA never opens the link), marketing from that sender fails; receipts can
280
286
  // still come.
281
287
  await qa.markUnsubscribed(address);
@@ -1,4 +1,4 @@
1
- export declare const CYPRESS_METHODS: readonly ["project", "updateProject", "customFields", "saveCustomField", "deleteCustomField", "setCustomFieldEnabled", "setStandardField", "sites", "addSite", "setMultiStep", "saveSignupScreen", "removeSignupScreen", "createAddress", "formValues", "listAddresses", "signInAccount", "totpCode", "listFormSections", "signupStarters", "getFormSection", "followsFormat", "signupForms", "signupForm", "saveSignupForm", "deleteSignupForm", "signupFormCode", "signupFormTest", "cleanupList", "markDevHost", "getAddress", "checkOutAccount", "extendCheckout", "returnAccount", "updateAddress", "deleteAddress", "markSubmitted", "waitForCode", "waitForLink", "messages", "countEmails", "checkEmail", "expectNoEmail", "markUnsubscribed", "markResubscribed", "checkUnsubscribe", "consent", "recordConsent", "recordCouponResult", "checkSequence", "offers", "checkDelivery", "variants", "nameVariants", "passwordVariants", "flowChecks", "setPassword", "savedPassword", "getRun", "runReport", "listRuns", "addRunNote"];
1
+ export declare const CYPRESS_METHODS: readonly ["project", "updateProject", "customFields", "saveCustomField", "deleteCustomField", "setCustomFieldEnabled", "setStandardField", "sites", "addSite", "setMultiStep", "saveSignupScreen", "removeSignupScreen", "createAddress", "formValues", "listAddresses", "signInAccount", "totpCode", "listFormSections", "signupStarters", "getFormSection", "followsFormat", "signupForms", "signupForm", "saveSignupForm", "deleteSignupForm", "signupFormCode", "signupFormTest", "cleanupList", "journey", "markDevHost", "getAddress", "checkOutAccount", "extendCheckout", "returnAccount", "updateAddress", "deleteAddress", "markSubmitted", "waitForCode", "waitForLink", "messages", "countEmails", "checkEmail", "expectNoEmail", "markUnsubscribed", "markResubscribed", "checkUnsubscribe", "consent", "recordConsent", "recordCouponResult", "checkSequence", "offers", "checkDelivery", "variants", "nameVariants", "passwordVariants", "flowChecks", "setPassword", "savedPassword", "getRun", "runReport", "listRuns", "addRunNote"];
2
2
  export type CypressMethod = (typeof CYPRESS_METHODS)[number];
3
3
  export declare const NOT_IN_CYPRESS: readonly ["forTest", "withAccount", "startRun", "finishRun", "recordTest", "recordTestTotals"];
4
4
  export declare const CYPRESS_TASK = "proxymail-qa";
@@ -31,6 +31,7 @@ export const CYPRESS_METHODS = [
31
31
  'signupFormCode',
32
32
  'signupFormTest',
33
33
  'cleanupList',
34
+ 'journey',
34
35
  'markDevHost',
35
36
  'getAddress',
36
37
  'checkOutAccount',
package/dist/index.d.ts CHANGED
@@ -470,7 +470,10 @@ export type ProjectInfo = Record<string, unknown> & {
470
470
  locked?: boolean;
471
471
  custom_fields?: number;
472
472
  multi_step_sites?: string[];
473
+ areas?: ProjectArea[];
474
+ spam_checks?: boolean;
473
475
  };
476
+ export type ProjectArea = 'signup' | 'offers' | 'marketing' | 'receipts';
474
477
  export interface FormValues {
475
478
  address: string;
476
479
  created: boolean;
@@ -624,7 +627,7 @@ export interface SharedSender {
624
627
  fix: string;
625
628
  docs: string;
626
629
  }
627
- export type NothingArrivedCase = 'nothing_arrived' | 'no_match' | 'turned_away' | 'already_used';
630
+ export type NothingArrivedCase = 'nothing_arrived' | 'no_match' | 'turned_away' | 'already_used' | 'arrived_before_since';
628
631
  export interface Variant {
629
632
  tests: string;
630
633
  address: string;
@@ -677,11 +680,12 @@ export interface CountOptions {
677
680
  }
678
681
  export type EmailCategory = 'auth' | 'transactional' | 'marketing';
679
682
  export type CountSubtype = 'otp' | 'coupon' | 'verify' | 'magic_signin' | 'invite' | 'reset' | 'other' | 'unsubscribe' | 'list_unsubscribe' | 'any';
680
- export type CheckId = 'spf' | 'dkim' | 'dmarc' | 'shared_sender' | 'local_links' | 'plain_http' | 'expected_host' | 'link_site' | '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';
683
+ export type CheckId = 'spf' | 'dkim' | 'dmarc' | 'shared_sender' | 'local_links' | 'plain_http' | 'expected_host' | 'link_site' | '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' | 'code_length' | 'link_length' | 'auth_length' | 'subject_length' | 'one_action';
681
684
  export interface EmailCheck {
682
685
  check: CheckId;
683
686
  status: 'pass' | 'fail' | 'warn' | 'skip';
684
687
  detail: string;
688
+ inbox_score?: number;
685
689
  score?: number;
686
690
  markers?: Array<{
687
691
  id: string;
@@ -914,6 +918,121 @@ export interface FlowChecks {
914
918
  flow: Flow;
915
919
  checks: FlowCheck[];
916
920
  }
921
+ export type JourneyPhase = 'after_signup' | 'signing_in' | 'password_reset' | 'invites' | 'ongoing';
922
+ export type JourneyAgeBand = 'under-18' | '18-24' | '25-34' | '35-44' | '45-54' | '55-plus';
923
+ export interface JourneyOptions {
924
+ site?: string;
925
+ phase?: JourneyPhase;
926
+ country?: string[];
927
+ countryUnknown?: boolean;
928
+ age?: JourneyAgeBand[];
929
+ ageUnknown?: boolean;
930
+ anyTags?: string[];
931
+ address?: string;
932
+ gotStep?: string[];
933
+ notGotStep?: string[];
934
+ }
935
+ export interface JourneyStepOut {
936
+ type: 'step';
937
+ key: string;
938
+ kind: string;
939
+ kind_name: string;
940
+ sender: string;
941
+ got: number;
942
+ of: number | null;
943
+ wait: {
944
+ ms: number;
945
+ kind: 'one' | 'two' | 'usual' | null;
946
+ all_ms: number[];
947
+ range_ms?: [number, number];
948
+ from: string;
949
+ } | null;
950
+ countries: Record<string, number>;
951
+ age_bands: Record<string, number>;
952
+ still_due: {
953
+ addresses: string[];
954
+ left_out: number;
955
+ usually_after_ms: number | null;
956
+ };
957
+ did_not_get: {
958
+ addresses: string[];
959
+ left_out: number;
960
+ } | null;
961
+ warnings: Array<{
962
+ id: string;
963
+ text: string;
964
+ }>;
965
+ emails: Array<{
966
+ id: string;
967
+ address: string;
968
+ received_at: string;
969
+ }>;
970
+ emails_left_out?: number;
971
+ }
972
+ export interface JourneyPathFilter {
973
+ site: string;
974
+ country?: string[];
975
+ country_unknown?: boolean;
976
+ age?: JourneyAgeBand[];
977
+ age_unknown?: boolean;
978
+ any_tags?: string[];
979
+ address?: string;
980
+ got_step?: string[];
981
+ not_got_step?: string[];
982
+ }
983
+ export interface JourneySplit {
984
+ type: 'split';
985
+ by: 'country' | 'age band' | 'tag';
986
+ paths: Array<{
987
+ label: string;
988
+ accounts: number;
989
+ filter: JourneyPathFilter;
990
+ query: string;
991
+ steps: JourneyStepOut[];
992
+ }>;
993
+ }
994
+ export interface Journey {
995
+ showing: string;
996
+ notes: string[];
997
+ link: string;
998
+ journey: string;
999
+ name: string;
1000
+ by: 'site' | 'sender';
1001
+ journeys: Array<{
1002
+ journey: string;
1003
+ name: string;
1004
+ by: 'site' | 'sender';
1005
+ accounts: number;
1006
+ }>;
1007
+ accounts: {
1008
+ shown: number;
1009
+ total: number;
1010
+ with_no_email: number;
1011
+ };
1012
+ emails: number;
1013
+ truncated: boolean;
1014
+ filters_left_off: number;
1015
+ filter_values: Record<'country' | 'age' | 'tags', Array<{
1016
+ value: string;
1017
+ accounts: number;
1018
+ chosen?: boolean;
1019
+ }>> & Partial<Record<'country_unknown' | 'age_unknown', {
1020
+ accounts: number;
1021
+ chosen?: boolean;
1022
+ }>>;
1023
+ phases: Array<{
1024
+ phase: JourneyPhase;
1025
+ name: string;
1026
+ started_by: string;
1027
+ steps: Array<JourneyStepOut | JourneySplit>;
1028
+ }>;
1029
+ good_practice: Array<{
1030
+ rule: string;
1031
+ name: string;
1032
+ checked: number;
1033
+ warned: number;
1034
+ }>;
1035
+ }
917
1036
  export interface AddressAllowance {
918
1037
  limited: boolean;
919
1038
  used: number;
@@ -1001,6 +1120,7 @@ export interface Run {
1001
1120
  likely_spam: number;
1002
1121
  may_spam: number;
1003
1122
  harmful_attachments: number;
1123
+ lowest_inbox_score?: number | null;
1004
1124
  highest_spam_score: number | null;
1005
1125
  };
1006
1126
  comparison?: {
@@ -1039,6 +1159,8 @@ export declare class ProxyMailQA {
1039
1159
  mailDomain?: string;
1040
1160
  fillUnknownFields?: FillUnknownFields;
1041
1161
  fillIdFields?: boolean;
1162
+ areas?: ProjectArea[];
1163
+ spamChecks?: boolean;
1042
1164
  }): Promise<ProjectInfo>;
1043
1165
  customFields(): Promise<CustomFields>;
1044
1166
  saveCustomField(field: CustomFieldInput): Promise<CustomFieldSaved>;
@@ -1115,6 +1237,7 @@ export declare class ProxyMailQA {
1115
1237
  problem?: string;
1116
1238
  };
1117
1239
  cleanupList(options?: CleanupListOptions): Promise<CleanupList>;
1240
+ journey(options?: JourneyOptions | JourneyPathFilter): Promise<Journey>;
1118
1241
  markDevHost(host: string): Promise<{
1119
1242
  dev_hosts: string[];
1120
1243
  }>;
package/dist/index.js CHANGED
@@ -101,7 +101,8 @@ export class ProxyMailQA {
101
101
  // throws ProxyMailQAError with status 402 and code plan_required; past the
102
102
  // day's 50, status 429 and code daily_limit, until midnight UTC.
103
103
  // From 0.12.0 it also has fill_unknown_fields, standard_fields_off, locked,
104
- // custom_fields (how many) and multi_step_sites.
104
+ // custom_fields (how many) and multi_step_sites; from 0.13.0, fill_id_fields;
105
+ // from 0.15.0, areas and spam_checks.
105
106
  project() {
106
107
  return this.request('GET', '/project');
107
108
  }
@@ -117,15 +118,18 @@ export class ProxyMailQA {
117
118
  // person asks; for one call, pass guess to formValues. fillIdFields (new in
118
119
  // 0.13.0) true adds the five ID and tax number ready-made custom fields, or
119
120
  // turns on those there, and false turns them off: a lead's key only, and
120
- // only when the person asks.
121
+ // only when the person asks. areas (the whole list, at least one) and
122
+ // spamChecks (both new in 0.15.0) need the lead too; spam checks can fail a
123
+ // run.
121
124
  updateProject(patch) {
122
- const { emailPrefix, mailDomain, fillUnknownFields, fillIdFields, ...rest } = patch;
125
+ const { emailPrefix, mailDomain, fillUnknownFields, fillIdFields, spamChecks, ...rest } = patch;
123
126
  return this.request('PATCH', '/project', {
124
127
  ...rest,
125
128
  ...(emailPrefix !== undefined ? { email_prefix: emailPrefix } : {}),
126
129
  ...(mailDomain !== undefined ? { mail_domain: mailDomain } : {}),
127
130
  ...(fillUnknownFields !== undefined ? { fill_unknown_fields: fillUnknownFields } : {}),
128
131
  ...(fillIdFields !== undefined ? { fill_id_fields: fillIdFields } : {}),
132
+ ...(spamChecks !== undefined ? { spam_checks: spamChecks } : {}),
129
133
  });
130
134
  }
131
135
  // The project's custom fields, its guesses setting and whether only leads
@@ -402,8 +406,9 @@ export class ProxyMailQA {
402
406
  return this.request('GET', `/form-sections${query ? `?${query}` : ''}`);
403
407
  }
404
408
  // One section: for an ID or tax number, its format in a country, a fake
405
- // value that follows it, and variants. Give address to keep the value the
406
- // same for that test account (New in 0.13.0).
409
+ // value that follows it, given only where one can never be a real person's, and
410
+ // variants. Give address to keep the value the same for that test account
411
+ // (New in 0.13.0).
407
412
  getFormSection(id, options = {}) {
408
413
  const q = new URLSearchParams();
409
414
  if (options.country)
@@ -436,6 +441,31 @@ export class ProxyMailQA {
436
441
  const query = q.toString();
437
442
  return this.request('GET', `/cleanup-list${query ? `?${query}` : ''}`);
438
443
  }
444
+ // A site's journey, as the Journeys page draws it, for all the project's
445
+ // test accounts or the ones the options pick (Journeys Lab; new in 0.14.0).
446
+ // A split path's filter works as the options too.
447
+ journey(options = {}) {
448
+ const o = options;
449
+ const q = new URLSearchParams();
450
+ // A comma inside a value is written %2C, as the page's address writes it.
451
+ const list = (items) => (items?.length ? items.map((item) => item.replace(/%/g, '%25').replace(/,/g, '%2C')).join(',') : null);
452
+ const put = (name, value) => {
453
+ if (value)
454
+ q.set(name, value);
455
+ };
456
+ put('site', o.site);
457
+ put('phase', o.phase);
458
+ put('country', list(o.country));
459
+ put('country_unknown', o.countryUnknown || o.country_unknown ? '1' : null);
460
+ put('age', list(o.age));
461
+ put('age_unknown', o.ageUnknown || o.age_unknown ? '1' : null);
462
+ put('any_tags', list(o.anyTags ?? o.any_tags));
463
+ put('address', o.address);
464
+ put('got_step', list(o.gotStep ?? o.got_step));
465
+ put('not_got_step', list(o.notGotStep ?? o.not_got_step));
466
+ const query = q.toString();
467
+ return this.request('GET', `/journeys${query ? `?${query}` : ''}`);
468
+ }
439
469
  markDevHost(host) {
440
470
  return this.request('POST', '/project/dev-hosts', { host });
441
471
  }
@@ -617,13 +647,14 @@ export class ProxyMailQA {
617
647
  deleteAddress(address) {
618
648
  return this.request('DELETE', `/addresses/${encodeURIComponent(address)}`);
619
649
  }
620
- // Records that the test has just submitted a form with the address (a
650
+ // Records that the test is about to submit a form with the address (a
621
651
  // sign-up unless flow says otherwise), on site (a page URL, kept as host and
622
652
  // path, with any part of the path that has an email address, an ID, a long
623
- // number or a token in it hidden; never its query or fragment). The time is the
624
- // server's: the wait that finds the code or link then returns
625
- // time_to_email. Pass its submitted_at as since. Never send the form's
626
- // contents.
653
+ // number or a token in it hidden; never its query or fragment). Call it just
654
+ // before the test presses the button: the time is the server's, taken when
655
+ // the call arrives, so after the click a fast email can come first. Pass its
656
+ // submitted_at as since; the wait that finds the code or link then returns
657
+ // time_to_email. Never send the form's contents.
627
658
  markSubmitted(address, options = {}) {
628
659
  return this.request('POST', `/addresses/${encodeURIComponent(address)}/submits`, { flow: options.flow, site: options.site });
629
660
  }
@@ -707,9 +738,8 @@ export class ProxyMailQA {
707
738
  return { address: result.address, since: result.since, until: result.until };
708
739
  }
709
740
  }
710
- // markUnsubscribed to offers below are Marketing and offer emails, in Labs:
711
- // the key's creator switches it on in Account settings → Labs. Until then
712
- // they throw a 403 that says so.
741
+ // markUnsubscribed to offers below are for projects that test offers or
742
+ // marketing (Project settings → What you test, or updateProject({ areas })).
713
743
  // Records that the address unsubscribed from a sender, after the test did
714
744
  // it in its own browser (Proxy Mail QA never opens unsubscribe links). Any
715
745
  // later marketing email from that sender fails after_unsubscribe, however
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proxymail-qa",
3
- "version": "0.13.0",
3
+ "version": "0.15.0",
4
4
  "description": "Test every email your app sends from Playwright, Cypress, Jest, Vitest, any Node script or the command line: 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)",