proxymail-qa 0.12.0 → 0.14.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 +41 -11
- package/dist/cli-main.d.ts +19 -0
- package/dist/cli-main.js +373 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +27 -0
- package/dist/cypress-methods.d.ts +9 -0
- package/dist/cypress-methods.js +72 -0
- package/dist/cypress-plugin.d.ts +4 -0
- package/dist/cypress-plugin.js +28 -0
- package/dist/cypress.d.ts +32 -0
- package/dist/cypress.js +42 -0
- package/dist/index.d.ts +580 -6
- package/dist/index.js +333 -6
- package/package.json +19 -4
package/dist/cypress.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Cypress commands (FM-15), matching the Playwright helper: cy.proxymail has
|
|
2
|
+
// the client's methods, for the test it's in. Import it in the support file
|
|
3
|
+
// and register the task with setupProxyMailQA from proxymail-qa/cypress/plugin.
|
|
4
|
+
//
|
|
5
|
+
// // cypress/support/e2e.ts
|
|
6
|
+
// import 'proxymail-qa/cypress';
|
|
7
|
+
//
|
|
8
|
+
// it('signs up', () => {
|
|
9
|
+
// cy.proxymail.createAddress({ persona: true }).then(({ address }) => {
|
|
10
|
+
// …
|
|
11
|
+
// cy.proxymail.waitForCode(address).then(({ value }) => cy.get('[name=code]').type(value));
|
|
12
|
+
// });
|
|
13
|
+
// });
|
|
14
|
+
//
|
|
15
|
+
// Each command runs in Node through cy.task, so the API key never reaches the
|
|
16
|
+
// browser. In a run, each call says which test it came from.
|
|
17
|
+
import { CYPRESS_METHODS, CYPRESS_TASK } from './cypress-methods.js';
|
|
18
|
+
import { testName } from './test-name.js';
|
|
19
|
+
const WAITS = new Set(['waitForCode', 'waitForLink', 'expectNoEmail']);
|
|
20
|
+
const DEFAULT_WAIT = 30;
|
|
21
|
+
// Cypress gives up on a task after 60 seconds; a wait can hold for its
|
|
22
|
+
// timeout, so give it that and a margin.
|
|
23
|
+
export function taskTimeout(method, args) {
|
|
24
|
+
if (!WAITS.has(method))
|
|
25
|
+
return undefined;
|
|
26
|
+
const options = args[1];
|
|
27
|
+
return ((options?.timeout ?? DEFAULT_WAIT) + 30) * 1000;
|
|
28
|
+
}
|
|
29
|
+
// Builds cy.proxymail from Cypress's globals; exported for the tests.
|
|
30
|
+
export function proxymailCommands(Cypress, cy) {
|
|
31
|
+
const call = (method, args) => {
|
|
32
|
+
const test = Cypress.currentTest;
|
|
33
|
+
const name = test ? testName('', test.titlePath ?? (test.title ? [test.title] : [])) : '';
|
|
34
|
+
Cypress.log({ name: 'proxymail', displayName: 'proxymail', message: [method, typeof args[0] === 'string' ? args[0] : ''].filter(Boolean).join(' ') });
|
|
35
|
+
return cy.task(CYPRESS_TASK, { method, args, test: name || null }, { log: false, timeout: taskTimeout(method, args) });
|
|
36
|
+
};
|
|
37
|
+
return Object.fromEntries(CYPRESS_METHODS.map((method) => [method, (...args) => call(method, args)]));
|
|
38
|
+
}
|
|
39
|
+
const globals = globalThis;
|
|
40
|
+
if (globals.Cypress && globals.cy) {
|
|
41
|
+
Object.defineProperty(globals.cy, 'proxymail', { value: proxymailCommands(globals.Cypress, globals.cy), configurable: true });
|
|
42
|
+
}
|