-
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
3 changed files
with
82 additions
and
83 deletions.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
...s/functional/tests/app/Magento/Checkout/Test/Constraint/AssertShippingMethodsEstimate.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,76 @@ | ||
<?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\Mtf\Client\BrowserInterface; | ||
use Magento\Mtf\Constraint\AbstractConstraint; | ||
|
||
/** | ||
* Asserts shipping methods estimation on checkout page. | ||
*/ | ||
abstract class AssertShippingMethodsEstimate extends AbstractConstraint | ||
{ | ||
/** | ||
* Asserts shipping methods estimation on checkout page. | ||
* | ||
* @param CheckoutOnepage $checkoutOnepage | ||
* @param BrowserInterface $browser | ||
* @return void | ||
*/ | ||
protected function assert( | ||
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 estimation on checkout page."; | ||
} | ||
} |
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