File tree Expand file tree Collapse file tree 3 files changed +47
-0
lines changed
Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -86,4 +86,20 @@ test('404 page is present', async ({ page }) => {
8686 await headlampPage . authenticate ( ) ;
8787 await headlampPage . navigateTopage ( '/404test' , / W h o o p s ! T h i s p a g e d o e s n ' t e x i s t / ) ;
8888} ) ;
89+
90+ test ( 'pagination goes to next page' , async ( { page } ) => {
91+ const headlampPage = new HeadlampPage ( page ) ;
92+ await headlampPage . authenticate ( ) ;
93+
94+ const securityPage = new SecurityPage ( page ) ;
95+ await securityPage . navigateToSecurity ( ) ;
96+ await securityPage . clickOnRolesSection ( ) ;
97+
98+ // Check if there is text "Rows per page" on the page
99+ await headlampPage . checkPageContent ( 'Rows per page' ) ;
100+
101+ // Check working of pagination
102+ await headlampPage . checkRows ( ) ;
103+ } ) ;
104+
89105// --- Headlamp tests end --- //
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ export class HeadlampPage {
4747 }
4848
4949 async checkPageContent ( text : string ) {
50+ await this . page . waitForSelector ( `:has-text("${ text } ")` ) ;
5051 const pageContent = await this . page . content ( ) ;
5152 expect ( pageContent ) . toContain ( text ) ;
5253 }
@@ -97,4 +98,25 @@ export class HeadlampPage {
9798 await this . page . click ( `a:has-text("${ pluginName } ")` ) ;
9899 await this . page . waitForLoadState ( 'load' ) ;
99100 }
101+
102+ async checkRows ( ) {
103+ // Get value of rows per page
104+ const rowsDisplayed1 = await this . getRowsDisplayed ( ) ;
105+
106+ // Click on the next page button
107+ const nextPageButton = this . page . getByTitle ( 'Next page' ) ;
108+ await nextPageButton . click ( ) ;
109+
110+ // Get value of rows per page after clicking next page button
111+ const rowsDisplayed2 = await this . getRowsDisplayed ( ) ;
112+
113+ // Check if the rows displayed are different
114+ expect ( rowsDisplayed1 ) . not . toBe ( rowsDisplayed2 ) ;
115+ }
116+
117+ async getRowsDisplayed ( ) {
118+ const paginationCaption = this . page . locator ( "p:has-text(' of ')" ) ;
119+ const captionText = await paginationCaption . textContent ( ) ;
120+ return captionText ;
121+ }
100122}
Original file line number Diff line number Diff line change @@ -18,4 +18,13 @@ export class SecurityPage {
1818 // Wait for the page to load
1919 await this . page . waitForLoadState ( 'load' ) ;
2020 }
21+
22+ async clickOnRolesSection ( ) {
23+ // Wait for the Service Accounts tab to load
24+ await this . page . waitForSelector ( 'span:has-text("Roles")' ) ;
25+ // Click on the "Service Accounts" section
26+ await this . page . click ( 'span:has-text("Roles")' ) ;
27+ // Wait for the page to load
28+ await this . page . waitForLoadState ( 'load' ) ;
29+ }
2130}
You can’t perform that action at this time.
0 commit comments