Compare commits
1 Commits
view-headi
...
web-tests
| Author | SHA1 | Date | |
|---|---|---|---|
| 19c9609859 |
@@ -36,19 +36,12 @@ export default defineConfig({
|
|||||||
|
|
||||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||||
trace: "retain-on-failure",
|
trace: "retain-on-failure",
|
||||||
|
|
||||||
// Add request logging
|
|
||||||
logger: {
|
|
||||||
isEnabled: (name, severity) => severity === 'error' || name === 'api',
|
|
||||||
log: (name, severity, message, args) => console.log(`${severity}: ${message}`, args)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Configure projects for major browsers */
|
/* Configure projects for major browsers */
|
||||||
projects: [
|
projects: [
|
||||||
// {
|
// {
|
||||||
// name: 'chromium-serial',
|
// name: 'chromium-serial',
|
||||||
// testMatch: /.*\/(35-record-gift-from-image-share|40-add-contact)\.spec\.ts/,
|
|
||||||
// use: {
|
// use: {
|
||||||
// ...devices['Desktop Chrome'],
|
// ...devices['Desktop Chrome'],
|
||||||
// permissions: ["clipboard-read"],
|
// permissions: ["clipboard-read"],
|
||||||
@@ -57,13 +50,11 @@ export default defineConfig({
|
|||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
// name: 'firefox-serial',
|
// name: 'firefox-serial',
|
||||||
// testMatch: /.*\/(35-record-gift-from-image-share|40-add-contact)\.spec\.ts/,
|
|
||||||
// use: { ...devices['Desktop Firefox'] },
|
// use: { ...devices['Desktop Firefox'] },
|
||||||
// workers: 1,
|
// workers: 1,
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
name: 'chromium',
|
name: 'chromium',
|
||||||
testMatch: /^(?!.*\/(35-record-gift-from-image-share|40-add-contact)\.spec\.ts).+\.spec\.ts$/,
|
|
||||||
use: {
|
use: {
|
||||||
...devices['Desktop Chrome'],
|
...devices['Desktop Chrome'],
|
||||||
permissions: ["clipboard-read"],
|
permissions: ["clipboard-read"],
|
||||||
@@ -71,7 +62,6 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'firefox',
|
name: 'firefox',
|
||||||
testMatch: /^(?!.*\/(35-record-gift-from-image-share|40-add-contact)\.spec\.ts).+\.spec\.ts$/,
|
|
||||||
use: { ...devices['Desktop Firefox'] },
|
use: { ...devices['Desktop Firefox'] },
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ test('Record something given', async ({ page }) => {
|
|||||||
// Refresh home view and check gift
|
// Refresh home view and check gift
|
||||||
await page.goto('./');
|
await page.goto('./');
|
||||||
const item = await page.locator('li').filter({ hasText: finalTitle });
|
const item = await page.locator('li').filter({ hasText: finalTitle });
|
||||||
await item.locator('[data-testid="circle-info-link"]').click();
|
await item.getByTestId('circle-info-link').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 page1Promise = page.waitForEvent('popup');
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ test('Record item given from image-share', async ({ page }) => {
|
|||||||
|
|
||||||
// Refresh home view and check gift
|
// Refresh home view and check gift
|
||||||
await page.goto('./');
|
await page.goto('./');
|
||||||
const item1 = page.locator('li').filter({ hasText: finalTitle });
|
const item1 = page.locator('li').filter({ hasText: finalTitle }).first();
|
||||||
await expect(item1.getByRole('img')).toBeVisible();
|
await expect(item1.getByRole('img')).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
|
|||||||
await expect(page.locator('li.border-b')).toContainText(userName);
|
await expect(page.locator('li.border-b')).toContainText(userName);
|
||||||
|
|
||||||
// Rename contact
|
// Rename contact
|
||||||
await page.locator(`li[data-testid="contactListItem"] h2:has-text("${userName}") + span svg.fa-circle-info`).click();
|
await page.getByTestId(`contactListItem`).locator(`h2 a:has-text("${userName}")`).click();
|
||||||
// now on the DID view page
|
// now on the DID view page
|
||||||
await page.locator('h2 svg.fa-pen').click();
|
await page.locator('h2 svg.fa-pen').click();
|
||||||
// now on the contact edit page
|
// now on the contact edit page
|
||||||
@@ -116,10 +116,11 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
|
|||||||
// Confirm that home shows contact in "Record Something…"
|
// Confirm that home shows contact in "Record Something…"
|
||||||
await page.goto('./');
|
await page.goto('./');
|
||||||
await page.getByTestId('closeOnboardingAndFinish').click();
|
await page.getByTestId('closeOnboardingAndFinish').click();
|
||||||
await expect(page.locator('#sectionRecordSomethingGiven ul li').filter({ hasText: contactName }).nth(0)).toBeVisible();
|
const userGaveLink = page.locator('#sectionRecordSomethingGiven ul li').filter({ hasText: contactName }).nth(0);
|
||||||
|
await expect(userGaveLink).toBeVisible();
|
||||||
|
await userGaveLink.click();
|
||||||
|
|
||||||
// Record something given by new contact
|
// Record something given by new contact
|
||||||
await page.getByRole('heading', { name: contactName }).click();
|
|
||||||
await page.getByPlaceholder('What was given').fill(finalTitle);
|
await page.getByPlaceholder('What was given').fill(finalTitle);
|
||||||
await page.getByRole('spinbutton').fill(randomNonZeroNumber.toString());
|
await page.getByRole('spinbutton').fill(randomNonZeroNumber.toString());
|
||||||
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
||||||
@@ -130,7 +131,7 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
|
|||||||
|
|
||||||
// Firefox complains on load the initial feed here when we use the test server.
|
// Firefox complains on load the initial feed here when we use the test server.
|
||||||
// It may be similar to the CORS problem below.
|
// It may be similar to the CORS problem below.
|
||||||
await page.locator('li').filter({ hasText: finalTitle }).locator('a').click();
|
await page.locator('li').filter({ hasText: finalTitle }).getByTestId('circle-info-link').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();
|
||||||
|
|
||||||
@@ -154,7 +155,7 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
|
|||||||
// Go to home view and look for gift
|
// Go to home view and look for gift
|
||||||
await page.goto('./');
|
await page.goto('./');
|
||||||
await page.getByTestId('closeOnboardingAndFinish').click();
|
await page.getByTestId('closeOnboardingAndFinish').click();
|
||||||
const giftLink = page.locator('li').filter({ hasText: finalTitle }).locator('a');
|
const giftLink = page.locator('li').filter({ hasText: finalTitle }).getByTestId('circle-info-link').first();
|
||||||
await expect(giftLink).toBeVisible();
|
await expect(giftLink).toBeVisible();
|
||||||
await giftLink.click();
|
await giftLink.click();
|
||||||
|
|
||||||
@@ -226,7 +227,7 @@ test('Add contact, copy details, delete, and import from paste & from file', asy
|
|||||||
// See a different clipboard solution below.
|
// See a different clipboard solution below.
|
||||||
|
|
||||||
// see contact details on the second contact
|
// see contact details on the second contact
|
||||||
await page.getByTestId('contactListItem').nth(1).locator('a').click();
|
await page.getByTestId('contactListItem').nth(1).locator(`h2 a)`).click();
|
||||||
await page.getByRole('heading', { name: 'Identifier Details' }).isVisible();
|
await page.getByRole('heading', { name: 'Identifier Details' }).isVisible();
|
||||||
// remove contact
|
// remove contact
|
||||||
await page.locator('button > svg.fa-trash-can').click();
|
await page.locator('button > svg.fa-trash-can').click();
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export async function deleteContact(page: Page, did: string): Promise<void> {
|
|||||||
await page.goto('./contacts');
|
await page.goto('./contacts');
|
||||||
const contactName = createContactName(did);
|
const contactName = createContactName(did);
|
||||||
// go to the detail page for this contact
|
// go to the detail page for this contact
|
||||||
await page.locator(`li[data-testid="contactListItem"] h2:has-text("${contactName}") + span svg.fa-circle-info`).click();
|
await page.getByTestId(`contactListItem`).locator(`h2 a:has-text("${contactName}")`).click();
|
||||||
// delete the contact
|
// delete the contact
|
||||||
await page.locator('button > svg.fa-trash-can').click();
|
await page.locator('button > svg.fa-trash-can').click();
|
||||||
await page.locator('div[role="alert"] button:has-text("Yes")').click();
|
await page.locator('div[role="alert"] button:has-text("Yes")').click();
|
||||||
@@ -82,7 +82,7 @@ export async function generateNewEthrUser(page: Page): Promise<string> {
|
|||||||
return newDid;
|
return newDid;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate a new random user and register them.
|
// Generate a new random user, register them, and add them as a contact with name from createContactName.
|
||||||
// Note that this makes 000 the active user. Use switchToUser to switch to this DID.
|
// Note that this makes 000 the active user. Use switchToUser to switch to this DID.
|
||||||
export async function generateAndRegisterEthrUser(page: Page): Promise<string> {
|
export async function generateAndRegisterEthrUser(page: Page): Promise<string> {
|
||||||
const newDid = await generateNewEthrUser(page);
|
const newDid = await generateNewEthrUser(page);
|
||||||
@@ -109,7 +109,7 @@ export async function generateRandomString(length: number): Promise<string> {
|
|||||||
|
|
||||||
// Function to create an array of unique strings
|
// Function to create an array of unique strings
|
||||||
export async function createUniqueStringsArray(count: number): Promise<string[]> {
|
export async function createUniqueStringsArray(count: number): Promise<string[]> {
|
||||||
const stringsArray = [];
|
const stringsArray: string[] = [];
|
||||||
const stringLength = 16;
|
const stringLength = 16;
|
||||||
|
|
||||||
for (let i = 0; i < count; i++) {
|
for (let i = 0; i < count; i++) {
|
||||||
@@ -122,7 +122,7 @@ export async function createUniqueStringsArray(count: number): Promise<string[]>
|
|||||||
|
|
||||||
// Function to create an array of two-digit non-zero numbers
|
// Function to create an array of two-digit non-zero numbers
|
||||||
export async function createRandomNumbersArray(count: number): Promise<number[]> {
|
export async function createRandomNumbersArray(count: number): Promise<number[]> {
|
||||||
const numbersArray = [];
|
const numbersArray: number[] = [];
|
||||||
|
|
||||||
for (let i = 0; i < count; i++) {
|
for (let i = 0; i < count; i++) {
|
||||||
let randomNumber = Math.floor(Math.random() * 99) + 1;
|
let randomNumber = Math.floor(Math.random() * 99) + 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user