Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aashwin-rvvup committed Oct 28, 2024
1 parent 7df486f commit 9f7453a
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Test/End-2-End/pay_by_bank.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ test("Can place an order using pay by bank", async ({ page, browser }) => {
await page.waitForTimeout(3000);
await page.getByRole("button", { name: "Place order" }).click();

// Credit card form
const frame = page.frameLocator("iframe.rvvup-modal");
await frame.getByLabel("Mock Bank").click();
await frame.getByRole("button", { name: "Continue on desktop" }).click();
Expand All @@ -31,3 +30,25 @@ test("Can place an order using pay by bank", async ({ page, browser }) => {
"Your payment is being processed and is pending confirmation. You will receive an email confirmation when the payment is confirmed.",
);
});


test("Prevent close is handled on bank selection screen and can only be closed by pressing 'x'", async ({page}) => {
const visitCheckoutPayment = new VisitCheckoutPayment(page);
await visitCheckoutPayment.visit();

await page.getByLabel("Pay by Bank").click();
/** Add timeout to prevent clicking 'Place Order' too fast, which will result in
* failure to open popup modal
*/
await page.waitForTimeout(3000);
await page.getByRole("button", {name: "Place order"}).click();

const frame = page.frameLocator("iframe.rvvup-modal");
await expect(frame.getByLabel("Mock Bank")).toBeVisible();
await page.locator("#rvvup-modal div").click();
// Shouldn't close
await page.waitForTimeout(500);
await frame.getByTitle("Exit").click();

await expect(page.locator("#rvvup-modal div")).toBeHidden();
});

0 comments on commit 9f7453a

Please sign in to comment.