11import { BrowserContext , expect , Locator , Page } from "@playwright/test" ;
2- import { ANVIL_TABS } from "./anvil/anvil-tabs" ;
3- import {
4- BackpageHeader ,
5- ColumnDescription ,
6- TabDescription ,
7- } from "./testInterfaces" ;
8- import { BrowserContext , expect , Locator , Page } from "@playwright/test" ;
92import {
103 BackpageHeader ,
114 ColumnDescription ,
@@ -942,8 +935,8 @@ export async function filterAndTestLastPagePagination(
942935 . filter (
943936 ( n ) =>
944937 ! isNaN ( n ) &&
945- n > ( ANVIL_TABS . FILES . maxPages ?? 0 ) * 3 &&
946- n < ( ANVIL_TABS . FILES . maxPages ?? 0 ) * MAX_PAGINATIONS
938+ n > ( tab . maxPages ?? 0 ) * 3 &&
939+ n < ( tab . maxPages ?? 0 ) * MAX_PAGINATIONS
947940 ) ;
948941 if ( filterCounts . length == 0 ) {
949942 console . log (
@@ -968,27 +961,27 @@ export async function filterAndTestLastPagePagination(
968961 ) . not . toHaveText ( "Page 1 of 1" ) ;
969962
970963 // Detect number of pages
971- const SplitStartingPageText = (
964+ const splitStartingPageText = (
972965 await page . getByText ( PAGE_COUNT_REGEX , { exact : true } ) . innerText ( )
973966 ) . split ( " " ) ;
974- const max_pages = parseInt (
975- SplitStartingPageText [ SplitStartingPageText . length - 1 ]
967+ const maxPages = parseInt (
968+ splitStartingPageText [ splitStartingPageText . length - 1 ]
976969 ) ;
977970 // Paginate forwards
978- for ( let i = 2 ; i < max_pages + 1 ; i ++ ) {
971+ for ( let i = 2 ; i < maxPages + 1 ; i ++ ) {
979972 await page
980973 . getByRole ( "button" )
981974 . filter ( { has : page . getByTestId ( FORWARD_BUTTON_TEST_ID ) } )
982975 . dispatchEvent ( "click" ) ;
983976 await expect ( getFirstRowNthColumnCellLocator ( page , 0 ) ) . toBeVisible ( ) ;
984977 // Expect the page count to have incremented
985978 await expect ( page . getByText ( PAGE_COUNT_REGEX , { exact : true } ) ) . toHaveText (
986- `Page ${ i } of ${ max_pages } `
979+ `Page ${ i } of ${ maxPages } `
987980 ) ;
988981 }
989982 // Expect to be on the last page
990983 await expect ( page . getByText ( PAGE_COUNT_REGEX , { exact : true } ) ) . toContainText (
991- `Page ${ max_pages } of ${ max_pages } `
984+ `Page ${ maxPages } of ${ maxPages } `
992985 ) ;
993986 // Expect the back button to be enabled on the last page
994987 await expect (
@@ -1021,11 +1014,11 @@ export async function testPaginationContent(
10211014 await expect ( page . getByText ( PAGE_COUNT_REGEX , { exact : true } ) ) . toHaveText (
10221015 / P a g e 1 o f [ 0 - 9 ] + /
10231016 ) ;
1024- const max_pages = 5 ;
1017+ const maxPages = 5 ;
10251018 const FirstTableEntries = [ ] ;
10261019
10271020 // Paginate forwards
1028- for ( let i = 2 ; i < max_pages + 1 ; i ++ ) {
1021+ for ( let i = 2 ; i < maxPages + 1 ; i ++ ) {
10291022 await expect ( firstElementTextLocator ) . not . toHaveText ( "" ) ;
10301023 const OriginalFirstTableEntry = await firstElementTextLocator . innerText ( ) ;
10311024 // Click the next button
@@ -1044,7 +1037,7 @@ export async function testPaginationContent(
10441037 . filter ( { has : page . getByTestId ( BACK_BUTTON_TEST_ID ) } )
10451038 ) . toBeEnabled ( ) ;
10461039 // Expect the forwards button to be enabled
1047- if ( i != max_pages ) {
1040+ if ( i != maxPages ) {
10481041 await expect (
10491042 page
10501043 . getByRole ( "button" )
@@ -1060,15 +1053,15 @@ export async function testPaginationContent(
10601053 }
10611054
10621055 // Paginate backwards
1063- for ( let i = 0 ; i < max_pages - 1 ; i ++ ) {
1064- const OldFirstTableEntry = FirstTableEntries [ max_pages - i - 2 ] ;
1056+ for ( let i = 0 ; i < maxPages - 1 ; i ++ ) {
1057+ const OldFirstTableEntry = FirstTableEntries [ maxPages - i - 2 ] ;
10651058 await page
10661059 . getByRole ( "button" )
10671060 . filter ( { has : page . getByTestId ( BACK_BUTTON_TEST_ID ) } )
10681061 . click ( ) ;
10691062 // Expect page number to be correct
10701063 await expect ( page . getByText ( PAGE_COUNT_REGEX , { exact : true } ) ) . toHaveText (
1071- RegExp ( `Page ${ max_pages - i - 1 } of [0-9]+` )
1064+ RegExp ( `Page ${ maxPages - i - 1 } of [0-9]+` )
10721065 ) ;
10731066 // Expect page entry to be consistent with forward pagination
10741067 await expect ( firstElementTextLocator ) . toHaveText ( OldFirstTableEntry ) ;
0 commit comments