fix: adjust playwright tests to new home-page button, and use 3 threads for fewer random failures

This commit is contained in:
2025-12-20 19:59:30 -07:00
parent e7ca2bb791
commit f460d6c3e2
6 changed files with 11 additions and 10 deletions

View File

@@ -21,7 +21,7 @@ export default defineConfig({
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: 4,
workers: 3,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
['list'],

View File

@@ -282,9 +282,9 @@ test('Check User 0 can register a random person', async ({ page }) => {
} catch (error) {
console.log('Could not force close dialog, continuing...');
}
// Wait for Person button to be ready - simplified approach
await page.waitForSelector('button:has-text("Person")', { timeout: 10000 });
await page.getByRole('button', { name: 'Person' }).click();
// Wait for Thank button to be ready - simplified approach
await page.waitForSelector('button:has-text("Thank")', { timeout: 10000 });
await page.getByRole('button', { name: 'Thank' }).click();
await page.getByRole('listitem').filter({ hasText: UNNAMED_ENTITY_NAME }).locator('svg').click();
await page.getByPlaceholder('What was given').fill('Gave me access!');
await page.getByRole('button', { name: 'Sign & Send' }).click();

View File

@@ -107,7 +107,7 @@ test('Record something given', async ({ page }) => {
return !document.querySelector('.dialog-overlay');
}, { timeout: 5000 });
await page.getByRole('button', { name: 'Person' }).click();
await page.getByRole('button', { name: 'Thank' }).click();
await page.getByRole('listitem').filter({ hasText: UNNAMED_ENTITY_NAME }).locator('svg').click();
await page.getByPlaceholder('What was given').fill(finalTitle);
await page.getByRole('spinbutton').fill(randomNonZeroNumber.toString());

View File

@@ -116,7 +116,7 @@ test('Record 9 new gifts', async ({ page }) => {
if (i === 0) {
await page.getByTestId('closeOnboardingAndFinish').click();
}
await page.getByRole('button', { name: 'Person' }).click();
await page.getByRole('button', { name: 'Thank' }).click();
await page.getByRole('listitem').filter({ hasText: UNNAMED_ENTITY_NAME }).locator('svg').click();
await page.getByPlaceholder('What was given').fill(finalTitles[i]);
await page.getByRole('spinbutton').fill(finalNumbers[i].toString());

View File

@@ -1,7 +1,8 @@
import { test, expect, Page } from '@playwright/test';
import { importUser } from './testUtils';
async function testProjectGive(page: Page, selector: string) {
async function testProjectGive(page: Page, isToProject: boolean) {
const selector = isToProject ? 'gives-to' : 'gives-from';
// Generate a random string of a few characters
const randomString = Math.random().toString(36).substring(2, 6);
@@ -42,9 +43,9 @@ async function testProjectGive(page: Page, selector: string) {
}
test('Record a give to a project', async ({ page }) => {
await testProjectGive(page, 'gives-to');
await testProjectGive(page, true);
});
test('Record a give from a project', async ({ page }) => {
await testProjectGive(page, 'gives-from');
await testProjectGive(page, false);
});

View File

@@ -117,7 +117,7 @@ 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 page.getByRole('button', { name: 'Person' }).click();
await page.getByRole('button', { name: 'Thank' }).click();
await expect(page.locator('#sectionGiftedGiver').getByRole('listitem').filter({ hasText: contactName })).toBeVisible();
// Record something given by new contact