From c956533e4148c44e9304f9f246d4ff2f6b8d2b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dafydd=20Ll=C5=B7r=20Pearson?= Date: Thu, 11 Apr 2024 08:45:51 +0100 Subject: [PATCH] fix: Re-enter card details --- e2e/tests/ui-driven/src/globalHelpers.ts | 4 ++++ e2e/tests/ui-driven/src/pay.spec.ts | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/e2e/tests/ui-driven/src/globalHelpers.ts b/e2e/tests/ui-driven/src/globalHelpers.ts index 45b2f43b6c..7ce8798f40 100644 --- a/e2e/tests/ui-driven/src/globalHelpers.ts +++ b/e2e/tests/ui-driven/src/globalHelpers.ts @@ -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"); diff --git a/e2e/tests/ui-driven/src/pay.spec.ts b/e2e/tests/ui-driven/src/pay.spec.ts index 406b60310e..fc1bd0c9e2 100644 --- a/e2e/tests/ui-driven/src/pay.spec.ts +++ b/e2e/tests/ui-driven/src/pay.spec.ts @@ -4,6 +4,7 @@ import { fillGovUkCardDetails, getSessionId, log, + submitCardDetails, waitForPaymentResponse, } from "./globalHelpers"; import type { Page } from "@playwright/test"; @@ -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(); @@ -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(); @@ -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(); @@ -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 submitCardDetails(page); const { paymentId } = await waitForPaymentResponse(page, context); expect(paymentId).toBeTruthy(); @@ -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, @@ -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,