proxymail-qa 0.2.0 → 0.3.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
@@ -86,6 +86,9 @@ cy.task('createAddress').then(({ address }) => {
86
86
  // A persona with a date of birth for an age band, and a country.
87
87
  await qa.createAddress({ persona: true, age: 'under13', country: 'GB' });
88
88
 
89
+ // Find a test account made earlier: an under-18 in GB with a saved password.
90
+ const [teen] = await qa.listAddresses({ tags: ['age-gate'], country: 'GB', maxAge: 17, hasPassword: true });
91
+
89
92
  // The link that opens a mobile app (myapp://…) when the email also has a web one.
90
93
  const { value: appLink } = await qa.waitForLink(address, { app: true });
91
94
 
package/dist/index.d.ts CHANGED
@@ -57,6 +57,16 @@ export interface CreateAddressInput {
57
57
  dateOfBirth?: string;
58
58
  country?: string;
59
59
  }
60
+ export interface ListAddressesOptions {
61
+ limit?: number;
62
+ before?: string;
63
+ tags?: string[];
64
+ country?: string;
65
+ minAge?: number;
66
+ maxAge?: number;
67
+ hasPassword?: boolean;
68
+ search?: string;
69
+ }
60
70
  export interface AddressPatch {
61
71
  label?: string | null;
62
72
  notes?: string | null;
@@ -146,10 +156,7 @@ export declare class ProxyMailQA {
146
156
  password: true;
147
157
  }): Promise<CreatedAddressWithPassword>;
148
158
  createAddress(input?: CreateAddressInput): Promise<CreatedAddress>;
149
- listAddresses(options?: {
150
- limit?: number;
151
- before?: string;
152
- }): Promise<Address[]>;
159
+ listAddresses(options?: ListAddressesOptions): Promise<Address[]>;
153
160
  getAddress(address: string): Promise<Address>;
154
161
  updateAddress(address: string, patch: AddressPatch): Promise<Address>;
155
162
  deleteAddress(address: string): Promise<void>;
package/dist/index.js CHANGED
@@ -79,12 +79,26 @@ export class ProxyMailQA {
79
79
  country: input.country,
80
80
  });
81
81
  }
82
+ // Newest first. With filters, finds test accounts made earlier, such as
83
+ // an under-18 in GB with a saved password: every filter given must match.
82
84
  listAddresses(options = {}) {
83
85
  const query = new URLSearchParams();
84
86
  if (options.limit)
85
87
  query.set('limit', String(options.limit));
86
88
  if (options.before)
87
89
  query.set('before', options.before);
90
+ for (const tag of options.tags ?? [])
91
+ query.append('tag', tag);
92
+ if (options.country)
93
+ query.set('country', options.country);
94
+ if (options.minAge !== undefined)
95
+ query.set('min_age', String(options.minAge));
96
+ if (options.maxAge !== undefined)
97
+ query.set('max_age', String(options.maxAge));
98
+ if (options.hasPassword !== undefined)
99
+ query.set('has_password', String(options.hasPassword));
100
+ if (options.search)
101
+ query.set('search', options.search);
88
102
  return this.request('GET', `/addresses${query.size ? `?${query}` : ''}`);
89
103
  }
90
104
  getAddress(address) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proxymail-qa",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Disposable test inboxes for Playwright, Cypress and scripts: create an address, then wait for its verification code or link.",
5
5
  "license": "MIT",
6
6
  "author": "Proxy Mail QA <hello@proxymail.qa> (https://proxymail.qa)",