File tree Expand file tree Collapse file tree 7 files changed +113
-3
lines changed
Test/Unit/Model/ResourceModel
dev/tests/functional/tests/app/Magento/Checkout/Test Expand file tree Collapse file tree 7 files changed +113
-3
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,8 @@ public function getReservedOrderId($quote)
173
173
}
174
174
175
175
/**
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.
177
178
*
178
179
* @param int $orderIncrementId
179
180
* @return bool
Original file line number Diff line number Diff line change 6
6
7
7
namespace Magento \Quote \Test \Unit \Model \ResourceModel ;
8
8
9
-
10
9
class QuoteTest extends \PHPUnit_Framework_TestCase
11
10
{
12
11
/**
Original file line number Diff line number Diff line change 13
13
*/
14
14
class Shipping extends Form
15
15
{
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
+ }
17
25
}
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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 >
Original file line number Diff line number Diff line change 22
22
<step name =" placeOrder" module =" Magento_Checkout" next =" createCustomerAccount" />
23
23
<step name =" createCustomerAccount" module =" Magento_Checkout" />
24
24
</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 >
25
31
</config >
You can’t perform that action at this time.
0 commit comments