-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathexample_test.js
More file actions
34 lines (33 loc) · 946 Bytes
/
example_test.js
File metadata and controls
34 lines (33 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const { expect } = require('chai');
Feature('Example');
/**
* See https://codecept.io/ for more information
*/
Scenario('Can create a new inbox', async ({ I }) => {
//<gen>codeceptjs_wait_for_email
const mailbox = await I.haveNewMailbox();
await I.sendEmail({
to: [mailbox.emailAddress],
subject: 'Hello',
body: 'World'
});
await I.waitForLatestEmail(10);
await I.seeInEmailSubject('Hello');
await I.seeInEmailBody('World')
//</gen>
});
Scenario('Can extract verification code', async ({ I }) => {
const mailbox = await I.haveNewMailbox();
await I.sendEmail({
to: [mailbox.emailAddress],
subject: 'Verify your account',
body: 'Your code is: 123-456'
});
//<gen>codeceptjs_wait_for_matching_extract
const email = await I.waitForEmailMatching({
subject: 'Verify your account',
})
const [_, code] = /Your code is: ([0-9-]{7})/.exec(email.body)
//</gen>
expect(code).eq('123-456')
});