File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ export const BackToTop = () => {
3636
3737 return (
3838 < button
39+ id = 'back-to-top'
3940 onClick = { scrollToTop }
4041 className = { `fixed right-4 bottom-4 z-50 rounded-full bg-blue-500 p-2 text-white shadow-lg ${
4142 isVisible ? 'animate-fade-in opacity-100 hover:cursor-pointer' : 'animate-fade-out opacity-0'
Original file line number Diff line number Diff line change @@ -20,9 +20,17 @@ test.describe('General Tests', () => {
2020
2121 test ( 'Back to top button functionality' , async ( { page } ) => {
2222 // Initially button should not be visible
23- const backToTopButton = page . getByRole ( 'button' , { name : 'Back to top' } )
23+ const backToTopButton = page . locator ( '#back-to- top')
2424 await expect ( backToTopButton ) . not . toBeVisible ( )
2525
26+ // Click on the category containers to add enough content to scroll
27+ // class category-container
28+ const categoryContainers = page . locator ( '.category-container' )
29+ const containerCount = await categoryContainers . count ( )
30+ for ( let i = 0 ; i < containerCount ; i ++ ) {
31+ await categoryContainers . nth ( i ) . click ( )
32+ }
33+
2634 // Scroll down to make the button appear
2735 await page . evaluate ( ( ) => {
2836 window . scrollTo ( 0 , 1000 )
You can’t perform that action at this time.
0 commit comments