diff --git a/CHANGELOG.md b/CHANGELOG.md index d2f197678..447dac8ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 5.2.0 +* Added Sign in with Amazon to the authentication modal +* Fixed bug where pressing enter on a text input config field would open the file selector for Amazon Private Key +* Fixed usage of a php8 str_contains so that installations that don't have the Symfony polyfill will still work correctly +* Fixed issue that crawlers could trigger by hitting the login/checkout path without an Amazon checkout session +* Modified Amazon Pay button rendering so that it will be triggered by customer data loading after the Amazon javascript runs +* Updated MFTF tests to handle authentication popup that happens in desktop view now +* Updated composer.json requires to specify a few additional dependencies that are used + ## 5.1.0 * General availability release * Added tests for refund, multi auth refund, and multi auth with capture initiated diff --git a/Controller/Login/Checkout.php b/Controller/Login/Checkout.php index d4aa7879a..7f506ad7a 100644 --- a/Controller/Login/Checkout.php +++ b/Controller/Login/Checkout.php @@ -28,6 +28,9 @@ class Checkout extends \Amazon\Pay\Controller\Login public function execute() { $checkoutSessionId = $this->getRequest()->getParam('amazonCheckoutSessionId'); + if ($checkoutSessionId == '') { + return $this->_redirect('checkout/cart'); + } try { $checkoutSession = $this->amazonAdapter->getCheckoutSession( diff --git a/README.md b/README.md index 22fe3a0c7..1933313ee 100755 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ The following table provides an overview on which Git branch is compatible to wh Magento Version | Github Branch | Latest release ---|---|--- 2.2.6 - 2.2.11 (EOL) | [V2checkout-1.2.x](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/V2checkout-1.2.x) | 1.20.0 (EOL) -2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.1.0 +2.3.0 - 2.4.x | [master](https://github.com/amzn/amazon-payments-magento-2-plugin/tree/master) | 5.2.0 ## Release Notes See [CHANGELOG.md](/CHANGELOG.md) diff --git a/Test/Mftf-23/ActionGroup/AmazonBeginLoginOnlyActionGroup.xml b/Test/Mftf-23/ActionGroup/AmazonBeginLoginOnlyActionGroup.xml new file mode 100644 index 000000000..5e6129b5a --- /dev/null +++ b/Test/Mftf-23/ActionGroup/AmazonBeginLoginOnlyActionGroup.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Test/Mftf-23/ActionGroup/AmazonCheckoutActionGroup.xml b/Test/Mftf-23/ActionGroup/AmazonCheckoutActionGroup.xml index 38e210b58..59b0dcf9f 100644 --- a/Test/Mftf-23/ActionGroup/AmazonCheckoutActionGroup.xml +++ b/Test/Mftf-23/ActionGroup/AmazonCheckoutActionGroup.xml @@ -3,6 +3,7 @@ + @@ -25,6 +26,10 @@ + + + + diff --git a/Test/Mftf-23/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml b/Test/Mftf-23/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml new file mode 100644 index 000000000..8ad9c27fc --- /dev/null +++ b/Test/Mftf-23/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Test/Mftf-23/ActionGroup/AmazonLoginOnlyActionGroup.xml b/Test/Mftf-23/ActionGroup/AmazonLoginOnlyActionGroup.xml index 4439875e0..006dca33b 100644 --- a/Test/Mftf-23/ActionGroup/AmazonLoginOnlyActionGroup.xml +++ b/Test/Mftf-23/ActionGroup/AmazonLoginOnlyActionGroup.xml @@ -1,6 +1,17 @@ + + + + + + + + + + + @@ -9,5 +20,9 @@ + + + + diff --git a/Test/Mftf-23/ActionGroup/AmazonLoginOnlyRedirectActionGroup.xml b/Test/Mftf-23/ActionGroup/AmazonLoginOnlyRedirectActionGroup.xml new file mode 100644 index 000000000..172c6829a --- /dev/null +++ b/Test/Mftf-23/ActionGroup/AmazonLoginOnlyRedirectActionGroup.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Test/Mftf-23/ActionGroup/AmazonLoginRedirectActionGroup.xml b/Test/Mftf-23/ActionGroup/AmazonLoginRedirectActionGroup.xml new file mode 100644 index 000000000..c72f65d5d --- /dev/null +++ b/Test/Mftf-23/ActionGroup/AmazonLoginRedirectActionGroup.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Test/Mftf-23/Data/AmazonPaymentConfigData.xml b/Test/Mftf-23/Data/AmazonPaymentConfigData.xml index 3593d1d3d..13faaca60 100644 --- a/Test/Mftf-23/Data/AmazonPaymentConfigData.xml +++ b/Test/Mftf-23/Data/AmazonPaymentConfigData.xml @@ -42,7 +42,8 @@ SampleAmazonPaymentApiVersion SampleAmazonPaymentActive - SampleAmazonPaymentPrivateKey + SampleAmazonPaymentPrivateKey + SampleAmazonPaymentPrivateKeySelectedText SampleAmazonPaymentPublicKeyId SampleAmazonPaymentMerchantId SampleAmazonPaymentStoreId @@ -56,9 +57,12 @@ 1 - + {{_CREDS.amazon/private_key}} + + text + {{_CREDS.amazon/public_key_id}} @@ -92,7 +96,8 @@ SampleAmazonPaymentApiVersion SampleAmazonPaymentActive - EUAmazonPaymentPrivateKey + EUAmazonPaymentPrivateKey + SampleAmazonPaymentPrivateKeySelectedText EUAmazonPaymentPublicKeyId EUAmazonPaymentMerchantId EUAmazonPaymentStoreId @@ -100,7 +105,7 @@ SampleAmazonPaymentSandbox SampleAmazonPaymentLwaDisabled - + {{_CREDS.amazon/eu_private_key}} @@ -122,7 +127,8 @@ SampleAmazonPaymentApiVersion SampleAmazonPaymentActive - SampleAmazonPaymentPrivateKey + SampleAmazonPaymentPrivateKey + SampleAmazonPaymentPrivateKeySelectedText SampleAmazonPaymentPublicKeyId SampleAmazonPaymentMerchantId SampleAmazonPaymentStoreId diff --git a/Test/Mftf-23/Metadata/amazon_payment_v2_config-meta.xml b/Test/Mftf-23/Metadata/amazon_payment_v2_config-meta.xml index 09af9a21a..0eaaa889f 100644 --- a/Test/Mftf-23/Metadata/amazon_payment_v2_config-meta.xml +++ b/Test/Mftf-23/Metadata/amazon_payment_v2_config-meta.xml @@ -14,7 +14,13 @@ string - + + string + + + string + + string diff --git a/Test/Mftf-23/Test/AmazonCancelReturnUrl.xml b/Test/Mftf-23/Test/AmazonCancelReturnUrl.xml deleted file mode 120000 index bd55044e9..000000000 --- a/Test/Mftf-23/Test/AmazonCancelReturnUrl.xml +++ /dev/null @@ -1 +0,0 @@ -../../Mftf-24/Test/AmazonCancelReturnUrl.xml \ No newline at end of file diff --git a/Test/Mftf-23/Test/AmazonCancelReturnUrl.xml b/Test/Mftf-23/Test/AmazonCancelReturnUrl.xml new file mode 100644 index 000000000..ad10905ef --- /dev/null +++ b/Test/Mftf-23/Test/AmazonCancelReturnUrl.xml @@ -0,0 +1,85 @@ + + + + + + + <description value="User should be directed to the page where they clicked the Amazon Pay button when clicking Cancel"/> + <severity value="CRITICAL"/> + <group value="amazon_pay"/> + <group value="amazon_pay_button"/> + </annotations> + + <before> + <createData entity="SimpleTwo" stepKey="createSimpleProduct"/> + <createData entity="SampleAmazonPaymentConfigLwa" stepKey="SampleAmazonPaymentConfigLwa"/> + <magentoCLI command="config:set {{AmazonButtonProductConfig.path}} 1" stepKey="displayAmazonButtonProduct"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + </before> + + <after> + <createData entity="SampleAmazonPaymentConfig" stepKey="SampleAmazonPaymentConfigData"/> + <actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteCustomer"> + <argument name="email" value="{{AmazonAccount.email}}"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + </after> + + <!-- Click Sign-in button from sign-in page --> + <amOnPage url="{{StorefrontCustomerSignInPage.url}}" stepKey="amOnSignInPage"/> + <waitForPageLoad time="30" stepKey="waitPageFullyLoaded"/> + + <!--Save opener window name since popup auto-closes--> + <executeJS function="return window.name;" stepKey="openerName"/> + <click selector="{{AmazonLoginSection.login}}" stepKey="signInWithAmazon"/> + <wait time="1" stepKey="allowPopupToOpen"/> + <switchToNextTab stepKey="switchToWindowLoginPopup"/> + + <!-- Login to Amazon --> + <actionGroup ref="AmazonBeginLoginOnlyActionGroup" stepKey="amazonBeginLoginOnlyActionGroup"/> + <waitForElement selector="{{AmazonPageSection.loginCancelButton}}" stepKey="waitForCancelLogin"/> + + <!-- Cancel login with Amazon and land back on sign-in Magento page --> + <click selector="{{AmazonPageSection.loginCancelButton}}" stepKey="clickLoginCancelButton"/> + <!-- Switch back to main window --> + <switchToWindow userInput="{$openerName}" stepKey="switchToWindowOpener" /> + <waitForPageLoad stepKey="waitForSigninPageLoad"/> + <seeInCurrentUrl url="{{StorefrontCustomerSignInPage.url}}" stepKey="assertLoginUrl"/> + + <!--Go to product page--> + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductStoreFront"> + <argument name="productUrl" value="$$createSimpleProduct.custom_attributes[url_key]$$"/> + </actionGroup> + <!--Verify only Amazon Button is present--> + <seeElement selector="{{AmazonButtonSection.product}}" stepKey="seeEnabledAmazonButton"/> + + <!-- Click Amazon Pay button on product page and login --> + <click selector="{{AmazonButtonSection.product}}" stepKey="clickAmazonButton"/> + + <wait time="1" stepKey="allowPopupToOpen2"/> + <switchToNextTab stepKey="switchToWindowLoginPopup2"/> + <waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="seeAmazonCheckoutButton"/> + + <!--Come back to checkout with default address--> + <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"> + <argument name="openerName" value="{$openerName}"/> + </actionGroup> + + <!-- Click edit button on address --> + <click selector="{{AmazonCheckoutSection.editShippingButton}}" stepKey="clickAmazonEditShippingButton"/> + <wait time="1" stepKey="allowPopupToOpen3"/> + <switchToNextTab stepKey="switchToAddressEditPopup"/> + <waitForElement selector="{{AmazonPageSection.cancelButton}}" stepKey="waitForCancelCheckout"/> + + <!-- Click cancel button on Amazon hosted page --> + <click selector="{{AmazonPageSection.cancelButton}}" stepKey="cancelCheckout"/> + <!-- Switch back to main window --> + <switchToWindow userInput="{$openerName}" stepKey="switchToWindowOpener2" /> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + + <!-- Assert being back in the product page --> + <seeInCurrentUrl url="{{CheckoutPage.url}}" stepKey="assertProductUrl"/> + </test> +</tests> diff --git a/Test/Mftf-23/Test/AmazonCheckoutAsyncDeclinedTest.xml b/Test/Mftf-23/Test/AmazonCheckoutAsyncDeclinedTest.xml index 68e97ff14..7d64e407d 100644 --- a/Test/Mftf-23/Test/AmazonCheckoutAsyncDeclinedTest.xml +++ b/Test/Mftf-23/Test/AmazonCheckoutAsyncDeclinedTest.xml @@ -20,10 +20,7 @@ </after> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"> <argument name="cc" value="4354" /> </actionGroup> <!--Go to payment method--> @@ -48,6 +45,7 @@ <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Payment Review" stepKey="seePaymentReviewedStatus"/> <!-- run async processing, which will cancel the order --> + <wait time="30" stepKey="waitForStatusUpdate"/> <magentoCLI command="amazon:payment:async:process" stepKey="updateStatus"/> <!-- Open created order in backend --> diff --git a/Test/Mftf-23/Test/AmazonCheckoutAsyncSuccessTest.xml b/Test/Mftf-23/Test/AmazonCheckoutAsyncSuccessTest.xml index 3c47f0cc7..3342bf1e9 100644 --- a/Test/Mftf-23/Test/AmazonCheckoutAsyncSuccessTest.xml +++ b/Test/Mftf-23/Test/AmazonCheckoutAsyncSuccessTest.xml @@ -20,10 +20,7 @@ </after> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"> <argument name="cc" value="0701" /> </actionGroup> <!--Go to payment method--> diff --git a/Test/Mftf-23/Test/AmazonCheckoutButtonTest.xml b/Test/Mftf-23/Test/AmazonCheckoutButtonTest.xml index b93ecb0a4..dec966a60 100644 --- a/Test/Mftf-23/Test/AmazonCheckoutButtonTest.xml +++ b/Test/Mftf-23/Test/AmazonCheckoutButtonTest.xml @@ -26,5 +26,6 @@ <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMiniCart"/> <!--Verify only Amazon Button is present--> <seeElement selector="{{AmazonButtonSection.checkout}}" stepKey="seeEnabledAmazonButton"/> + <wait time="1" stepKey="AllowButtonToActivateWorkaround"/> </test> </tests> diff --git a/Test/Mftf-23/Test/AmazonCheckoutBuyerCanceledTest.xml b/Test/Mftf-23/Test/AmazonCheckoutBuyerCanceledTest.xml index 1c58b27b9..8eea58e93 100644 --- a/Test/Mftf-23/Test/AmazonCheckoutBuyerCanceledTest.xml +++ b/Test/Mftf-23/Test/AmazonCheckoutBuyerCanceledTest.xml @@ -11,10 +11,7 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"> <argument name="cc" value="3064" /> </actionGroup> <!--Go to payment method--> diff --git a/Test/Mftf-23/Test/AmazonCheckoutCancelledThenSuccessTest.xml b/Test/Mftf-23/Test/AmazonCheckoutCancelledThenSuccessTest.xml deleted file mode 100644 index ad12f4f02..000000000 --- a/Test/Mftf-23/Test/AmazonCheckoutCancelledThenSuccessTest.xml +++ /dev/null @@ -1,89 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AmazonCheckoutCancelledThenSuccess" extends="AmazonCheckoutButton"> - <annotations> - <stories value="Amazon Checkout Cancelled then Successful"/> - <title value="Amazon Checkout Cancelled then Successful"/> - <description value="User should be able to checkout with Amazon Pay after cancelling their checkout session."/> - <severity value="CRITICAL"/> - <group value="amazon_pay_disabled"/> - <group value="amazon_pay_checkout"/> - </annotations> - - <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - - <click selector="{{AmazonPageSection.cancelButton}}" stepKey="cancelCheckout"/> - <waitForPageLoad stepKey="waitForCheckoutPageLoad"/> - - <!--Go back to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton2"/> - <actionGroup ref="AmazonAlreadyLoggedInActionGroup" stepKey="AmazonLoginActionGroup2"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup2"/> - - <!-- Get the current checkout session ID --> - <executeJS function="return localStorage.getItem('amzn-checkout-session')" stepKey="getCheckoutSession2"/> - - <!-- Ensure we have an active checkout session by clicking Edit address --> - <click selector="{{AmazonCheckoutSection.editShippingButton}}" stepKey="clickAmazonEditShippingButton"/> - <waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="waitForCancelCheckout2"/> - <click selector="{{AmazonPageSection.cancelButton}}" stepKey="cancelCheckout2"/> - <waitForPageLoad stepKey="waitForCheckoutPageLoad2"/> - - <!--Go back to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton3"/> - <actionGroup ref="AmazonAlreadyLoggedInActionGroup" stepKey="AmazonLoginActionGroup3"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup3"/> - <waitForPageLoad stepKey="waitForCheckoutPageLoad3"/> - - <!-- Get the current checkout session ID and make sure it changed --> - <executeJS function="return localStorage.getItem('amzn-checkout-session')" stepKey="getCheckoutSession3"/> - <assertNotEquals stepKey="verifyChangedSession2"> - <actualResult type="const">$getCheckoutSession3</actualResult> - <expectedResult type="const">$getCheckoutSession2</expectedResult> - </assertNotEquals> - - <!--Go to payment method--> - <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> - <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> - - <click selector="{{AmazonCheckoutSection.editPaymentButton}}" stepKey="clickEditPaymentButton"/> - <waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="waitForContinueButton"/> - <click selector="{{AmazonPageSection.cancelButton}}" stepKey="cancelCheckout3"/> - <waitForPageLoad stepKey="waitForCheckoutPageLoad4"/> - - <!--Go back to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton4"/> - <actionGroup ref="AmazonAlreadyLoggedInActionGroup" stepKey="AmazonLoginActionGroup4"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup4"/> - <waitForPageLoad stepKey="waitForCheckoutPageLoad5"/> - - <!-- Get the current checkout session ID and make sure it changed --> - <executeJS function="return localStorage.getItem('amzn-checkout-session')" stepKey="getCheckoutSession4"/> - <assertNotEquals stepKey="verifyChangedSession3"> - <actualResult type="const">$getCheckoutSession4</actualResult> - <expectedResult type="const">$getCheckoutSession3</expectedResult> - </assertNotEquals> - - <!--Go to payment method, edit payment, then proceed--> - <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext2"/> - <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad2"/> - <click selector="{{AmazonCheckoutSection.editPaymentButton}}" stepKey="clickEditPaymentButton2"/> - <waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="waitForContinueButton2"/> - <click selector="{{AmazonPageSection.checkoutButton}}" stepKey="clickAmazonCheckoutButton2"/> - <waitForElement selector="{{CheckoutPaymentSection.availablePaymentSolutions}}" stepKey="waitForCheckoutPaymentPageLoad3"/> - - <!--Verify only Amazon Pay method is visible--> - <seeNumberOfElements selector="{{CheckoutPaymentSection.availablePaymentSolutions}}" userInput="1" stepKey="seeSingleAvailablePaymentSolution"/> - <seeElement selector="{{AmazonCheckoutSection.method}}" stepKey="seeAmazonPaymentMethod"/> - <!--Place order--> - <actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="guestPlaceorder"> - <argument name="orderNumberMessage" value="CONST.successGuestCheckoutOrderNumberMessage" /> - <argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage" /> - </actionGroup> - </test> -</tests> diff --git a/Test/Mftf-23/Test/AmazonCheckoutDeclinedTest.xml b/Test/Mftf-23/Test/AmazonCheckoutDeclinedTest.xml index cf2bfc141..8b1efaedc 100644 --- a/Test/Mftf-23/Test/AmazonCheckoutDeclinedTest.xml +++ b/Test/Mftf-23/Test/AmazonCheckoutDeclinedTest.xml @@ -11,10 +11,7 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"> <argument name="cc" value="3434" /> </actionGroup> <!--Go to payment method--> diff --git a/Test/Mftf-23/Test/AmazonCheckoutLoggedInNoGuestButtonTest.xml b/Test/Mftf-23/Test/AmazonCheckoutLoggedInNoGuestButtonTest.xml index e4b74a913..5bbe81ec4 100644 --- a/Test/Mftf-23/Test/AmazonCheckoutLoggedInNoGuestButtonTest.xml +++ b/Test/Mftf-23/Test/AmazonCheckoutLoggedInNoGuestButtonTest.xml @@ -45,10 +45,7 @@ <!--Go to Amazon Pay from the checkout and login--> <waitForElement selector="{{AmazonButtonSection.checkout}}" stepKey="waitForAmazonChangedShippingPageLoad"/> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-23/Test/AmazonCheckoutLoginTest.xml b/Test/Mftf-23/Test/AmazonCheckoutLoginTest.xml index 7db721c92..706a9d07f 100644 --- a/Test/Mftf-23/Test/AmazonCheckoutLoginTest.xml +++ b/Test/Mftf-23/Test/AmazonCheckoutLoginTest.xml @@ -10,8 +10,13 @@ <group value="amazon_pay_login"/> </annotations> + <!--Save opener window name since popup auto-closes--> + <executeJS function="return window.name;" stepKey="openerName"/> + <!--Go to Amazon Pay from the checkout and login--> <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> + <wait time="1" stepKey="allowPopupToOpen"/> + <switchToNextTab stepKey="switchToWindowLoginPopup"/> <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> </test> </tests> diff --git a/Test/Mftf-23/Test/AmazonCheckoutMulticurrencySuccessTest.xml b/Test/Mftf-23/Test/AmazonCheckoutMulticurrencySuccessTest.xml index 1fcb90acc..e2cb0e213 100644 --- a/Test/Mftf-23/Test/AmazonCheckoutMulticurrencySuccessTest.xml +++ b/Test/Mftf-23/Test/AmazonCheckoutMulticurrencySuccessTest.xml @@ -27,10 +27,7 @@ </after> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-23/Test/AmazonCheckoutOrderTwoItems.xml b/Test/Mftf-23/Test/AmazonCheckoutOrderTwoItems.xml index f96d423b2..3708e8a4a 100644 --- a/Test/Mftf-23/Test/AmazonCheckoutOrderTwoItems.xml +++ b/Test/Mftf-23/Test/AmazonCheckoutOrderTwoItems.xml @@ -40,10 +40,7 @@ <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMiniCart"/> <!--Go to Amazon Pay and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-23/Test/AmazonCheckoutReturnToStandardTest.xml b/Test/Mftf-23/Test/AmazonCheckoutReturnToStandardTest.xml index 1014ead56..6273aa103 100644 --- a/Test/Mftf-23/Test/AmazonCheckoutReturnToStandardTest.xml +++ b/Test/Mftf-23/Test/AmazonCheckoutReturnToStandardTest.xml @@ -11,10 +11,7 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <click selector="{{AmazonCheckoutSection.returnToStandardCheckout}}" stepKey="clickReturnToStandardCheckout"/> <waitForPageLoad stepKey="waitForStandardCheckoutPageLoad"/> diff --git a/Test/Mftf-23/Test/AmazonCheckoutSuccessTest.xml b/Test/Mftf-23/Test/AmazonCheckoutSuccessTest.xml index f10a977d1..c52d24de8 100644 --- a/Test/Mftf-23/Test/AmazonCheckoutSuccessTest.xml +++ b/Test/Mftf-23/Test/AmazonCheckoutSuccessTest.xml @@ -11,10 +11,7 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-23/Test/AmazonInvoiceMultipleCapture.xml b/Test/Mftf-23/Test/AmazonInvoiceMultipleCapture.xml index 4a873fc9e..c99b391f7 100644 --- a/Test/Mftf-23/Test/AmazonInvoiceMultipleCapture.xml +++ b/Test/Mftf-23/Test/AmazonInvoiceMultipleCapture.xml @@ -26,10 +26,7 @@ <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMiniCart2"/> <!--Go to Amazon Pay and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-23/Test/AmazonInvoiceOnlySingleCapture.xml b/Test/Mftf-23/Test/AmazonInvoiceOnlySingleCapture.xml index 465814478..af6e3e91f 100644 --- a/Test/Mftf-23/Test/AmazonInvoiceOnlySingleCapture.xml +++ b/Test/Mftf-23/Test/AmazonInvoiceOnlySingleCapture.xml @@ -35,10 +35,7 @@ <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMiniCart2"/> <!--Go to Amazon Pay and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-23/Test/AmazonInvoicePendingCapturedTest.xml b/Test/Mftf-23/Test/AmazonInvoicePendingCapturedTest.xml index 95534bf06..2c3bfc81c 100644 --- a/Test/Mftf-23/Test/AmazonInvoicePendingCapturedTest.xml +++ b/Test/Mftf-23/Test/AmazonInvoicePendingCapturedTest.xml @@ -11,10 +11,7 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-23/Test/AmazonInvoicePendingDeclinedTest.xml b/Test/Mftf-23/Test/AmazonInvoicePendingDeclinedTest.xml index acfa1518f..65f2e874a 100644 --- a/Test/Mftf-23/Test/AmazonInvoicePendingDeclinedTest.xml +++ b/Test/Mftf-23/Test/AmazonInvoicePendingDeclinedTest.xml @@ -11,10 +11,7 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-23/Test/AmazonInvoiceTest.xml b/Test/Mftf-23/Test/AmazonInvoiceTest.xml index 0883f4b52..fd199a2b6 100644 --- a/Test/Mftf-23/Test/AmazonInvoiceTest.xml +++ b/Test/Mftf-23/Test/AmazonInvoiceTest.xml @@ -11,10 +11,7 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-23/Test/AmazonMiniCartLoginTest.xml b/Test/Mftf-23/Test/AmazonMiniCartLoginTest.xml index 29994e8e1..8e2d45f87 100644 --- a/Test/Mftf-23/Test/AmazonMiniCartLoginTest.xml +++ b/Test/Mftf-23/Test/AmazonMiniCartLoginTest.xml @@ -10,8 +10,13 @@ <group value="amazon_pay_login"/> </annotations> + <!--Save opener window name since popup auto-closes--> + <executeJS function="return window.name;" stepKey="openerName"/> + <!--Go to Amazon Pay from the mini cart and login--> <click selector="{{AmazonButtonSection.miniCart}}" stepKey="clickAmazonButton"/> + <wait time="1" stepKey="allowPopupToOpen"/> + <switchToNextTab stepKey="switchToWindowLoginPopup"/> <actionGroup ref="AmazonLoginActionGroup" stepKey="amazonLoginActionGroup"/> </test> </tests> diff --git a/Test/Mftf-23/Test/AmazonPaymentLoginTest.xml b/Test/Mftf-23/Test/AmazonPaymentLoginTest.xml index 3a921cf1a..708d2641d 100644 --- a/Test/Mftf-23/Test/AmazonPaymentLoginTest.xml +++ b/Test/Mftf-23/Test/AmazonPaymentLoginTest.xml @@ -10,9 +10,14 @@ <group value="amazon_pay_login"/> </annotations> + <!--Save opener window name since popup auto-closes--> + <executeJS function="return window.name;" stepKey="openerName"/> + <!--Go to Amazon Pay from the payment method and login--> - <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> + <wait time="1" stepKey="allowButtonToActivate"/> <click selector="{{AmazonButtonSection.payment}}" stepKey="clickAmazonButton"/> + <wait time="1" stepKey="allowPopupToOpen"/> + <switchToNextTab stepKey="switchToWindowLoginPopup"/> <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> </test> </tests> diff --git a/Test/Mftf-23/Test/AmazonProductLoginTest.xml b/Test/Mftf-23/Test/AmazonProductLoginTest.xml index 74ccc5319..2e00fe5a3 100644 --- a/Test/Mftf-23/Test/AmazonProductLoginTest.xml +++ b/Test/Mftf-23/Test/AmazonProductLoginTest.xml @@ -10,8 +10,13 @@ <group value="amazon_pay_login"/> </annotations> + <!--Save opener window name since popup auto-closes--> + <executeJS function="return window.name;" stepKey="openerName"/> + <!--Add to cart via Amazon Pay button on product page and login--> <click selector="{{AmazonButtonSection.product}}" stepKey="clickAmazonButton"/> + <wait time="1" stepKey="allowPopupToOpen"/> + <switchToNextTab stepKey="switchToWindowLoginPopup"/> <actionGroup ref="AmazonLoginActionGroup" stepKey="amazonLoginActionGroup"/> </test> </tests> diff --git a/Test/Mftf-23/Test/AmazonRefund.xml b/Test/Mftf-23/Test/AmazonRefund.xml index 1960c68f3..b8425fc12 100644 --- a/Test/Mftf-23/Test/AmazonRefund.xml +++ b/Test/Mftf-23/Test/AmazonRefund.xml @@ -11,10 +11,7 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-23/Test/AmazonShippingAddressTest.xml b/Test/Mftf-23/Test/AmazonShippingAddressTest.xml index 4a03b9205..3f3bc09c1 100644 --- a/Test/Mftf-23/Test/AmazonShippingAddressTest.xml +++ b/Test/Mftf-23/Test/AmazonShippingAddressTest.xml @@ -11,13 +11,13 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> + <!--Save opener window name since popup auto-closes--> + <executeJS function="return window.name;" stepKey="openerName"/> <!--Change shipping address--> <click selector="{{AmazonCheckoutSection.editShippingButton}}" stepKey="clickAmazonEditShippingButton"/> <wait time="1" stepKey="allowButtonToActivate"/> + <switchToNextTab stepKey="switchToWindowLoginPopup"/> <waitForElement selector="{{AmazonPageSection.changeAddressButton}}" stepKey="waitForAmazonEditShippingPageLoad"/> <click selector="{{AmazonPageSection.changeAddressButton}}" stepKey="clickChangeAmazonAddressButton"/> <click selector="{{AmazonPageSection.notSelectedAddress}}" stepKey="clickNotSelectedAmazonAddress"/> @@ -25,6 +25,8 @@ <waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="waitForAmazonChangedShippingPageLoad"/> <wait time="1" stepKey="allowButtonToActivate2"/> <!--Come back to checkout with changed address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="ChangedAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonCheckoutActionGroup" stepKey="ChangedAmazonCheckoutActionGroup"> + <argument name="openerName" value="{$openerName}"/> + </actionGroup> </test> </tests> diff --git a/Test/Mftf-23/Test/AmazonSignInButtonNoGuestCheckoutPopupTest.xml b/Test/Mftf-23/Test/AmazonSignInButtonNoGuestCheckoutPopupTest.xml new file mode 100644 index 000000000..c3c1ca049 --- /dev/null +++ b/Test/Mftf-23/Test/AmazonSignInButtonNoGuestCheckoutPopupTest.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AmazonSignInButtonNoGuestCheckoutPopup"> + <annotations> + <stories value="Amazon Sign In Button No Guest Checkout"/> + <title value="Amazon Sign In Button No Guest Checkout"/> + <description value="Amazon Sign In button should be visible when proceeding to checkout with guest checkout disabled"/> + <severity value="CRITICAL"/> + <group value="amazon_pay"/> + <group value="amazon_pay_signin"/> + </annotations> + + <before> + <createData entity="SimpleTwo" stepKey="createSimpleProduct"/> + <createData entity="SampleAmazonPaymentConfigLwa" stepKey="SampleAmazonPaymentConfigLwa"/> + <magentoCLI command="config:set checkout/options/guest_checkout 0" stepKey="disableGuestCheckout"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + </before> + + <after> + <createData entity="SampleAmazonPaymentConfig" stepKey="SampleAmazonPaymentConfig"/> + <magentoCLI command="config:set checkout/options/guest_checkout 1" stepKey="enableGuestCheckout"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + </after> + + <!--Go to product page--> + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductStoreFront"> + <argument name="productUrl" value="$$createSimpleProduct.custom_attributes[url_key]$$"/> + </actionGroup> + <!--Click on Add To Cart button--> + <actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="clickOnAddToCartButton"/> + <!--Go to checkout--> + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMiniCart"/> + <!-- Verify Sign in with Amazon button is displayed --> + <seeElement selector="{{AmazonLoginSection.login}}" stepKey="seeSignInWithAmazonButtonLogin"/> + </test> +</tests> diff --git a/Test/Mftf-23/Test/AmazonSignInCreateAccountTest.xml b/Test/Mftf-23/Test/AmazonSignInCreateAccountTest.xml index 58ba952d8..1707fe1ca 100644 --- a/Test/Mftf-23/Test/AmazonSignInCreateAccountTest.xml +++ b/Test/Mftf-23/Test/AmazonSignInCreateAccountTest.xml @@ -20,11 +20,7 @@ <actionGroup ref="logout" stepKey="logout"/> </after> - <!--Verify Sign in with Amazon Button is present--> - <click selector="{{AmazonLoginSection.login}}" stepKey="clickSignInWithAmazonButton"/> - <actionGroup ref="AmazonLoginOnlyActionGroup" stepKey="AmazonLoginOnlyActionGroup"/> - <click selector="{{AmazonLoginSection.consentButton}}" stepKey="clickAmazonConsentButton"/> <waitForPageLoad stepKey="waitForMyAccountPageLoad"/> <see userInput="My Account" stepKey="seeMyAccount"/> diff --git a/Test/Mftf-23/Test/AmazonSignInExistingUnlinkedAccountTest.xml b/Test/Mftf-23/Test/AmazonSignInExistingUnlinkedAccountTest.xml index d7e59e95c..a8de56085 100644 --- a/Test/Mftf-23/Test/AmazonSignInExistingUnlinkedAccountTest.xml +++ b/Test/Mftf-23/Test/AmazonSignInExistingUnlinkedAccountTest.xml @@ -18,11 +18,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> </after> - <!--Verify Sign in with Amazon Button is present--> - <click selector="{{AmazonLoginSection.login}}" stepKey="seeSignInWithAmazonButton"/> - <actionGroup ref="AmazonLoginOnlyActionGroup" stepKey="AmazonLoginOnlyActionGroup"/> - <click selector="{{AmazonLoginSection.consentButton}}" stepKey="clickAmazonConsentButton"/> <waitForPageLoad stepKey="waitForLinkAccountPageLoad"/> <see userInput="A store account for this email address already exists" stepKey="seeAnAccountExists"/> diff --git a/Test/Mftf-23/Test/AmazonSignInToExistingTest.xml b/Test/Mftf-23/Test/AmazonSignInToExistingTest.xml index 4a9cc6507..0a2fe3ccb 100644 --- a/Test/Mftf-23/Test/AmazonSignInToExistingTest.xml +++ b/Test/Mftf-23/Test/AmazonSignInToExistingTest.xml @@ -20,11 +20,7 @@ <actionGroup ref="logout" stepKey="logout"/> </after> - <!--Verify Sign in with Amazon Button is present--> - <click selector="{{AmazonLoginSection.login}}" stepKey="clickSignInWithAmazonButton"/> - <actionGroup ref="AmazonLoginOnlyActionGroup" stepKey="AmazonLoginOnlyActionGroup"/> - <click selector="{{AmazonLoginSection.consentButton}}" stepKey="clickAmazonConsentButton"/> <waitForPageLoad stepKey="waitForMyAccountPageLoad"/> <see userInput="My Account" stepKey="seeMyAccount"/> @@ -35,15 +31,22 @@ <amOnPage url="{{StorefrontCustomerSignInPage.url}}" stepKey="amOnSignInPage2"/> <waitForPageLoad time="30" stepKey="waitPageFullyLoaded"/> + <!--Save opener window name since popup auto-closes--> + <executeJS function="return window.name;" stepKey="openerName"/> + <!--Verify Sign in with Amazon Button is present again--> <click selector="{{AmazonLoginSection.login}}" stepKey="clickSignInWithAmazonButton2"/> + <wait time="1" stepKey="allowButtonToActivate"/> + <switchToNextTab stepKey="switchToLoginWindow"/> <!-- make sure we are logged out from Amazon by clearing ubid-main cookie --> <resetCookie userInput="ubid-main" parameterArray="['domainName' => '.amazon.com']" stepKey="resetCookieForAmazon"/> <reloadPage stepKey="reloadAmazonLoginPage"/> - <actionGroup ref="AmazonLoginOnlyActionGroup" stepKey="AmazonLoginOnlyActionGroup2"/> - <click selector="{{AmazonLoginSection.consentButton}}" stepKey="clickAmazonConsentButton2"/> + <actionGroup ref="AmazonLoginOnlyRedirectActionGroup" stepKey="AmazonLoginOnlyRedirectActionGroup2"/> + <click selector="{{AmazonLoginSection.consentButton}}" stepKey="clickAmazonConsentButton"/> + <!-- Switch back to main window --> + <switchToWindow userInput="{$openerName}" stepKey="switchToWindowOpener" /> <waitForPageLoad stepKey="waitForMyAccountPageLoad2"/> <see userInput="My Account" stepKey="seeMyAccount2"/> diff --git a/Test/Mftf-23/Test/AmazonSigninCheckoutSuccessTest.xml b/Test/Mftf-23/Test/AmazonSigninCheckoutSuccessTest.xml index f36a11bb7..d315e6d53 100644 --- a/Test/Mftf-23/Test/AmazonSigninCheckoutSuccessTest.xml +++ b/Test/Mftf-23/Test/AmazonSigninCheckoutSuccessTest.xml @@ -23,10 +23,7 @@ </after> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-24/ActionGroup/AmazonBeginLoginOnlyActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonBeginLoginOnlyActionGroup.xml new file mode 100644 index 000000000..5e6129b5a --- /dev/null +++ b/Test/Mftf-24/ActionGroup/AmazonBeginLoginOnlyActionGroup.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AmazonBeginLoginOnlyActionGroup"> + <waitForElement selector="{{AmazonPageSection.emailField}}" stepKey="waitForEmailField"/> + <wait time="1" stepKey="allowButtonToActivate1"/> + <fillField selector="{{AmazonPageSection.emailField}}" userInput="{{AmazonAccount.email}}" stepKey="fillAmazonPageEmailField"/> + <fillField selector="{{AmazonPageSection.passwordField}}" userInput="{{AmazonAccount.password}}" stepKey="fillAmazonPagePasswordField"/> + <click selector="{{AmazonPageSection.signInButton}}" stepKey="clickAmazonPageSignInButton"/> + <!--Verify successful login by the presence of the continue button--> + <wait time="1" stepKey="allowButtonToActivate2"/> + <waitForElement selector="{{AmazonLoginSection.consentButton}}" stepKey="seeAmazonConsentButton"/> + </actionGroup> +</actionGroups> diff --git a/Test/Mftf-24/ActionGroup/AmazonCheckoutActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonCheckoutActionGroup.xml index 8ef757c7f..f2e6c53a5 100644 --- a/Test/Mftf-24/ActionGroup/AmazonCheckoutActionGroup.xml +++ b/Test/Mftf-24/ActionGroup/AmazonCheckoutActionGroup.xml @@ -3,6 +3,7 @@ <actionGroup name="AmazonCheckoutActionGroup"> <arguments> <argument name="cc" defaultValue="1111" type="string"/> + <argument name="openerName" type="string"/> </arguments> <!--Get shipping address information--> @@ -25,6 +26,10 @@ <waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="waitForAmazonCheckoutButton"/> <wait time="1" stepKey="allowContinueButtonToActivate"/> <click selector="{{AmazonPageSection.checkoutButton}}" stepKey="clickAmazonCheckoutButton"/> + + <!-- Switch back to main window --> + <switchToWindow userInput="{{openerName}}" stepKey="switchToWindowOpener" /> + <waitForPageLoad stepKey="waitForCheckoutPageLoad"/> <!--Filter out address data--> <executeJS function="return '{$amazonAddressLine1Raw}' !== 'null' ? '{$amazonAddressLine1Raw}' : ''" stepKey="amazonAddressLine1"/> diff --git a/Test/Mftf-24/ActionGroup/AmazonLoginActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonLoginActionGroup.xml index 4e23f0aeb..91e78a889 100644 --- a/Test/Mftf-24/ActionGroup/AmazonLoginActionGroup.xml +++ b/Test/Mftf-24/ActionGroup/AmazonLoginActionGroup.xml @@ -1,11 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!--Open login popup and complete form--> <actionGroup name="AmazonLoginActionGroup"> - <waitForElement selector="{{AmazonPageSection.emailField}}" stepKey="waitForEmailField"/> - <wait time="1" stepKey="allowButtonToActivate1"/> - <fillField selector="{{AmazonPageSection.emailField}}" userInput="{{AmazonAccount.email}}" stepKey="fillAmazonPageEmailField"/> - <fillField selector="{{AmazonPageSection.passwordField}}" userInput="{{AmazonAccount.password}}" stepKey="fillAmazonPagePasswordField"/> - <click selector="{{AmazonPageSection.signInButton}}" stepKey="clickAmazonPageSignInButton"/> + <!-- Fill in login form --> + <waitForElement selector="{{AmazonPageSection.emailField}}" time="30" stepKey="apWaitForLogin"/> + <fillField selector="{{AmazonPageSection.emailField}}" userInput="{{AmazonAccount.email}}" stepKey="apEnterEmail"/> + <fillField selector="{{AmazonPageSection.passwordField}}" userInput="{{AmazonAccount.password}}" stepKey="apEnterPassword"/> + <click selector="{{AmazonPageSection.signInButton}}" stepKey="clickSigninButton"/> + <!--Verify successful login by the presence of the checkout button--> <wait time="1" stepKey="allowButtonToActivate"/> <waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="seeAmazonCheckoutButton"/> diff --git a/Test/Mftf-24/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml new file mode 100644 index 000000000..38df5ecec --- /dev/null +++ b/Test/Mftf-24/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!--Open login popup and complete form--> + <actionGroup name="AmazonLoginAndCheckoutActionGroup"> + <arguments> + <argument name="buttonSelector" defaultValue="{{AmazonButtonSection.checkout}}" type="string"/> + <argument name="cc" defaultValue="1111" type="string"/> + </arguments> + + <!--Save opener window name since popup auto-closes--> + <executeJS function="return window.name;" stepKey="openerName"/> + + <!--Go to Amazon Pay from the checkout and login--> + <waitForElement selector="{{buttonSelector}}" time="30" stepKey="apWaitForButton"/> + <wait time="1" stepKey="allowButtonToActivate"/> + <click selector="{{buttonSelector}}" stepKey="clickAmazonButton"/> + + <wait time="1" stepKey="allowPopupToOpen"/> + <switchToNextTab stepKey="switchToLoginPopupWindow"/> + + <!-- Fill in login form --> + <waitForElement selector="{{AmazonPageSection.emailField}}" time="30" stepKey="apWaitForLogin"/> + <fillField selector="{{AmazonPageSection.emailField}}" userInput="{{AmazonAccount.email}}" stepKey="apEnterEmail"/> + <fillField selector="{{AmazonPageSection.passwordField}}" userInput="{{AmazonAccount.password}}" stepKey="apEnterPassword"/> + <click selector="{{AmazonPageSection.signInButton}}" stepKey="clickSigninButton"/> + + <!--Verify successful login by the presence of the checkout button--> + <wait time="1" stepKey="allowButtonToActivate2"/> + <waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="seeAmazonCheckoutButton"/> + + + <!--Get shipping address information--> + <grabAttributeFrom selector="{{AmazonPageSection.addressId}}" userInput="data-address_id" stepKey="amazonAddressId"/> + <grabAttributeFrom selector="{{AmazonPageSection.addressDetails({$amazonAddressId})}}" userInput="data-name_on_address" stepKey="amazonAddressName"/> + <grabAttributeFrom selector="{{AmazonPageSection.addressDetails({$amazonAddressId})}}" userInput="data-address_line1" stepKey="amazonAddressLine1Raw"/> + <grabAttributeFrom selector="{{AmazonPageSection.addressDetails({$amazonAddressId})}}" userInput="data-address_line2" stepKey="amazonAddressLine2Raw"/> + <grabAttributeFrom selector="{{AmazonPageSection.addressDetails({$amazonAddressId})}}" userInput="data-address_line3" stepKey="amazonAddressLine3Raw"/> + <grabAttributeFrom selector="{{AmazonPageSection.addressDetails({$amazonAddressId})}}" userInput="data-city" stepKey="amazonAddressCity"/> + <grabAttributeFrom selector="{{AmazonPageSection.addressDetails({$amazonAddressId})}}" userInput="data-zip_code" stepKey="amazonAddressZipCode"/> + <grabAttributeFrom selector="{{AmazonPageSection.addressDetails({$amazonAddressId})}}" userInput="data-country" stepKey="amazonAddressCountryCode"/> + <grabAttributeFrom selector="{{AmazonPageSection.addressDetails({$amazonAddressId})}}" userInput="data-phone_number" stepKey="amazonAddressPhoneNumber"/> + + <!-- choose card --> + <click selector="{{AmazonPageSection.changePaymentButton}}" stepKey="clickChangeAddress"/> + <executeJS function="document.querySelectorAll('#maxo_payment_methods .a-radio-label').forEach(function(v,i,o) { if (v.querySelector('.trail_number').innerText.includes('{{cc}}')) { v.click() } });" stepKey="executeJsCc"/> + <click selector="{{AmazonPageSection.usePaymentButton}}" stepKey="clickUsePaymentMethod"/> + + <!--Go back to checkout--> + <waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="waitForAmazonCheckoutButton"/> + <wait time="1" stepKey="allowContinueButtonToActivate"/> + <click selector="{{AmazonPageSection.checkoutButton}}" stepKey="clickAmazonCheckoutButton"/> + + <!-- Switch back to main window --> + <switchToWindow userInput="{$openerName}" stepKey="switchToWindowOpener" /> + + <waitForPageLoad stepKey="waitForCheckoutPageLoad"/> + <wait time="1" stepKey="allowAddressToPopulate"/> + <!--Filter out address data--> + <executeJS function="return '{$amazonAddressLine1Raw}' !== 'null' ? '{$amazonAddressLine1Raw}' : ''" stepKey="amazonAddressLine1"/> + <executeJS function="return '{$amazonAddressLine2Raw}' !== 'null' ? '{$amazonAddressLine2Raw}' : ''" stepKey="amazonAddressLine2"/> + <executeJS function="return '{$amazonAddressLine3Raw}' !== 'null' ? '{$amazonAddressLine3Raw}' : ''" stepKey="amazonAddressLine3"/> + <grabAttributeFrom selector="{{AmazonCheckoutSection.countryNameByCode({$amazonAddressCountryCode})}}" userInput="data-title" stepKey="amazonAddressCountryName"/> + <!--Verify correct shipping address is displayed--> + <see selector="{{AmazonCheckoutSection.shippingAddress}}" userInput="$amazonAddressName" stepKey="seeAmazonAddressName"/> + <see selector="{{AmazonCheckoutSection.shippingAddress}}" userInput="$amazonAddressLine1" stepKey="seeAmazonAddressLine1"/> + <see selector="{{AmazonCheckoutSection.shippingAddress}}" userInput="$amazonAddressLine2" stepKey="seeAmazonAddressLine2"/> + <see selector="{{AmazonCheckoutSection.shippingAddress}}" userInput="$amazonAddressLine3" stepKey="seeAmazonAddressLine3"/> + <see selector="{{AmazonCheckoutSection.shippingAddress}}" userInput="$amazonAddressCity" stepKey="seeAmazonAddressCity"/> + <see selector="{{AmazonCheckoutSection.shippingAddress}}" userInput="$amazonAddressZipCode" stepKey="seeAmazonAddressZipCode"/> + <see selector="{{AmazonCheckoutSection.shippingAddress}}" userInput="$amazonAddressCountryName" stepKey="seeAmazonAddressCountryName"/> + <see selector="{{AmazonCheckoutSection.shippingAddress}}" userInput="$amazonAddressPhoneNumber" stepKey="seeAmazonAddressPhoneNumber"/> + <return value="{$amazonAddressZipCode}" stepKey="returnAddressZip"/> + </actionGroup> +</actionGroups> diff --git a/Test/Mftf-24/ActionGroup/AmazonLoginOnlyActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonLoginOnlyActionGroup.xml index 4439875e0..006dca33b 100644 --- a/Test/Mftf-24/ActionGroup/AmazonLoginOnlyActionGroup.xml +++ b/Test/Mftf-24/ActionGroup/AmazonLoginOnlyActionGroup.xml @@ -1,6 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AmazonLoginOnlyActionGroup"> + <arguments> + <argument name="buttonSelector" defaultValue="{{AmazonLoginSection.login}}" type="string"/> + </arguments> + <!--Save opener window name since popup auto-closes--> + <executeJS function="return window.name;" stepKey="openerName"/> + + <!--Verify Sign in with Amazon Button is present--> + <click selector="{{buttonSelector}}" stepKey="clickSignInWithAmazonButton"/> + <wait time="1" stepKey="allowPopupToOpen"/> + <switchToNextTab stepKey="switchToWindowLoginPopup"/> + <waitForElement selector="{{AmazonPageSection.emailField}}" stepKey="waitForEmailField"/> <wait time="1" stepKey="allowButtonToActivate1"/> <fillField selector="{{AmazonPageSection.emailField}}" userInput="{{AmazonAccount.email}}" stepKey="fillAmazonPageEmailField"/> @@ -9,5 +20,9 @@ <!--Verify successful login by the presence of the continue button--> <wait time="1" stepKey="allowButtonToActivate2"/> <waitForElement selector="{{AmazonLoginSection.consentButton}}" stepKey="seeAmazonConsentButton"/> + <click selector="{{AmazonLoginSection.consentButton}}" stepKey="clickAmazonConsentButton"/> + + <!-- Switch back to main window --> + <switchToWindow userInput="{$openerName}" stepKey="switchToWindowOpener" /> </actionGroup> </actionGroups> diff --git a/Test/Mftf-24/ActionGroup/AmazonLoginOnlyRedirectActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonLoginOnlyRedirectActionGroup.xml new file mode 100644 index 000000000..172c6829a --- /dev/null +++ b/Test/Mftf-24/ActionGroup/AmazonLoginOnlyRedirectActionGroup.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AmazonLoginOnlyRedirectActionGroup"> + <waitForElement selector="{{AmazonPageSection.emailField}}" stepKey="waitForEmailField"/> + <wait time="1" stepKey="allowButtonToActivate1"/> + <fillField selector="{{AmazonPageSection.emailField}}" userInput="{{AmazonAccount.email}}" stepKey="fillAmazonPageEmailField"/> + <fillField selector="{{AmazonPageSection.passwordField}}" userInput="{{AmazonAccount.password}}" stepKey="fillAmazonPagePasswordField"/> + <click selector="{{AmazonPageSection.signInButton}}" stepKey="clickAmazonPageSignInButton"/> + <!--Verify successful login by the presence of the continue button--> + <wait time="1" stepKey="allowButtonToActivate2"/> + <waitForElement selector="{{AmazonLoginSection.consentButton}}" stepKey="seeAmazonConsentButton"/> + </actionGroup> +</actionGroups> diff --git a/Test/Mftf-24/ActionGroup/AmazonLoginRedirectActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonLoginRedirectActionGroup.xml new file mode 100644 index 000000000..c72f65d5d --- /dev/null +++ b/Test/Mftf-24/ActionGroup/AmazonLoginRedirectActionGroup.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AmazonLoginRedirectActionGroup"> + <waitForElement selector="{{AmazonPageSection.emailField}}" stepKey="waitForEmailField"/> + <wait time="1" stepKey="allowButtonToActivate1"/> + <fillField selector="{{AmazonPageSection.emailField}}" userInput="{{AmazonAccount.email}}" stepKey="fillAmazonPageEmailField"/> + <fillField selector="{{AmazonPageSection.passwordField}}" userInput="{{AmazonAccount.password}}" stepKey="fillAmazonPagePasswordField"/> + <click selector="{{AmazonPageSection.signInButton}}" stepKey="clickAmazonPageSignInButton"/> + <!--Verify successful login by the presence of the checkout button--> + <wait time="1" stepKey="allowButtonToActivate"/> + <waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="seeAmazonCheckoutButton"/> + </actionGroup> +</actionGroups> diff --git a/Test/Mftf-24/Data/AmazonPaymentConfigData.xml b/Test/Mftf-24/Data/AmazonPaymentConfigData.xml index 3593d1d3d..13faaca60 100644 --- a/Test/Mftf-24/Data/AmazonPaymentConfigData.xml +++ b/Test/Mftf-24/Data/AmazonPaymentConfigData.xml @@ -42,7 +42,8 @@ <entity name="SampleAmazonPaymentConfig" type="amazon_payment_config"> <requiredEntity type="api_version">SampleAmazonPaymentApiVersion</requiredEntity> <requiredEntity type="active">SampleAmazonPaymentActive</requiredEntity> - <requiredEntity type="private_key">SampleAmazonPaymentPrivateKey</requiredEntity> + <requiredEntity type="private_key_text">SampleAmazonPaymentPrivateKey</requiredEntity> + <requiredEntity type="private_key_selected">SampleAmazonPaymentPrivateKeySelectedText</requiredEntity> <requiredEntity type="public_key_id">SampleAmazonPaymentPublicKeyId</requiredEntity> <requiredEntity type="merchant_id">SampleAmazonPaymentMerchantId</requiredEntity> <requiredEntity type="store_id">SampleAmazonPaymentStoreId</requiredEntity> @@ -56,9 +57,12 @@ <entity name="SampleAmazonPaymentActive" type="active"> <data key="value">1</data> </entity> - <entity name="SampleAmazonPaymentPrivateKey" type="private_key"> + <entity name="SampleAmazonPaymentPrivateKey" type="private_key_text"> <data key="value">{{_CREDS.amazon/private_key}}</data> </entity> + <entity name="SampleAmazonPaymentPrivateKeySelectedText" type="private_key_selected"> + <data key="value">text</data> + </entity> <entity name="SampleAmazonPaymentPublicKeyId" type="public_key_id"> <data key="value">{{_CREDS.amazon/public_key_id}}</data> </entity> @@ -92,7 +96,8 @@ <entity name="EUAmazonPaymentConfig" type="amazon_payment_config"> <requiredEntity type="api_version">SampleAmazonPaymentApiVersion</requiredEntity> <requiredEntity type="active">SampleAmazonPaymentActive</requiredEntity> - <requiredEntity type="private_key">EUAmazonPaymentPrivateKey</requiredEntity> + <requiredEntity type="private_key_text">EUAmazonPaymentPrivateKey</requiredEntity> + <requiredEntity type="private_key_selected">SampleAmazonPaymentPrivateKeySelectedText</requiredEntity> <requiredEntity type="public_key_id">EUAmazonPaymentPublicKeyId</requiredEntity> <requiredEntity type="merchant_id">EUAmazonPaymentMerchantId</requiredEntity> <requiredEntity type="store_id">EUAmazonPaymentStoreId</requiredEntity> @@ -100,7 +105,7 @@ <requiredEntity type="sandbox">SampleAmazonPaymentSandbox</requiredEntity> <requiredEntity type="lwa_enabled">SampleAmazonPaymentLwaDisabled</requiredEntity> </entity> - <entity name="EUAmazonPaymentPrivateKey" type="private_key"> + <entity name="EUAmazonPaymentPrivateKey" type="private_key_text"> <data key="value">{{_CREDS.amazon/eu_private_key}}</data> </entity> <entity name="EUAmazonPaymentPublicKeyId" type="public_key_id"> @@ -122,7 +127,8 @@ <entity name="SampleAmazonPaymentConfigLwa" type="amazon_payment_config"> <requiredEntity type="api_version">SampleAmazonPaymentApiVersion</requiredEntity> <requiredEntity type="active">SampleAmazonPaymentActive</requiredEntity> - <requiredEntity type="private_key">SampleAmazonPaymentPrivateKey</requiredEntity> + <requiredEntity type="private_key_text">SampleAmazonPaymentPrivateKey</requiredEntity> + <requiredEntity type="private_key_selected">SampleAmazonPaymentPrivateKeySelectedText</requiredEntity> <requiredEntity type="public_key_id">SampleAmazonPaymentPublicKeyId</requiredEntity> <requiredEntity type="merchant_id">SampleAmazonPaymentMerchantId</requiredEntity> <requiredEntity type="store_id">SampleAmazonPaymentStoreId</requiredEntity> diff --git a/Test/Mftf-24/Metadata/AmazonPaymentV2ConfigMeta.xml b/Test/Mftf-24/Metadata/AmazonPaymentV2ConfigMeta.xml index 09af9a21a..0eaaa889f 100644 --- a/Test/Mftf-24/Metadata/AmazonPaymentV2ConfigMeta.xml +++ b/Test/Mftf-24/Metadata/AmazonPaymentV2ConfigMeta.xml @@ -14,7 +14,13 @@ <object key="active_v2" dataType="active"> <field key="value">string</field> </object> - <object key="private_key" dataType="private_key"> + <object key="private_key_text" dataType="private_key_text"> + <field key="value">string</field> + </object> + <object key="private_key_pem" dataType="private_key_pem"> + <field key="value">string</field> + </object> + <object key="private_key_selected" dataType="private_key_selected"> <field key="value">string</field> </object> <object key="public_key_id" dataType="public_key_id"> diff --git a/Test/Mftf-24/Test/AmazonCancelReturnUrl.xml b/Test/Mftf-24/Test/AmazonCancelReturnUrl.xml index 03d1f3c41..0d5ae3b26 100644 --- a/Test/Mftf-24/Test/AmazonCancelReturnUrl.xml +++ b/Test/Mftf-24/Test/AmazonCancelReturnUrl.xml @@ -14,25 +14,37 @@ <createData entity="SimpleTwo" stepKey="createSimpleProduct"/> <createData entity="SampleAmazonPaymentConfigLwa" stepKey="SampleAmazonPaymentConfigLwa"/> <magentoCLI command="config:set {{AmazonButtonProductConfig.path}} 1" stepKey="displayAmazonButtonProduct"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdminPanel"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> <after> <createData entity="SampleAmazonPaymentConfig" stepKey="SampleAmazonPaymentConfigData"/> + <actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteCustomer"> + <argument name="email" value="{{AmazonAccount.email}}"/> + </actionGroup> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> </after> <!-- Click Sign-in button from sign-in page --> <amOnPage url="{{StorefrontCustomerSignInPage.url}}" stepKey="amOnSignInPage"/> <waitForPageLoad time="30" stepKey="waitPageFullyLoaded"/> + + <!--Save opener window name since popup auto-closes--> + <executeJS function="return window.name;" stepKey="openerName"/> <click selector="{{AmazonLoginSection.login}}" stepKey="signInWithAmazon"/> - + <wait time="1" stepKey="allowPopupToOpen"/> + <switchToNextTab stepKey="switchToWindowLoginPopup"/> + <!-- Login to Amazon --> - <actionGroup ref="AmazonLoginOnlyActionGroup" stepKey="amazonLoginOnlyActionGroup"/> + <actionGroup ref="AmazonBeginLoginOnlyActionGroup" stepKey="amazonBeginLoginOnlyActionGroup"/> <waitForElement selector="{{AmazonPageSection.loginCancelButton}}" stepKey="waitForCancelLogin"/> <!-- Cancel login with Amazon and land back on sign-in Magento page --> <click selector="{{AmazonPageSection.loginCancelButton}}" stepKey="clickLoginCancelButton"/> + <!-- Switch back to main window --> + <switchToWindow userInput="{$openerName}" stepKey="switchToWindowOpener" /> <waitForPageLoad stepKey="waitForSigninPageLoad"/> <seeInCurrentUrl url="{{StorefrontCustomerSignInPage.url}}" stepKey="assertLoginUrl"/> @@ -45,21 +57,29 @@ <!-- Click Amazon Pay button on product page and login --> <click selector="{{AmazonButtonSection.product}}" stepKey="clickAmazonButton"/> + + <wait time="1" stepKey="allowPopupToOpen2"/> + <switchToNextTab stepKey="switchToWindowLoginPopup2"/> <waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="seeAmazonCheckoutButton"/> - <!-- <actionGroup ref="AmazonLoginActionGroup" stepKey="amazonLoginActionGroup"/> --> <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"> + <argument name="openerName" value="{$openerName}"/> + </actionGroup> <!-- Click edit button on address --> <click selector="{{AmazonCheckoutSection.editShippingButton}}" stepKey="clickAmazonEditShippingButton"/> + <wait time="1" stepKey="allowPopupToOpen3"/> + <switchToNextTab stepKey="switchToAddressEditPopup"/> <waitForElement selector="{{AmazonPageSection.cancelButton}}" stepKey="waitForCancelCheckout"/> <!-- Click cancel button on Amazon hosted page --> <click selector="{{AmazonPageSection.cancelButton}}" stepKey="cancelCheckout"/> + <!-- Switch back to main window --> + <switchToWindow userInput="{$openerName}" stepKey="switchToWindowOpener2" /> <waitForPageLoad stepKey="waitForProductPageLoad"/> <!-- Assert being back in the product page --> - <seeInCurrentUrl url="$$createSimpleProduct.custom_attributes[url_key]$$" stepKey="assertProductUrl"/> + <seeInCurrentUrl url="{{CheckoutPage.url}}" stepKey="assertProductUrl"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/Test/Mftf-24/Test/AmazonCheckoutAsyncDeclinedTest.xml b/Test/Mftf-24/Test/AmazonCheckoutAsyncDeclinedTest.xml index e1502013e..5481fd6de 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutAsyncDeclinedTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutAsyncDeclinedTest.xml @@ -20,10 +20,7 @@ </after> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"> <argument name="cc" value="4354" /> </actionGroup> <!--Go to payment method--> diff --git a/Test/Mftf-24/Test/AmazonCheckoutAsyncSuccessTest.xml b/Test/Mftf-24/Test/AmazonCheckoutAsyncSuccessTest.xml index 954eccbee..65913debc 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutAsyncSuccessTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutAsyncSuccessTest.xml @@ -20,10 +20,7 @@ </after> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"> <argument name="cc" value="0701" /> </actionGroup> <!--Go to payment method--> diff --git a/Test/Mftf-24/Test/AmazonCheckoutButtonTest.xml b/Test/Mftf-24/Test/AmazonCheckoutButtonTest.xml index b93ecb0a4..dec966a60 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutButtonTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutButtonTest.xml @@ -26,5 +26,6 @@ <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMiniCart"/> <!--Verify only Amazon Button is present--> <seeElement selector="{{AmazonButtonSection.checkout}}" stepKey="seeEnabledAmazonButton"/> + <wait time="1" stepKey="AllowButtonToActivateWorkaround"/> </test> </tests> diff --git a/Test/Mftf-24/Test/AmazonCheckoutBuyerCanceledTest.xml b/Test/Mftf-24/Test/AmazonCheckoutBuyerCanceledTest.xml index 1c58b27b9..8eea58e93 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutBuyerCanceledTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutBuyerCanceledTest.xml @@ -11,10 +11,7 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"> <argument name="cc" value="3064" /> </actionGroup> <!--Go to payment method--> diff --git a/Test/Mftf-24/Test/AmazonCheckoutCancelledThenSuccessTest.xml b/Test/Mftf-24/Test/AmazonCheckoutCancelledThenSuccessTest.xml deleted file mode 100644 index ad12f4f02..000000000 --- a/Test/Mftf-24/Test/AmazonCheckoutCancelledThenSuccessTest.xml +++ /dev/null @@ -1,89 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AmazonCheckoutCancelledThenSuccess" extends="AmazonCheckoutButton"> - <annotations> - <stories value="Amazon Checkout Cancelled then Successful"/> - <title value="Amazon Checkout Cancelled then Successful"/> - <description value="User should be able to checkout with Amazon Pay after cancelling their checkout session."/> - <severity value="CRITICAL"/> - <group value="amazon_pay_disabled"/> - <group value="amazon_pay_checkout"/> - </annotations> - - <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - - <click selector="{{AmazonPageSection.cancelButton}}" stepKey="cancelCheckout"/> - <waitForPageLoad stepKey="waitForCheckoutPageLoad"/> - - <!--Go back to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton2"/> - <actionGroup ref="AmazonAlreadyLoggedInActionGroup" stepKey="AmazonLoginActionGroup2"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup2"/> - - <!-- Get the current checkout session ID --> - <executeJS function="return localStorage.getItem('amzn-checkout-session')" stepKey="getCheckoutSession2"/> - - <!-- Ensure we have an active checkout session by clicking Edit address --> - <click selector="{{AmazonCheckoutSection.editShippingButton}}" stepKey="clickAmazonEditShippingButton"/> - <waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="waitForCancelCheckout2"/> - <click selector="{{AmazonPageSection.cancelButton}}" stepKey="cancelCheckout2"/> - <waitForPageLoad stepKey="waitForCheckoutPageLoad2"/> - - <!--Go back to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton3"/> - <actionGroup ref="AmazonAlreadyLoggedInActionGroup" stepKey="AmazonLoginActionGroup3"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup3"/> - <waitForPageLoad stepKey="waitForCheckoutPageLoad3"/> - - <!-- Get the current checkout session ID and make sure it changed --> - <executeJS function="return localStorage.getItem('amzn-checkout-session')" stepKey="getCheckoutSession3"/> - <assertNotEquals stepKey="verifyChangedSession2"> - <actualResult type="const">$getCheckoutSession3</actualResult> - <expectedResult type="const">$getCheckoutSession2</expectedResult> - </assertNotEquals> - - <!--Go to payment method--> - <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> - <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> - - <click selector="{{AmazonCheckoutSection.editPaymentButton}}" stepKey="clickEditPaymentButton"/> - <waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="waitForContinueButton"/> - <click selector="{{AmazonPageSection.cancelButton}}" stepKey="cancelCheckout3"/> - <waitForPageLoad stepKey="waitForCheckoutPageLoad4"/> - - <!--Go back to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton4"/> - <actionGroup ref="AmazonAlreadyLoggedInActionGroup" stepKey="AmazonLoginActionGroup4"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup4"/> - <waitForPageLoad stepKey="waitForCheckoutPageLoad5"/> - - <!-- Get the current checkout session ID and make sure it changed --> - <executeJS function="return localStorage.getItem('amzn-checkout-session')" stepKey="getCheckoutSession4"/> - <assertNotEquals stepKey="verifyChangedSession3"> - <actualResult type="const">$getCheckoutSession4</actualResult> - <expectedResult type="const">$getCheckoutSession3</expectedResult> - </assertNotEquals> - - <!--Go to payment method, edit payment, then proceed--> - <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext2"/> - <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad2"/> - <click selector="{{AmazonCheckoutSection.editPaymentButton}}" stepKey="clickEditPaymentButton2"/> - <waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="waitForContinueButton2"/> - <click selector="{{AmazonPageSection.checkoutButton}}" stepKey="clickAmazonCheckoutButton2"/> - <waitForElement selector="{{CheckoutPaymentSection.availablePaymentSolutions}}" stepKey="waitForCheckoutPaymentPageLoad3"/> - - <!--Verify only Amazon Pay method is visible--> - <seeNumberOfElements selector="{{CheckoutPaymentSection.availablePaymentSolutions}}" userInput="1" stepKey="seeSingleAvailablePaymentSolution"/> - <seeElement selector="{{AmazonCheckoutSection.method}}" stepKey="seeAmazonPaymentMethod"/> - <!--Place order--> - <actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="guestPlaceorder"> - <argument name="orderNumberMessage" value="CONST.successGuestCheckoutOrderNumberMessage" /> - <argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage" /> - </actionGroup> - </test> -</tests> diff --git a/Test/Mftf-24/Test/AmazonCheckoutDeclinedTest.xml b/Test/Mftf-24/Test/AmazonCheckoutDeclinedTest.xml index cf2bfc141..8b1efaedc 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutDeclinedTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutDeclinedTest.xml @@ -11,10 +11,7 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"> <argument name="cc" value="3434" /> </actionGroup> <!--Go to payment method--> diff --git a/Test/Mftf-24/Test/AmazonCheckoutLoggedInNoGuestButtonTest.xml b/Test/Mftf-24/Test/AmazonCheckoutLoggedInNoGuestButtonTest.xml index e4b74a913..5bbe81ec4 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutLoggedInNoGuestButtonTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutLoggedInNoGuestButtonTest.xml @@ -45,10 +45,7 @@ <!--Go to Amazon Pay from the checkout and login--> <waitForElement selector="{{AmazonButtonSection.checkout}}" stepKey="waitForAmazonChangedShippingPageLoad"/> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-24/Test/AmazonCheckoutLoginTest.xml b/Test/Mftf-24/Test/AmazonCheckoutLoginTest.xml index 7db721c92..706a9d07f 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutLoginTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutLoginTest.xml @@ -10,8 +10,13 @@ <group value="amazon_pay_login"/> </annotations> + <!--Save opener window name since popup auto-closes--> + <executeJS function="return window.name;" stepKey="openerName"/> + <!--Go to Amazon Pay from the checkout and login--> <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> + <wait time="1" stepKey="allowPopupToOpen"/> + <switchToNextTab stepKey="switchToWindowLoginPopup"/> <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> </test> </tests> diff --git a/Test/Mftf-24/Test/AmazonCheckoutMulticurrencySuccessTest.xml b/Test/Mftf-24/Test/AmazonCheckoutMulticurrencySuccessTest.xml index 262444071..d6ac0cc16 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutMulticurrencySuccessTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutMulticurrencySuccessTest.xml @@ -27,10 +27,7 @@ </after> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-24/Test/AmazonCheckoutOrderTwoItems.xml b/Test/Mftf-24/Test/AmazonCheckoutOrderTwoItems.xml index f96d423b2..3708e8a4a 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutOrderTwoItems.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutOrderTwoItems.xml @@ -40,10 +40,7 @@ <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMiniCart"/> <!--Go to Amazon Pay and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-24/Test/AmazonCheckoutReturnToStandardTest.xml b/Test/Mftf-24/Test/AmazonCheckoutReturnToStandardTest.xml index 2faf66e4d..10e90752d 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutReturnToStandardTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutReturnToStandardTest.xml @@ -11,15 +11,11 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <click selector="{{AmazonCheckoutSection.returnToStandardCheckout}}" stepKey="clickReturnToStandardCheckout"/> <waitForPageLoad stepKey="waitForStandardCheckoutPageLoad"/> - - <seeInField selector="{{CheckoutShippingSection.postcode}}" userInput="$DefaultAmazonCheckoutActionGroup" stepKey="seeAmazonAddressPostcode"/> + <seeInField selector="{{CheckoutShippingSection.postcode}}" userInput="$AmazonLoginAndCheckoutActionGroup" stepKey="seeAmazonAddressPostcode"/> </test> </tests> diff --git a/Test/Mftf-24/Test/AmazonCheckoutSuccessTest.xml b/Test/Mftf-24/Test/AmazonCheckoutSuccessTest.xml index f10a977d1..c52d24de8 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutSuccessTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutSuccessTest.xml @@ -11,10 +11,7 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-24/Test/AmazonInvoiceMultipleCapture.xml b/Test/Mftf-24/Test/AmazonInvoiceMultipleCapture.xml index 9447d51b0..6b8582400 100644 --- a/Test/Mftf-24/Test/AmazonInvoiceMultipleCapture.xml +++ b/Test/Mftf-24/Test/AmazonInvoiceMultipleCapture.xml @@ -26,10 +26,7 @@ <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMiniCart2"/> <!--Go to Amazon Pay and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-24/Test/AmazonInvoiceOnlySingleCapture.xml b/Test/Mftf-24/Test/AmazonInvoiceOnlySingleCapture.xml index 8ea4b28d2..cda7071c1 100644 --- a/Test/Mftf-24/Test/AmazonInvoiceOnlySingleCapture.xml +++ b/Test/Mftf-24/Test/AmazonInvoiceOnlySingleCapture.xml @@ -35,10 +35,7 @@ <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMiniCart2"/> <!--Go to Amazon Pay and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-24/Test/AmazonInvoicePendingCapturedTest.xml b/Test/Mftf-24/Test/AmazonInvoicePendingCapturedTest.xml index 42c322b2e..4b9dae11c 100644 --- a/Test/Mftf-24/Test/AmazonInvoicePendingCapturedTest.xml +++ b/Test/Mftf-24/Test/AmazonInvoicePendingCapturedTest.xml @@ -11,10 +11,7 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-24/Test/AmazonInvoicePendingDeclinedTest.xml b/Test/Mftf-24/Test/AmazonInvoicePendingDeclinedTest.xml index ffce9ce49..4c3594b6e 100644 --- a/Test/Mftf-24/Test/AmazonInvoicePendingDeclinedTest.xml +++ b/Test/Mftf-24/Test/AmazonInvoicePendingDeclinedTest.xml @@ -11,10 +11,7 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-24/Test/AmazonInvoiceTest.xml b/Test/Mftf-24/Test/AmazonInvoiceTest.xml index 89b98f00c..09398f369 100644 --- a/Test/Mftf-24/Test/AmazonInvoiceTest.xml +++ b/Test/Mftf-24/Test/AmazonInvoiceTest.xml @@ -11,10 +11,7 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/Test/Mftf-24/Test/AmazonMiniCartLoginTest.xml b/Test/Mftf-24/Test/AmazonMiniCartLoginTest.xml index 29994e8e1..8e2d45f87 100644 --- a/Test/Mftf-24/Test/AmazonMiniCartLoginTest.xml +++ b/Test/Mftf-24/Test/AmazonMiniCartLoginTest.xml @@ -10,8 +10,13 @@ <group value="amazon_pay_login"/> </annotations> + <!--Save opener window name since popup auto-closes--> + <executeJS function="return window.name;" stepKey="openerName"/> + <!--Go to Amazon Pay from the mini cart and login--> <click selector="{{AmazonButtonSection.miniCart}}" stepKey="clickAmazonButton"/> + <wait time="1" stepKey="allowPopupToOpen"/> + <switchToNextTab stepKey="switchToWindowLoginPopup"/> <actionGroup ref="AmazonLoginActionGroup" stepKey="amazonLoginActionGroup"/> </test> </tests> diff --git a/Test/Mftf-24/Test/AmazonPaymentLoginTest.xml b/Test/Mftf-24/Test/AmazonPaymentLoginTest.xml index 3a921cf1a..708d2641d 100644 --- a/Test/Mftf-24/Test/AmazonPaymentLoginTest.xml +++ b/Test/Mftf-24/Test/AmazonPaymentLoginTest.xml @@ -10,9 +10,14 @@ <group value="amazon_pay_login"/> </annotations> + <!--Save opener window name since popup auto-closes--> + <executeJS function="return window.name;" stepKey="openerName"/> + <!--Go to Amazon Pay from the payment method and login--> - <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> + <wait time="1" stepKey="allowButtonToActivate"/> <click selector="{{AmazonButtonSection.payment}}" stepKey="clickAmazonButton"/> + <wait time="1" stepKey="allowPopupToOpen"/> + <switchToNextTab stepKey="switchToWindowLoginPopup"/> <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> </test> </tests> diff --git a/Test/Mftf-24/Test/AmazonProductLoginTest.xml b/Test/Mftf-24/Test/AmazonProductLoginTest.xml index 74ccc5319..2e00fe5a3 100644 --- a/Test/Mftf-24/Test/AmazonProductLoginTest.xml +++ b/Test/Mftf-24/Test/AmazonProductLoginTest.xml @@ -10,8 +10,13 @@ <group value="amazon_pay_login"/> </annotations> + <!--Save opener window name since popup auto-closes--> + <executeJS function="return window.name;" stepKey="openerName"/> + <!--Add to cart via Amazon Pay button on product page and login--> <click selector="{{AmazonButtonSection.product}}" stepKey="clickAmazonButton"/> + <wait time="1" stepKey="allowPopupToOpen"/> + <switchToNextTab stepKey="switchToWindowLoginPopup"/> <actionGroup ref="AmazonLoginActionGroup" stepKey="amazonLoginActionGroup"/> </test> </tests> diff --git a/Test/Mftf-24/Test/AmazonRefund.xml b/Test/Mftf-24/Test/AmazonRefund.xml index 83f6a7fdc..754cf7303 100644 --- a/Test/Mftf-24/Test/AmazonRefund.xml +++ b/Test/Mftf-24/Test/AmazonRefund.xml @@ -11,10 +11,7 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> @@ -51,7 +48,7 @@ <click selector="{{AdminInvoiceMainActionsSection.openNewCreditMemoFromInvoice}}" stepKey="clickCreateCreditMemo"/> <waitForPageLoad stepKey="waitForCreditMemoPageLoad"/> <!-- adding the raw selector here as the Magento provided one is incorrect --> - <click selector=".action-default.scalable.save.submit-button.refund.primary" stepKey="submitRefund"/> + <click selector=".action-default.scalable.save.submit-button.refund.primary" stepKey="submitRefund"/> <see userInput="Amazon Pay refund successful." stepKey="seeAmazonMessage"/> <see userInput="You created the credit memo." stepKey="seeMagentoMessage"/> </test> diff --git a/Test/Mftf-24/Test/AmazonShippingAddressTest.xml b/Test/Mftf-24/Test/AmazonShippingAddressTest.xml index 4a03b9205..3f3bc09c1 100644 --- a/Test/Mftf-24/Test/AmazonShippingAddressTest.xml +++ b/Test/Mftf-24/Test/AmazonShippingAddressTest.xml @@ -11,13 +11,13 @@ </annotations> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> + <!--Save opener window name since popup auto-closes--> + <executeJS function="return window.name;" stepKey="openerName"/> <!--Change shipping address--> <click selector="{{AmazonCheckoutSection.editShippingButton}}" stepKey="clickAmazonEditShippingButton"/> <wait time="1" stepKey="allowButtonToActivate"/> + <switchToNextTab stepKey="switchToWindowLoginPopup"/> <waitForElement selector="{{AmazonPageSection.changeAddressButton}}" stepKey="waitForAmazonEditShippingPageLoad"/> <click selector="{{AmazonPageSection.changeAddressButton}}" stepKey="clickChangeAmazonAddressButton"/> <click selector="{{AmazonPageSection.notSelectedAddress}}" stepKey="clickNotSelectedAmazonAddress"/> @@ -25,6 +25,8 @@ <waitForElement selector="{{AmazonPageSection.checkoutButton}}" stepKey="waitForAmazonChangedShippingPageLoad"/> <wait time="1" stepKey="allowButtonToActivate2"/> <!--Come back to checkout with changed address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="ChangedAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonCheckoutActionGroup" stepKey="ChangedAmazonCheckoutActionGroup"> + <argument name="openerName" value="{$openerName}"/> + </actionGroup> </test> </tests> diff --git a/Test/Mftf-24/Test/AmazonSignInButtonNoGuestCheckoutPopupTest.xml b/Test/Mftf-24/Test/AmazonSignInButtonNoGuestCheckoutPopupTest.xml new file mode 100644 index 000000000..c3c1ca049 --- /dev/null +++ b/Test/Mftf-24/Test/AmazonSignInButtonNoGuestCheckoutPopupTest.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AmazonSignInButtonNoGuestCheckoutPopup"> + <annotations> + <stories value="Amazon Sign In Button No Guest Checkout"/> + <title value="Amazon Sign In Button No Guest Checkout"/> + <description value="Amazon Sign In button should be visible when proceeding to checkout with guest checkout disabled"/> + <severity value="CRITICAL"/> + <group value="amazon_pay"/> + <group value="amazon_pay_signin"/> + </annotations> + + <before> + <createData entity="SimpleTwo" stepKey="createSimpleProduct"/> + <createData entity="SampleAmazonPaymentConfigLwa" stepKey="SampleAmazonPaymentConfigLwa"/> + <magentoCLI command="config:set checkout/options/guest_checkout 0" stepKey="disableGuestCheckout"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + </before> + + <after> + <createData entity="SampleAmazonPaymentConfig" stepKey="SampleAmazonPaymentConfig"/> + <magentoCLI command="config:set checkout/options/guest_checkout 1" stepKey="enableGuestCheckout"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + </after> + + <!--Go to product page--> + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductStoreFront"> + <argument name="productUrl" value="$$createSimpleProduct.custom_attributes[url_key]$$"/> + </actionGroup> + <!--Click on Add To Cart button--> + <actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="clickOnAddToCartButton"/> + <!--Go to checkout--> + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMiniCart"/> + <!-- Verify Sign in with Amazon button is displayed --> + <seeElement selector="{{AmazonLoginSection.login}}" stepKey="seeSignInWithAmazonButtonLogin"/> + </test> +</tests> diff --git a/Test/Mftf-24/Test/AmazonSignInCreateAccountTest.xml b/Test/Mftf-24/Test/AmazonSignInCreateAccountTest.xml index 849bec38f..5bf55ee0d 100644 --- a/Test/Mftf-24/Test/AmazonSignInCreateAccountTest.xml +++ b/Test/Mftf-24/Test/AmazonSignInCreateAccountTest.xml @@ -20,11 +20,7 @@ <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> - <!--Verify Sign in with Amazon Button is present--> - <click selector="{{AmazonLoginSection.login}}" stepKey="clickSignInWithAmazonButton"/> - <actionGroup ref="AmazonLoginOnlyActionGroup" stepKey="AmazonLoginOnlyActionGroup"/> - <click selector="{{AmazonLoginSection.consentButton}}" stepKey="clickAmazonConsentButton"/> <waitForPageLoad stepKey="waitForMyAccountPageLoad"/> <see userInput="My Account" stepKey="seeMyAccount"/> diff --git a/Test/Mftf-24/Test/AmazonSignInExistingUnlinkedAccountTest.xml b/Test/Mftf-24/Test/AmazonSignInExistingUnlinkedAccountTest.xml index d7e59e95c..a8de56085 100644 --- a/Test/Mftf-24/Test/AmazonSignInExistingUnlinkedAccountTest.xml +++ b/Test/Mftf-24/Test/AmazonSignInExistingUnlinkedAccountTest.xml @@ -18,11 +18,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> </after> - <!--Verify Sign in with Amazon Button is present--> - <click selector="{{AmazonLoginSection.login}}" stepKey="seeSignInWithAmazonButton"/> - <actionGroup ref="AmazonLoginOnlyActionGroup" stepKey="AmazonLoginOnlyActionGroup"/> - <click selector="{{AmazonLoginSection.consentButton}}" stepKey="clickAmazonConsentButton"/> <waitForPageLoad stepKey="waitForLinkAccountPageLoad"/> <see userInput="A store account for this email address already exists" stepKey="seeAnAccountExists"/> diff --git a/Test/Mftf-24/Test/AmazonSignInToExistingTest.xml b/Test/Mftf-24/Test/AmazonSignInToExistingTest.xml index 9b34659b4..eb26e91f5 100644 --- a/Test/Mftf-24/Test/AmazonSignInToExistingTest.xml +++ b/Test/Mftf-24/Test/AmazonSignInToExistingTest.xml @@ -20,11 +20,7 @@ <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> - <!--Verify Sign in with Amazon Button is present--> - <click selector="{{AmazonLoginSection.login}}" stepKey="clickSignInWithAmazonButton"/> - <actionGroup ref="AmazonLoginOnlyActionGroup" stepKey="AmazonLoginOnlyActionGroup"/> - <click selector="{{AmazonLoginSection.consentButton}}" stepKey="clickAmazonConsentButton"/> <waitForPageLoad stepKey="waitForMyAccountPageLoad"/> <see userInput="My Account" stepKey="seeMyAccount"/> @@ -35,15 +31,22 @@ <amOnPage url="{{StorefrontCustomerSignInPage.url}}" stepKey="amOnSignInPage2"/> <waitForPageLoad time="30" stepKey="waitPageFullyLoaded"/> + <!--Save opener window name since popup auto-closes--> + <executeJS function="return window.name;" stepKey="openerName"/> + <!--Verify Sign in with Amazon Button is present again--> <click selector="{{AmazonLoginSection.login}}" stepKey="clickSignInWithAmazonButton2"/> + <wait time="1" stepKey="allowButtonToActivate"/> + <switchToNextTab stepKey="switchToLoginWindow"/> <!-- make sure we are logged out from Amazon by clearing ubid-main cookie --> <resetCookie userInput="ubid-main" parameterArray="['domainName' => '.amazon.com']" stepKey="resetCookieForAmazon"/> <reloadPage stepKey="reloadAmazonLoginPage"/> - <actionGroup ref="AmazonLoginOnlyActionGroup" stepKey="AmazonLoginOnlyActionGroup2"/> - <click selector="{{AmazonLoginSection.consentButton}}" stepKey="clickAmazonConsentButton2"/> + <actionGroup ref="AmazonLoginOnlyRedirectActionGroup" stepKey="AmazonLoginOnlyRedirectActionGroup2"/> + <click selector="{{AmazonLoginSection.consentButton}}" stepKey="clickAmazonConsentButton"/> + <!-- Switch back to main window --> + <switchToWindow userInput="{$openerName}" stepKey="switchToWindowOpener" /> <waitForPageLoad stepKey="waitForMyAccountPageLoad2"/> <see userInput="My Account" stepKey="seeMyAccount2"/> diff --git a/Test/Mftf-24/Test/AmazonSigninCheckoutSuccessTest.xml b/Test/Mftf-24/Test/AmazonSigninCheckoutSuccessTest.xml index 0b02ff279..f69a5fa5e 100644 --- a/Test/Mftf-24/Test/AmazonSigninCheckoutSuccessTest.xml +++ b/Test/Mftf-24/Test/AmazonSigninCheckoutSuccessTest.xml @@ -23,10 +23,7 @@ </after> <!--Go to Amazon Pay from the checkout and login--> - <click selector="{{AmazonButtonSection.checkout}}" stepKey="clickAmazonButton"/> - <actionGroup ref="AmazonLoginActionGroup" stepKey="AmazonLoginActionGroup"/> - <!--Come back to checkout with default address--> - <actionGroup ref="AmazonCheckoutActionGroup" stepKey="DefaultAmazonCheckoutActionGroup"/> + <actionGroup ref="AmazonLoginAndCheckoutActionGroup" stepKey="AmazonLoginAndCheckoutActionGroup"/> <!--Go to payment method--> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickCheckoutShippingNext"/> <waitForPageLoad stepKey="waitForCheckoutPaymentPageLoad"/> diff --git a/composer.json b/composer.json index c3a6cf666..7ef108629 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "amzn/amazon-pay-magento-2-module", "description": "Official Magento2 Plugin to integrate with Amazon Pay", "type": "magento2-module", - "version": "5.1.0", + "version": "5.2.0", "license": [ "Apache-2.0" ], @@ -31,6 +31,11 @@ "magento/module-quote": "^101.0", "magento/module-customer": "^102.0||^103.0", "magento/module-store": "^101.0", + "magento/module-catalog": "^103.0||^104.0", + "magento/module-configurable-product": "^100.0", + "magento/module-directory": "^100.0", + "magento/module-media-storage": "^100.0", + "magento/module-paypal": "^100.0||^101.0", "amzn/amazon-pay-api-sdk-php": "^2.2", "aws/aws-php-sns-message-validator": "^1.5" }, diff --git a/view/adminhtml/templates/system/config/private-key.phtml b/view/adminhtml/templates/system/config/private-key.phtml index c6507e92f..04ecdb76b 100644 --- a/view/adminhtml/templates/system/config/private-key.phtml +++ b/view/adminhtml/templates/system/config/private-key.phtml @@ -18,7 +18,7 @@ ?> <div class="private-key-buttons"> - <button id="private_key_pem_button"><?= /* @noEscape */ __('Upload .pem file') ?></button> + <button id="private_key_pem_button" type="button"><?= /* @noEscape */ __('Upload .pem file') ?></button> <div><?= /* @noEscape */ __('or') ?></div> - <button id="private_key_text_button"><?= /* @noEscape */ __('Copy & Paste') ?></button> + <button id="private_key_text_button" type="button"><?= /* @noEscape */ __('Copy & Paste') ?></button> </div> diff --git a/view/frontend/layout/default.xml b/view/frontend/layout/default.xml index 765e77ede..316391cf5 100755 --- a/view/frontend/layout/default.xml +++ b/view/frontend/layout/default.xml @@ -20,5 +20,26 @@ <referenceContainer name="content"> <block class="Amazon\Pay\Block\Config" name="amazon_pay_config" template="Amazon_Pay::config.phtml" /> </referenceContainer> + + <referenceBlock name="authentication-popup"> + <arguments> + <argument name="jsLayout" xsi:type="array"> + <item name="components" xsi:type="array"> + <item name="authenticationPopup" xsi:type="array"> + <item name="children" xsi:type="array"> + <item name="amazon-button" xsi:type="array"> + <item name="component" xsi:type="string">Amazon_Pay/js/view/login-button-wrapper</item> + <item name="sortOrder" xsi:type="string">0</item> + <item name="displayArea" xsi:type="string">additional-login-form-fields</item> + <item name="config" xsi:type="array"> + <item name="tooltip" xsi:type="string" translate="true">Securely login into our website using your existing Amazon details.</item> + </item> + </item> + </item> + </item> + </item> + </argument> + </arguments> + </referenceBlock> </body> </page> diff --git a/view/frontend/templates/config.phtml b/view/frontend/templates/config.phtml index 5213e1fa9..60dcaba3e 100755 --- a/view/frontend/templates/config.phtml +++ b/view/frontend/templates/config.phtml @@ -26,7 +26,7 @@ registry.set('amazonPay', <?= /* @noEscape */ \Zend_Json::encode($block->getConfig()); ?>); }); - <?php if ($frontName != 'checkout' || (str_contains($pathInfo, 'checkout/cart') === true)): ?> + <?php if ($frontName != 'checkout' || (strpos($pathInfo, 'checkout/cart') !== false)): ?> require (['Amazon_Pay/js/model/storage'], function(amazonStorage) { amazonStorage.clearAmazonCheckout(); }); diff --git a/view/frontend/web/css/source/_module.less b/view/frontend/web/css/source/_module.less index 32927b18e..11892c5bb 100755 --- a/view/frontend/web/css/source/_module.less +++ b/view/frontend/web/css/source/_module.less @@ -53,6 +53,33 @@ top: 50%; } } + .block-customer-login { + .amazon-sign-in-button-container { + .field-tooltip { + .field-tooltip-content { + top: 38px; + left: -245px; + + &:before { + border: none; + border-left: 10px solid transparent; + border-right: 10px solid transparent; + border-bottom: 10px solid #666666; + top: -10px; + left: 244px; + } + &:after { + border: none; + border-left: 10px solid transparent; + border-right: 10px solid transparent; + border-bottom: 10px solid #f4f4f4; + top: -8px; + left: 244px; + } + } + } + } + } .cart-summary { .amazon-button-container { diff --git a/view/frontend/web/js/amazon-button.js b/view/frontend/web/js/amazon-button.js index bab2ab62c..0d782b67e 100755 --- a/view/frontend/web/js/amazon-button.js +++ b/view/frontend/web/js/amazon-button.js @@ -22,113 +22,122 @@ define([ ], function ($, checkoutSessionConfigLoad, amazonStorage, url, amazonCheckout, customerData) { 'use strict'; - var cart = customerData.get('cart'), - customer = customerData.get('customer'), - canCheckoutWithAmazon = false; - - // to use Amazon Pay: customer needs to be logged in, or guest checkout allowed, or Amazon Sign-in enabled - if (customer().firstname || amazonStorage.isGuestCheckoutEnabled || amazonStorage.isLwaEnabled) { - canCheckoutWithAmazon = true; - } - - if (amazonStorage.isEnabled && canCheckoutWithAmazon) { - $.widget('amazon.AmazonButton', { - options: { - payOnly: null, - placement: 'Cart', - hideIfUnavailable: '' - }, - - _loadButtonConfig: function (callback) { - checkoutSessionConfigLoad(function (checkoutSessionConfig) { - if (!$.isEmptyObject(checkoutSessionConfig)) { - callback({ - merchantId: checkoutSessionConfig['merchant_id'], - ledgerCurrency: checkoutSessionConfig['currency'], - sandbox: checkoutSessionConfig['sandbox'], - checkoutLanguage: checkoutSessionConfig['language'], - productType: this._isPayOnly(checkoutSessionConfig['pay_only']) ? 'PayOnly' : 'PayAndShip', - placement: this.options.placement, - buttonColor: checkoutSessionConfig['button_color'], - createCheckoutSessionConfig: { - payloadJSON: checkoutSessionConfig['checkout_payload'], - signature: checkoutSessionConfig['checkout_signature'], - publicKeyId: checkoutSessionConfig['public_key_id'], - } - }); + $.widget('amazon.AmazonButton', { + options: { + payOnly: null, + placement: 'Cart', + hideIfUnavailable: '' + }, - if (this.options.placement !== "Checkout") { - $(this.options.hideIfUnavailable).show(); + _loadButtonConfig: function (callback) { + checkoutSessionConfigLoad(function (checkoutSessionConfig) { + if (!$.isEmptyObject(checkoutSessionConfig)) { + callback({ + merchantId: checkoutSessionConfig['merchant_id'], + ledgerCurrency: checkoutSessionConfig['currency'], + sandbox: checkoutSessionConfig['sandbox'], + checkoutLanguage: checkoutSessionConfig['language'], + productType: this._isPayOnly(checkoutSessionConfig['pay_only']) ? 'PayOnly' : 'PayAndShip', + placement: this.options.placement, + buttonColor: checkoutSessionConfig['button_color'], + createCheckoutSessionConfig: { + payloadJSON: checkoutSessionConfig['checkout_payload'], + signature: checkoutSessionConfig['checkout_signature'], + publicKeyId: checkoutSessionConfig['public_key_id'], } - } else { - $(this.options.hideIfUnavailable).hide(); - } - }.bind(this)); - }, + }); - /** - * @param {boolean} isCheckoutSessionPayOnly - * @returns {boolean} - * @private - */ - _isPayOnly: function (isCheckoutSessionPayOnly) { - var result = isCheckoutSessionPayOnly; - if (result && this.options.payOnly !== null) { - result = this.options.payOnly; + if (this.options.placement !== "Checkout") { + $(this.options.hideIfUnavailable).show(); + } + } else { + $(this.options.hideIfUnavailable).hide(); } - return result; - }, + }.bind(this)); + }, - /** - * Create button - */ - _create: function () { - this._draw(); + /** + * @param {boolean} isCheckoutSessionPayOnly + * @returns {boolean} + * @private + */ + _isPayOnly: function (isCheckoutSessionPayOnly) { + var result = isCheckoutSessionPayOnly; + if (result && this.options.payOnly !== null) { + result = this.options.payOnly; + } + return result; + }, - if (this.options.placement == 'Product') { - this._redraw(); - } - }, + /** + * Create button + */ + _create: function () { + this._draw(); - /** - * Draw button - **/ - _draw: function () { - var $buttonContainer = this.element; - amazonCheckout.withAmazonCheckout(function (amazon, args) { - var $buttonRoot = $('<div></div>'); - $buttonRoot.html('<img src="' + require.toUrl('images/loader-1.gif') + '" alt="" width="24" />'); - $buttonContainer.empty().append($buttonRoot); - this._loadButtonConfig(function (buttonConfig) { - amazon.Pay.renderButton('#' + $buttonRoot.empty().removeUniqueId().uniqueId().attr('id'), buttonConfig); - $('.amazon-button-container .field-tooltip').fadeIn(); - $('.amazon-checkout-button').click(function() { customerData.invalidate('*'); }); - }); - }, this); - }, + if (this.options.placement == 'Product') { + this._redraw(); + } + }, - /** - * Redraw button if needed - **/ - _redraw: function () { - var self = this; + /** + * Draw button + **/ + _draw: function () { + var $buttonContainer = this.element; + amazonCheckout.withAmazonCheckout(function (amazon, args) { + var $buttonRoot = $('<div></div>'); + $buttonRoot.html('<img src="' + require.toUrl('images/loader-1.gif') + '" alt="" width="24" />'); + $buttonContainer.empty().append($buttonRoot); + this._loadButtonConfig(function (buttonConfig) { + amazon.Pay.renderButton('#' + $buttonRoot.empty().removeUniqueId().uniqueId().attr('id'), buttonConfig); + $('.amazon-button-container .field-tooltip').fadeIn(); + $('.amazon-checkout-button').click(function() { customerData.invalidate('*'); }); + }); + }, this); + }, - amazonCheckout.withAmazonCheckout(function (amazon, args) { - var cartData = customerData.get('cart'); - cartData.subscribe(function (updatedCart) { - if (!$(self.options.hideIfUnavailable).first().is(':visible')) { - self._draw(); - } - }); + /** + * Redraw button if needed + **/ + _redraw: function () { + var self = this; + + amazonCheckout.withAmazonCheckout(function (amazon, args) { + var cartData = customerData.get('cart'); + cartData.subscribe(function (updatedCart) { + if (!$(self.options.hideIfUnavailable).first().is(':visible')) { + self._draw(); + } }); + }); - }, + }, - click: function () { - this.element.children().first().trigger('click'); - } - }); + click: function () { + this.element.children().first().trigger('click'); + } + }); + + + var cart = customerData.get('cart'), + customer = customerData.get('customer'), + canCheckoutWithAmazon = false; + // to use Amazon Pay: customer needs to be logged in, or guest checkout allowed, or Amazon Sign-in enabled + if (customer().firstname || amazonStorage.isGuestCheckoutEnabled || amazonStorage.isLwaEnabled) { + canCheckoutWithAmazon = true; + } + + if (amazonStorage.isEnabled && canCheckoutWithAmazon) { return $.amazon.AmazonButton; + } else { + return function(config, element) { + customer.subscribe(function() { + if (customer().firstname || amazonStorage.isGuestCheckoutEnabled || amazonStorage.isLwaEnabled) { + $(element).AmazonButton(); + } + }); + }; } }); diff --git a/view/frontend/web/js/view/login-button-wrapper.js b/view/frontend/web/js/view/login-button-wrapper.js new file mode 100644 index 000000000..6db25891d --- /dev/null +++ b/view/frontend/web/js/view/login-button-wrapper.js @@ -0,0 +1,46 @@ +/** + * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +define( + [ + 'jquery', + 'uiRegistry', + 'Amazon_Pay/js/model/storage', + 'amazonPayLoginButton', + 'uiComponent' + ], function( + $, + registry, + amazonStorage, + loginButton, + component + ) { + 'use strict'; + + if (amazonStorage.isLwaEnabled) { + return component.extend({ + defaults: { + template: 'Amazon_Pay/login-button-wrapper' + }, + + initializeLoginButton: function() { + $('#AmazonPayButton').AmazonLoginButton(); + } + + }); + } + + return component; +}); diff --git a/view/frontend/web/template/login-button-wrapper.html b/view/frontend/web/template/login-button-wrapper.html new file mode 100644 index 000000000..1fa775be2 --- /dev/null +++ b/view/frontend/web/template/login-button-wrapper.html @@ -0,0 +1,47 @@ +<!-- +/** + * Copyright © Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +--> + +<!-- ko foreach: getRegion('before-amazon-button') --> + <!-- ko template: getTemplate() --><!-- /ko --> +<!--/ko--> + +<div class="amazon-sign-in-button-container"> + <div class="amazon-sign-in-button-container__cell"> + <div id="AmazonPayButton" + class="login-with-amazon" + afterRender="initializeLoginButton"> + </div> + </div> + <div class="amazon-sign-in-button-container__cell"> + <div class="field-tooltip toggle"> + <span class="field-tooltip-action action-help" + data-bind="mageInit: {'dropdown':{'activeClass': '_active'}}" + data-toggle="dropdown" + aria-haspopup="true" + aria-expanded="false" + role="button"> + </span> + <div class="field-tooltip-content" data-target="dropdown" aria-hidden="true" data-bind="text: tooltip"> + Securely login into our website using your existing Amazon details. + </div> + </div> + </div> +</div> + +<!-- ko foreach: getRegion('after-amazon-button') --> + <!-- ko template: getTemplate() --><!-- /ko --> +<!--/ko-->