Skip to content

Commit 839716f

Browse files
committed
Add table tests, to log in on the website
1 parent 05425f1 commit 839716f

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

src/test/e2e/features/Login.feature

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ Feature: Performing a login
22

33
Scenario: Login with a default user
44
Given I'm on the login page
5-
When I log in with a default user
5+
When I log in with a user:
6+
| email | password |
7+
| automationtests@testing.com | 12345678 |
68
Then show a welcome message on the site
79
And show user name 'Leandro Nelson Gael Castro' on the site
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
Feature: Sending message to customer service
22

3-
Scenario: Show the customer service label
3+
Background:
44
Given I'm on the login page
5-
And I log in with a default user
5+
And I log in with a user:
6+
| email | password |
7+
| automationtests@testing.com | 12345678 |
8+
9+
Scenario: Show the customer service label
610
When I'm on the contact page
711
Then the system shows a customer service label
812

913
Scenario: Attaching a document to the message to the customer
10-
Given I'm on the login page
11-
And I log in with a default user
12-
And I'm on the contact page
13-
When I send a message with a document
14+
When I'm on the contact page
15+
And I send a message with a document
1416
Then the system shows a successful message

src/test/e2e/pages/Login.page.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ class LoginPage {
2727
return $('.info-account');
2828
}
2929

30-
login(user: { login: string; password: string }) {
30+
login(email: string, password: string) {
3131
if (this.buttonLogin.isExisting()) {
3232
this.buttonLogin.click();
33+
3334
this.inputEmail.waitForEnabled();
34-
this.inputEmail.setValue(user.login);
35-
this.inputPassword.setValue(user.password);
35+
this.inputEmail.setValue(email);
36+
this.inputPassword.setValue(password);
37+
3638
this.buttonSignIn.click();
3739
this.welcomeMessage.waitForExist();
3840
}

src/test/e2e/steps/Login.steps.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@ Given(/^I'm on the login page$/, () => {
66
loginPage.open();
77
});
88

9-
When(/^I log in with a default user$/, () => {
10-
const user = {
11-
login: 'automationtests@testing.com',
12-
password: '12345678',
13-
};
14-
loginPage.login(user);
9+
When(/^I log in with a user:$/, (data) => {
10+
const [user] = data.hashes();
11+
loginPage.login(user.email, user.password);
1512
});
1613

1714
Then(/^show a welcome message on the site$/, () => {

0 commit comments

Comments
 (0)