Skip to content

Commit

Permalink
fix: Failing e2e tests passing locally after removing redundant awaits
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Oct 5, 2023
1 parent a6143fa commit 0bc1847
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
28 changes: 14 additions & 14 deletions e2e/tests/ui-driven/src/invite-to-pay/agent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ test.describe("Agent journey @regression", async () => {
});
await expect(toggleInviteToPayButton).toBeVisible();
await toggleInviteToPayButton.click();
const inviteToPayFormHeader = await page.getByText(
"Invite someone else to pay for this application",
const inviteToPayFormHeader = page.getByText(
"Invite someone else to pay for this application"
);
await expect(inviteToPayFormHeader).toBeVisible();

await answerInviteToPayForm(page);
await page.getByRole("button", { name: "Send invitation to pay" }).click();
await page.waitForLoadState("networkidle");
page.getByRole("button", { name: "Send invitation to pay" }).click();
await page.waitForResponse(res => res.url().includes("invite-to-pay"))

const errorMessage = await page.getByText(
"Error generating payment request, please try again",
const errorMessage = page.getByText(
"Error generating payment request, please try again"
);
await expect(errorMessage).toBeHidden();

Expand All @@ -73,7 +73,7 @@ test.describe("Agent journey @regression", async () => {
expect(paymentRequest).toBeDefined();
expect(paymentRequest).toMatchObject(mockPaymentRequest);

const successMessage = await page.getByText("Payment invitation sent");
const successMessage = page.getByText("Payment invitation sent");
await expect(successMessage).toBeVisible();
});

Expand Down Expand Up @@ -108,15 +108,15 @@ test.describe("Agent journey @regression", async () => {
const secondPage = await browserContext.newPage();
await secondPage.goto(resumeLink);
await expect(
await secondPage.getByRole("heading", {
secondPage.getByRole("heading", {
name: "Resume your application",
}),
).toBeVisible();
await secondPage.getByLabel("Email address").fill(context.user.email);
await secondPage.getByTestId("continue-button").click();

await expect(
await secondPage.getByRole("heading", {
secondPage.getByRole("heading", {
name: "Sorry, you can't make changes to this application",
}),
).toBeVisible();
Expand All @@ -138,22 +138,22 @@ test.describe("Agent journey @regression", async () => {
const secondPage = await browserContext.newPage();
await secondPage.goto(resumeLink);
await expect(
await secondPage.getByRole("heading", {
secondPage.getByRole("heading", {
name: "Resume your application",
}),
).toBeVisible();
await secondPage.getByLabel("Email address").fill(context.user.email);
await secondPage.getByTestId("continue-button").click();

// Reconciliation ignored
const reconciliationText = await secondPage.getByText(
"This service has been updated since you last saved your application. We will ask you to answer any updated questions again when you continue.",
const reconciliationText = secondPage.getByText(
"This service has been updated since you last saved your application. We will ask you to answer any updated questions again when you continue."
);
await expect(reconciliationText).toBeHidden();

// Locked application message displayed
await expect(
await secondPage.getByRole("heading", {
secondPage.getByRole("heading", {
name: "Sorry, you can't make changes to this application",
}),
).toBeVisible();
Expand All @@ -180,7 +180,7 @@ test.describe("Agent journey @regression", async () => {
sessionId,
adminGQLClient,
});
await expect(paymentRequest).toBeDefined();
expect(paymentRequest).toBeDefined();

// Attempt to make payment in tab 2...
await tab2.getByText("Pay now using GOV.UK Pay").click();
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/ui-driven/src/invite-to-pay/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ export async function makePaymentRequest({
});
await toggleInviteToPayButton.click();
await answerInviteToPayForm(page);
await page.getByRole("button", { name: "Send invitation to pay" }).click();
await page.waitForLoadState("networkidle");
page.getByRole("button", { name: "Send invitation to pay" }).click();
await page.waitForResponse(res => res.url().includes("invite-to-pay"));

return sessionId;
}

0 comments on commit 0bc1847

Please sign in to comment.