-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogin.spec.ts
More file actions
67 lines (55 loc) · 2.17 KB
/
Copy pathlogin.spec.ts
File metadata and controls
67 lines (55 loc) · 2.17 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { test, expect } from '../../fixtures/test-base';
import {
ADMIN_USER,
CUSTOMER_USER,
INVALID_USERS,
} from '../../data/users.data';
test.describe('Login @smoke', () => {
test.use({ storageState: { cookies: [], origins: [] } });
test.beforeEach(async ({ loginPage }) => {
await loginPage.goto();
});
test('Successful login with customer credentials', async ({ loginPage, page }) => {
await test.step('Fill customer credentials and submit', async () => {
await loginPage.login(CUSTOMER_USER.email, CUSTOMER_USER.password);
});
await test.step('Verify redirect to home page after login', async () => {
await expect(page).toHaveURL('/');
});
});
test('Successful login with admin credentials', async ({ loginPage, page }) => {
await test.step('Fill admin credentials and submit', async () => {
await loginPage.login(ADMIN_USER.email, ADMIN_USER.password);
});
await test.step('Verify redirect to home page after login', async () => {
await expect(page).toHaveURL('/');
});
});
test('Login with test credential quick-login buttons', async ({ loginPage, page }) => {
await test.step('Click "Use This Account" for customer and submit', async () => {
await loginPage.loginAsCustomer();
});
await test.step('Verify redirect to home page after quick login', async () => {
await expect(page).toHaveURL('/');
});
});
test('Invalid credentials show error', async ({ loginPage }) => {
await test.step('Submit with wrong password', async () => {
await loginPage.login(
INVALID_USERS.wrongPassword.email,
INVALID_USERS.wrongPassword.password,
);
});
await test.step('Verify error message is displayed in notifications', async () => {
await expect(loginPage.notificationsRegion).toContainText(/invalid credentials/i);
});
});
test('Guest continue redirects to home', async ({ loginPage, page }) => {
await test.step('Click "Continue as Guest" link', async () => {
await loginPage.continueAsGuestLink.click();
});
await test.step('Verify redirect to home page', async () => {
await expect(page).toHaveURL('/');
});
});
});