Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(e2e): Update e2e tests to match GovPay journey #3009

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
@@ -1,9 +1,10 @@
import { test, expect } from "@playwright/test";

Check failure on line 1 in e2e/tests/ui-driven/src/pay.spec.ts

View workflow job for this annotation

GitHub Actions / E2E tests

[chromium] › pay.spec.ts:85:7 › Gov Pay integration @regression › a retry attempt for a failed GOV.UK payment

1) [chromium] › pay.spec.ts:85:7 › Gov Pay integration @regression › a retry attempt for a failed GOV.UK payment Test timeout of 45000ms exceeded.
import {
cards,
fillGovUkCardDetails,
getSessionId,
log,
submitCardDetails,
waitForPaymentResponse,
} from "./globalHelpers";
import type { Page } from "@playwright/test";
Expand Down Expand Up @@ -57,7 +58,7 @@
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 @@ -87,7 +88,7 @@

await page.getByText(payButtonText).click();
await fillGovUkCardDetails({ page, cardNumber: cards.invalid_card_number });
await page.locator("#return-url").click();

Check failure on line 91 in e2e/tests/ui-driven/src/pay.spec.ts

View workflow job for this annotation

GitHub Actions / E2E tests

[chromium] › pay.spec.ts:85:7 › Gov Pay integration @regression › a retry attempt for a failed GOV.UK payment

1) [chromium] › pay.spec.ts:85:7 › Gov Pay integration @regression › a retry attempt for a failed GOV.UK payment Error: locator.click: Test timeout of 45000ms exceeded. Call log: - waiting for locator('#return-url') 89 | await page.getByText(payButtonText).click(); 90 | await fillGovUkCardDetails({ page, cardNumber: cards.invalid_card_number }); > 91 | await page.locator("#return-url").click(); | ^ 92 | 93 | const { paymentId: failedPaymentRef } = await waitForPaymentResponse( 94 | page, at /home/runner/work/planx-new/planx-new/e2e/tests/ui-driven/src/pay.spec.ts:91:39

const { paymentId: failedPaymentRef } = await waitForPaymentResponse(
page,
Expand Down Expand Up @@ -116,7 +117,7 @@
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 @@
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 @@
// 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();
Expand Down Expand Up @@ -275,7 +281,7 @@
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 @@
page,
cardNumber: cards.successful_card_number,
});
await page.locator("#confirm").click();
await submitCardDetails(page);
const { paymentId: actualPaymentId } = await waitForPaymentResponse(
page,
context,
Expand Down
Loading