Skip to content

Commit

Permalink
Merge pull request #598 from Adyen/develop-3
Browse files Browse the repository at this point in the history
Release version 3.17.4
  • Loading branch information
goran-stamenkovski-logeecom authored Dec 27, 2024
2 parents 70368ca + d128df3 commit 40cd342
Show file tree
Hide file tree
Showing 55 changed files with 2,557 additions and 22 deletions.
34 changes: 28 additions & 6 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

name: E2E Test
run-name: Headless E2E tests for Adyen Shopware Plugin

on:
on:
pull_request:
workflow_dispatch:

Expand All @@ -14,8 +15,7 @@ jobs:
timeout-minutes: 20
strategy:
fail-fast: false
# if: ${{ github.actor != 'renovate[bot]' || github.actor != 'lgtm-com[bot]' }}
if: false
if: ${{ github.actor != 'renovate[bot]' && github.actor != 'lgtm-com[bot]' }}
# Prevent bots from initiating E2E pipeline
steps:
- name: Clone Code
Expand All @@ -32,14 +32,15 @@ jobs:
docker exec shopware6 bash -c "sudo mysql -u root -proot shopware -e \"UPDATE sales_channel_domain SET url='https://local.shopware.shop' WHERE url NOT LIKE 'default.%';\""
docker exec shopware6 bash -c \
"sudo mysql -u root -proot shopware -e \"SELECT @RULE_ID := id FROM rule WHERE name = 'All customers'; UPDATE shipping_method SET availability_rule_id = @RULE_ID;\""
docker exec shopware6 bash -c "sudo mysql -u root -proot shopware -e \"UPDATE system_config SET configuration_value='{\"enabled\": false}' WHERE configuration_key='core.basicInformation.cookieConsent';\""
docker network create localnetwork
docker network connect --alias local.shopware.shop localnetwork shopware6
- name: Install/Configure Plugin
run: |
docker exec shopware6 bash -c "composer config --json repositories.local '{\"type\": \"path\", \"url\": \"/data/extensions/workdir\", \"options\": { \"symlink\": false } }'"
docker exec shopware6 bash -c 'composer require adyen/adyen-shopware6:*'
docker exec shopware6 bash -c 'composer require adyen/adyen-shopware6:*@RC'
docker exec shopware6 bash -c 'php bin/console plugin:refresh'
docker exec shopware6 bash -c 'php bin/console plugin:install AdyenPaymentShopware6 --activate'
docker exec shopware6 bash -c 'php bin/console cache:clear'
Expand All @@ -55,7 +56,6 @@ jobs:
- name: Run E2E Tests
run: docker compose -f .github/workflows/templates/docker-compose.playwright.yml run --rm playwright /e2e.sh
env:
INTEGRATION_TESTS_BRANCH: develop
SHOPWARE_BASE_URL: ${{secrets.SHOPWARE_BASE_URL}}
PAYPAL_USERNAME: ${{secrets.PLAYWRIGHT_PAYPAL_USERNAME}}
PAYPAL_PASSWORD: ${{secrets.PLAYWRIGHT_PAYPAL_PASSWORD}}
Expand All @@ -66,3 +66,25 @@ jobs:
with:
name: html-report
path: test-report

- name: Copy Adyen api logs from container if available
if: always()
run: |
# Create a local directory for logs
mkdir -p logs
# Check if the log file exists in the container
if docker exec shopware6 test -f /var/www/html/var/log/adyen/api.log; then
echo "Log file exists. Copying..."
docker cp shopware6:/var/www/html/var/log/adyen/api.log logs
else
echo "Log file does not exist. Skipping copy."
fi
shell: bash

- name: Upload Adyen api Logs
if: always()
uses: actions/upload-artifact@v3
with:
name: adyen-api-logs
path: logs/*
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.42.1"
},
"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);
}
}
Loading

0 comments on commit 40cd342

Please sign in to comment.