You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.5 KiB

4 months ago
import { test, expect } from '@playwright/test';
import { importUser } from './testUtils';
4 months ago
test('Record something given', async ({ page }) => {
// Generate a random string of a few characters
const randomString = Math.random().toString(36).substring(2, 6);
4 months ago
// Generate a random non-zero single-digit number
const randomNonZeroNumber = Math.floor(Math.random() * 99) + 1;
// Standard title prefix
const standardTitle = 'Gift ';
4 months ago
// Combine title prefix with the random string
const finalTitle = standardTitle + randomString;
4 months ago
// Import user 00
await importUser(page, '00');
4 months ago
// Record something given
await page.goto('./');
await page.getByTestId('closeOnboardingAndFinish').click();
4 months ago
await page.getByRole('heading', { name: 'Unnamed/Unknown' }).click();
await page.getByPlaceholder('What was given').fill(finalTitle);
await page.getByRole('spinbutton').fill(randomNonZeroNumber.toString());
4 months ago
await page.getByRole('button', { name: 'Sign & Send' }).click();
await expect(page.getByText('That gift was recorded.')).toBeVisible();
4 months ago
// Refresh home view and check gift
await page.goto('./');
await page.locator('li').filter({ hasText: finalTitle }).locator('a').click();
await expect(page.getByRole('heading', { name: 'Verifiable Claim Details' })).toBeVisible();
await expect(page.getByText(finalTitle, { exact: true })).toBeVisible();
const page1Promise = page.waitForEvent('popup');
await page.getByRole('link', { name: 'View on the Public Server' }).click();
const page1 = await page1Promise;
4 months ago
});