Skip to content

Commit 21d79d3

Browse files
committed
MAGETWO-63215: FedEx Shipment Tracking fails for valid tracking number
- Refactored functional tests
1 parent 73ce327 commit 21d79d3

File tree

10 files changed

+173
-87
lines changed

10 files changed

+173
-87
lines changed

dev/tests/functional/tests/app/Magento/Fedex/Test/TestCase/TrackingShipmentForPlacedOrderTest.php

Lines changed: 0 additions & 31 deletions
This file was deleted.

dev/tests/functional/tests/app/Magento/Fedex/Test/TestCase/TrackingShipmentForPlacedOrderTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
9-
<testCase name="Magento\Fedex\Test\TestCase\TrackingShipmentForPlacedOrderTest" summary="Create shipment for order with FedEx shipping method.">
10-
<variation name="TrackingShipmentForPlacedOrderTestVariation1" summary="Creating shipment for order placed within FedEx." ticketId="MAGETWO-58158">
9+
<testCase name="Magento\Shipping\Test\TestCase\TrackingShipmentForPlacedOrderTest" summary="Create shipment for order with FedEx shipping method.">
10+
<variation name="TrackingFedExShipmentForPlacedOrderTestVariation1" summary="Creating shipment for order placed within FedEx." ticketId="MAGETWO-58158">
1111
<data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data>
1212
<data name="customer/dataset" xsi:type="string">default</data>
1313
<data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data>

dev/tests/functional/tests/app/Magento/Fedex/Test/etc/testcase.xml

Lines changed: 0 additions & 23 deletions
This file was deleted.

dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\Sales\Test\Block\Adminhtml\Order\View\Tab;
88

99
use Magento\Backend\Test\Block\Widget\Tab;
10+
use Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info\ShippingInfoBlock;
1011
use Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info\CommentsHistoryBlock;
1112
use Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info\PaymentInfoBlock;
1213

@@ -29,6 +30,13 @@ class Info extends Tab
2930
*/
3031
private $paymentInfoBlockSelector = '.order-payment-method';
3132

33+
/**
34+
* Selector for `Shipping Information` block.
35+
*
36+
* @var string
37+
*/
38+
private $shippingInfoBlock = '.order-shipping-method';
39+
3240
/**
3341
* Selector for Comments history block.
3442
*
@@ -59,6 +67,19 @@ public function getPaymentInfoBlock()
5967
);
6068
}
6169

70+
/**
71+
* Gets Order Shipping Information block.
72+
*
73+
* @return ShippingInfoBlock
74+
*/
75+
public function getShippingInfoBlock()
76+
{
77+
return $this->blockFactory->create(
78+
ShippingInfoBlock::class,
79+
['element' => $this->_rootElement->find($this->shippingInfoBlock)]
80+
);
81+
}
82+
6283
/**
6384
* Returns Comments history block.
6485
*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info;
7+
8+
use Magento\Mtf\Block\Block;
9+
10+
/**
11+
* Representation of Order Shipping Information.
12+
*/
13+
class ShippingInfoBlock extends Block
14+
{
15+
/**
16+
* Selector for a shipment tracking popup.
17+
*
18+
* @var string
19+
*/
20+
private $trackingPopupLink = '#linkId';
21+
22+
/**
23+
* Opens the shipment tracking popup.
24+
*
25+
* @return void
26+
*/
27+
public function openTrackingPopup()
28+
{
29+
$popup = $this->_rootElement->find($this->trackingPopupLink);
30+
$popup->click();
31+
}
32+
}

dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Order/TrackingInfoTable.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ class TrackingInfoTable extends Block
2828
*/
2929
private $addButton = '[data-ui-id="shipment-tracking-save-button"]';
3030

31-
/**
32-
* Selector for tracking number popup link.
33-
*
34-
* @var string
35-
*/
36-
private $popup = './/tbody/tr[not(contains(@class,"no-display"))]/td/a[contains(normalize-space(.), "%s")]';
37-
3831
/**
3932
* Creates tracking number.
4033
*
@@ -48,17 +41,6 @@ public function addTrackingNumber(array $data)
4841
$this->_rootElement->find($this->addButton)->click();
4942
}
5043

51-
/**
52-
* Opens a popup with tracking number details.
53-
*
54-
* @param string $trackingNumber
55-
*/
56-
public function openPopup($trackingNumber)
57-
{
58-
$popupLink = $this->_rootElement->find(sprintf($this->popup, $trackingNumber), Locator::SELECTOR_XPATH);
59-
$popupLink->click();
60-
}
61-
6244
/**
6345
* Creates block for tracking number item.
6446
*

dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertTrackingDetailsIsPresent.php

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77

88
use Magento\Mtf\Client\BrowserInterface;
99
use Magento\Mtf\Constraint\AbstractConstraint;
10-
use Magento\Shipping\Test\Page\Adminhtml\SalesShipmentView;
11-
use Magento\Shipping\Test\Page\Adminhtml\ShipmentIndex;
10+
use Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info;
11+
use Magento\Sales\Test\Fixture\OrderInjectable;
12+
use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
13+
use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
1214

1315
/**
1416
* Class contains asserts for tracking number popup window.
@@ -26,25 +28,31 @@ class AssertTrackingDetailsIsPresent extends AbstractConstraint
2628
* Processes the assertions for tracking number data in the popup window.
2729
*
2830
* @param BrowserInterface $browser
29-
* @param ShipmentIndex $shipmentIndex
30-
* @param SalesShipmentView $salesShipmentView
31-
* @param $shipmentIds
31+
* @param OrderInjectable $order
32+
* @param OrderIndex $orderIndex
33+
* @param SalesOrderView $salesOrderView
3234
* @param $resultTrackingData
3335
*/
3436
public function processAssert(
3537
BrowserInterface $browser,
36-
ShipmentIndex $shipmentIndex,
37-
SalesShipmentView $salesShipmentView,
38-
$shipmentIds,
38+
OrderInjectable $order,
39+
OrderIndex $orderIndex,
40+
SalesOrderView $salesOrderView,
3941
$resultTrackingData
4042
) {
41-
$shipmentIndex->open();
42-
$shipmentIndex->getShipmentsGrid()
43-
->searchAndOpen(['id' => array_pop($shipmentIds)]);
43+
$orderIndex->open();
44+
$orderIndex->getSalesOrderGrid()
45+
->searchAndOpen(['id' => $order->getId()]);
46+
47+
/** @var Info $infoTab */
48+
$infoTab = $salesOrderView->getOrderForm()
49+
->openTab('info')
50+
->getTab('info');
4451

4552
$mainWindow = $browser->getCurrentWindow();
46-
$trackingInfoTable = $salesShipmentView->getTrackingInfoBlock();
47-
$trackingInfoTable->openPopup($resultTrackingData['number']);
53+
$shippingInfoBlock = $infoTab->getShippingInfoBlock();
54+
$shippingInfoBlock->openTrackingPopup();
55+
4856
$browser->selectWindow();
4957

5058
$selector = '.close';
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Shipping\Test\TestCase;
7+
8+
use Magento\Mtf\TestCase\Scenario;
9+
10+
/**
11+
* Preconditions:
12+
* 1. Enable payment method "Check/Money Order".
13+
*
14+
* Steps:
15+
* 1. Go to Storefront.
16+
* 2. Add products to the shopping cart.
17+
* 3. Fill shipping information on Checkout step.
18+
* 4. Select shipping method.
19+
* 5. Place order.
20+
* 6. Go to Sales > Orders.
21+
* 7. Select created order in the grid and open it.
22+
* 8. Click 'Ship' button.
23+
* 9. Fill data according to dataset.
24+
* 10. Click 'Submit Shipment' button.
25+
* 11. Select created shipment in the grid and open it.
26+
* 12. Add tracking number according to dataset.
27+
* 13. Select created order in the grid and open it.
28+
* 14. Click on 'Track Order' link.
29+
* 15. Perform all asserts.
30+
*
31+
* @group Shipping
32+
* @ZephyrId MAGETWO-58158
33+
*/
34+
class TrackingShipmentForPlacedOrderTest extends Scenario
35+
{
36+
/* tags */
37+
const MVP = 'yes';
38+
const TEST_TYPE = '3rd_party_test';
39+
const SEVERITY = 'S1';
40+
/* end tags */
41+
42+
/**
43+
* Runs one page checkout test.
44+
*
45+
* @return void
46+
*/
47+
public function test()
48+
{
49+
$this->executeScenario();
50+
}
51+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
9+
<testCase name="Magento\Shipping\Test\TestCase\TrackingShipmentForPlacedOrderTest" summary="Create shipment for order.">
10+
<variation name="TrackingShipmentForPlacedOrderTestVariation1" summary="Creating shipment for order placed." ticketId="MAGETWO-58158">
11+
<data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data>
12+
<data name="customer/dataset" xsi:type="string">default</data>
13+
<data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data>
14+
<data name="checkoutMethod" xsi:type="string">login</data>
15+
<data name="shipping/shipping_service" xsi:type="string">Fixed</data>
16+
<data name="shipping/shipping_method" xsi:type="string">Flat Rate</data>
17+
<data name="cart/data/shipping_method" xsi:type="string">Flat Rate</data>
18+
<data name="payment/method" xsi:type="string">checkmo</data>
19+
<data name="configData" xsi:type="string">checkmo, fedex, shipping_origin_US_CA</data>
20+
<data name="trackingData" xsi:type="array">
21+
<item name="carrier" xsi:type="string">Custom Value</item>
22+
<item name="carrier_title" xsi:type="string">Custom Number</item>
23+
<item name="tracking_number" xsi:type="string">0123456789</item>
24+
</data>
25+
<data name="resultTrackingData" xsi:type="array">
26+
<item name="number" xsi:type="string">0123456789</item>
27+
</data>
28+
<data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data>
29+
<constraint name="Magento\Shipping\Test\Constraint\AssertTrackingDetailsIsPresent" />
30+
</variation>
31+
</testCase>
32+
</config>

dev/tests/functional/tests/app/Magento/Shipping/Test/etc/testcase.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,18 @@
1515
<step name="selectCheckoutMethod" module="Magento_Checkout" next="fillShippingAddresses" />
1616
<step name="fillShippingAddresses" module="Magento_Shipping" />
1717
</scenario>
18+
<scenario name="TrackingShipmentForPlacedOrderTest" firstStep="setupConfiguration">
19+
<step name="setupConfiguration" module="Magento_Config" next="createProducts" />
20+
<step name="createProducts" module="Magento_Catalog" next="addProductsToTheCart" />
21+
<step name="addProductsToTheCart" module="Magento_Checkout" next="proceedToCheckout" />
22+
<step name="proceedToCheckout" module="Magento_Checkout" next="createCustomer" />
23+
<step name="createCustomer" module="Magento_Customer" next="selectCheckoutMethod" />
24+
<step name="selectCheckoutMethod" module="Magento_Checkout" next="fillShippingAddress" />
25+
<step name="fillShippingAddress" module="Magento_Checkout" next="fillShippingMethod" />
26+
<step name="fillShippingMethod" module="Magento_Checkout" next="selectPaymentMethod" />
27+
<step name="selectPaymentMethod" module="Magento_Checkout" next="placeOrder" />
28+
<step name="placeOrder" module="Magento_Checkout" next="createShipment"/>
29+
<step name="createShipment" module="Magento_Sales" next="addTrackingNumber"/>
30+
<step name="addTrackingNumber" module="Magento_Shipping" />
31+
</scenario>
1832
</config>

0 commit comments

Comments
 (0)