proxymail-qa 0.8.1 → 0.9.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 +7 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +29 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -107,6 +107,13 @@ await qa.createAddress({ persona: true, age: 'under13', country: 'GB' });
|
|
|
107
107
|
// Find a test account made earlier: an under-18 in GB with a saved password.
|
|
108
108
|
const [teen] = await qa.listAddresses({ tags: ['age-gate'], country: 'GB', maxAge: 17, hasPassword: true });
|
|
109
109
|
|
|
110
|
+
// Sign in again as a saved test account: the one used on this site first, with
|
|
111
|
+
// its password (needs a key with "Can read saved passwords"); null if none fits.
|
|
112
|
+
const account = await qa.signInAccount({ site: 'staging.example.com', tags: ['verified'] });
|
|
113
|
+
|
|
114
|
+
// Testing on localhost? Links to it then pass checkEmail's local-links check.
|
|
115
|
+
await qa.markDevHost('localhost:3000');
|
|
116
|
+
|
|
110
117
|
// The link that opens a mobile app (myapp://…) when the email also has a web one.
|
|
111
118
|
const { value: appLink } = await qa.waitForLink(address, { app: true });
|
|
112
119
|
|
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;
|
|
@@ -126,6 +137,8 @@ export interface CreateAddressInput {
|
|
|
126
137
|
age?: AgeBand;
|
|
127
138
|
dateOfBirth?: string;
|
|
128
139
|
country?: string;
|
|
140
|
+
site?: string;
|
|
141
|
+
environment?: string;
|
|
129
142
|
}
|
|
130
143
|
export interface ListAddressesOptions {
|
|
131
144
|
limit?: number;
|
|
@@ -136,6 +149,8 @@ export interface ListAddressesOptions {
|
|
|
136
149
|
maxAge?: number;
|
|
137
150
|
hasPassword?: boolean;
|
|
138
151
|
search?: string;
|
|
152
|
+
site?: string;
|
|
153
|
+
environment?: string;
|
|
139
154
|
}
|
|
140
155
|
export interface AddressPatch {
|
|
141
156
|
label?: string | null;
|
|
@@ -290,6 +305,10 @@ export declare class ProxyMailQA {
|
|
|
290
305
|
createAddress(input?: CreateAddressInput): Promise<CreatedAddress>;
|
|
291
306
|
formValues(options: FormValuesOptions): Promise<FormValues>;
|
|
292
307
|
listAddresses(options?: ListAddressesOptions): Promise<Address[]>;
|
|
308
|
+
signInAccount(options?: SignInOptions): Promise<SignInAccount | null>;
|
|
309
|
+
markDevHost(host: string): Promise<{
|
|
310
|
+
dev_hosts: string[];
|
|
311
|
+
}>;
|
|
293
312
|
getAddress(address: string): Promise<Address>;
|
|
294
313
|
checkOutAccount(options?: CheckoutOptions): Promise<CheckedOutAccount>;
|
|
295
314
|
extendCheckout(account: CheckedOutAccount, minutes?: number): Promise<{
|
package/dist/index.js
CHANGED
|
@@ -100,6 +100,8 @@ export class ProxyMailQA {
|
|
|
100
100
|
age: input.age,
|
|
101
101
|
date_of_birth: input.dateOfBirth,
|
|
102
102
|
country: input.country,
|
|
103
|
+
site: input.site,
|
|
104
|
+
environment: input.environment,
|
|
103
105
|
});
|
|
104
106
|
}
|
|
105
107
|
// What to type or pick in each field of a sign-up form, from a new address
|
|
@@ -127,6 +129,8 @@ export class ProxyMailQA {
|
|
|
127
129
|
age: options.age,
|
|
128
130
|
date_of_birth: options.dateOfBirth,
|
|
129
131
|
country: options.country,
|
|
132
|
+
site: options.site,
|
|
133
|
+
environment: options.environment,
|
|
130
134
|
});
|
|
131
135
|
}
|
|
132
136
|
// Newest first. With filters, finds test accounts made earlier, such as
|
|
@@ -149,8 +153,31 @@ export class ProxyMailQA {
|
|
|
149
153
|
query.set('has_password', String(options.hasPassword));
|
|
150
154
|
if (options.search)
|
|
151
155
|
query.set('search', options.search);
|
|
156
|
+
if (options.site)
|
|
157
|
+
query.set('site', options.site);
|
|
158
|
+
if (options.environment)
|
|
159
|
+
query.set('environment', options.environment);
|
|
152
160
|
return this.request('GET', `/addresses${query.size ? `?${query}` : ''}`);
|
|
153
161
|
}
|
|
162
|
+
// The saved test account to sign in with, and its password, in one call:
|
|
163
|
+
// one with a saved password and every tag given, used on this site first,
|
|
164
|
+
// then the one that got mail most recently. null when none fits. Needs a
|
|
165
|
+
// key created with "Can read saved passwords"; every reveal is logged.
|
|
166
|
+
async signInAccount(options = {}) {
|
|
167
|
+
try {
|
|
168
|
+
return await this.request('POST', '/addresses/sign-in', { site: options.site, environment: options.environment, tags: options.tags });
|
|
169
|
+
}
|
|
170
|
+
catch (err) {
|
|
171
|
+
if (err instanceof ProxyMailQAError && err.status === 404)
|
|
172
|
+
return null;
|
|
173
|
+
throw err;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// Marks a host (localhost:3000, say) as a dev environment of the project:
|
|
177
|
+
// links to it then pass checkEmail's local-links check instead of failing.
|
|
178
|
+
markDevHost(host) {
|
|
179
|
+
return this.request('POST', '/project/dev-hosts', { host });
|
|
180
|
+
}
|
|
154
181
|
getAddress(address) {
|
|
155
182
|
return this.request('GET', `/addresses/${encodeURIComponent(address)}`);
|
|
156
183
|
}
|
|
@@ -166,6 +193,8 @@ export class ProxyMailQA {
|
|
|
166
193
|
max_age: options.maxAge,
|
|
167
194
|
has_password: options.hasPassword,
|
|
168
195
|
search: options.search,
|
|
196
|
+
site: options.site,
|
|
197
|
+
environment: options.environment,
|
|
169
198
|
minutes: options.minutes,
|
|
170
199
|
});
|
|
171
200
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "proxymail-qa",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.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)",
|