Skip to content

Commit

Permalink
Add e2e tests to the same repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
brankologeecom committed Dec 19, 2024
1 parent f7d3797 commit db01571
Show file tree
Hide file tree
Showing 51 changed files with 2,510 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SHOPWARE_BASE_URL=""
PAYPAL_USERNAME=""
PAYPAL_PASSWORD=""
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
playwright-report/
test-results.json
test-report/
.DS_Store
.idea
.env
23 changes: 23 additions & 0 deletions .github/workflows/e2e/adyen-integration-tools-tests/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "pluginstest",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test:ci:shopware": "npx playwright test --config=projects/shopware/shopwareCIContainer.config.cjs",
"test:adyenlocal:shopware": "npx playwright test --workers=1 --headed --project=chromium --config=projects/shopware/shopware.config.cjs",
"test:adyenlocal:shopware:headless": "npx playwright test --workers=1 --project=chromium --config=projects/shopware/shopware.config.cjs",
"test:adyenlocal:shopware:parallel": "npx playwright test --headed --project=chromium --config=projects/shopware/shopware.config.cjs",
"test:adyenlocal:shopware:headless:parallel": "npx playwright test --project=chromium --config=projects/shopware/shopware.config.cjs"
},
"keywords": [],
"author": "",
"license": "MIT",
"devDependencies": {
"@playwright/test": "1.48.2"
},
"dependencies": {
"dotenv": "^16.3.1"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { expect } from "@playwright/test";
export class AdyenGivingComponents {
constructor(page) {
this.page = page;

this.adyenGivingContainer = page.locator(".adyen-checkout__adyen-giving");
this.adyenGivingActionsContainer = this.adyenGivingContainer.locator(
".adyen-checkout__adyen-giving-actions"
);
this.actionButtonsContainer = this.adyenGivingActionsContainer.locator(
".adyen-checkout__amounts"
);

this.leastAmountButton = this.actionButtonsContainer
.locator(".adyen-checkout__button")
.nth(0);
this.midAmountButton = this.actionButtonsContainer
.locator(".adyen-checkout__button")
.nth(1);
this.mostAmountButton = this.actionButtonsContainer
.locator(".adyen-checkout__button")
.nth(2);

this.donateButton = this.adyenGivingActionsContainer.locator(
".adyen-checkout__button--donate"
);
this.declinelButton = this.adyenGivingActionsContainer.locator(
".adyen-checkout__button--decline"
);

this.DonationMessage = this.adyenGivingContainer.locator(
".adyen-checkout__status__text"
);
}

async makeDonation(amount = "least") {
switch (amount) {
case "least":
await this.leastAmountButton.click();
break;
case "mid":
await this.midAmountButton.click();
break;
case "most":
await this.mostAmountButton.click();
break;
}
await this.donateButton.click();
}

async declineDonation() {
await this.declinelButton.click();
}

async verifySuccessfulDonationMessage() {
await expect(this.DonationMessage).toHaveText("Thanks for your support!");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export class AmazonPayComponents {
constructor(page) {
this.page = page;

this.amazonPayContainer = page.locator("#amazonpayContainer");
this.amazonPayButton = this.amazonPayContainer.getByLabel('Amazon Pay - Use your Amazon Pay Sandbox test account');

}

async clickAmazonPayButton() {
await this.amazonPayButton.click();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
export class BancontactCardComponents {
constructor(page) {
this.page = page;

this.cardNumberInput = page
.frameLocator(
".adyen-checkout__card__cardNumber__input iframe"
)
.locator(".input-field");

this.expDateInput = page
.frameLocator(
".adyen-checkout__card__exp-date__input iframe"
)
.locator(".input-field");

this.holderNameInput = page.locator(
"input.adyen-checkout__card__holderName__input"
);
}

async fillHolderName(holderName) {
await this.holderNameInput.click();
await this.holderNameInput.fill(holderName);
}
async fillCardNumber(cardNumber) {
await this.cardNumberInput.click();
await this.cardNumberInput.fill(cardNumber);
}
async fillExpDate(expDate) {
await this.expDateInput.click();
await this.expDateInput.fill(expDate);
}

async fillBancontacCardInfo(
cardNumber,
cardExpirationDate,
) {
await this.fillCardNumber(cardNumber);
await this.fillExpDate(cardExpirationDate);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export class BoletoComponents {
constructor(page) {
this.page = page;

this.socialSecurityNumberInput = page.locator(
"#adyen_boleto_social_security_number"
);
this.firstNameInput = page.locator("#adyen_boleto_firstname");
this.lastNameInput = page.locator("#adyen_boleto_lastname");
}

async fillBoletoDetails(socialSecurityNumber, firstName, lastName) {
await this.socialSecurityNumberInput.fill(socialSecurityNumber);
await this.firstNameInput.fill(firstName);
await this.lastNameInput.fill(lastName);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
export class CreditCardComponents {
constructor(page) {
this.page = page;

this.holderNameInput = page.locator(
".adyen-checkout__card__holderName input"
);

this.cardNumberInput = page
.frameLocator(".adyen-checkout__card__cardNumber__input iframe")
.locator(".input-field");

this.expDateInput = page
.frameLocator(".adyen-checkout__card__exp-date__input iframe")
.locator(".input-field");

this.cvcInput = page
.frameLocator(".adyen-checkout__card__cvc__input iframe")
.locator(".input-field");

this.typeDelay = 50;
}

async fillHolderName(holderName) {
await this.holderNameInput.scrollIntoViewIfNeeded();
await this.holderNameInput.click();
await this.holderNameInput.type(holderName);
}
async fillCardNumber(cardNumber) {
await this.cardNumberInput.scrollIntoViewIfNeeded();
await this.cardNumberInput.click();
await this.cardNumberInput.type(cardNumber, { delay: this.typeDelay });
}
async fillExpDate(expDate) {
await this.expDateInput.scrollIntoViewIfNeeded();
await this.expDateInput.click();
await this.expDateInput.type(expDate, { delay: this.typeDelay });
}
async fillCVC(CVC) {
await this.cvcInput.scrollIntoViewIfNeeded();
await this.cvcInput.click();
await this.cvcInput.type(CVC, { delay: this.typeDelay });
}

async fillCreditCardInfo(
cardHolderName,
cardHolderLastName,
cardNumber,
cardExpirationDate,
cardCVC = undefined
) {
await this.fillCardNumber(cardNumber);
await this.fillExpDate(cardExpirationDate);
if (cardCVC !== undefined ) {
await this.fillCVC(cardCVC);
}
await this.fillHolderName(cardHolderName);
await this.fillHolderName(` ${cardHolderLastName}`);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export class GiftcardComponents {
constructor(page) {
// Abstract implementation is being extended in GiftcardComponentsMagento.js
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export class IDealComponents {
constructor(page) {
this.page = page;

this.iDealDropDown = page.locator(
"#payment_form_adyen_hpp_ideal .adyen-checkout__dropdown__button"
);
}

iDealDropDownSelectorGenerator(issuerName) {
return this.page.locator(
`#payment_form_adyen_hpp_ideal .adyen-checkout__dropdown__list li [alt='${issuerName}']`
);
}

async selectIdealIssuer(issuerName) {
await this.iDealDropDown.click();
await this.iDealDropDownSelectorGenerator(issuerName).click();
}

async selectRefusedIdealIssuer() {
await this.iDealDropDown.click();
await this.iDealDropDownSelectorGenerator("Test Issuer Refused").click();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export class OneyComponents {
constructor(page) {
this.activePaymentMethodSection = page;

this.maleGenderRadioButton = this.activePaymentMethodSection
.locator(".adyen-checkout__radio_group__input-wrapper")
.nth(0);
this.birthdayInput = this.activePaymentMethodSection.locator(
".adyen-checkout__input--dateOfBirth"
);
this.telephoneNumberInput = this.activePaymentMethodSection.locator(
".adyen-checkout__input--telephoneNumber");
}

async completeOneyForm(user) {
await this.maleGenderRadioButton.click();
await this.birthdayInput.type(user.dateOfBirth);

await this.telephoneNumberInput.fill("");
await this.telephoneNumberInput.type(user.phoneNumber);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export class PayPalComponents {
constructor(page) {
this.page = page;

this.payPalButton = page
.frameLocator("iframe[title='PayPal']").last()
.locator(".paypal-button").first();
}

async proceedToPayPal() {
// The iframe which contains PayPal button may require extra time to load
await new Promise(r => setTimeout(r, 500));
await this.payPalButton.scrollIntoViewIfNeeded();
await this.payPalButton.hover();
await this.payPalButton.click();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export class SepaDirectDebitComponents {
constructor(page) {
this.page = page;

this.accountHolderNameInput = this.page.locator(
"input[name='ownerName']"
);
this.accountNumberInput = this.page.locator(
"input[name='ibanNumber']"
);
}

async fillSepaDirectDebitInfo(accountHolderName, accountNumber) {
await this.accountHolderNameInput.click();
await this.accountHolderNameInput.fill(accountHolderName);

await this.accountNumberInput.click();
await this.accountNumberInput.fill(accountNumber);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export class IDealComponents {
constructor(page) {
this.page = page;

this.iDealDropDown = page.locator(
".adyen-checkout__dropdown__button"
);
}

/** @deprecated on Ideal 2.0 */
iDealDropDownSelectorGenerator(issuerName) {
return this.page.locator(
`.adyen-checkout__dropdown__list li [alt='${issuerName}']`
);
}

/** @deprecated on Ideal 2.0 */
async selectIdealIssuer(issuerName) {
await this.iDealDropDown.click();
await this.iDealDropDownSelectorGenerator(issuerName).click();
}

/** @deprecated on Ideal 2.0 */
async selectRefusedIdealIssuer() {
await this.iDealDropDown.click();
await this.iDealDropDownSelectorGenerator("Test Issuer Refused").click();
}
}
Loading

0 comments on commit db01571

Please sign in to comment.