-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ECP-9498] Introduce test case for shopper cancellation (#135)
Co-authored-by: Can Demiralp <[email protected]>
- Loading branch information
1 parent
862ce00
commit 41d4292
Showing
4 changed files
with
61 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
projects/magento/pageObjects/checkout/PayPalComponentsMagento.page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { PayPalComponents } from "../../../common/checkoutComponents/PayPalComponents.js"; | ||
import { PayPalPaymentPage } from "../../../common/redirect/PayPalPaymentPage.js"; | ||
import { PaymentDetailsPage } from "../plugin/PaymentDetails.page.js"; | ||
|
||
export class PayPalComponentsMagentoPage extends PayPalComponents { | ||
constructor(page) { | ||
super(page); | ||
this.page = page; | ||
} | ||
|
||
async payViaPayPal(username, password) { | ||
const popup = await this.initiatePayPalPopup() | ||
await new PayPalPaymentPage(popup).makePayPalPayment(username, password); | ||
} | ||
|
||
async cancelPayPal() { | ||
const popup = await this.initiatePayPalPopup(); | ||
await new PayPalPaymentPage(popup).cancelAndGoToStore(); | ||
} | ||
|
||
async initiatePayPalPopup() { | ||
const paymentDetailPage = new PaymentDetailsPage(this.page); | ||
const payPalSection = await paymentDetailPage.selectPayPal(); | ||
|
||
await this.page.waitForLoadState("load", { timeout: 15000 }); | ||
|
||
const [popup] = await Promise.all([ | ||
this.page.waitForEvent("popup"), | ||
payPalSection.proceedToPayPal(), | ||
]); | ||
|
||
return popup; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters