Skip to content

Commit c99291d

Browse files
committed
MAGETWO-99171: Random Failure of MFTF test
1 parent c7a1431 commit c99291d

File tree

6 files changed

+127
-1
lines changed

6 files changed

+127
-1
lines changed

app/code/Magento/Braintree/Test/Mftf/Section/StorefrontMiniCartSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="StorefrontMiniCartSection">
12-
<element name="payWithPayPal" type="button" selector=".braintree-paypal-button-hidden" timeout="30"/>
12+
<element name="payWithPayPal" type="button" selector="[id^='braintree-paypal-mini-cart']" timeout="30"/>
1313
<element name="proceedWithSandboxPurchase" type="text" selector="#return_url"/>
1414
</section>
1515
</sections>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontResolveWindowsCount">
12+
<executeJS function="return 0;" stepKey="windowsCount"/>
13+
<executeInSelenium function="function ($webdriver) use (&amp;$windowsCount) {
14+
$windowsCount = count($webdriver->getWindowHandles());
15+
}" stepKey="calculateWindowsCount"/>
16+
</actionGroup>
17+
<actionGroup name="StorefrontWaitForPaypalWindowAppearsAndSwitchTo">
18+
<arguments>
19+
<argument name="windowsCount" type="string"/>
20+
</arguments>
21+
<executeInSelenium function="function ($webdriver) use ({{windowsCount}}, $I) {
22+
$webdriver->wait()->until(\Facebook\WebDriver\WebDriverExpectedCondition::numberOfWindowsToBe({{windowsCount}} + 1));
23+
$handles = $webdriver->getWindowHandles();
24+
$lastWindow = end($handles);
25+
$I->switchToWindow($lastWindow);
26+
}" stepKey="switchToPaypalSandboxTab"/>
27+
</actionGroup>
28+
<actionGroup name="StorefrontWaitForPaypalWindowCloseAndSwitchToMain">
29+
<arguments>
30+
<argument name="windowsCount" type="string"/>
31+
</arguments>
32+
<executeInSelenium function="function ($webdriver) use ({{windowsCount}}, $I) {
33+
$webdriver->wait()->until(\Facebook\WebDriver\WebDriverExpectedCondition::numberOfWindowsToBe({{windowsCount}}));
34+
$handles = $webdriver->getWindowHandles();
35+
$lastWindow = end($handles);
36+
$I->switchToWindow($lastWindow);
37+
}" stepKey="switchBackToMainWindow"/>
38+
</actionGroup>
39+
<!-- PayPal account login -->
40+
<actionGroup name="StorefrontPaypalLoginWithBuyerAccount">
41+
<arguments>
42+
<argument name="buyerAccount" defaultValue="DefaultPaypalBuyerAccount"/>
43+
</arguments>
44+
<waitForElementVisible selector="{{PayPalPopupLoginSection.email}}" stepKey="waitForEmailFieldVisible"/>
45+
<fillField userInput="{{buyerAccount.email}}" selector="{{PayPalPopupLoginSection.email}}" stepKey="fillBuyerEmail"/>
46+
<conditionalClick selector="{{PayPalPopupLoginSection.nextButton}}" dependentSelector="{{PayPalPopupLoginSection.password}}" visible="false" stepKey="proceedToPassword"/>
47+
<waitForElementNotVisible time="30" selector="{{PayPalPopupLoginSection.busySpinner}}" stepKey="waitForBusySpinner"/>
48+
<waitForElementNotVisible time="30" selector="{{PayPalPopupLoginSection.preloadSpinner}}" stepKey="waitForPreloadSpinner"/>
49+
<waitForElementVisible selector="{{PayPalPopupLoginSection.password}}" stepKey="waitForPasswordFieldVisible"/>
50+
<fillField userInput="{{buyerAccount.password}}" selector="{{PayPalPopupLoginSection.password}}" stepKey="fillBuyerPassword"/>
51+
<click selector="{{PayPalPopupLoginSection.loginButton}}" stepKey="clickLogin"/>
52+
<waitForElementNotVisible time="30" selector="{{PayPalPopupLoginSection.busySpinner}}" stepKey="waitForBusySpinnerAfterLogin"/>
53+
<waitForElementNotVisible time="30" selector="{{PayPalPopupLoginSection.preloadSpinner}}" stepKey="waitForPreloadSpinnerAfterLogin"/>
54+
</actionGroup>
55+
<!-- Assumes we are logged in to PayPal account -->
56+
<!-- PayPal account submit review -->
57+
<actionGroup name="StorefrontPaypalWindowSubmitReview">
58+
<waitForElementVisible time="30" selector="{{PayPalPopupReviewSection.continueButton}}" stepKey="waitForContinuaButtonVisible"/>
59+
<click selector="{{PayPalPopupReviewSection.continueButton}}" stepKey="clickContinueButton"/>
60+
<waitForElementNotVisible time="30" selector="{{PayPalPopupLoginSection.busySpinner}}" stepKey="waitForBusySpinner"/>
61+
<waitForElementNotVisible time="30" selector="{{PayPalPopupLoginSection.preloadSpinner}}" stepKey="waitForPreloadSpinner"/>
62+
</actionGroup>
63+
</actionGroups>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<!-- Should be resolved from {{_CREDS}} after MQE-1576 will be delivered -->
12+
<entity name="DefaultPaypalBuyerAccount" type="data">
13+
<data key="email">{{_CREDS.paypal_buyer_account_email}}</data>
14+
<data key="password">{{_CREDS.paypal_buyer_account_password}}</data>
15+
</entity>
16+
</entities>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
9+
<page name="AdminConfigPaymentMethodsPage" url="https://www.sandbox.paypal.com/checkoutnow" area="external" module="Magento_Paypal">
10+
<section name="PayPalPopupLoginSection"/>
11+
<section name="PayPalPopupReviewSection"/>
12+
</page>
13+
</pages>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="PayPalPopupLoginSection">
12+
<element name="email" type="input" selector="[role='main'] [name='login_email']"/>
13+
<element name="password" type="input" selector="[role='main'] [name='login_password']"/>
14+
<element name="nextButton" type="button" selector="[role='main'] button[value='Next']"/>
15+
<element name="loginButton" type="button" selector="[role='main'] button[value='Login']"/>
16+
<element name="busySpinner" type="block" selector="[aria-busy='true']"/>
17+
<element name="preloadSpinner" type="block" selector="#preloaderSpinner"/>
18+
</section>
19+
</sections>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="PayPalPopupReviewSection">
12+
<element name="continueButton" type="button" selector="[role='main'] [value='Continue']"/>
13+
<element name="payNowButton" type="button" selector="[role='main'] [value='Pay Now']"/>
14+
</section>
15+
</sections>

0 commit comments

Comments
 (0)