From 3ccdb7b451b9c0e6e11effb8745c8f5900b8682e Mon Sep 17 00:00:00 2001 From: Spencer Gabhart Date: Tue, 4 Oct 2022 13:32:19 -0400 Subject: [PATCH 01/13] ASD-974 - Handle occasional Amazon authentication popup auto-closing, MFTF 2.3/2.4 --- .../AmazonBeginLoginOnlyActionGroup.xml | 42 +++- .../ActionGroup/AmazonLoginActionGroup.xml | 76 ++++++-- .../AmazonLoginAndCheckoutActionGroup.xml | 77 ++++++-- .../AmazonLoginOnlyActionGroup.xml | 41 +++- .../AmazonLoginOnlyRedirectActionGroup.xml | 40 +++- Test/Mftf-23/Section/AmazonPageSection.xml | 4 +- Test/Mftf-23/Test/AmazonCancelReturnUrl.xml | 121 +++++++++--- .../Test/AmazonSignInToExistingTest.xml | 3 - .../AmazonBeginLoginOnlyActionGroup.xml | 15 +- .../ActionGroup/AmazonCheckoutActionGroup.xml | 3 + .../ActionGroup/AmazonLoginActionGroup.xml | 17 +- .../AmazonLoginAndCheckoutActionGroup.xml | 21 +- .../AmazonLoginOnlyActionGroup.xml | 13 +- .../AmazonLoginOnlyRedirectActionGroup.xml | 12 +- .../Helper/HandlePopupSecondScreen.php | 179 ++++++++++++++++++ Test/Mftf-24/Helper/LoadAddresses.php | 43 ++++- Test/Mftf-24/Helper/SignInOrContinue.php | 145 ++++++++++++++ Test/Mftf-24/Section/AmazonPageSection.xml | 2 +- Test/Mftf-24/Test/AmazonCancelReturnUrl.xml | 28 +-- .../Test/AmazonSignInToExistingTest.xml | 3 - 20 files changed, 746 insertions(+), 139 deletions(-) create mode 100644 Test/Mftf-24/Helper/HandlePopupSecondScreen.php create mode 100644 Test/Mftf-24/Helper/SignInOrContinue.php diff --git a/Test/Mftf-23/ActionGroup/AmazonBeginLoginOnlyActionGroup.xml b/Test/Mftf-23/ActionGroup/AmazonBeginLoginOnlyActionGroup.xml index 5e6129b5a..df51bf8e7 100644 --- a/Test/Mftf-23/ActionGroup/AmazonBeginLoginOnlyActionGroup.xml +++ b/Test/Mftf-23/ActionGroup/AmazonBeginLoginOnlyActionGroup.xml @@ -5,9 +5,43 @@ - - - - + + + + diff --git a/Test/Mftf-23/ActionGroup/AmazonLoginActionGroup.xml b/Test/Mftf-23/ActionGroup/AmazonLoginActionGroup.xml index 8bb17e0be..530da756d 100644 --- a/Test/Mftf-23/ActionGroup/AmazonLoginActionGroup.xml +++ b/Test/Mftf-23/ActionGroup/AmazonLoginActionGroup.xml @@ -5,29 +5,69 @@ - - - + + + }" stepKey="navigateToAddressAndPaymentOptions" /> diff --git a/Test/Mftf-23/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml b/Test/Mftf-23/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml index 95349f785..4f5bd2a45 100644 --- a/Test/Mftf-23/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml +++ b/Test/Mftf-23/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml @@ -22,30 +22,69 @@ - - - - + + + }" stepKey="navigateToAddressAndPaymentOptions" /> diff --git a/Test/Mftf-23/ActionGroup/AmazonLoginOnlyActionGroup.xml b/Test/Mftf-23/ActionGroup/AmazonLoginOnlyActionGroup.xml index 006dca33b..b9aa176cf 100644 --- a/Test/Mftf-23/ActionGroup/AmazonLoginOnlyActionGroup.xml +++ b/Test/Mftf-23/ActionGroup/AmazonLoginOnlyActionGroup.xml @@ -14,13 +14,44 @@ + - - - - - + + + + diff --git a/Test/Mftf-23/ActionGroup/AmazonLoginOnlyRedirectActionGroup.xml b/Test/Mftf-23/ActionGroup/AmazonLoginOnlyRedirectActionGroup.xml index 172c6829a..cef9aeef8 100644 --- a/Test/Mftf-23/ActionGroup/AmazonLoginOnlyRedirectActionGroup.xml +++ b/Test/Mftf-23/ActionGroup/AmazonLoginOnlyRedirectActionGroup.xml @@ -5,9 +5,41 @@ - - - - + + + + + diff --git a/Test/Mftf-23/Section/AmazonPageSection.xml b/Test/Mftf-23/Section/AmazonPageSection.xml index bef5a519a..6a6f4e111 100644 --- a/Test/Mftf-23/Section/AmazonPageSection.xml +++ b/Test/Mftf-23/Section/AmazonPageSection.xml @@ -5,9 +5,9 @@ - + - + diff --git a/Test/Mftf-23/Test/AmazonCancelReturnUrl.xml b/Test/Mftf-23/Test/AmazonCancelReturnUrl.xml index 0a2b8a1ac..f3bc78234 100644 --- a/Test/Mftf-23/Test/AmazonCancelReturnUrl.xml +++ b/Test/Mftf-23/Test/AmazonCancelReturnUrl.xml @@ -38,12 +38,6 @@ - - - - - - @@ -56,31 +50,104 @@ - - + + + + + }" stepKey="handlePopupSecondScreen2" /> diff --git a/Test/Mftf-23/Test/AmazonSignInToExistingTest.xml b/Test/Mftf-23/Test/AmazonSignInToExistingTest.xml index 2fac5737c..e76e1a89e 100644 --- a/Test/Mftf-23/Test/AmazonSignInToExistingTest.xml +++ b/Test/Mftf-23/Test/AmazonSignInToExistingTest.xml @@ -43,9 +43,6 @@ - - - diff --git a/Test/Mftf-24/ActionGroup/AmazonBeginLoginOnlyActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonBeginLoginOnlyActionGroup.xml index 5e6129b5a..36a5dcfb1 100644 --- a/Test/Mftf-24/ActionGroup/AmazonBeginLoginOnlyActionGroup.xml +++ b/Test/Mftf-24/ActionGroup/AmazonBeginLoginOnlyActionGroup.xml @@ -1,13 +1,20 @@ + - - - - + + + {{AmazonPageSection.signInButton}} + {$openerName} + + + + {{AmazonPageSection.loginCancelButton}} + {$openerName} + diff --git a/Test/Mftf-24/ActionGroup/AmazonCheckoutActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonCheckoutActionGroup.xml index c2dbc3498..67438a1b6 100644 --- a/Test/Mftf-24/ActionGroup/AmazonCheckoutActionGroup.xml +++ b/Test/Mftf-24/ActionGroup/AmazonCheckoutActionGroup.xml @@ -6,11 +6,14 @@ + {{AmazonPageSection.changeAddressButton}} {{AmazonPageSection.addressBackButton}} {{AmazonPageSection.addressId}} + {{openerName}} + {{AmazonCheckoutSection.editShippingButton}} diff --git a/Test/Mftf-24/ActionGroup/AmazonLoginActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonLoginActionGroup.xml index 60961a623..238484997 100644 --- a/Test/Mftf-24/ActionGroup/AmazonLoginActionGroup.xml +++ b/Test/Mftf-24/ActionGroup/AmazonLoginActionGroup.xml @@ -6,17 +6,16 @@ - - - - + + + {{AmazonPageSection.signInButton}} + - + {$openerName} - {{AmazonCheckoutSection.editShippingButton}} - {{AmazonPageSection.addressId}} - {{AmazonPageSection.changePaymentButton}} - {{AmazonPageSection.changeAddressButton}} + {{AmazonPageSection.continueButton}} + {{AmazonCheckoutSection.editShippingButton}} + {{AmazonPageSection.addressId}} diff --git a/Test/Mftf-24/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml index 9759d48ba..09a8d77c1 100644 --- a/Test/Mftf-24/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml +++ b/Test/Mftf-24/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml @@ -22,25 +22,26 @@ - - - - + + + {{AmazonPageSection.signInButton}} + - + {$openerName} - {{AmazonCheckoutSection.editShippingButton}} - {{AmazonPageSection.addressId}} - {{AmazonPageSection.changePaymentButton}} - {{AmazonPageSection.changeAddressButton}} + {{AmazonPageSection.continueButton}} + {{AmazonCheckoutSection.editShippingButton}} + {{AmazonPageSection.addressId}} - + {{AmazonPageSection.changeAddressButton}} {{AmazonPageSection.addressBackButton}} {{AmazonPageSection.addressId}} + {$openerName} + {{AmazonCheckoutSection.editShippingButton}} diff --git a/Test/Mftf-24/ActionGroup/AmazonLoginOnlyActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonLoginOnlyActionGroup.xml index 006dca33b..d5f54136f 100644 --- a/Test/Mftf-24/ActionGroup/AmazonLoginOnlyActionGroup.xml +++ b/Test/Mftf-24/ActionGroup/AmazonLoginOnlyActionGroup.xml @@ -16,12 +16,15 @@ - - - - - + + + {{AmazonPageSection.signInButton}} + + + {{AmazonLoginSection.consentButton}} + + diff --git a/Test/Mftf-24/ActionGroup/AmazonLoginOnlyRedirectActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonLoginOnlyRedirectActionGroup.xml index 172c6829a..4363598c0 100644 --- a/Test/Mftf-24/ActionGroup/AmazonLoginOnlyRedirectActionGroup.xml +++ b/Test/Mftf-24/ActionGroup/AmazonLoginOnlyRedirectActionGroup.xml @@ -5,9 +5,13 @@ - - - - + + + {{AmazonPageSection.signInButton}} + + + + {{AmazonLoginSection.consentButton}} + diff --git a/Test/Mftf-24/Helper/HandlePopupSecondScreen.php b/Test/Mftf-24/Helper/HandlePopupSecondScreen.php new file mode 100644 index 000000000..1da144138 --- /dev/null +++ b/Test/Mftf-24/Helper/HandlePopupSecondScreen.php @@ -0,0 +1,179 @@ +getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver'); + + $magentoWebDriver->executeInSelenium(function (RemoteWebDriver $remoteWebDriver) use ( + $magentoWebDriver, + $signInButton + ) { + try { + $remoteWebDriver->findElement( + WebDriverBy::cssSelector($signInButton) + )->click(); + $magentoWebDriver->switchToNextTab(); + $magentoWebDriver->wait(5); + } catch (\Exception $ex) { + + } catch (\Error $err) { + + } + }); + } + + public function navigateToAddressAndPaymentOptions( + $openerName, + $continueButton, + $editShippingButton, + $addressId + ) { + /** @var MagentoWebDriver $magentoWebDriver */ + $magentoWebDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver'); + $stepLog = []; + + $magentoWebDriver->executeInSelenium(function (RemoteWebDriver $remoteWebDriver) use ( + $magentoWebDriver, + $stepLog, + $openerName, + $continueButton, + $editShippingButton, + $addressId + ) { + try { + if (count($remoteWebDriver->getWindowHandles()) > 1) { + if ($magentoWebDriver->executeJS('return window.name;') === $openerName) { + $stepLog[] = 'Popup remained open, switching back to it'; + $magentoWebDriver->switchToNextTab(); + } + + $continueAs = $remoteWebDriver->findElements(WebDriverBy::cssSelector($continueButton)); + + if (!empty($continueAs)) { + $stepLog[] = 'Click Continue as... button and return to checkout'; + $continueAs[0]->click(); + $remoteWebDriver->switchTo()->window($openerName); + $magentoWebDriver->waitForPageLoad(30); + + $stepLog[] = 'Wait for Edit button in address details'; + $editAddressSelector = WebDriverBy::cssSelector($editShippingButton); + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::elementToBeClickable($editAddressSelector)); + $stepLog[] = 'Click Edit button to return to normal flow'; + $remoteWebDriver->findElement($editAddressSelector)->click(); + + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::numberOfWindowsToBe(2)); + $magentoWebDriver->switchToNextTab(); + $addressIdSelector = WebDriverBy::cssSelector($addressId); + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::presenceOfElementLocated($addressIdSelector)); + } else { + $stepLog[] = 'No continue button, standard maxo/pay now'; + $addressIdSelector = WebDriverBy::cssSelector($addressId); + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::presenceOfElementLocated($addressIdSelector)); + } + } else { + $stepLog[] = 'Popup closed, allowing checkout page to load'; + $magentoWebDriver->waitForLoadingMaskToDisappear(30); + $stepLog[] = 'Wait for Edit button in address details'; + $editAddressSelector = WebDriverBy::cssSelector($editShippingButton); + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::elementToBeClickable($editAddressSelector)); + $stepLog[] = 'Click Edit button to return to normal flow'; + $remoteWebDriver->findElement($editAddressSelector)->click(); + + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::numberOfWindowsToBe(2)); + $magentoWebDriver->switchToNextTab(); + $addressIdSelector = WebDriverBy::cssSelector($addressId); + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::presenceOfElementLocated($addressIdSelector)); + } + } catch (\Exception $ex) { + $stepLog[] = $ex->getMessage(); + } finally { + var_dump($stepLog); + } + }); + } + + public function handleSignInConsent($consentButton) + { + /** @var MagentoWebDriver $magentoWebDriver */ + $magentoWebDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver'); + $stepLog = []; + + $magentoWebDriver->executeInSelenium(function (RemoteWebDriver $remoteWebDriver) use ( + $magentoWebDriver, + $stepLog, + $consentButton + ) { + try { + if (count($remoteWebDriver->getWindowHandles()) > 1) { + $stepLog[] = 'Popup remained open, switching back to it'; + $magentoWebDriver->switchToNextTab(); + + $loginConsent = $remoteWebDriver->findElements(WebDriverBy::cssSelector($consentButton)); + + if (!empty($loginConsent)) { + $stepLog[] = 'Click Continue button'; + $loginConsent[0]->click(); + $magentoWebDriver->switchToNextTab(); + } + } else { + $stepLog[] = 'Popup closed, following redirect to account screen'; + } + } catch (\Exception $ex) { + $stepLog[] = $ex->getMessage(); + } finally { + var_dump($stepLog); + } + }); + } + + public function handleCancelSignIn( + $loginCancelButton, + $openerName + ) { + /** @var MagentoWebDriver $magentoWebDriver */ + $magentoWebDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver'); + $stepLog = []; + + $magentoWebDriver->executeInSelenium(function (RemoteWebDriver $remoteWebDriver) use ( + $magentoWebDriver, + $stepLog, + $loginCancelButton, + $openerName + ) { + try { + if (count($remoteWebDriver->getWindowHandles()) > 1) { + $stepLog[] = 'Popup remained open, switching back to it'; + $magentoWebDriver->switchToNextTab(); + + $loginCancel = $remoteWebDriver->findElements(WebDriverBy::cssSelector($loginCancelButton)); + + if (!empty($loginCancel)) { + $stepLog[] = 'Cancel login with Amazon and land back on sign-in Magento page'; + $loginCancel[0]->click(); + $remoteWebDriver->switchTo()->window($openerName); + } + } else { + $stepLog[] = 'Popup closed, signing out manually and returning to login page'; + $magentoWebDriver->amOnPage('customer/account/logout/'); + $magentoWebDriver->wait(5); + $magentoWebDriver->amOnPage('/customer/account/login/'); + } + } catch (\Exception $ex) { + $stepLog[] = $ex->getMessage(); + } finally { + var_dump($stepLog); + } + }); + } +} diff --git a/Test/Mftf-24/Helper/LoadAddresses.php b/Test/Mftf-24/Helper/LoadAddresses.php index 3e0a85622..68089214f 100644 --- a/Test/Mftf-24/Helper/LoadAddresses.php +++ b/Test/Mftf-24/Helper/LoadAddresses.php @@ -2,26 +2,51 @@ namespace Amazon\Pay\Test\Mftf\Helper; +use Facebook\WebDriver\Exception\TimeoutException; use Magento\FunctionalTestingFramework\Helper\Helper; +use Facebook\WebDriver\Remote\RemoteWebDriver; +use Facebook\WebDriver\WebDriverBy; +use Facebook\WebDriver\WebDriverExpectedCondition; class LoadAddresses extends Helper { public function loadAddresses( $changeAddressSelector, $addressBackButtonSelector, - $defaultAddressSelector + $defaultAddressSelector, + $openerName, + $editShippingButton ) { - /** @var \Magento\FunctionalTestingFramework\Module\MagentoWebDriver $webDriver */ - $webDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver'); - $waitTime = 15000; + /** @var \Magento\FunctionalTestingFramework\Module\MagentoWebDriver $magentoWebDriver */ + $magentoWebDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver'); + $waitTime = 15; try { - $webDriver->waitForElementClickable($changeAddressSelector, $waitTime); - $webDriver->click($changeAddressSelector); - $webDriver->waitForElementClickable($addressBackButtonSelector, $waitTime); - $webDriver->click($addressBackButtonSelector); + $magentoWebDriver->waitForElementClickable($changeAddressSelector, $waitTime); + $magentoWebDriver->click($changeAddressSelector); + $magentoWebDriver->waitForElementClickable($addressBackButtonSelector, $waitTime); + $magentoWebDriver->click($addressBackButtonSelector); - $webDriver->waitForElement($defaultAddressSelector, $waitTime); + $magentoWebDriver->waitForElement($defaultAddressSelector, $waitTime); + } catch (TimeoutException $e) { + $magentoWebDriver->switchToNextTab(); + + try { + $magentoWebDriver->executeInSelenium(function (RemoteWebDriver $remoteWebDriver) use ( + $magentoWebDriver, + $editShippingButton + ) { + $editAddressSelector = WebDriverBy::cssSelector($editShippingButton); + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::elementToBeClickable($editAddressSelector)); + $magentoWebDriver->debug('Click Edit button to return to normal flow'); + $remoteWebDriver->findElement($editAddressSelector)->click(); + + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::numberOfWindowsToBe(2)); + $magentoWebDriver->switchToNextTab(); + }); + } catch (\Exception $e) { + + } } catch (\Exception $e) { // Avoid out of memory error sometimes caused by print_r // print_r($e); diff --git a/Test/Mftf-24/Helper/SignInOrContinue.php b/Test/Mftf-24/Helper/SignInOrContinue.php new file mode 100644 index 000000000..a4cec5ab8 --- /dev/null +++ b/Test/Mftf-24/Helper/SignInOrContinue.php @@ -0,0 +1,145 @@ +getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver'); + + $magentoWebDriver->executeInSelenium(function (RemoteWebDriver $remoteWebDriver) use ( + $magentoWebDriver, + $emailField, + $passwordField, + $signInButton, + $openerName, + $continueButton, + $editShippingButton, + $addressId + ) { + $email = $remoteWebDriver->findElements( + WebDriverBy::cssSelector($emailField) + ); + + if (!empty($email)) { + $magentoWebDriver->fillField($emailField, new PasswordArgument('pay-demo-eu@amazon.com')); + $magentoWebDriver->fillField($passwordField, new PasswordArgument('demo123')); + + try { + $remoteWebDriver->findElement( + WebDriverBy::cssSelector($signInButton) + )->click(); + $magentoWebDriver->switchToNextTab(); + $magentoWebDriver->wait(3); + } catch (\Exception $ex) { + $magentoWebDriver->debug('exception caught'); + } catch (\Error $err) { + $magentoWebDriver->debug('error caught'); + } + } else { + $magentoWebDriver->debug('Popup appeared as normal'); + $continueAs = $remoteWebDriver->findElements(WebDriverBy::cssSelector($continueButton)); + + if (!empty($continueAs)) { + $magentoWebDriver->debug('Click Continue as... button and return to checkout'); + $continueAs[0]->click(); + $remoteWebDriver->switchTo()->window($openerName); + $magentoWebDriver->waitForPageLoad(30); + + $magentoWebDriver->debug('Wait for Edit button in address details'); + $editAddressSelector = WebDriverBy::cssSelector($editShippingButton); + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::elementToBeClickable($editAddressSelector)); + $magentoWebDriver->debug('Click Edit button to return to normal flow'); + $remoteWebDriver->findElement($editAddressSelector)->click(); + + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::numberOfWindowsToBe(2)); + $magentoWebDriver->switchToNextTab(); + $addressIdSelector = WebDriverBy::cssSelector($addressId); + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::presenceOfElementLocated($addressIdSelector)); + } else { + $addressIdSelector = WebDriverBy::cssSelector($addressId); + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::presenceOfElementLocated($addressIdSelector)); + } + } + }); + } + + public function handleSecondScreen( + $openerName, + $continueButton, + $editShippingButton, + $addressId + ) { + /** @var \Magento\FunctionalTestingFramework\Module\MagentoWebDriver $magentoWebDriver */ + $magentoWebDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver'); + + $magentoWebDriver->executeInSelenium(function (RemoteWebDriver $remoteWebDriver) use ( + $magentoWebDriver, + $openerName, + $continueButton, + $editShippingButton, + $addressId + ) { + try { + if (count($remoteWebDriver->getWindowHandles()) > 1) { + if ($magentoWebDriver->executeJS('return window.name;') === $openerName) { + $magentoWebDriver->debug('Popup remained open, switching back to it'); + $magentoWebDriver->switchToNextTab(); + } + + $continueAs = $remoteWebDriver->findElements(WebDriverBy::cssSelector($continueButton)); + + if (!empty($continueAs)) { + $magentoWebDriver->debug('Click Continue as... button and return to checkout'); + $continueAs[0]->click(); + $remoteWebDriver->switchTo()->window($openerName); + $magentoWebDriver->waitForPageLoad(30); + + $magentoWebDriver->debug('Wait for Edit button in address details'); + $editAddressSelector = WebDriverBy::cssSelector($editShippingButton); + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::elementToBeClickable($editAddressSelector)); + $magentoWebDriver->debug('Click Edit button to return to normal flow'); + $remoteWebDriver->findElement($editAddressSelector)->click(); + + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::numberOfWindowsToBe(2)); + $magentoWebDriver->switchToNextTab(); + $addressIdSelector = WebDriverBy::cssSelector($addressId); + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::presenceOfElementLocated($addressIdSelector)); + } else { + $addressIdSelector = WebDriverBy::cssSelector($addressId); + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::presenceOfElementLocated($addressIdSelector)); + } + } else { + $magentoWebDriver->debug('Popup closed, allowing checkout page to load'); + $magentoWebDriver->debug('Wait for Edit button in address details'); + $editAddressSelector = WebDriverBy::cssSelector($editShippingButton); + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::elementToBeClickable($editAddressSelector)); + $magentoWebDriver->debug('Click Edit button to return to normal flow'); + $remoteWebDriver->findElement($editAddressSelector)->click(); + + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::numberOfWindowsToBe(2)); + $magentoWebDriver->switchToNextTab(); + $addressIdSelector = WebDriverBy::cssSelector($addressId); + $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::presenceOfElementLocated($addressIdSelector)); + } + } catch (\Exception $ex) { + + } + }); + } +} diff --git a/Test/Mftf-24/Section/AmazonPageSection.xml b/Test/Mftf-24/Section/AmazonPageSection.xml index 2bdefc481..3ad4aa94b 100644 --- a/Test/Mftf-24/Section/AmazonPageSection.xml +++ b/Test/Mftf-24/Section/AmazonPageSection.xml @@ -5,7 +5,7 @@ - + diff --git a/Test/Mftf-24/Test/AmazonCancelReturnUrl.xml b/Test/Mftf-24/Test/AmazonCancelReturnUrl.xml index 8ed756859..4b5096862 100644 --- a/Test/Mftf-24/Test/AmazonCancelReturnUrl.xml +++ b/Test/Mftf-24/Test/AmazonCancelReturnUrl.xml @@ -41,12 +41,6 @@ - - - - - - @@ -59,15 +53,25 @@ - - + + + + {{AmazonPageSection.emailField}} + {{AmazonPageSection.passwordField}} + {{AmazonPageSection.signInButton}} + {$openerName} + {{AmazonPageSection.continueButton}} + {{AmazonCheckoutSection.editShippingButton}} + {{AmazonPageSection.addressId}} + + + {$openerName} - {{AmazonCheckoutSection.editShippingButton}} - {{AmazonPageSection.addressId}} - {{AmazonPageSection.changePaymentButton}} - {{AmazonPageSection.changeAddressButton}} + {{AmazonPageSection.continueButton}} + {{AmazonCheckoutSection.editShippingButton}} + {{AmazonPageSection.addressId}} diff --git a/Test/Mftf-24/Test/AmazonSignInToExistingTest.xml b/Test/Mftf-24/Test/AmazonSignInToExistingTest.xml index 8f24b4bf6..ac47521e0 100644 --- a/Test/Mftf-24/Test/AmazonSignInToExistingTest.xml +++ b/Test/Mftf-24/Test/AmazonSignInToExistingTest.xml @@ -43,9 +43,6 @@ - - - From a61a1010279e8c509481584210eb1f04f0746860 Mon Sep 17 00:00:00 2001 From: Spencer Gabhart Date: Tue, 18 Oct 2022 14:37:34 -0400 Subject: [PATCH 02/13] ASD-974 - Handle popup remaining open with no actionable items --- .../AmazonGoToPaymentMethodActionGroup.xml | 9 ++++ .../ActionGroup/AmazonLoginActionGroup.xml | 6 +++ .../AmazonLoginAndCheckoutActionGroup.xml | 14 ++++-- Test/Mftf-24/Helper/EnsurePopupOpened.php | 45 +++++++++++++++++++ .../Helper/HandlePopupSecondScreen.php | 29 +++++++++++- Test/Mftf-24/Helper/LoadAddresses.php | 41 +++++++++-------- Test/Mftf-24/Section/AmazonPageSection.xml | 3 ++ .../AmazonBillingAddressVisibilityTest.xml | 2 +- .../Test/AmazonBillingFormVisibilityTest.xml | 2 +- .../Test/AmazonCheckoutAsyncDeclinedTest.xml | 4 +- .../Test/AmazonCheckoutAsyncSuccessTest.xml | 4 +- .../Test/AmazonCheckoutBuyerCanceledTest.xml | 4 +- .../Test/AmazonCheckoutDeclinedTest.xml | 4 +- ...mazonCheckoutLoggedInNoGuestButtonTest.xml | 4 +- Test/Mftf-24/Test/AmazonCheckoutLoginTest.xml | 4 +- ...AmazonCheckoutMulticurrencySuccessTest.xml | 4 +- .../Test/AmazonCheckoutOrderTwoItems.xml | 4 +- .../Test/AmazonCheckoutPayNowDeclinedTest.xml | 2 +- ...CheckoutPayNowMulticurrencySuccessTest.xml | 2 +- .../Test/AmazonCheckoutPayNowSuccessTest.xml | 2 +- .../Test/AmazonCheckoutSuccessTest.xml | 4 +- .../Test/AmazonInvoiceMultipleCapture.xml | 4 +- .../Test/AmazonInvoicePendingCapturedTest.xml | 4 +- .../Test/AmazonInvoicePendingDeclinedTest.xml | 4 +- Test/Mftf-24/Test/AmazonInvoiceTest.xml | 4 +- Test/Mftf-24/Test/AmazonMiniCartLoginTest.xml | 4 +- Test/Mftf-24/Test/AmazonPaymentLoginTest.xml | 2 +- Test/Mftf-24/Test/AmazonProductLoginTest.xml | 4 +- Test/Mftf-24/Test/AmazonRefund.xml | 4 +- .../Test/AmazonSigninCheckoutSuccessTest.xml | 4 +- 30 files changed, 152 insertions(+), 75 deletions(-) create mode 100644 Test/Mftf-24/ActionGroup/AmazonGoToPaymentMethodActionGroup.xml create mode 100644 Test/Mftf-24/Helper/EnsurePopupOpened.php diff --git a/Test/Mftf-24/ActionGroup/AmazonGoToPaymentMethodActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonGoToPaymentMethodActionGroup.xml new file mode 100644 index 000000000..00bfe0cc2 --- /dev/null +++ b/Test/Mftf-24/ActionGroup/AmazonGoToPaymentMethodActionGroup.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Test/Mftf-24/ActionGroup/AmazonLoginActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonLoginActionGroup.xml index 238484997..0b5dc59b8 100644 --- a/Test/Mftf-24/ActionGroup/AmazonLoginActionGroup.xml +++ b/Test/Mftf-24/ActionGroup/AmazonLoginActionGroup.xml @@ -2,6 +2,10 @@ + + + + @@ -16,6 +20,8 @@ {{AmazonPageSection.continueButton}} {{AmazonCheckoutSection.editShippingButton}} {{AmazonPageSection.addressId}} + {{AmazonPageSection.checkoutButton}} + {{buttonSelector}} diff --git a/Test/Mftf-24/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml index 09a8d77c1..4fadfcf13 100644 --- a/Test/Mftf-24/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml +++ b/Test/Mftf-24/ActionGroup/AmazonLoginAndCheckoutActionGroup.xml @@ -9,13 +9,16 @@ + - + + {{buttonSelector}} + @@ -32,6 +35,8 @@ {{AmazonPageSection.continueButton}} {{AmazonCheckoutSection.editShippingButton}} {{AmazonPageSection.addressId}} + {{AmazonPageSection.checkoutButton}} + {{buttonSelector}} @@ -40,10 +45,13 @@ {{AmazonPageSection.changeAddressButton}} {{AmazonPageSection.addressBackButton}} {{AmazonPageSection.addressId}} - {$openerName} - {{AmazonCheckoutSection.editShippingButton}} + + diff --git a/Test/Mftf-24/Helper/EnsurePopupOpened.php b/Test/Mftf-24/Helper/EnsurePopupOpened.php new file mode 100644 index 000000000..08d0170ad --- /dev/null +++ b/Test/Mftf-24/Helper/EnsurePopupOpened.php @@ -0,0 +1,45 @@ +getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver'); + $log = []; + + try { + $magentoWebDriver->executeInSelenium(function (RemoteWebDriver $remoteWebDriver) use ( + $magentoWebDriver, + $buttonSelector, + $log + ) { + try { + $remoteWebDriver->wait(15, 100)->until( + WebDriverExpectedCondition::numberOfWindowsToBe(2) + ); + } catch (TimeoutException $e) { + $log[] = 'Timed out waiting for second window:\n' . $e->getMessage(); + $log[] = 'Attempting to click button again'; + $magentoWebDriver->click($buttonSelector); + $magentoWebDriver->wait(1); + } catch (\Exception $e) { + $log[] = 'General exception thrown while waiting for second window:\n' . $e->getMessage(); + } + }); + } catch (\Exception $e) { + $log[] = 'General exception thrown while executing remote web driver code:\n' . $e->getMessage(); + // Avoid out of memory error sometimes caused by print_r + // print_r($e); + } finally { + var_dump($log); + } + } +} diff --git a/Test/Mftf-24/Helper/HandlePopupSecondScreen.php b/Test/Mftf-24/Helper/HandlePopupSecondScreen.php index 1da144138..1956b1dd8 100644 --- a/Test/Mftf-24/Helper/HandlePopupSecondScreen.php +++ b/Test/Mftf-24/Helper/HandlePopupSecondScreen.php @@ -37,7 +37,9 @@ public function navigateToAddressAndPaymentOptions( $openerName, $continueButton, $editShippingButton, - $addressId + $addressId, + $checkoutButton, + $apButton ) { /** @var MagentoWebDriver $magentoWebDriver */ $magentoWebDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver'); @@ -49,7 +51,9 @@ public function navigateToAddressAndPaymentOptions( $openerName, $continueButton, $editShippingButton, - $addressId + $addressId, + $checkoutButton, + $apButton ) { try { if (count($remoteWebDriver->getWindowHandles()) > 1) { @@ -59,6 +63,27 @@ public function navigateToAddressAndPaymentOptions( } $continueAs = $remoteWebDriver->findElements(WebDriverBy::cssSelector($continueButton)); + $checkout = $remoteWebDriver->findElements(WebDriverBy::cssSelector($checkoutButton)); + + if (empty($continueAs) && empty($checkout)) { + $stepLog[] = 'Popup didn\'t finish loading, closing popup and re-initiating Amazon Pay'; + + // $url = $magentoWebDriver->_getCurrentUri(); + // $magentoWebDriver->amOnPage($url); + // $magentoWebDriver->wait(3); + + $stepLog[] = 'Closing tab'; + $magentoWebDriver->closeTab(); + $stepLog[] = 'Switching back to opener'; + $magentoWebDriver->switchToWindow($openerName); + $stepLog[] = 'Clicking Amazon button on checkout'; + $magentoWebDriver->click($apButton); + $stepLog[] = 'Waiting for popup to load and switching back to it'; + $magentoWebDriver->wait(3); + $magentoWebDriver->switchToNextTab(); + + $continueAs = $remoteWebDriver->findElements(WebDriverBy::cssSelector($continueButton)); + } if (!empty($continueAs)) { $stepLog[] = 'Click Continue as... button and return to checkout'; diff --git a/Test/Mftf-24/Helper/LoadAddresses.php b/Test/Mftf-24/Helper/LoadAddresses.php index 68089214f..1881277da 100644 --- a/Test/Mftf-24/Helper/LoadAddresses.php +++ b/Test/Mftf-24/Helper/LoadAddresses.php @@ -13,40 +13,43 @@ class LoadAddresses extends Helper public function loadAddresses( $changeAddressSelector, $addressBackButtonSelector, - $defaultAddressSelector, - $openerName, - $editShippingButton + $defaultAddressSelector ) { /** @var \Magento\FunctionalTestingFramework\Module\MagentoWebDriver $magentoWebDriver */ $magentoWebDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver'); $waitTime = 15; + $stepLog = []; try { + $stepLog[] = 'Waiting for Change Address button'; $magentoWebDriver->waitForElementClickable($changeAddressSelector, $waitTime); $magentoWebDriver->click($changeAddressSelector); + $stepLog[] = 'Clicked Change Address, waiting for Back button'; $magentoWebDriver->waitForElementClickable($addressBackButtonSelector, $waitTime); $magentoWebDriver->click($addressBackButtonSelector); + $stepLog[] = 'Looking for default address'; $magentoWebDriver->waitForElement($defaultAddressSelector, $waitTime); - } catch (TimeoutException $e) { - $magentoWebDriver->switchToNextTab(); + $stepLog[] = 'Found default address'; + // } catch (\Exception $e) { + // $magentoWebDriver->switchToNextTab(); - try { - $magentoWebDriver->executeInSelenium(function (RemoteWebDriver $remoteWebDriver) use ( - $magentoWebDriver, - $editShippingButton - ) { - $editAddressSelector = WebDriverBy::cssSelector($editShippingButton); - $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::elementToBeClickable($editAddressSelector)); - $magentoWebDriver->debug('Click Edit button to return to normal flow'); - $remoteWebDriver->findElement($editAddressSelector)->click(); + // try { + // $magentoWebDriver->executeInSelenium(function (RemoteWebDriver $remoteWebDriver) use ( + // $magentoWebDriver, + // $editShippingButton + // ) { + // $editAddressSelector = WebDriverBy::cssSelector($editShippingButton); + // $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::elementToBeClickable($editAddressSelector)); + // $magentoWebDriver->debug('Click Edit button to return to normal flow'); + // $remoteWebDriver->findElement($editAddressSelector)->click(); - $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::numberOfWindowsToBe(2)); - $magentoWebDriver->switchToNextTab(); - }); - } catch (\Exception $e) { + // $remoteWebDriver->wait(30, 100)->until(WebDriverExpectedCondition::numberOfWindowsToBe(2)); + // $magentoWebDriver->switchToNextTab(); + // }); + // } catch (\Exception $e) { - } + // } } catch (\Exception $e) { // Avoid out of memory error sometimes caused by print_r // print_r($e); diff --git a/Test/Mftf-24/Section/AmazonPageSection.xml b/Test/Mftf-24/Section/AmazonPageSection.xml index 3ad4aa94b..a166087f8 100644 --- a/Test/Mftf-24/Section/AmazonPageSection.xml +++ b/Test/Mftf-24/Section/AmazonPageSection.xml @@ -17,5 +17,8 @@ + + + diff --git a/Test/Mftf-24/Test/AmazonBillingAddressVisibilityTest.xml b/Test/Mftf-24/Test/AmazonBillingAddressVisibilityTest.xml index 12a8a1603..e5fd7e17c 100644 --- a/Test/Mftf-24/Test/AmazonBillingAddressVisibilityTest.xml +++ b/Test/Mftf-24/Test/AmazonBillingAddressVisibilityTest.xml @@ -37,7 +37,7 @@ - + diff --git a/Test/Mftf-24/Test/AmazonBillingFormVisibilityTest.xml b/Test/Mftf-24/Test/AmazonBillingFormVisibilityTest.xml index 12a8a1603..e5fd7e17c 100644 --- a/Test/Mftf-24/Test/AmazonBillingFormVisibilityTest.xml +++ b/Test/Mftf-24/Test/AmazonBillingFormVisibilityTest.xml @@ -37,7 +37,7 @@ - + diff --git a/Test/Mftf-24/Test/AmazonCheckoutAsyncDeclinedTest.xml b/Test/Mftf-24/Test/AmazonCheckoutAsyncDeclinedTest.xml index 5481fd6de..11cab5dbf 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutAsyncDeclinedTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutAsyncDeclinedTest.xml @@ -23,9 +23,7 @@ - - - + diff --git a/Test/Mftf-24/Test/AmazonCheckoutAsyncSuccessTest.xml b/Test/Mftf-24/Test/AmazonCheckoutAsyncSuccessTest.xml index 65913debc..8088e6933 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutAsyncSuccessTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutAsyncSuccessTest.xml @@ -23,9 +23,7 @@ - - - + diff --git a/Test/Mftf-24/Test/AmazonCheckoutBuyerCanceledTest.xml b/Test/Mftf-24/Test/AmazonCheckoutBuyerCanceledTest.xml index 8eea58e93..e23edbdbd 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutBuyerCanceledTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutBuyerCanceledTest.xml @@ -14,9 +14,7 @@ - - - + diff --git a/Test/Mftf-24/Test/AmazonCheckoutDeclinedTest.xml b/Test/Mftf-24/Test/AmazonCheckoutDeclinedTest.xml index 8b1efaedc..64f059f44 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutDeclinedTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutDeclinedTest.xml @@ -14,9 +14,7 @@ - - - + diff --git a/Test/Mftf-24/Test/AmazonCheckoutLoggedInNoGuestButtonTest.xml b/Test/Mftf-24/Test/AmazonCheckoutLoggedInNoGuestButtonTest.xml index 5bbe81ec4..ab4cda661 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutLoggedInNoGuestButtonTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutLoggedInNoGuestButtonTest.xml @@ -46,9 +46,7 @@ - - - + diff --git a/Test/Mftf-24/Test/AmazonCheckoutLoginTest.xml b/Test/Mftf-24/Test/AmazonCheckoutLoginTest.xml index b06741461..20eaf9e64 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutLoginTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutLoginTest.xml @@ -16,6 +16,8 @@ - + + + diff --git a/Test/Mftf-24/Test/AmazonCheckoutMulticurrencySuccessTest.xml b/Test/Mftf-24/Test/AmazonCheckoutMulticurrencySuccessTest.xml index cbbee576f..d8b296db0 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutMulticurrencySuccessTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutMulticurrencySuccessTest.xml @@ -28,9 +28,7 @@ - - - + diff --git a/Test/Mftf-24/Test/AmazonCheckoutOrderTwoItems.xml b/Test/Mftf-24/Test/AmazonCheckoutOrderTwoItems.xml index 3708e8a4a..06712ca8c 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutOrderTwoItems.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutOrderTwoItems.xml @@ -41,9 +41,7 @@ - - - + diff --git a/Test/Mftf-24/Test/AmazonCheckoutPayNowDeclinedTest.xml b/Test/Mftf-24/Test/AmazonCheckoutPayNowDeclinedTest.xml index f0d0e2d52..d26e1af77 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutPayNowDeclinedTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutPayNowDeclinedTest.xml @@ -28,7 +28,7 @@ - + diff --git a/Test/Mftf-24/Test/AmazonCheckoutPayNowMulticurrencySuccessTest.xml b/Test/Mftf-24/Test/AmazonCheckoutPayNowMulticurrencySuccessTest.xml index 601956581..447dc540e 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutPayNowMulticurrencySuccessTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutPayNowMulticurrencySuccessTest.xml @@ -41,7 +41,7 @@ - + diff --git a/Test/Mftf-24/Test/AmazonCheckoutPayNowSuccessTest.xml b/Test/Mftf-24/Test/AmazonCheckoutPayNowSuccessTest.xml index 5a3c337e0..43a42badc 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutPayNowSuccessTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutPayNowSuccessTest.xml @@ -28,7 +28,7 @@ - + diff --git a/Test/Mftf-24/Test/AmazonCheckoutSuccessTest.xml b/Test/Mftf-24/Test/AmazonCheckoutSuccessTest.xml index 6a745d87f..c86b3b241 100644 --- a/Test/Mftf-24/Test/AmazonCheckoutSuccessTest.xml +++ b/Test/Mftf-24/Test/AmazonCheckoutSuccessTest.xml @@ -12,9 +12,7 @@ - - - + diff --git a/Test/Mftf-24/Test/AmazonInvoiceMultipleCapture.xml b/Test/Mftf-24/Test/AmazonInvoiceMultipleCapture.xml index 6b8582400..2de7e6735 100644 --- a/Test/Mftf-24/Test/AmazonInvoiceMultipleCapture.xml +++ b/Test/Mftf-24/Test/AmazonInvoiceMultipleCapture.xml @@ -27,9 +27,7 @@ - - - + diff --git a/Test/Mftf-24/Test/AmazonInvoicePendingCapturedTest.xml b/Test/Mftf-24/Test/AmazonInvoicePendingCapturedTest.xml index 4b9dae11c..35b7070dd 100644 --- a/Test/Mftf-24/Test/AmazonInvoicePendingCapturedTest.xml +++ b/Test/Mftf-24/Test/AmazonInvoicePendingCapturedTest.xml @@ -12,9 +12,7 @@ - - - + diff --git a/Test/Mftf-24/Test/AmazonInvoicePendingDeclinedTest.xml b/Test/Mftf-24/Test/AmazonInvoicePendingDeclinedTest.xml index 4c3594b6e..29dd08d1f 100644 --- a/Test/Mftf-24/Test/AmazonInvoicePendingDeclinedTest.xml +++ b/Test/Mftf-24/Test/AmazonInvoicePendingDeclinedTest.xml @@ -12,9 +12,7 @@ - - - + diff --git a/Test/Mftf-24/Test/AmazonInvoiceTest.xml b/Test/Mftf-24/Test/AmazonInvoiceTest.xml index 09398f369..bad82fcd7 100644 --- a/Test/Mftf-24/Test/AmazonInvoiceTest.xml +++ b/Test/Mftf-24/Test/AmazonInvoiceTest.xml @@ -12,9 +12,7 @@ - - - + diff --git a/Test/Mftf-24/Test/AmazonMiniCartLoginTest.xml b/Test/Mftf-24/Test/AmazonMiniCartLoginTest.xml index 74f970301..56814ecca 100644 --- a/Test/Mftf-24/Test/AmazonMiniCartLoginTest.xml +++ b/Test/Mftf-24/Test/AmazonMiniCartLoginTest.xml @@ -16,6 +16,8 @@ - + + + diff --git a/Test/Mftf-24/Test/AmazonPaymentLoginTest.xml b/Test/Mftf-24/Test/AmazonPaymentLoginTest.xml index 87ce7a46a..18b9efc1b 100644 --- a/Test/Mftf-24/Test/AmazonPaymentLoginTest.xml +++ b/Test/Mftf-24/Test/AmazonPaymentLoginTest.xml @@ -17,6 +17,6 @@ - + diff --git a/Test/Mftf-24/Test/AmazonProductLoginTest.xml b/Test/Mftf-24/Test/AmazonProductLoginTest.xml index cd4f98acc..5cf24d75b 100644 --- a/Test/Mftf-24/Test/AmazonProductLoginTest.xml +++ b/Test/Mftf-24/Test/AmazonProductLoginTest.xml @@ -16,6 +16,8 @@ - + + + diff --git a/Test/Mftf-24/Test/AmazonRefund.xml b/Test/Mftf-24/Test/AmazonRefund.xml index 18a6cbf55..db581b56a 100644 --- a/Test/Mftf-24/Test/AmazonRefund.xml +++ b/Test/Mftf-24/Test/AmazonRefund.xml @@ -12,9 +12,7 @@ - - - + diff --git a/Test/Mftf-24/Test/AmazonSigninCheckoutSuccessTest.xml b/Test/Mftf-24/Test/AmazonSigninCheckoutSuccessTest.xml index f69a5fa5e..d14a1672c 100644 --- a/Test/Mftf-24/Test/AmazonSigninCheckoutSuccessTest.xml +++ b/Test/Mftf-24/Test/AmazonSigninCheckoutSuccessTest.xml @@ -24,9 +24,7 @@ - - - + From db5c3bd6d1b6ffa5072cd7f2f3c6a35d0da0895d Mon Sep 17 00:00:00 2001 From: Spencer Gabhart Date: Thu, 27 Oct 2022 16:21:44 -0400 Subject: [PATCH 03/13] ASD-974 - Remove invalid test action for MFTF/Magento 2.4.3 --- Test/Mftf-24/ActionGroup/AmazonGoToPaymentMethodActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/Mftf-24/ActionGroup/AmazonGoToPaymentMethodActionGroup.xml b/Test/Mftf-24/ActionGroup/AmazonGoToPaymentMethodActionGroup.xml index 00bfe0cc2..c3e4f7580 100644 --- a/Test/Mftf-24/ActionGroup/AmazonGoToPaymentMethodActionGroup.xml +++ b/Test/Mftf-24/ActionGroup/AmazonGoToPaymentMethodActionGroup.xml @@ -2,7 +2,7 @@ - + From dfbe7a446547af70ac4fe4f845e34af647a48492 Mon Sep 17 00:00:00 2001 From: Spencer Gabhart Date: Wed, 15 Mar 2023 09:41:51 -0400 Subject: [PATCH 04/13] ASD-1048 - Remove references to Zend classes removed in Magento 2.4.6, update requirements for PHP 8.2 --- Block/Config.php | 8 ++++++++ Helper/Customer.php | 4 ++-- composer.json | 2 +- view/frontend/templates/config.phtml | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Block/Config.php b/Block/Config.php index 534393e68..f031ae50d 100755 --- a/Block/Config.php +++ b/Block/Config.php @@ -69,6 +69,14 @@ public function getConfig() return $config; } + /** + * @return string + */ + public function getJsonConfig() + { + return json_encode($this->getConfig()); + } + /** * @return bool */ diff --git a/Helper/Customer.php b/Helper/Customer.php index f567dc928..a42ebe31d 100644 --- a/Helper/Customer.php +++ b/Helper/Customer.php @@ -18,7 +18,7 @@ namespace Amazon\Pay\Helper; use Amazon\Pay\Api\Data\AmazonCustomerInterface; -use Zend_Validate; +use Magento\Framework\Validator\ValidatorChain; class Customer { @@ -79,7 +79,7 @@ public function getAmazonCustomer($buyerInfo) public function createCustomer(AmazonCustomerInterface $amazonCustomer) { - if (! Zend_Validate::is($amazonCustomer->getEmail(), 'EmailAddress')) { + if (! ValidatorChain::is($amazonCustomer->getEmail(), '\Magento\Framework\Validator\EmailAddress')) { throw new ValidatorException(__('the email address for your Amazon account is invalid')); } diff --git a/composer.json b/composer.json index 547bfc7e7..7e299e32a 100755 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "guzzlehttp/guzzle": "^6.2.0" }, "require": { - "php": "~7.0.13||~7.1.0||~7.2.0||~7.3.0||~7.4.0||~8.0.0||~8.1.0", + "php": "~7.0.13||~7.1.0||~7.2.0||~7.3.0||~7.4.0||~8.0.0||~8.1.0||~8.2.0", "magento/framework": "^102.0||^103.0", "magento/module-sales": "^100.0||^101.0||^102.0||^103.0", "magento/module-checkout": "^100.0", diff --git a/view/frontend/templates/config.phtml b/view/frontend/templates/config.phtml index 60dcaba3e..28fb09239 100755 --- a/view/frontend/templates/config.phtml +++ b/view/frontend/templates/config.phtml @@ -23,7 +23,7 @@