Skip to content

Commit

Permalink
Add E2E test workshop advanced flow (#95)
Browse files Browse the repository at this point in the history
Co-authored-by: kwokhe <[email protected]>
  • Loading branch information
Kwok-he-Chu and kwokhe authored Oct 3, 2024
1 parent 072b0d5 commit 5b94006
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/workshop/workshop-advanced-flow.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// @ts-check
const { test, expect } = require('@playwright/test');
const utilities = require('../utilities');

test('Workshop - Advanced Flow Payment', async ({ page }) => {
await page.goto('/');

// Select "Drop-in"
await expect(page.locator('text="Start shopping"')).toBeVisible();
await page.getByRole('link', { name: 'Start shopping' }).click();

// Click "Continue to checkout"
await page.getByRole('link', { name: 'Continue to checkout' }).click();

// Wait for load event
await page.waitForLoadState('load');

// Assert that "Credit or debit card" is visible
await expect(page.locator('text="Credit or debit card"')).toBeVisible();

// Click "Credit or debit card"
const radioButton = await page.getByRole('radio', { name: 'Credit or debit card' });
await radioButton.click();

// Wait for load event
await page.waitForLoadState('load');

// Fill card details
await utilities.fillDropinCardDetails(page);

// Click "Pay" button
const payButton = page.locator('.adyen-checkout__button__text >> visible=true');
await expect(payButton).toBeVisible();
await payButton.click();

await expect(page.locator('text="Return Home"')).toBeVisible();
});

0 comments on commit 5b94006

Please sign in to comment.