Skip to content

Commit d266472

Browse files
Added Pagination.spec.js script
1 parent ad8eb42 commit d266472

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const { test, expect } = require('@playwright/test');
2+
3+
test('Verify Pagination Functionality', async ({ page }) => {
4+
// Define constants
5+
const targetURL = 'https://qa-practice.netlify.app/pagination';
6+
const pageSelectMessageLocator = '#pageResult';
7+
8+
// Navigate to the target URL
9+
await page.goto(targetURL);
10+
11+
// Function to validate page selection
12+
const validatePageSelection = async (pageNumber, expectedText) => {
13+
await page.getByRole('link', { name: pageNumber }).click();
14+
const message = page.locator(pageSelectMessageLocator);
15+
await expect(message).toBeVisible();
16+
await expect(message).toHaveText(expectedText);
17+
};
18+
19+
// Validate clicking on individual pages
20+
await validatePageSelection('1', 'You clicked page no. 1');
21+
await validatePageSelection('2', 'You clicked page no. 2');
22+
await validatePageSelection('3', 'You clicked page no. 3');
23+
24+
// Validate clicking on the "Next" button
25+
await validatePageSelection('Next', 'You clicked the "Next" button');
26+
});

0 commit comments

Comments
 (0)