forked from trent_larson/crowd-funder-for-time-pwa
adjust test lines to await/expect appropriately
This commit is contained in:
@@ -7,7 +7,7 @@ test('Check activity feed - check that server is running', async ({ page }) => {
|
||||
await page.getByTestId('closeOnboardingAndFinish').click();
|
||||
|
||||
// Check that initial 10 activities have been loaded
|
||||
await page.locator('ul#listLatestActivity li:nth-child(10)');
|
||||
await expect(page.locator('ul#listLatestActivity li:nth-child(10)')).toBeVisible();
|
||||
|
||||
// Scroll down a bit to trigger loading additional activities
|
||||
await page.locator('ul#listLatestActivity li:nth-child(50)').scrollIntoViewIfNeeded();
|
||||
@@ -18,7 +18,7 @@ test('Check discover results', async ({ page }) => {
|
||||
await page.goto('./discover');
|
||||
|
||||
// Check that initial 10 projects have been loaded
|
||||
await page.locator('ul#listDiscoverResults li.border-b:nth-child(10)');
|
||||
await expect(page.locator('ul#listDiscoverResults li.border-b:nth-child(10)')).toBeVisible();
|
||||
|
||||
// Scroll down a bit to trigger loading additional projects
|
||||
await page.locator('ul#listDiscoverResults li.border-b:nth-child(20)').scrollIntoViewIfNeeded();
|
||||
@@ -43,7 +43,7 @@ test('Check ability to share contact', async ({ page }) => {
|
||||
await page.goto('./discover');
|
||||
|
||||
// Check that initial 10 projects have been loaded
|
||||
await page.locator('ul#listDiscoverResults li.border-b:nth-child(10)');
|
||||
await expect(page.locator('ul#listDiscoverResults li.border-b:nth-child(10)')).toBeVisible();
|
||||
|
||||
// Scroll down a bit to trigger loading additional projects
|
||||
await page.locator('ul#listDiscoverResults li.border-b:nth-child(20)').scrollIntoViewIfNeeded();
|
||||
|
||||
@@ -16,11 +16,11 @@ test('Check User 0 can invite someone', async ({ page }) => {
|
||||
await expect(page.locator('div[role="alert"] button:has-text("Yes")')).toBeHidden();
|
||||
|
||||
// check that the invite is in the list
|
||||
const newInviteLine = await page.locator(`td:has-text("Neighbor ${neighborNum}")`);
|
||||
const newInviteLine = page.locator(`td:has-text("Neighbor ${neighborNum}")`);
|
||||
await expect(newInviteLine).toBeVisible();
|
||||
// retrieve the link from the title
|
||||
const inviteLink = await newInviteLine.getAttribute('data-testId');
|
||||
await expect(inviteLink).not.toBeNull();
|
||||
expect(inviteLink).not.toBeNull();
|
||||
|
||||
// become the new user and accept the invite
|
||||
await switchToUser(page, newDid);
|
||||
|
||||
@@ -22,6 +22,7 @@ test('Record an offer', async ({ page }) => {
|
||||
await page.getByTestId('offerButton').click();
|
||||
await page.getByTestId('inputDescription').fill(description);
|
||||
await page.getByTestId('inputOfferAmount').fill(randomNonZeroNumber.toString());
|
||||
expect(page.getByRole('button', { name: 'Sign & Send' }));
|
||||
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
||||
await expect(page.getByText('That offer was recorded.')).toBeVisible();
|
||||
|
||||
@@ -36,8 +37,8 @@ test('Record an offer', async ({ page }) => {
|
||||
const serverPagePromise = page.waitForEvent('popup');
|
||||
await page.getByRole('link', { name: 'View on the Public Server' }).click();
|
||||
const serverPage = await serverPagePromise;
|
||||
await serverPage.getByText(description);
|
||||
await serverPage.getByText('did:none:HIDDEN');
|
||||
await expect(serverPage.getByText(description)).toBeVisible();
|
||||
await expect(serverPage.getByText('did:none:HIDDEN')).toBeVisible();
|
||||
|
||||
// Now update that offer
|
||||
|
||||
@@ -61,12 +62,12 @@ test('Record an offer', async ({ page }) => {
|
||||
await page.goto('./projects');
|
||||
await page.getByRole('link', { name: 'Offers', exact: true }).click();
|
||||
await page.locator('li').filter({ hasText: description }).locator('a').first().click();
|
||||
const newItemDesc = await page.getByTestId('description');
|
||||
const newItemDesc = page.getByTestId('description');
|
||||
await expect(newItemDesc).toHaveText(updatedDescription);
|
||||
|
||||
// go to edit page
|
||||
await page.getByTestId('editClaimButton').click();
|
||||
const newAmount = await page.getByTestId('inputOfferAmount');
|
||||
const newAmount = page.getByTestId('inputOfferAmount');
|
||||
await expect(newAmount).toHaveValue((randomNonZeroNumber + 1).toString());
|
||||
|
||||
// go to the home page and check that the offer is shown as new
|
||||
@@ -102,8 +103,8 @@ test('Affirm delivery of an offer', async ({ page }) => {
|
||||
// click on the 'Affirm Delivery' button
|
||||
await page.getByRole('button', { name: 'Affirm Delivery' }).click();
|
||||
// fill our offer info and submit
|
||||
await page.getByPlaceholder('What was given').fill("Whatever the offer says");
|
||||
await page.getByRole('spinbutton').fill("2");
|
||||
await page.getByPlaceholder('What was given').fill('Whatever the offer says');
|
||||
await page.getByRole('spinbutton').fill('2');
|
||||
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
||||
await expect(page.getByText('That gift was recorded.')).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -4,11 +4,12 @@ import { importUser, generateNewEthrUser, switchToUser } from './testUtils';
|
||||
test('New offers for another user', async ({ page }) => {
|
||||
const user01Did = await generateNewEthrUser(page);
|
||||
await page.goto('./');
|
||||
expect(page.getByTestId('newDirectOffersActivityNumber')).toBeHidden();
|
||||
await expect(page.getByTestId('newDirectOffersActivityNumber')).toBeHidden();
|
||||
|
||||
await importUser(page, '00');
|
||||
await page.goto('./contacts');
|
||||
await page.getByPlaceholder('URL or DID, Name, Public Key').fill(user01Did + ', A Friend');
|
||||
await expect(page.locator('button > svg.fa-plus')).toBeVisible();
|
||||
await page.locator('button > svg.fa-plus').click();
|
||||
await expect(page.locator('div[role="alert"] span:has-text("Contact Added")')).toBeVisible();
|
||||
await page.locator('div[role="alert"] button:has-text("No")').click(); // don't register
|
||||
|
||||
@@ -85,11 +85,11 @@ export async function generateAndRegisterEthrUser(page: Page): Promise<string> {
|
||||
const contactName = createContactName(newDid);
|
||||
await page.getByPlaceholder('URL or DID, Name, Public Key').fill(`${newDid}, ${contactName}`);
|
||||
await page.locator('button > svg.fa-plus').click();
|
||||
await page.locator('li', { hasText: contactName }).click();
|
||||
// register them
|
||||
await page.locator('div[role="alert"] button:has-text("Yes")').click();
|
||||
// wait for it to disappear because the next steps may depend on alerts being gone
|
||||
await expect(page.locator('div[role="alert"] button:has-text("Yes")')).toBeHidden();
|
||||
await expect(page.locator('li', { hasText: contactName })).toBeVisible();
|
||||
|
||||
return newDid;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user