Skip to content

Commit ceab68d

Browse files
committed
Add google tests
1 parent a955cb4 commit ceab68d

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

playwright.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ export default defineConfig({
5454
use: { ...devices['Desktop Chrome'] },
5555
testMatch: '**/cc-vaulting-transaction.spec.ts',
5656
},
57+
{
58+
name: 'google-transaction-tests',
59+
dependencies: ['setup'],
60+
use: { ...devices['Desktop Chrome'] },
61+
testMatch: '**/google-transaction.spec.ts',
62+
},
5763
],
5864

5965
/* Run your local dev server before starting the tests */
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { test, expect } from '@playwright/test';
2+
import { PAYMENT_METHODS } from '../fixtures/payment-methods';
3+
import { CHECKOUT_TYPES } from '../fixtures/checkout-types';
4+
import { PRODUCT_TYPES } from '../fixtures/product-types';
5+
import { USER_TYPES } from '../fixtures/user-types';
6+
import { CheckoutPage } from '../pages/checkout-page';
7+
import { CartPage } from '../pages/cart-page';
8+
9+
test.describe('Google Pay Payment Tests', () => {
10+
const testCases = [
11+
{
12+
name: 'Classic',
13+
checkoutType: CHECKOUT_TYPES.CLASSIC,
14+
selector: PAYMENT_METHODS.GOOGLE_PAY.selector.classic
15+
},
16+
{
17+
name: 'Block',
18+
checkoutType: CHECKOUT_TYPES.BLOCK,
19+
selector: PAYMENT_METHODS.GOOGLE_PAY.selector.block
20+
}
21+
];
22+
23+
testCases.forEach(({ name, checkoutType, selector }) => {
24+
test(`Google Pay Success - ${name} Checkout`, async ({ page }) => {
25+
const checkoutPage = new CheckoutPage(page, checkoutType);
26+
const cartHelper = new CartPage(page);
27+
28+
await cartHelper.addProductToCart(PRODUCT_TYPES.SIMPLE);
29+
await checkoutPage.goToCheckout(checkoutType);
30+
await checkoutPage.fillBillingDetails(USER_TYPES.ES_USER);
31+
32+
await page.click(selector);
33+
await page.waitForTimeout(1000);
34+
35+
const iframe = page.locator('iframe[name^="__zoid__monei_payment_request__"]');
36+
await expect(iframe).toBeVisible({ timeout: 5000 });
37+
console.log('✅ Google Pay button is visible');
38+
});
39+
});
40+
});

0 commit comments

Comments
 (0)