@ -1,7 +1,7 @@
import { test , expect } from '@playwright/test' ;
import { test , expect } from '@playwright/test' ;
import { importUser } from './testUtils' ;
import { importUser } from './testUtils' ;
test ( 'Add contact' , async ( { page } ) = > {
test ( 'Add contact, record gift, confirm gift ' , async ( { page } ) = > {
// Generate a random string of 16 characters
// Generate a random string of 16 characters
let randomString = Math . random ( ) . toString ( 36 ) . substring ( 2 , 18 ) ;
let randomString = Math . random ( ) . toString ( 36 ) . substring ( 2 , 18 ) ;
@ -60,4 +60,27 @@ test('Add contact', async ({ page }) => {
await page . locator ( 'li' ) . filter ( { hasText : finalTitle } ) . locator ( 'a' ) . click ( ) ;
await page . locator ( 'li' ) . filter ( { hasText : finalTitle } ) . locator ( 'a' ) . click ( ) ;
await expect ( page . getByRole ( 'heading' , { name : 'Verifiable Claim Details' } ) ) . toBeVisible ( ) ;
await expect ( page . getByRole ( 'heading' , { name : 'Verifiable Claim Details' } ) ) . toBeVisible ( ) ;
await expect ( page . getByText ( finalTitle , { exact : true } ) ) . toBeVisible ( ) ;
await expect ( page . getByText ( finalTitle , { exact : true } ) ) . toBeVisible ( ) ;
// Switch to user 00
await page . goto ( './account' ) ;
await page . getByRole ( 'heading' , { name : 'Advanced' } ) . click ( ) ;
await page . getByRole ( 'link' , { name : 'Switch Identifier' } ) . click ( ) ;
await page . getByRole ( 'link' , { name : 'Add Another Identity…' } ) . click ( ) ;
await page . getByText ( 'You have a seed' ) . click ( ) ;
await page . getByPlaceholder ( 'Seed Phrase' ) . fill ( 'rigid shrug mobile smart veteran half all pond toilet brave review universe ship congress found yard skate elite apology jar uniform subway slender luggage' ) ;
await page . getByRole ( 'button' , { name : 'Import' } ) . click ( ) ;
// Go to home view and look for gift
await page . goto ( './' ) ;
await page . locator ( 'li' ) . filter ( { hasText : finalTitle } ) . locator ( 'a' ) . click ( ) ;
// Confirm gift as user 00
await page . getByRole ( 'button' , { name : 'Confirm' } ) . click ( ) ;
await page . getByRole ( 'button' , { name : 'Yes' } ) . click ( ) ;
await expect ( page . getByText ( 'Confirmation submitted.' ) ) . toBeVisible ( ) ;
// Refresh claim page, Confirm button should be hidden
await page . reload ( ) ;
await expect ( page . getByRole ( 'button' , { name : 'Confirm' } ) ) . toBeVisible ( ) ;
await expect ( page . getByRole ( 'button' , { name : 'Confirm' } ) ) . toBeHidden ( ) ;
} ) ;
} ) ;