From 314cf7d8743d1127419e0cca2961c319a838e9b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dafydd=20Ll=C5=B7r=20Pearson?= Date: Thu, 11 Apr 2024 08:01:30 +0100 Subject: [PATCH] chore(e2e): Update submit card details locator on GovPay [skip pizza] --- e2e/tests/ui-driven/src/globalHelpers.ts | 4 ++++ e2e/tests/ui-driven/src/pay.spec.ts | 13 +++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/e2e/tests/ui-driven/src/globalHelpers.ts b/e2e/tests/ui-driven/src/globalHelpers.ts index 45b2f43b6c..a3d64d8098 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.getByRole("button", { name: "Continue" }).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..ac3a8a8716 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,7 @@ 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(); + await page.getByRole("button", { name: "Continue" }).click(); const { paymentId } = await waitForPaymentResponse(page, context); expect(paymentId).toBeTruthy(); @@ -275,7 +276,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 +304,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,