forked from trent_larson/crowd-funder-for-time-pwa
fix: adjust playwright tests to new home-page button, and use 3 threads for fewer random failures
This commit is contained in:
@@ -21,7 +21,7 @@ export default defineConfig({
|
|||||||
/* Retry on CI only */
|
/* Retry on CI only */
|
||||||
retries: process.env.CI ? 2 : 0,
|
retries: process.env.CI ? 2 : 0,
|
||||||
/* Opt out of parallel tests on CI. */
|
/* Opt out of parallel tests on CI. */
|
||||||
workers: 4,
|
workers: 3,
|
||||||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||||
reporter: [
|
reporter: [
|
||||||
['list'],
|
['list'],
|
||||||
|
|||||||
@@ -282,9 +282,9 @@ test('Check User 0 can register a random person', async ({ page }) => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('Could not force close dialog, continuing...');
|
console.log('Could not force close dialog, continuing...');
|
||||||
}
|
}
|
||||||
// Wait for Person button to be ready - simplified approach
|
// Wait for Thank button to be ready - simplified approach
|
||||||
await page.waitForSelector('button:has-text("Person")', { timeout: 10000 });
|
await page.waitForSelector('button:has-text("Thank")', { timeout: 10000 });
|
||||||
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.getByRole('listitem').filter({ hasText: UNNAMED_ENTITY_NAME }).locator('svg').click();
|
||||||
await page.getByPlaceholder('What was given').fill('Gave me access!');
|
await page.getByPlaceholder('What was given').fill('Gave me access!');
|
||||||
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ test('Record something given', async ({ page }) => {
|
|||||||
return !document.querySelector('.dialog-overlay');
|
return !document.querySelector('.dialog-overlay');
|
||||||
}, { timeout: 5000 });
|
}, { 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.getByRole('listitem').filter({ hasText: UNNAMED_ENTITY_NAME }).locator('svg').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());
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ test('Record 9 new gifts', async ({ page }) => {
|
|||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
await page.getByTestId('closeOnboardingAndFinish').click();
|
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.getByRole('listitem').filter({ hasText: UNNAMED_ENTITY_NAME }).locator('svg').click();
|
||||||
await page.getByPlaceholder('What was given').fill(finalTitles[i]);
|
await page.getByPlaceholder('What was given').fill(finalTitles[i]);
|
||||||
await page.getByRole('spinbutton').fill(finalNumbers[i].toString());
|
await page.getByRole('spinbutton').fill(finalNumbers[i].toString());
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { test, expect, Page } from '@playwright/test';
|
import { test, expect, Page } from '@playwright/test';
|
||||||
import { importUser } from './testUtils';
|
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
|
// Generate a random string of a few characters
|
||||||
const randomString = Math.random().toString(36).substring(2, 6);
|
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 }) => {
|
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 }) => {
|
test('Record a give from a project', async ({ page }) => {
|
||||||
await testProjectGive(page, 'gives-from');
|
await testProjectGive(page, false);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ 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 page.getByRole('button', { name: 'Person' }).click();
|
await page.getByRole('button', { name: 'Thank' }).click();
|
||||||
await expect(page.locator('#sectionGiftedGiver').getByRole('listitem').filter({ hasText: contactName })).toBeVisible();
|
await expect(page.locator('#sectionGiftedGiver').getByRole('listitem').filter({ hasText: contactName })).toBeVisible();
|
||||||
|
|
||||||
// Record something given by new contact
|
// Record something given by new contact
|
||||||
|
|||||||
Reference in New Issue
Block a user