|
@ -6,7 +6,7 @@ test('Record an offer', async ({ page }) => { |
|
|
const randomString = Math.random().toString(36).substring(2, 8); |
|
|
const randomString = Math.random().toString(36).substring(2, 8); |
|
|
// Standard title prefix
|
|
|
// Standard title prefix
|
|
|
const finalTitle = `Offering of ${randomString}`; |
|
|
const finalTitle = `Offering of ${randomString}`; |
|
|
const randomNonZeroNumber = Math.floor(Math.random() * 999) + 1; |
|
|
const randomNonZeroNumber = Math.floor(Math.random() * 998) + 1; |
|
|
|
|
|
|
|
|
// Create new ID for default user
|
|
|
// Create new ID for default user
|
|
|
await importUser(page); |
|
|
await importUser(page); |
|
@ -22,12 +22,41 @@ test('Record an offer', async ({ page }) => { |
|
|
await page.getByRole('button', { name: 'Sign & Send' }).click(); |
|
|
await page.getByRole('button', { name: 'Sign & Send' }).click(); |
|
|
await expect(page.getByText('That offer was recorded.')).toBeVisible(); |
|
|
await expect(page.getByText('That offer was recorded.')).toBeVisible(); |
|
|
|
|
|
|
|
|
// Refresh home view and check gift
|
|
|
// go to the offer and check the values
|
|
|
await page.goto('./projects'); |
|
|
await page.goto('./projects'); |
|
|
await page.locator('li').filter({ hasText: finalTitle }).locator('a').first().click(); |
|
|
await page.locator('li').filter({ hasText: finalTitle }).locator('a').first().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(); |
|
|
const page1Promise = page.waitForEvent('popup'); |
|
|
const serverPagePromise = page.waitForEvent('popup'); |
|
|
await page.getByRole('link', { name: 'View on the Public Server' }).click(); |
|
|
await page.getByRole('link', { name: 'View on the Public Server' }).click(); |
|
|
const page1 = await page1Promise; |
|
|
const serverPage = await serverPagePromise; |
|
|
}); |
|
|
await serverPage.getByText(finalTitle); |
|
|
|
|
|
await serverPage.getByText('did:none:HIDDEN'); |
|
|
|
|
|
|
|
|
|
|
|
// Now update that offer
|
|
|
|
|
|
|
|
|
|
|
|
// find the edit page and check the old values again
|
|
|
|
|
|
await page.goto('./projects'); |
|
|
|
|
|
await page.locator('li').filter({ hasText: finalTitle }).locator('a').first().click(); |
|
|
|
|
|
await page.getByTestId('editClaimButton').click(); |
|
|
|
|
|
await page.locator('heading', { hasText: 'What was offered' }).isVisible(); |
|
|
|
|
|
const itemDesc = await page.getByTestId('itemDescription'); |
|
|
|
|
|
await expect(itemDesc).toHaveValue(finalTitle); |
|
|
|
|
|
const amount = await page.getByTestId('inputOfferAmount'); |
|
|
|
|
|
await expect(amount).toHaveValue(randomNonZeroNumber.toString()); |
|
|
|
|
|
// update the values
|
|
|
|
|
|
await itemDesc.fill('Updated ' + finalTitle); |
|
|
|
|
|
await amount.fill(String(randomNonZeroNumber + 1)); |
|
|
|
|
|
await page.getByRole('button', { name: 'Sign & Send' }).click(); |
|
|
|
|
|
|
|
|
|
|
|
// go to the offer claim again and check the updated values
|
|
|
|
|
|
await page.goto('./projects'); |
|
|
|
|
|
await page.locator('li').filter({ hasText: finalTitle }).locator('a').first().click(); |
|
|
|
|
|
const newItemDesc = await page.getByTestId('description'); |
|
|
|
|
|
await expect(newItemDesc).toHaveText(finalTitle); |
|
|
|
|
|
|
|
|
|
|
|
// go to edit page
|
|
|
|
|
|
await page.getByTestId('editClaimButton').click(); |
|
|
|
|
|
const newAmount = await page.getByTestId('inputOfferAmount'); |
|
|
|
|
|
await expect(newAmount).toHaveValue(randomNonZeroNumber.toString()); |
|
|
|
|
|
}); |
|
|