File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments