Skip to content

Commit

Permalink
MAGETWO-60958: [Backport] Incorrect province code sent on Checkout to…
Browse files Browse the repository at this point in the history
… UPS #6564 - for 2.1

- MAGETWO-70727: [GitHub] Shipping method randomly dissapear when page refreshed for 2.1 #7497
  • Loading branch information
ameysar committed Jul 26, 2017
1 parent e97a673 commit 3798dfa
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 2 deletions.
@@ -0,0 +1,79 @@
<?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.
*/
class AssertShippingMethodsSuccessEstimate extends AbstractConstraint
{
/**
* Asserts that shipping methods are present on checkout page.
*
* @param CheckoutOnepage $checkoutOnepage
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(
CheckoutOnepage $checkoutOnepage,
BrowserInterface $browser
) {
if ($this->shouldOpenCheckout($checkoutOnepage, $browser)) {
$checkoutOnepage->open();
}

\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.";
}
}
Expand Up @@ -32,7 +32,9 @@
<step name="setupConfiguration" module="Magento_Config" next="createProducts" />
<step name="createProducts" module="Magento_Catalog" next="addProductsToTheCart" />
<step name="addProductsToTheCart" module="Magento_Checkout" next="proceedToCheckout" />
<step name="proceedToCheckout" module="Magento_Checkout" next="fillShippingAddress" />
<step name="proceedToCheckout" module="Magento_Checkout" next="createCustomer" />
<step name="createCustomer" module="Magento_Customer" next="selectCheckoutMethod"/>
<step name="selectCheckoutMethod" module="Magento_Checkout" next="fillShippingAddress"/>
<step name="fillShippingAddress" module="Magento_Checkout" next="resolveShippingMethods" />
<step name="resolveShippingMethods" module="Magento_Checkout" />
</scenario>
Expand Down
Expand Up @@ -7,16 +7,24 @@
-->
<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">
<variation name="OnePageEstimateShippingMethodsTestUpsVariation1" 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="checkoutMethod" xsi:type="string">guest</data>
<data name="configData" xsi:type="string">ups, shipping_origin_US_CA</data>
<constraint name="Magento\Checkout\Test\Constraint\AssertShippingMethodsSuccessEstimateAfterAddressEdit" />
</variation>
<variation name="OnePageEstimateShippingMethodsTestUpsVariation2" ticketId="MAGETWO-71044">
<data name="products" xsi:type="string">catalogProductSimple::default</data>
<data name="customer/dataset" xsi:type="string">johndoe_with_addresses</data>
<data name="checkoutMethod" xsi:type="string">login</data>
<data name="configData" xsi:type="string">ups, shipping_origin_US_CA</data>
<constraint name="Magento\Checkout\Test\Constraint\AssertShippingMethodsSuccessEstimate" />
</variation>
</testCase>
</config>

0 comments on commit 3798dfa

Please sign in to comment.