Skip to content

Commit 43fac0c

Browse files
Added Buttons Folder and �Checkboxes.spec.js script
1 parent 93e2ff9 commit 43fac0c

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

playwright.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ const { defineConfig, devices } = require('@playwright/test');
1111
* @see https://playwright.dev/docs/test-configuration
1212
*/
1313
module.exports = defineConfig({
14-
testDir: './tests/Forms',
14+
// testDir: './tests/Forms',
15+
testDir: './tests/',
16+
1517
/* Run tests in files in parallel */
1618
fullyParallel: true,
1719
/* Fail the build on CI if you accidentally left test.only in the source code. */

tests/Buttons/Checkboxes.spec.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const { test, expect } = require('@playwright/test');
2+
3+
test('Verify Checkboxes and Reset Functionality', async ({ page }) => {
4+
// Navigate to the checkbox page
5+
await page.goto('https://qa-practice.netlify.app/checkboxes');
6+
7+
// Locate the checkboxes
8+
const checkbox1 = page.locator('#checkbox1');
9+
const checkbox2 = page.locator('#checkbox2');
10+
const checkbox3 = page.locator('#checkbox3');
11+
12+
// Locate the Reset button
13+
const resetButton = page.locator('[class*="btn btn-primary"]');
14+
15+
// Click on all checkboxes and verify they are selected
16+
await checkbox1.check();
17+
await checkbox2.check();
18+
await checkbox3.check();
19+
20+
// Assert all checkboxes are selected
21+
await expect(checkbox1).toBeChecked();
22+
await expect(checkbox2).toBeChecked();
23+
await expect(checkbox3).toBeChecked();
24+
25+
//Click the Reset button and verify all checkboxes are deselected
26+
await resetButton.click();
27+
28+
// Assert all checkboxes are not selected after reset
29+
await expect(checkbox1).not.toBeChecked();
30+
await expect(checkbox2).not.toBeChecked();
31+
await expect(checkbox3).not.toBeChecked();
32+
});

0 commit comments

Comments
 (0)