Skip to content

Commit 8d40195

Browse files
Jacek NorbertJacek Norbert
authored andcommitted
Improvement of Merchant Account test
1 parent ca6eb45 commit 8d40195

File tree

4 files changed

+34
-178
lines changed

4 files changed

+34
-178
lines changed

modules/account_example/test/index.js

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import Stripe from "./page-object";
66
import Login from "../../../tests/e2e/page-objects/login";
77
import {
88
ma_data,
9-
user_stripe
109
} from "../../../tests/e2e/data/data.js";
1110
import {
1211
getBtAlertText
@@ -15,15 +14,33 @@ import {
1514
const stripe = new Stripe();
1615
const login = new Login();
1716

17+
const {
18+
dev
19+
} = {
20+
dev: {
21+
email: faker.internet.exampleEmail(),
22+
name: faker.name.firstName(),
23+
password: faker.internet.password(),
24+
phone: faker.phone.phoneNumber()
25+
}
26+
};
27+
1828
fixture("Merchant Account")
1929
.page(process.env.MP_URL)
20-
.beforeEach(async t => {
21-
await login.login(user_stripe.email, user_stripe.password);
22-
await t.navigateTo("/account");
23-
});
2430

2531
test("Add new account", async t => {
26-
await t.expect(stripe.element.info.innerText).eql(`You don't have saved accounts yet, please add your first account.`)
32+
await t.click(stripe.link.signup)
33+
34+
await t
35+
.click(stripe.link.devRegister)
36+
.typeText(stripe.input.firstname, dev.name)
37+
.typeText(stripe.input.email, dev.email)
38+
.typeText(stripe.input.password, dev.password)
39+
.typeText(stripe.input.phone, dev.phone)
40+
.click(stripe.button.createAccount);
41+
42+
await login.login(dev.email, dev.password);
43+
await t.navigateTo("/account");
2744

2845
await t.click(stripe.button.addAccount);
2946

modules/account_example/test/page-object.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
2-
Selector,
3-
t
2+
Selector
43
} from 'testcafe';
54

65
export default class Stripe {
@@ -9,20 +8,29 @@ export default class Stripe {
98
submit: Selector('button[type="submit"]'),
109
addAccount: Selector('a[data-add-account]'),
1110
deleteAccount: Selector('.delete-stripe'),
11+
createAccount: Selector('.btn.btn-primary'),
1212
};
1313
this.iframe = {
1414
iframeStripe: Selector('iframe[name="stripe_checkout_app"]'),
1515
validation: Selector('.Popover-content')
1616
};
1717
this.link = {
18-
editAccount: Selector('a').withText('Edit')
18+
editAccount: Selector('a').withText('Edit'),
19+
signup: Selector('a').withText('Register'),
20+
login: Selector('a').withText('Log in'),
21+
devRegister: Selector('a').withText('Developer'),
22+
clientRegister: Selector('a').withText('Client')
1923
}
2024
this.element = {
2125
address: Selector('.mt-3 li').withText('Address'),
2226
state: Selector('table td:nth-of-type(2)'),
2327
info: Selector('.mt-4 p')
2428
}
2529
this.input = {
30+
firstname: Selector('#form_first_name'),
31+
email: Selector('[type="email"]'),
32+
password: Selector('[type="password"]'),
33+
phone: Selector('#form_mobile_number'),
2634
country: Selector['data-country'],
2735
routingNumber: Selector('[data-routing-number]'),
2836
accountNumber: Selector('[data-account-number]'),
@@ -36,7 +44,6 @@ export default class Stripe {
3644
city: Selector('.person.border-bottom.border-light.mb-5 #input-city'),
3745
state: Selector('.person.border-bottom.border-light.mb-5 #input-state'),
3846
code: Selector('.person.border-bottom.border-light.mb-5 #input-zip'),
39-
4047
cardNumber: Selector(
4148
'.Fieldset-childLeftRight > .Textbox-inputRow > input[type="tel"].Fieldset-input.Textbox-control'
4249
),

modules/users/test/index.js

Lines changed: 0 additions & 108 deletions
This file was deleted.

modules/users/test/page-object.js

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)