Skip to content

Commit 78a84d0

Browse files
author
Stanislav Idolov
committed
MAGETWO-57278: For Dutch locale, ZIP in checkout is already giving out a "validation failed" error at page load
-- functional test
1 parent 3078782 commit 78a84d0

File tree

7 files changed

+113
-3
lines changed

7 files changed

+113
-3
lines changed

app/code/Magento/Quote/Model/ResourceModel/Quote.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ public function getReservedOrderId($quote)
173173
}
174174

175175
/**
176-
* Check is order increment id use in sales/order table
176+
* Check if order increment ID is already used.
177+
* Method can be used to avoid collisions of order IDs.
177178
*
178179
* @param int $orderIncrementId
179180
* @return bool

app/code/Magento/Quote/Test/Unit/Model/ResourceModel/QuoteTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
namespace Magento\Quote\Test\Unit\Model\ResourceModel;
88

9-
109
class QuoteTest extends \PHPUnit_Framework_TestCase
1110
{
1211
/**

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,13 @@
1313
*/
1414
class Shipping extends Form
1515
{
16-
//
16+
/**
17+
* Returns form's required elements
18+
*
19+
* @return \Magento\Mtf\Client\ElementInterface[]
20+
*/
21+
public function getRequiredFields()
22+
{
23+
return $this->_rootElement->getElements("div .field._required");
24+
}
1725
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Checkout\Test\Constraint;
8+
9+
use Magento\Checkout\Test\Page\CheckoutOnepage;
10+
use Magento\Mtf\Constraint\AbstractConstraint;
11+
12+
/**
13+
* Class AssertShippingAddressJsValidationMessagesIsAbsent
14+
* Assert js validation messages are absent for required fields.
15+
*/
16+
class AssertShippingAddressJsValidationMessagesIsAbsent extends AbstractConstraint
17+
{
18+
/**
19+
* Assert js validation messages are absent for required fields.
20+
*
21+
* @param CheckoutOnepage $checkoutOnepage
22+
* @return void
23+
*/
24+
public function processAssert(CheckoutOnepage $checkoutOnepage)
25+
{
26+
$requiredFields = $checkoutOnepage->getShippingBlock()->getRequiredFields();
27+
28+
/** @var \Magento\Mtf\Client\ElementInterface $field */
29+
foreach ($requiredFields as $field) {
30+
$errorContainer = $field->find("div .field-error");
31+
\PHPUnit_Framework_Assert::assertFalse(
32+
$errorContainer->isVisible(),
33+
'Js validation error messages must be absent for required fields after checkout start.'
34+
);
35+
}
36+
}
37+
38+
/**
39+
* Returns string representation of successful assertion
40+
*
41+
* @return string
42+
*/
43+
public function toString()
44+
{
45+
return 'Js validation messages are absent for required fields.';
46+
}
47+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Checkout\Test\TestCase;
8+
9+
use Magento\Mtf\TestCase\Scenario;
10+
11+
/**
12+
* Steps:
13+
* 1. Go to Frontend as guest.
14+
* 2. Add simple product to shopping cart
15+
* 3. Go to shopping cart page
16+
* 4. Proceed to checkout
17+
* 5. Perform assertions.
18+
*
19+
* @group One_Page_Checkout
20+
* @ZephyrId MAGETWO-59697
21+
*/
22+
class OnePageCheckoutJsValidationTest extends Scenario
23+
{
24+
/**
25+
* Runs one page checkout js validation test.
26+
*
27+
* @return void
28+
*/
29+
public function test()
30+
{
31+
$this->executeScenario();
32+
}
33+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2016 Magento. 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\Checkout\Test\TestCase\OnePageCheckoutJsValidationTest" summary="JS validation verification for Checkout flow" ticketId="MAGETWO-59697">
10+
<variation name="OnePageCheckoutJsValidationTestVariation1" summary="JS validation is not applied for empty required checkout fields if customer did not fill them">
11+
<data name="products/0" xsi:type="string">catalogProductSimple::default</data>
12+
<data name="checkoutMethod" xsi:type="string">guest</data>
13+
<constraint name="Magento\Checkout\Test\Constraint\AssertShippingAddressJsValidationMessagesIsAbsent" />
14+
</variation>
15+
</testCase>
16+
</config>

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,10 @@
2222
<step name="placeOrder" module="Magento_Checkout" next="createCustomerAccount" />
2323
<step name="createCustomerAccount" module="Magento_Checkout" />
2424
</scenario>
25+
<scenario name="OnePageCheckoutJsValidationTest" firstStep="setupConfiguration">
26+
<step name="setupConfiguration" module="Magento_Config" next="createProducts" />
27+
<step name="createProducts" module="Magento_Catalog" next="addProductsToTheCart" />
28+
<step name="addProductsToTheCart" module="Magento_Checkout" next="ProceedToCheckout" />
29+
<step name="ProceedToCheckout" module="Magento_Checkout" />
30+
</scenario>
2531
</config>

0 commit comments

Comments
 (0)