Skip to content

Commit d095174

Browse files
committed
updated script
1 parent 890daa8 commit d095174

File tree

3 files changed

+36
-52
lines changed

3 files changed

+36
-52
lines changed

tests/bstack_test_add_to_cart.js

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

tests/bstack_test_checkout_flow.js

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

tests/bstack_test_demo.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const { expect, test } = require('@playwright/test');
2+
3+
test('Browserstack playwright demo', async ({ page }) => {
4+
const baseUrl = 'https://the-internet.herokuapp.com/';
5+
6+
await page.goto(baseUrl);
7+
8+
await page.waitForTimeout(3000);
9+
10+
await expect(page).toHaveTitle('The Internet');
11+
12+
await page.getByRole('link', { name: 'Checkboxes' }).click();
13+
14+
const checkbox1 = page.getByRole('checkbox').first();
15+
const checkbox2 = page.getByRole('checkbox').last();
16+
17+
expect(await checkbox1.isChecked()).toBe(false);
18+
await checkbox1.check();
19+
expect(await checkbox1.isChecked()).toBe(true);
20+
21+
expect(await checkbox2.isChecked()).toBe(true);
22+
await checkbox2.uncheck();
23+
expect(await checkbox2.isChecked()).toBe(false);
24+
25+
await page.goto(baseUrl);
26+
await page.getByRole('link', { name: 'Dropdown' }).click();
27+
28+
const dropdown = page.locator('#dropdown');
29+
await dropdown.selectOption({ label: 'Option 1' });
30+
31+
await page.goBack();
32+
33+
const availableExamples = page.getByRole('heading', { name: 'Available Examples' });
34+
const headingText = await availableExamples.textContent();
35+
expect(headingText).toContain('Available Examples');
36+
});

0 commit comments

Comments
 (0)