Compare commits

...

2 Commits

Author SHA1 Message Date
19c9609859 start fixes to web tests (35 & 40 known to be bad) 2025-07-07 17:02:29 -06:00
a96cc8155c fix incorrect checks for success 2025-07-04 16:58:18 -06:00
6 changed files with 17 additions and 26 deletions

View File

@@ -36,19 +36,12 @@ export default defineConfig({
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
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 */
projects: [
// {
// name: 'chromium-serial',
// testMatch: /.*\/(35-record-gift-from-image-share|40-add-contact)\.spec\.ts/,
// use: {
// ...devices['Desktop Chrome'],
// permissions: ["clipboard-read"],
@@ -57,13 +50,11 @@ export default defineConfig({
// },
// {
// name: 'firefox-serial',
// testMatch: /.*\/(35-record-gift-from-image-share|40-add-contact)\.spec\.ts/,
// use: { ...devices['Desktop Firefox'] },
// workers: 1,
// },
{
name: 'chromium',
testMatch: /^(?!.*\/(35-record-gift-from-image-share|40-add-contact)\.spec\.ts).+\.spec\.ts$/,
use: {
...devices['Desktop Chrome'],
permissions: ["clipboard-read"],
@@ -71,7 +62,6 @@ export default defineConfig({
},
{
name: 'firefox',
testMatch: /^(?!.*\/(35-record-gift-from-image-share|40-add-contact)\.spec\.ts).+\.spec\.ts$/,
use: { ...devices['Desktop Firefox'] },
},

View File

@@ -144,7 +144,7 @@ export default class QuickActionBvcBeginView extends Vue {
"HUR",
BVC_MEETUPS_PROJECT_CLAIM_ID,
);
if (timeResult.type === "success") {
if (timeResult.success) {
timeSuccess = true;
} else {
logger.error("Error sending time:", timeResult);
@@ -154,7 +154,7 @@ export default class QuickActionBvcBeginView extends Vue {
type: "danger",
title: "Error",
text:
timeResult?.error?.userMessage ||
timeResult?.error ||
"There was an error sending the time.",
},
5000,
@@ -171,7 +171,7 @@ export default class QuickActionBvcBeginView extends Vue {
apiServer,
axios,
);
if (attendResult.type === "success") {
if (attendResult.success) {
attendedSuccess = true;
} else {
logger.error("Error sending attendance:", attendResult);
@@ -181,7 +181,7 @@ export default class QuickActionBvcBeginView extends Vue {
type: "danger",
title: "Error",
text:
attendResult?.error?.userMessage ||
attendResult?.error ||
"There was an error sending the attendance.",
},
5000,

View File

@@ -110,7 +110,7 @@ test('Record something given', async ({ page }) => {
// Refresh home view and check gift
await page.goto('./');
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.getByText(finalTitle, { exact: true })).toBeVisible();
const page1Promise = page.waitForEvent('popup');

View File

@@ -90,7 +90,7 @@ test('Record item given from image-share', async ({ page }) => {
// Refresh home view and check gift
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();
});

View File

@@ -102,7 +102,7 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
await expect(page.locator('li.border-b')).toContainText(userName);
// 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
await page.locator('h2 svg.fa-pen').click();
// 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…"
await page.goto('./');
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
await page.getByRole('heading', { name: contactName }).click();
await page.getByPlaceholder('What was given').fill(finalTitle);
await page.getByRole('spinbutton').fill(randomNonZeroNumber.toString());
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.
// 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.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
await page.goto('./');
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 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 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();
// remove contact
await page.locator('button > svg.fa-trash-can').click();

View File

@@ -63,7 +63,7 @@ export async function deleteContact(page: Page, did: string): Promise<void> {
await page.goto('./contacts');
const contactName = createContactName(did);
// 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
await page.locator('button > svg.fa-trash-can').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;
}
// 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.
export async function generateAndRegisterEthrUser(page: Page): Promise<string> {
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
export async function createUniqueStringsArray(count: number): Promise<string[]> {
const stringsArray = [];
const stringsArray: string[] = [];
const stringLength = 16;
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
export async function createRandomNumbersArray(count: number): Promise<number[]> {
const numbersArray = [];
const numbersArray: number[] = [];
for (let i = 0; i < count; i++) {
let randomNumber = Math.floor(Math.random() * 99) + 1;