adjust test lines to await/expect appropriately

This commit is contained in:
2024-11-07 19:07:45 -07:00
parent a73f0239c9
commit a3b10d9a78
5 changed files with 15 additions and 13 deletions

View File

@@ -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();
});