Skip to content

Commit 6626d08

Browse files
committed
Update tests
1 parent 1083afc commit 6626d08

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { Page } from '@playwright/test';
2+
3+
export abstract class BasePaymentProcessor {
4+
readonly page: Page;
5+
readonly wooSubmitButtonSelectors: string[] = [
6+
'#place_order',
7+
'.wc-block-components-checkout-place-order-button'
8+
];
9+
10+
constructor(page: Page) {
11+
this.page = page;
12+
}
13+
14+
/**
15+
* Clicks on the WooCommerce submit button, checking for multiple possible selectors
16+
*/
17+
async clickWooSubmitButton(): Promise<void> {
18+
// Try each selector in order until one is found
19+
for (const selector of this.wooSubmitButtonSelectors) {
20+
const buttonExists = await this.page.$(selector) !== null;
21+
if (buttonExists) {
22+
await this.page.click(selector);
23+
return;
24+
}
25+
}
26+
throw new Error('WooCommerce submit button not found. Tried selectors: ' + this.wooSubmitButtonSelectors.join(', '));
27+
}
28+
29+
// Define abstract methods that all payment processors must implement
30+
abstract processPayment(isHostedPayment?: boolean, preset?: string): Promise<void>;
31+
}

tests/specs/payment-gateway-matrix.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const testCombinations = configurations.map(config => ({
1818
expectSuccess: config.expectSuccess,
1919
userType: config.userType
2020
}));
21-
console.log(testCombinations);
2221
test.describe('Payment Gateway Matrix Tests', () => {
2322
testCombinations.forEach(({ paymentMethod, checkoutType, productType, userState, expectSuccess, userType }) => {
2423
test(`${paymentMethod.name} - ${checkoutType.name} - ${productType.name} - ${userState.name}`, async ({ page }) => {

0 commit comments

Comments
 (0)