-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAGETWO-60958: [Backport] Incorrect province code sent on Checkout to…
… UPS #6564 - for 2.1 - MAGETWO-70727: [GitHub] Shipping method randomly dissapear when page refreshed for 2.1 #7497
- Loading branch information
Showing
10 changed files
with
315 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
...Magento/Checkout/Test/Constraint/AssertShippingMethodsSuccessEstimateAfterAddressEdit.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?php | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Checkout\Test\Constraint; | ||
|
||
use Magento\Checkout\Test\Page\CheckoutOnepage; | ||
use Magento\Checkout\Test\TestStep\FillShippingAddressStep; | ||
use Magento\Mtf\Client\BrowserInterface; | ||
use Magento\Mtf\Constraint\AbstractConstraint; | ||
use Magento\Mtf\Fixture\FixtureFactory; | ||
use Magento\Mtf\TestStep\TestStepFactory; | ||
|
||
/** | ||
* Asserts that shipping methods are present on checkout page after address modification. | ||
*/ | ||
class AssertShippingMethodsSuccessEstimateAfterAddressEdit extends AbstractConstraint | ||
{ | ||
/** | ||
* Asserts that shipping methods are present on checkout page after address modification. | ||
* | ||
* @param CheckoutOnepage $checkoutOnepage | ||
* @param TestStepFactory $testStepFactory | ||
* @param FixtureFactory $fixtureFactory | ||
* @param BrowserInterface $browser | ||
* @param array $editAddressData | ||
* @return void | ||
*/ | ||
public function processAssert( | ||
CheckoutOnepage $checkoutOnepage, | ||
TestStepFactory $testStepFactory, | ||
FixtureFactory $fixtureFactory, | ||
BrowserInterface $browser, | ||
array $editAddressData = [] | ||
) { | ||
if ($this->shouldOpenCheckout($checkoutOnepage, $browser)) { | ||
$checkoutOnepage->open(); | ||
} | ||
|
||
if (!empty ($editAddressData)) { | ||
|
||
$address = $fixtureFactory->createByCode('address', ['data' => $editAddressData]); | ||
$testStepFactory->create( | ||
FillShippingAddressStep::class, | ||
[ | ||
'checkoutOnepage' => $checkoutOnepage, | ||
'shippingAddress' => $address | ||
] | ||
)->run(); | ||
|
||
\PHPUnit_Framework_Assert::assertFalse( | ||
$checkoutOnepage->getShippingMethodBlock()->isErrorPresent(), | ||
'Shipping estimation error is present.' | ||
); | ||
|
||
$methods = $checkoutOnepage->getShippingMethodBlock()->getAvailableMethods(); | ||
\PHPUnit_Framework_Assert::assertNotEmpty( | ||
$methods, | ||
'No shipping methods are present.' | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* Should open checkout page or not. | ||
* | ||
* @param CheckoutOnepage $checkoutOnepage | ||
* @param BrowserInterface $browser | ||
* @return bool | ||
*/ | ||
private function shouldOpenCheckout(CheckoutOnepage $checkoutOnepage, BrowserInterface $browser) | ||
{ | ||
$result = true; | ||
|
||
foreach (['checkout/', $checkoutOnepage::MCA] as $path) { | ||
$length = strlen($path); | ||
if (substr($browser->getUrl(), -$length) === $path) { | ||
$result = false; | ||
break; | ||
} | ||
} | ||
|
||
return $result; | ||
} | ||
|
||
/** | ||
* Returns a string representation of the object. | ||
* | ||
* @return string | ||
*/ | ||
public function toString() | ||
{ | ||
return "Shipping methods are present on checkout page after address modification."; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
...unctional/tests/app/Magento/Checkout/Test/TestCase/OnePageEstimateShippingMethodsTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Checkout\Test\TestCase; | ||
|
||
use Magento\Mtf\TestCase\Scenario; | ||
|
||
/** | ||
* Preconditions: | ||
* 1. Configure shipping method according dataset. | ||
* 2. Create product(-s) | ||
* | ||
* Steps: | ||
* 1. Go to Frontend. | ||
* 2. Add product(-s) to the cart. | ||
* 3. Proceed to Checkout. | ||
* 4. Fill shipping address according to dataset. | ||
* 5. Wait until shipping methods will appear. | ||
* 6. Perform assertions. | ||
* | ||
* @group One_Page_Checkout_(CS) | ||
* @ZephyrId MAGETWO-71002 | ||
*/ | ||
class OnePageEstimateShippingMethodsTest extends Scenario | ||
{ | ||
/** | ||
* Runs test. | ||
* | ||
* @return void | ||
*/ | ||
public function test() | ||
{ | ||
$this->executeScenario(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/ResolveShippingMethodsStep.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Checkout\Test\TestStep; | ||
|
||
use Magento\Checkout\Test\Page\CheckoutOnepage; | ||
use Magento\Mtf\TestStep\TestStepInterface; | ||
|
||
/** | ||
* Resolve shipping methods from checkout page. | ||
*/ | ||
class ResolveShippingMethodsStep implements TestStepInterface | ||
{ | ||
/** | ||
* Checkout view page. | ||
* | ||
* @var CheckoutOnepage | ||
*/ | ||
private $checkoutOnepage; | ||
|
||
/** | ||
* Open checkout page or not. | ||
* | ||
* @var bool | ||
*/ | ||
private $openPage = false; | ||
|
||
/** | ||
* @param CheckoutOnepage $checkoutOnepage | ||
* @param bool $openPage | ||
*/ | ||
public function __construct(CheckoutOnepage $checkoutOnepage, $openPage = false) | ||
{ | ||
$this->checkoutOnepage = $checkoutOnepage; | ||
$this->openPage = $openPage; | ||
} | ||
|
||
/** | ||
* Run step flow. | ||
* | ||
* @return array | ||
*/ | ||
public function run() | ||
{ | ||
if ($this->openPage) { | ||
$this->checkoutOnepage->open(); | ||
} | ||
|
||
$methods = $this->checkoutOnepage->getShippingMethodBlock()->getAvailableMethods(); | ||
return ['shippingMethods' => $methods]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...sts/functional/tests/app/Magento/Ups/Test/TestCase/OnePageEstimateShippingMethodsTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> | ||
<testCase name="Magento\Checkout\Test\TestCase\OnePageEstimateShippingMethodsTest" summary="Estimate shipping methods at checkout" ticketId="MAGETWO-71002"> | ||
<variation name="OnePageEstimateShippingMethodsTestUpsVariation" ticketId="MAGETWO-71003"> | ||
<data name="products" xsi:type="string">catalogProductSimple::default</data> | ||
<data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data> | ||
<data name="editAddressData" xsi:type="array"> | ||
<item name="city" xsi:type="string">Birmingham</item> | ||
<item name="region_id" xsi:type="string">Alabama</item> | ||
<item name="postcode" xsi:type="string">35201</item> | ||
</data> | ||
<data name="configData" xsi:type="string">ups, shipping_origin_US_CA</data> | ||
<constraint name="Magento\Checkout\Test\Constraint\AssertShippingMethodsSuccessEstimateAfterAddressEdit" /> | ||
</variation> | ||
</testCase> | ||
</config> |