@ -347,6 +347,27 @@ test('Record something given', async ({ page }, testInfo) => {
await page . getByTestId ( 'closeOnboardingAndFinish' ) . click ( ) ;
} ) ;
// STEP 4.5: Close any additional dialogs that might be blocking
await perfCollector . measureUserAction ( 'close-additional-dialogs' , async ( ) = > {
// Wait a moment for any dialogs to appear
await page . waitForTimeout ( 1000 ) ;
// Try to close any remaining dialogs
const closeButtons = page . locator ( 'button[aria-label*="close"], button[aria-label*="Close"], .dialog-overlay button, [role="dialog"] button' ) ;
const count = await closeButtons . count ( ) ;
for ( let i = 0 ; i < count ; i ++ ) {
try {
await closeButtons . nth ( i ) . click ( { timeout : 2000 } ) ;
} catch ( e ) {
// Ignore errors if button is not clickable
}
}
// Wait for any animations to complete
await page . waitForTimeout ( 500 ) ;
} ) ;
// STEP 5: Select recipient
await perfCollector . measureUserAction ( 'select-recipient' , async ( ) = > {
await page . getByRole ( 'button' , { name : 'Person' } ) . click ( ) ;
@ -368,15 +389,83 @@ test('Record something given', async ({ page }, testInfo) => {
// STEP 8: Refresh home view and locate gift
await perfCollector . measureUserAction ( 'refresh-home-view' , async ( ) = > {
await page . goto ( './' ) ;
// Try page.reload() instead of goto to see if that helps
await page . reload ( ) ;
} ) ;
await perfCollector . collectNavigationMetrics ( 'home-refresh-load' ) ;
const item = await page . locator ( 'li:first-child' ) . filter ( { hasText : finalTitle } ) ;
// Wait for feed to load and gift to appear
await perfCollector . measureUserAction ( 'wait-for-feed-load' , async ( ) = > {
// Wait for the feed container to be present
await page . locator ( 'ul' ) . first ( ) . waitFor ( { state : 'visible' , timeout : 15000 } ) ;
// Wait for any feed items to load (not just the first one)
await page . locator ( 'li' ) . first ( ) . waitFor ( { state : 'visible' , timeout : 15000 } ) ;
// Debug: Check what's actually in the feed
const feedItems = page . locator ( 'li' ) ;
const count = await feedItems . count ( ) ;
// Try to find our gift in any position, not just first
let giftFound = false ;
for ( let i = 0 ; i < count ; i ++ ) {
try {
const itemText = await feedItems . nth ( i ) . textContent ( ) ;
if ( itemText ? . includes ( finalTitle ) ) {
giftFound = true ;
break ;
}
} catch ( e ) {
// Continue to next item
}
}
if ( ! giftFound ) {
// Wait a bit more and try again
await page . waitForTimeout ( 3000 ) ;
// Check again
const newCount = await feedItems . count ( ) ;
for ( let i = 0 ; i < newCount ; i ++ ) {
try {
const itemText = await feedItems . nth ( i ) . textContent ( ) ;
if ( itemText ? . includes ( finalTitle ) ) {
giftFound = true ;
break ;
}
} catch ( e ) {
// Continue to next item
}
}
}
if ( ! giftFound ) {
throw new Error ( ` Gift with title " ${ finalTitle } " not found in feed after waiting ` ) ;
}
} ) ;
// Find the gift item (could be in any position)
const item = page . locator ( 'li' ) . filter ( { hasText : finalTitle } ) ;
// STEP 9: View gift details
await perfCollector . measureUserAction ( 'view-gift-details' , async ( ) = > {
await item . locator ( '[data-testid="circle-info-link"]' ) . click ( ) ;
// Debug: Check what elements are actually present
// Wait for the item to be visible
await item . waitFor ( { state : 'visible' , timeout : 10000 } ) ;
// Check if the circle-info-link exists
const circleInfoLink = item . locator ( '[data-testid="circle-info-link"]' ) ;
const isVisible = await circleInfoLink . isVisible ( ) ;
// If not visible, let's see what's in the item
if ( ! isVisible ) {
const itemHtml = await item . innerHTML ( ) ;
}
await circleInfoLink . click ( ) ;
} ) ;
await expect ( page . getByRole ( 'heading' , { name : 'Verifiable Claim Details' } ) ) . toBeVisible ( ) ;