Skip to content

Commit

Permalink
fix: Re-enter card details
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Apr 11, 2024
1 parent 6ed961e commit ee107ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
4 changes: 4 additions & 0 deletions e2e/tests/ui-driven/src/globalHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ export async function fillGovUkCardDetails({
await page.locator("button#submit-card-details").click();
}

export async function submitCardDetails(page: Page) {
await page.locator("#confirm").click();
}

export async function answerFindProperty(page: Page) {
await setupOSMockResponse(page);
await page.getByLabel("Postcode").fill("SW1 1AA");
Expand Down
18 changes: 12 additions & 6 deletions e2e/tests/ui-driven/src/pay.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
fillGovUkCardDetails,
getSessionId,
log,
submitCardDetails,
waitForPaymentResponse,
} from "./globalHelpers";
import type { Page } from "@playwright/test";
Expand Down Expand Up @@ -57,7 +58,7 @@ test.describe("Gov Pay integration @regression", async () => {
page,
cardNumber: cards.successful_card_number,
});
await page.locator("#confirm").click();
await submitCardDetails(page);
const { paymentId } = await waitForPaymentResponse(page, context);
expect(paymentId).toBeTruthy();

Expand Down Expand Up @@ -116,7 +117,7 @@ test.describe("Gov Pay integration @regression", async () => {
page,
cardNumber: cards.successful_card_number,
});
await page.locator("#confirm").click();
await submitCardDetails(page);
const { paymentId } = await waitForPaymentResponse(page, context);
expect(paymentId).toBeTruthy();

Expand Down Expand Up @@ -167,7 +168,7 @@ test.describe("Gov Pay integration @regression", async () => {
page,
cardNumber: cards.successful_card_number,
});
await page.locator("#confirm").click();
await submitCardDetails(page);
const { paymentId } = await waitForPaymentResponse(page, context);
expect(paymentId).toBeTruthy();

Expand Down Expand Up @@ -224,7 +225,12 @@ test.describe("Gov Pay integration @regression", async () => {
// retry the payment
await page.getByText("Retry payment").click();
await page.getByText("Continue with your payment").click();
await page.locator("#confirm").click();
// Re-enter card details
await fillGovUkCardDetails({
page,
cardNumber: cards.successful_card_number,
});
await page.getByRole("button", { name: "Continue" }).click();

const { paymentId } = await waitForPaymentResponse(page, context);
expect(paymentId).toBeTruthy();
Expand Down Expand Up @@ -275,7 +281,7 @@ test.describe("Gov Pay integration @regression", async () => {
page,
cardNumber: cards.successful_card_number,
});
await page.locator("#confirm").click();
await submitCardDetails(page);
const { paymentId: actualPaymentId } = await waitForPaymentResponse(
page,
context,
Expand Down Expand Up @@ -303,7 +309,7 @@ test.describe("Gov Pay integration @regression", async () => {
page,
cardNumber: cards.successful_card_number,
});
await page.locator("#confirm").click();
await submitCardDetails(page);
const { paymentId: actualPaymentId } = await waitForPaymentResponse(
page,
context,
Expand Down

0 comments on commit ee107ab

Please sign in to comment.