From fe90a64222355e24e6daf56dcfb7719b99377e2e Mon Sep 17 00:00:00 2001 From: Tamara Date: Mon, 23 Dec 2024 11:28:20 +0100 Subject: [PATCH 01/12] Fix the condition for executing E2E tests --- .github/workflows/e2e-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 5f57e95e..0ef7397f 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -15,7 +15,7 @@ jobs: timeout-minutes: 20 strategy: fail-fast: false - if: ${{ github.actor != 'renovate[bot]' || github.actor != 'lgtm-com[bot]' }} + if: ${{ github.actor != 'renovate[bot]' && github.actor != 'lgtm-com[bot]' }} # Prevent bots from initiating E2E pipeline steps: - name: Clone Code From 05a8219e7b5f1d98b8dfbd8cbca00caf4f233df6 Mon Sep 17 00:00:00 2001 From: Tamara Date: Mon, 23 Dec 2024 12:12:11 +0100 Subject: [PATCH 02/12] Fix the test - Payment methods should be updated when the billing address is changed --- .../pageObjects/plugin/ShippingDetails.page.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/pageObjects/plugin/ShippingDetails.page.js b/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/pageObjects/plugin/ShippingDetails.page.js index 24813ad8..5b587c1c 100644 --- a/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/pageObjects/plugin/ShippingDetails.page.js +++ b/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/pageObjects/plugin/ShippingDetails.page.js @@ -19,11 +19,11 @@ export class ShippingDetailsPage extends SPRBasePage { this.editSalutationDropDown = this.editAddressEditorWrapper.locator("#billing-addresspersonalSalutation"); this.editFirstNameField = this.editAddressEditorWrapper.locator("#billing-addresspersonalFirstName"); this.editLastNameField = this.editAddressEditorWrapper.locator("#billing-addresspersonalLastName"); - this.editAddressField = this.editAddressEditorWrapper.locator("#billing-addressAddressStreet"); - this.editPostCodeField = this.editAddressEditorWrapper.locator("#billing-addressAddressZipcode"); - this.editCityField = this.editAddressEditorWrapper.locator("#billing-addressAddressCity"); - this.editCountrySelectDropdown = this.editAddressEditorWrapper.locator("#billing-addressAddressCountry"); - this.editStateSelectDropDown = this.editAddressEditorWrapper.locator("#billing-addressAddressCountryState"); + this.editAddressField = this.editAddressEditorWrapper.locator("#billing-edit-addressAddressStreet"); + this.editPostCodeField = this.editAddressEditorWrapper.locator("#billing-edit-addressAddressZipcode"); + this.editCityField = this.editAddressEditorWrapper.locator("#billing-edit-addressAddressCity"); + this.editCountrySelectDropdown = this.editAddressEditorWrapper.locator("#billing-edit-addressAddressCountry"); + this.editStateSelectDropDown = this.editAddressEditorWrapper.locator("#billing-edit-addressAddressCountryState"); this.editSaveAddressButton = this.editAddressEditorWrapper.locator("button[type='submit']"); From e97aee1a3e6b11efba603ea83d04ff0193f31dc2 Mon Sep 17 00:00:00 2001 From: Tamara Date: Mon, 23 Dec 2024 14:16:13 +0100 Subject: [PATCH 03/12] Add adyen logs to artifacts --- .github/workflows/e2e-test.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 0ef7397f..fa249fde 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -66,3 +66,15 @@ jobs: with: name: html-report path: test-report + + - name: Upload Adyen Logs + uses: actions/upload-artifact@v3 + with: + name: adyen-logs + path: var/log/adyen/adyen.log + + - name: Upload Adyen api Logs + uses: actions/upload-artifact@v3 + with: + name: adyen-api-logs + path: var/log/adyen/api.log \ No newline at end of file From 78ec329b558c38c33c92083130899293d01a2572 Mon Sep 17 00:00:00 2001 From: Tamara Date: Mon, 23 Dec 2024 14:23:58 +0100 Subject: [PATCH 04/12] Add adyen logs to artifacts --- .github/workflows/e2e-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index fa249fde..0cca0c8b 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -68,12 +68,14 @@ jobs: path: test-report - name: Upload Adyen Logs + if: always() uses: actions/upload-artifact@v3 with: name: adyen-logs path: var/log/adyen/adyen.log - name: Upload Adyen api Logs + if: always() uses: actions/upload-artifact@v3 with: name: adyen-api-logs From e1f505be6f69a8b01dcf9465394d6225518796e3 Mon Sep 17 00:00:00 2001 From: Tamara Date: Mon, 23 Dec 2024 14:42:22 +0100 Subject: [PATCH 05/12] Add adyen logs to artifacts --- .github/workflows/e2e-test.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 0cca0c8b..73b7f173 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -67,16 +67,25 @@ jobs: name: html-report path: test-report + - name: Copy Logs from Container + if: always() + run: | + # Create a local directory for logs + mkdir -p logs + + # Copy logs from Shopware container to the host + docker cp shopware6:var/log/adyen logs + - name: Upload Adyen Logs if: always() uses: actions/upload-artifact@v3 with: name: adyen-logs - path: var/log/adyen/adyen.log + path: logs/adyen.log - name: Upload Adyen api Logs if: always() uses: actions/upload-artifact@v3 with: name: adyen-api-logs - path: var/log/adyen/api.log \ No newline at end of file + path: logs/api.log \ No newline at end of file From 93a8a7a7547dbb74761744bf2c00298956286ce4 Mon Sep 17 00:00:00 2001 From: Tamara Date: Mon, 23 Dec 2024 17:04:42 +0100 Subject: [PATCH 06/12] Add adyen logs to artifacts --- .github/workflows/e2e-test.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 73b7f173..686c6bf4 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -74,14 +74,7 @@ jobs: mkdir -p logs # Copy logs from Shopware container to the host - docker cp shopware6:var/log/adyen logs - - - name: Upload Adyen Logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: adyen-logs - path: logs/adyen.log + docker cp shopware6:~/html/var/log/adyen logs - name: Upload Adyen api Logs if: always() From 967ef2195e2f5e4af9103c31240b678e9ff1e104 Mon Sep 17 00:00:00 2001 From: Tamara Date: Mon, 23 Dec 2024 17:10:44 +0100 Subject: [PATCH 07/12] Fix the issue with failed Klarna payment --- src/Handlers/AbstractPaymentMethodHandler.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Handlers/AbstractPaymentMethodHandler.php b/src/Handlers/AbstractPaymentMethodHandler.php index 363aa71f..45b6b971 100644 --- a/src/Handlers/AbstractPaymentMethodHandler.php +++ b/src/Handlers/AbstractPaymentMethodHandler.php @@ -292,13 +292,16 @@ public function pay( */ $stateData = $requestStateData ?? $storedStateData ?? []; + $billieData = []; $companyName = $dataBag->get('companyName'); $registrationNumber = $dataBag->get('registrationNumber'); - $billieData = [ - 'companyName' => $companyName, - 'registrationNumber' => $registrationNumber, - ]; + if ($companyName && $registrationNumber) { + $billieData = [ + 'companyName' => $companyName, + 'registrationNumber' => $registrationNumber, + ]; + } /* * If there are more than one stateData and /payments calls have been completed, @@ -773,7 +776,10 @@ private function getPaymentRequest( $billieData = [] ) { $transactionId = $transaction->getOrderTransaction()->getId(); - $stateData['billieData'] = $billieData; + if ($billieData !== []) { + $stateData['billieData'] = $billieData; + } + try { $request = $this->preparePaymentsRequest( $salesChannelContext, From 1a3a8686a4d060b46ff35813473a08293e9c2acb Mon Sep 17 00:00:00 2001 From: Tamara Date: Tue, 24 Dec 2024 10:28:38 +0100 Subject: [PATCH 08/12] Remove unnecessary step in Klarna Pay Now test case --- .../projects/common/redirect/KlarnaPaymentPage.js | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/e2e/adyen-integration-tools-tests/projects/common/redirect/KlarnaPaymentPage.js b/.github/workflows/e2e/adyen-integration-tools-tests/projects/common/redirect/KlarnaPaymentPage.js index f47b1ba8..da5cd6e6 100644 --- a/.github/workflows/e2e/adyen-integration-tools-tests/projects/common/redirect/KlarnaPaymentPage.js +++ b/.github/workflows/e2e/adyen-integration-tools-tests/projects/common/redirect/KlarnaPaymentPage.js @@ -30,7 +30,6 @@ export default class KlarnaPaymentPage { if (await this.paymentTypeSelectButton.isVisible()) { await this.paymentTypeSelectButton.click(); - await this.paymentTypeSelectButton.click(); } } From 0da999fc5c7c1c14bd045ba21b022b47150edab4 Mon Sep 17 00:00:00 2001 From: Tamara Date: Tue, 24 Dec 2024 10:46:03 +0100 Subject: [PATCH 09/12] Run skipped tests --- .../projects/shopware/tests/ClearPayPayment.spec.js | 2 +- .../projects/shopware/tests/PayPalPayment.spec.js | 2 +- .../projects/shopware/tests/SepaDirectDebitPayment.spec.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/tests/ClearPayPayment.spec.js b/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/tests/ClearPayPayment.spec.js index ed629d51..235c61fd 100644 --- a/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/tests/ClearPayPayment.spec.js +++ b/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/tests/ClearPayPayment.spec.js @@ -18,7 +18,7 @@ test.describe.parallel("Payment via ClearPay", () => { await doPrePaymentChecks(page); }); - test.skip("should succeed", async ({ page }) => { + test("should succeed", async ({ page }) => { await payViaClearPay(page); await verifySuccessfulPayment(page); diff --git a/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/tests/PayPalPayment.spec.js b/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/tests/PayPalPayment.spec.js index 339af266..d9efd7d7 100644 --- a/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/tests/PayPalPayment.spec.js +++ b/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/tests/PayPalPayment.spec.js @@ -12,7 +12,7 @@ import { PayPalPaymentPage } from "../../common/redirect/PayPalPaymentPage.js"; const paymentResources = new PaymentResources(); const users = paymentResources.guestUser; -test.describe.skip("Payment via PayPal", () => { +test.describe("Payment via PayPal", () => { test.beforeEach(async ({ page }) => { await goToShippingWithFullCart(page); await proceedToPaymentAs(page, users.regular); diff --git a/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/tests/SepaDirectDebitPayment.spec.js b/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/tests/SepaDirectDebitPayment.spec.js index 8108adb5..aa40a981 100644 --- a/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/tests/SepaDirectDebitPayment.spec.js +++ b/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/tests/SepaDirectDebitPayment.spec.js @@ -20,7 +20,7 @@ test.describe("Payment via SEPA Direct debit", () => { }); // Depends on ECP-8525 - test.fixme("should succeed", async ({ page }) => { + test("should succeed", async ({ page }) => { const paymentDetailPage = new PaymentDetailsPage(page); const sepaPaymentSection = await paymentDetailPage.selectSepaDirectDebit(); From dc1b19bdebdc64bbbdfce4c797b51c657fce9a6f Mon Sep 17 00:00:00 2001 From: Tamara Date: Tue, 24 Dec 2024 12:44:59 +0100 Subject: [PATCH 10/12] Revert ClearPay payment test case to skipped --- .../projects/shopware/tests/ClearPayPayment.spec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/tests/ClearPayPayment.spec.js b/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/tests/ClearPayPayment.spec.js index 235c61fd..235fa2ac 100644 --- a/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/tests/ClearPayPayment.spec.js +++ b/.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/tests/ClearPayPayment.spec.js @@ -18,7 +18,8 @@ test.describe.parallel("Payment via ClearPay", () => { await doPrePaymentChecks(page); }); - test("should succeed", async ({ page }) => { + // Requires specific locations (VPN) + test.skip("should succeed", async ({ page }) => { await payViaClearPay(page); await verifySuccessfulPayment(page); From af2332299b17a5fde9ddc3c8669e7096e8dace40 Mon Sep 17 00:00:00 2001 From: Tamara Date: Tue, 24 Dec 2024 13:02:23 +0100 Subject: [PATCH 11/12] Replace test-report directory and git ignore --- .github/workflows/templates/docker-compose.playwright.yml | 2 +- .gitignore | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/templates/docker-compose.playwright.yml b/.github/workflows/templates/docker-compose.playwright.yml index fdbcf10b..017672fa 100644 --- a/.github/workflows/templates/docker-compose.playwright.yml +++ b/.github/workflows/templates/docker-compose.playwright.yml @@ -16,7 +16,7 @@ services: volumes: - ../scripts/e2e.sh:/e2e.sh - ../e2e/adyen-integration-tools-tests/:/tmp/adyen-integration-tools-tests/ - - ../../../test-report:/tmp/test-report + - ../../test-report:/tmp/test-report networks: localnetwork: diff --git a/.gitignore b/.gitignore index 058cce53..207d333b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,8 @@ .DS_Store #composer -vendor/ \ No newline at end of file +vendor/ + +#github actions +.github/test-report +.github/workflows/e2e/adyen-integration-tools-tests/projects/shopware/test-results \ No newline at end of file From 65a8cb6d632d6e24e8b13d6dd4a105c8cabcee69 Mon Sep 17 00:00:00 2001 From: Tamara Date: Tue, 24 Dec 2024 13:05:52 +0100 Subject: [PATCH 12/12] Add adyen logs to artifacts --- .github/workflows/e2e-test.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 686c6bf4..60201f9f 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -67,18 +67,24 @@ jobs: name: html-report path: test-report - - name: Copy Logs from Container + - name: Copy Adyen api logs from container if available if: always() run: | # Create a local directory for logs mkdir -p logs - # Copy logs from Shopware container to the host - docker cp shopware6:~/html/var/log/adyen 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/api.log \ No newline at end of file + path: logs/* \ No newline at end of file