-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathsignup_test.js
More file actions
39 lines (31 loc) · 1.26 KB
/
signup_test.js
File metadata and controls
39 lines (31 loc) · 1.26 KB
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
35
36
37
38
39
Feature('signup');
const MY_APPLICATION = 'https://playground.mailslurp.com'
//<gen>codeceptjs_signup_and_extract_full
Scenario('Test user sign up', async ({ I }) => {
// create a dummy inbox with MailSlurp
const emailAccount = await I.haveNewMailbox()
const password = 'test-password';
// load application
I.amOnPage(MY_APPLICATION);
// fill signup form
I.click('[data-test="sign-in-create-account-link"]')
I.fillField('[name="email"]', emailAccount.emailAddress);
I.fillField('[name="password"]', password);
I.click('[data-test="sign-up-create-account-button"]');
// wait for confirmation email
const email = await I.waitForEmailMatching({
subject: "Please confirm your email address"
})
// extract content use regex pattern
const [_, code] = /verification code is (\d+)/.exec(email.body)
// submit verification code
I.fillField('[name="code"]', code)
I.click('[data-test="confirm-sign-up-confirm-button"]');
// now login with verified account
I.fillField('[name="username"]', emailAccount.emailAddress);
I.fillField('[name="password"]', password);
I.click('[data-test="sign-in-sign-in-button"]');
// see welcome message
I.waitForElement('img[src*="welcome"]', 30);
});
//</gen>