77 */
88import { expect , test , type Page } from '@playwright/test'
99
10+ import { PAGE_SIZE } from '~/api/hooks'
11+
1012import { expectScrollTop , scrollTo } from './utils'
1113
1214// expectRowVisible is too have for all this
@@ -26,8 +28,8 @@ test('pagination', async ({ page }) => {
2628 await expect ( prevButton ) . toBeDisabled ( ) // we're on the first page
2729
2830 await expectCell ( page , 'snapshot-1' )
29- await expectCell ( page , ' disk-1-snapshot-25' )
30- await expect ( rows ) . toHaveCount ( 25 )
31+ await expectCell ( page , ` disk-1-snapshot-${ PAGE_SIZE } ` )
32+ await expect ( rows ) . toHaveCount ( PAGE_SIZE )
3133
3234 await scrollTo ( page , 100 )
3335
@@ -40,28 +42,28 @@ test('pagination', async ({ page }) => {
4042 await expect ( spinner ) . toBeHidden ( )
4143 await expectScrollTop ( page , 0 ) // scroll resets to top on page change
4244
43- await expectCell ( page , ' disk-1-snapshot-26' )
44- await expectCell ( page , ' disk-1-snapshot-50' )
45- await expect ( rows ) . toHaveCount ( 25 )
45+ await expectCell ( page , ` disk-1-snapshot-${ PAGE_SIZE + 1 } ` )
46+ await expectCell ( page , ` disk-1-snapshot-${ 2 * PAGE_SIZE } ` )
47+ await expect ( rows ) . toHaveCount ( PAGE_SIZE )
4648
4749 await nextButton . click ( )
48- await expectCell ( page , ' disk-1-snapshot-51' )
49- await expectCell ( page , ' disk-1-snapshot-75' )
50- await expect ( rows ) . toHaveCount ( 25 )
50+ await expectCell ( page , ` disk-1-snapshot-${ 2 * PAGE_SIZE + 1 } ` )
51+ await expectCell ( page , ` disk-1-snapshot-${ 3 * PAGE_SIZE } ` )
52+ await expect ( rows ) . toHaveCount ( PAGE_SIZE )
5153
5254 await nextButton . click ( )
53- await expectCell ( page , ' disk-1-snapshot-76' )
54- await expectCell ( page , 'disk-1-snapshot-86 ' )
55- await expect ( rows ) . toHaveCount ( 12 )
55+ await expectCell ( page , ` disk-1-snapshot-${ 3 * PAGE_SIZE + 1 } ` )
56+ await expectCell ( page , 'disk-1-snapshot-167 ' )
57+ await expect ( rows ) . toHaveCount ( 17 )
5658 await expect ( nextButton ) . toBeDisabled ( ) // no more pages
5759
5860 await scrollTo ( page , 250 )
5961
6062 await prevButton . click ( )
6163 await expect ( spinner ) . toBeHidden ( { timeout : 10 } ) // no spinner, cached page
62- await expect ( rows ) . toHaveCount ( 25 )
63- await expectCell ( page , ' disk-1-snapshot-51' )
64- await expectCell ( page , ' disk-1-snapshot-75' )
64+ await expect ( rows ) . toHaveCount ( PAGE_SIZE )
65+ await expectCell ( page , ` disk-1-snapshot-${ 2 * PAGE_SIZE + 1 } ` )
66+ await expectCell ( page , ` disk-1-snapshot-${ 3 * PAGE_SIZE } ` )
6567 await expectScrollTop ( page , 0 ) // scroll resets to top on prev too
6668
6769 await nextButton . click ( )
0 commit comments