Skip to content

Commit 0e63af2

Browse files
committed
B2B-2094: [AWS S3] Failed to load gift card order print page
1 parent 3017d87 commit 0e63af2

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest/CheckCheckoutSuccessPageAsRegisterCustomerTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137

138138
<!-- See print page -->
139139
<click selector="{{CheckoutSuccessMainSection.printLink}}" stepKey="clickPrintLink"/>
140-
<helper class="Magento\Ui\Test\Mftf\Helper\UiHelper" method="switchToWindowWithUrlAndClosePrintDialogIfEncountered" stepKey="switchToWindowWithUrlAndClosePrintDialogIfEncountered">
140+
<helper class="Magento\Sales\Test\Mftf\Helper\SalesHelper" method="switchToWindowWithUrlAndClosePrintDialogIfEncountered" stepKey="switchToWindowWithUrlAndClosePrintDialogIfEncountered">
141141
<argument name="expectedUrl">sales/order/print/order_id/</argument>
142142
<argument name="expectedUrlComparisonType">COMPARISON_PATH_SUBSET_MATCH</argument>
143143
</helper>

app/code/Magento/Ui/Test/Mftf/Helper/UiHelper.php renamed to app/code/Magento/Sales/Test/Mftf/Helper/SalesHelper.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
*/
66
declare(strict_types=1);
77

8-
namespace Magento\Ui\Test\Mftf\Helper;
8+
namespace Magento\Sales\Test\Mftf\Helper;
99

1010
use Facebook\WebDriver\Remote\RemoteWebDriver;
1111
use Magento\FunctionalTestingFramework\Helper\Helper;
1212
use Facebook\WebDriver\Exception\NoSuchWindowException;
1313

1414
/**
15-
* Class for MFTF helpers for Ui module.
15+
* Class for MFTF helpers for Sales module.
1616
*/
17-
class UiHelper extends Helper
17+
class SalesHelper extends Helper
1818
{
1919
private const COMPARISON_PATH_EXACT_MATCH = 'COMPARISON_PATH_EXACT_MATCH';
2020
private const COMPARISON_PATH_SUBSET_MATCH = 'COMPARISON_PATH_SUBSET_MATCH';
@@ -24,6 +24,14 @@ class UiHelper extends Helper
2424
self::COMPARISON_PATH_SUBSET_MATCH
2525
];
2626

27+
/**
28+
* Iterate through all available window handles and attach webdriver to window matching $expectedUrl.
29+
* If print dialog is found, close it to prevent selenium from hanging and becoming unresponsive.
30+
*
31+
* @param string $expectedUrl
32+
* @param string $expectedUrlComparisonType
33+
* @throws \Codeception\Exception\ModuleException
34+
*/
2735
public function switchToWindowWithUrlAndClosePrintDialogIfEncountered(
2836
string $expectedUrl,
2937
string $expectedUrlComparisonType

app/code/Magento/Sales/Test/Mftf/Test/StorefrontPrintOrderGuestTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@
267267

268268
<!-- Click on the "Print Order" button -->
269269
<click selector="{{StorefrontGuestOrderViewSection.printOrder}}" stepKey="printOrder"/>
270-
<helper class="Magento\Ui\Test\Mftf\Helper\UiHelper" method="switchToWindowWithUrlAndClosePrintDialogIfEncountered" stepKey="switchToWindowWithUrlAndClosePrintDialogIfEncountered">
270+
<helper class="Magento\Sales\Test\Mftf\Helper\SalesHelper" method="switchToWindowWithUrlAndClosePrintDialogIfEncountered" stepKey="switchToWindowWithUrlAndClosePrintDialogIfEncountered">
271271
<argument name="expectedUrl">sales/guest/print/order_id/</argument>
272272
<argument name="expectedUrlComparisonType">COMPARISON_PATH_SUBSET_MATCH</argument>
273273
</helper>

app/code/Magento/Sales/Test/Mftf/Test/StorefrontRedirectToOrderHistoryTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<grabFromCurrentUrl regex="~/order_id/(\d+)/~" stepKey="grabOrderIdFromURL"/>
4949
<comment userInput="BIC workaround" stepKey="waitForPrintWindowToOpen"/>
5050

51-
<helper class="Magento\Ui\Test\Mftf\Helper\UiHelper" method="switchToWindowWithUrlAndClosePrintDialogIfEncountered" stepKey="switchToWindowWithUrlAndClosePrintDialogIfEncountered">
51+
<helper class="Magento\Sales\Test\Mftf\Helper\SalesHelper" method="switchToWindowWithUrlAndClosePrintDialogIfEncountered" stepKey="switchToWindowWithUrlAndClosePrintDialogIfEncountered">
5252
<argument name="expectedUrl">sales/order/print/order_id/{$grabOrderIdFromURL}</argument>
5353
<argument name="expectedUrlComparisonType">COMPARISON_PATH_SUBSET_MATCH</argument>
5454
</helper>
@@ -85,7 +85,7 @@
8585
</actionGroup>
8686

8787
<comment userInput="Step key preserved for backwards compatibility" stepKey="waitForPrintWindowToOpen2" />
88-
<helper class="Magento\Ui\Test\Mftf\Helper\UiHelper" method="switchToWindowWithUrlAndClosePrintDialogIfEncountered" stepKey="switchToWindowWithUrlAndClosePrintDialogIfEncountered2">
88+
<helper class="Magento\Sales\Test\Mftf\Helper\SalesHelper" method="switchToWindowWithUrlAndClosePrintDialogIfEncountered" stepKey="switchToWindowWithUrlAndClosePrintDialogIfEncountered2">
8989
<argument name="expectedUrl">sales/order/print/order_id/</argument>
9090
<argument name="expectedUrlComparisonType">COMPARISON_PATH_SUBSET_MATCH</argument>
9191
</helper>

0 commit comments

Comments
 (0)