-
Notifications
You must be signed in to change notification settings - Fork 293
Expand file tree
/
Copy pathlogin.spec.ts
More file actions
21 lines (19 loc) · 996 Bytes
/
login.spec.ts
File metadata and controls
21 lines (19 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { test, expect } from '@playwright/test';
test.describe('Daily.dev Homepage', () => {
test('should load the homepage successfully', async ({ page }) => {
await page.goto('/');
await (page.getByRole('button', { name: 'Accept all' }).or(page.getByRole('button', {name: 'I understand'})).click());
await page.getByRole('button', { name: 'Log in' }).click();
await page.getByRole('textbox', { name: 'Email' }).click();
await page.getByRole('textbox', { name: 'Email' }).fill(process.env.USER_NAME);
await page.getByRole('textbox', { name: 'Email' }).press('Tab');
await page.getByRole('textbox', { name: 'Password' }).fill(process.env.PASSWORD);
await page.getByRole('button', { name: 'Log in' }).click();
// Check for profile element on both mobile and desktop
await expect(
page.getByRole('link', { name: 'playwrighttest\'s profile' }).or(
page.getByRole('button', { name: 'Profile settings' })
)
).toBeVisible()
});
});