-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathbstack_test_demo.js
More file actions
36 lines (24 loc) · 1.12 KB
/
bstack_test_demo.js
File metadata and controls
36 lines (24 loc) · 1.12 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
const { expect, test } = require('@playwright/test');
test('Browserstack playwright demo', async ({ page }) => {
const baseUrl = 'https://the-internet.herokuapp.com/';
await page.goto(baseUrl);
await page.waitForTimeout(3000);
await expect(page).toHaveTitle('The Internet');
await page.getByRole('link', { name: 'Checkboxes' }).click();
const checkbox1 = page.getByRole('checkbox').first();
const checkbox2 = page.getByRole('checkbox').last();
expect(await checkbox1.isChecked()).toBe(false);
await checkbox1.check();
expect(await checkbox1.isChecked()).toBe(true);
expect(await checkbox2.isChecked()).toBe(true);
await checkbox2.uncheck();
expect(await checkbox2.isChecked()).toBe(false);
await page.goto(baseUrl);
await page.getByRole('link', { name: 'Dropdown' }).click();
const dropdown = page.locator('#dropdown');
await dropdown.selectOption({ label: 'Option 1' });
await page.goBack();
const availableExamples = page.getByRole('heading', { name: 'Available Examples' });
const headingText = await availableExamples.textContent();
expect(headingText).toContain('Available Examples');
});