Skip to content

Commit 3e9f3b1

Browse files
author
Dmytro Aponasenko
committed
MTA-1502: Sync qmt repository with mainline - Sprint 5
- moved test to corresponded repository
1 parent cec6e92 commit 3e9f3b1

32 files changed

+1179
-7
lines changed

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ public function setQtyAndClickAddToCart($qty)
204204
*/
205205
public function setQty($qty)
206206
{
207-
$this->browser->selectWindow();
208-
$this->_rootElement->find($this->qty)->keys([$qty]);
207+
$this->_rootElement->find($this->qty)->setValue($qty);
209208
$this->_rootElement->click();
210209
}
211210

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\CheckoutAgreements\Test\Block\Multishipping;
7+
8+
use Magento\CheckoutAgreements\Test\Block\Onepage\AgreementReview;
9+
10+
/**
11+
* Multiple addresses checkout order review block.
12+
*/
13+
class MultishippingAgreementReview extends AgreementReview
14+
{
15+
//
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\CheckoutAgreements\Test\Constraint;
7+
8+
use Magento\Mtf\Constraint\AbstractConstraint;
9+
use Magento\Mtf\ObjectManager;
10+
use Magento\Multishipping\Test\Page\MultishippingCheckoutOverview;
11+
use Magento\Mtf\TestStep\TestStepFactory;
12+
13+
/**
14+
* Check that Terms and Conditions is present on the last checkout step - Order Review.
15+
*/
16+
class AssertTermRequireMessageOnMultishippingCheckout extends AbstractConstraint
17+
{
18+
/* tags */
19+
const SEVERITY = 'high';
20+
/* end tags */
21+
22+
/**
23+
* Expected notification message
24+
*/
25+
const NOTIFICATION_MESSAGE = 'This is a required field.';
26+
27+
/**
28+
* Check that clicking "Place order" without setting checkbox for agreement will result in error message displayed
29+
* under condition.
30+
*
31+
* @param MultishippingCheckoutOverview $page
32+
* @param TestStepFactory $stepFactory
33+
* @param array $product
34+
* @param array $payment
35+
* @param array $shipping
36+
* @return void
37+
*/
38+
public function processAssert(
39+
MultishippingCheckoutOverview $page,
40+
TestStepFactory $stepFactory,
41+
$product,
42+
$payment,
43+
$shipping
44+
) {
45+
$customer = ['customer' => ['dataSet' => 'johndoe_with_multiple_addresses']];
46+
$customer = $stepFactory->create('\Magento\Customer\Test\TestStep\CreateCustomerStep', $customer)->run();
47+
$product = $stepFactory->create('\Magento\Catalog\Test\TestStep\CreateProductsStep', ['products' => $product])
48+
->run();
49+
$stepFactory->create('\Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', $customer)->run();
50+
$stepFactory->create('\Magento\Checkout\Test\TestStep\AddProductsToTheCartStep', $product)->run();
51+
$stepFactory->create('\Magento\Multishipping\Test\TestStep\ProceedToMultipleAddressCheckoutStep')->run();
52+
$stepFactory->create(
53+
'\Magento\Multishipping\Test\TestStep\FillCustomerAddressesStep',
54+
array_merge($product, $customer)
55+
)->run();
56+
$stepFactory->create(
57+
'\Magento\Multishipping\Test\TestStep\FillShippingInformationStep',
58+
array_merge(['shippingMethod' => $shipping], $customer)
59+
)->run();
60+
$stepFactory->create(
61+
'\Magento\Multishipping\Test\TestStep\SelectPaymentMethodStep',
62+
['payment' => $payment]
63+
)->run();
64+
$stepFactory->create(
65+
'\Magento\CheckoutAgreements\Test\TestStep\CheckTermOnMultishippingStep',
66+
['agreementValue' => 'No']
67+
)->run();
68+
$stepFactory->create('\Magento\Multishipping\Test\TestStep\PlaceOrderStep')->run();
69+
\PHPUnit_Framework_Assert::assertEquals(
70+
self::NOTIFICATION_MESSAGE,
71+
$page->getAgreementReview()->getNotificationMassage(),
72+
'Notification required message of Terms and Conditions is absent.'
73+
);
74+
$stepFactory->create(
75+
'\Magento\CheckoutAgreements\Test\TestStep\CheckTermOnMultishippingStep',
76+
['agreementValue' => 'Yes']
77+
)->run();
78+
$stepFactory->create('\Magento\Multishipping\Test\TestStep\PlaceOrderStep')->run();
79+
}
80+
81+
/**
82+
* Returns a string representation of the object.
83+
*
84+
* @return string
85+
*/
86+
public function toString()
87+
{
88+
return 'Validation error message for terms and conditions checkbox is present on multishipping checkout.';
89+
}
90+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" ?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<page mca="multishipping/checkout/overview">
9+
<blocks>
10+
<agreementReview>
11+
<class>\Magento\CheckoutAgreements\Test\Block\Multishipping\MultishippingAgreementReview</class>
12+
<locator>#checkout-agreements</locator>
13+
<strategy>css selector</strategy>
14+
</agreementReview>
15+
</blocks>
16+
</page>
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
"product";"agreement/data/name";"agreement/data/is_active";"agreement/data/is_html";"agreement/data/stores/dataSet/0";"agreement/data/checkbox_text";"agreement/data/content";"shipping/shipping_service";"shipping/shipping_method";"payment/method";"constraint"
2-
"catalogProductSimple::default";"name%isolation%";"Enabled";"Text";"default";"test_checkbox%isolation%";"TestMessage%isolation%";"Flat Rate";"Fixed";"checkmo";"assertTermSuccessSaveMessage, assertTermInGrid, assertTermOnCheckout"
3-
"catalogProductSimple::default";"name%isolation%";"Enabled";"HTML";"default";"test_checkbox%isolation%";"<html>";"Flat Rate";"Fixed";"checkmo";"assertTermSuccessSaveMessage, assertTermInGrid, assertTermOnCheckout"
4-
"catalogProductSimple::default";"name%isolation%";"Enabled";"Text";"default";"test_checkbox%isolation%";"TestMessage%isolation%";"Flat Rate";"Fixed";"checkmo";"assertTermSuccessSaveMessage, assertTermInGrid, assertTermOnCheckout"
5-
"catalogProductSimple::default";"name%isolation%";"Disabled";"Text";"default";"test_checkbox%isolation%";"TestMessage%isolation%";"Flat Rate";"Fixed";"checkmo";"assertTermSuccessSaveMessage, assertTermInGrid, assertTermAbsentOnCheckout"
1+
"description";"product";"agreement/data/name";"agreement/data/is_active";"agreement/data/is_html";"agreement/data/stores/dataSet/0";"agreement/data/checkbox_text";"agreement/data/content";"shipping/shipping_service";"shipping/shipping_method";"payment/method";"constraint"
2+
"Create enabled term entity with text value";"catalogProductSimple::default";"name%isolation%";"Enabled";"Text";"default";"test_checkbox%isolation%";"TestMessage%isolation%";"Flat Rate";"Fixed";"checkmo";"assertTermSuccessSaveMessage, assertTermInGrid, assertTermOnCheckout"
3+
"Create enabled term entity with HTML value";"catalogProductSimple::default";"name%isolation%";"Enabled";"HTML";"default";"test_checkbox%isolation%";"<html>";"Flat Rate";"Fixed";"checkmo";"assertTermSuccessSaveMessage, assertTermInGrid, assertTermOnCheckout"
4+
"Create enabled term entity with text value";"catalogProductSimple::default";"name%isolation%";"Enabled";"Text";"default";"test_checkbox%isolation%";"TestMessage%isolation%";"Flat Rate";"Fixed";"checkmo";"assertTermSuccessSaveMessage, assertTermInGrid, assertTermOnCheckout"
5+
"Create disabled term entity";"catalogProductSimple::default";"name%isolation%";"Disabled";"Text";"default";"test_checkbox%isolation%";"TestMessage%isolation%";"Flat Rate";"Fixed";"checkmo";"assertTermSuccessSaveMessage, assertTermInGrid, assertTermAbsentOnCheckout"
6+
"Create enabled term, check with multishipping";"catalogProductSimple::default, catalogProductSimple::default";"name%isolation%";"Enabled";"Text";"default";"test_checkbox%isolation%";"TestMessage%isolation%";"Flat Rate";"Fixed";"checkmo";"assertTermRequireMessageOnMultishippingCheckout, assertOrderSuccessPlacedMessage"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\CheckoutAgreements\Test\TestStep;
7+
8+
use Magento\Multishipping\Test\Page\MultishippingCheckoutOverview;
9+
use Magento\Mtf\TestStep\TestStepInterface;
10+
use Magento\CheckoutAgreements\Test\Fixture\CheckoutAgreement;
11+
12+
/**
13+
* Process Terms and Conditions checkbox on multiple addresses checkout page.
14+
*/
15+
class CheckTermOnMultishippingStep implements TestStepInterface
16+
{
17+
/**
18+
* Multishipping overview page.
19+
*
20+
* @var MultishippingCheckoutOverview
21+
*/
22+
protected $multishippingCheckoutOverview;
23+
24+
/**
25+
* Term and conditions checkbox value.
26+
*
27+
* @var string
28+
*/
29+
protected $agreementValue;
30+
31+
/**
32+
* @param MultishippingCheckoutOverview $multishippingCheckoutOverview
33+
* @param string $agreementValue
34+
*/
35+
public function __construct(
36+
MultishippingCheckoutOverview $multishippingCheckoutOverview,
37+
$agreementValue = 'No'
38+
) {
39+
$this->multishippingCheckoutOverview = $multishippingCheckoutOverview;
40+
$this->agreementValue = $agreementValue;
41+
}
42+
43+
/**
44+
* Process Terms and Conditions checkbox on multiple addresses checkout overview step.
45+
*
46+
* @return void
47+
*/
48+
public function run()
49+
{
50+
$this->multishippingCheckoutOverview->getAgreementReview()->setAgreement($this->agreementValue);
51+
}
52+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\CheckoutAgreements\Test\TestStep;
7+
8+
use Magento\CheckoutAgreements\Test\Fixture\CheckoutAgreement;
9+
use Magento\Mtf\TestStep\TestStepInterface;
10+
11+
/**
12+
* Create term entity
13+
*/
14+
class CreateTermEntityStep implements TestStepInterface
15+
{
16+
/**
17+
* Checkout agreement page.
18+
*
19+
* @var CheckoutAgreement
20+
*/
21+
protected $agreement;
22+
23+
/**
24+
* @param CheckoutAgreement $agreement
25+
*/
26+
public function __construct(CheckoutAgreement $agreement)
27+
{
28+
$this->agreement = $agreement;
29+
}
30+
31+
/**
32+
* Create checkout agreement.
33+
*
34+
* @return array
35+
*/
36+
public function run()
37+
{
38+
$this->agreement->persist();
39+
return ['agreement' => $this->agreement];
40+
}
41+
}

dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/etc/constraint.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@
2424
<assertTermAbsentInGrid module="Magento_CheckoutAgreements">
2525
<severity>low</severity>
2626
</assertTermAbsentInGrid>
27+
<assertTermRequireMessageOnMultishippingCheckout module="Magento_CheckoutAgreements">
28+
<severity>high</severity>
29+
</assertTermRequireMessageOnMultishippingCheckout>
2730
</constraint>

dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerInjectable.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,19 @@
119119
<item name="presets" xsi:type="string">US_address_TX</item>
120120
</field>
121121
</dataset>
122+
123+
<dataset name="johndoe_with_multiple_addresses">
124+
<field name="firstname" xsi:type="string">John</field>
125+
<field name="lastname" xsi:type="string">Doe%isolation%</field>
126+
<field name="group_id" xsi:type="array">
127+
<item name="dataSet" xsi:type="string">General</item>
128+
</field>
129+
<field name="email" xsi:type="string">JohnDoe_%isolation%@example.com</field>
130+
<field name="password" xsi:type="string">123123q</field>
131+
<field name="password_confirmation" xsi:type="string">123123q</field>
132+
<field name="address" xsi:type="array">
133+
<item name="presets" xsi:type="string">US_address_NY, US_address</item>
134+
</field>
135+
</dataset>
122136
</storage>
123137
</repository>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Multishipping\Test\Block\Checkout;
8+
9+
use Magento\Mtf\Block\Block;
10+
use Magento\Mtf\Client\Locator;
11+
12+
/**
13+
* Multishipping checkout choose item addresses block.
14+
*/
15+
class Addresses extends Block
16+
{
17+
/**
18+
* 'Enter New Address' button.
19+
*
20+
* @var string
21+
*/
22+
protected $newAddress = '[data-role="add-new-address"]';
23+
24+
/**
25+
* 'Continue to Shipping Information' button.
26+
*
27+
* @var string
28+
*/
29+
protected $continue = '[class*=continue][data-role="can-continue"]';
30+
31+
/**
32+
* Add new customer address.
33+
*/
34+
public function addNewAddress()
35+
{
36+
$this->_rootElement->find($this->newAddress, Locator::SELECTOR_CSS)->click();
37+
}
38+
39+
/**
40+
* Select shipping addresses for products.
41+
*
42+
* @param array $bindings
43+
*/
44+
public function selectAddresses($bindings)
45+
{
46+
foreach ($bindings as $key => $value) {
47+
$this->_rootElement->find(
48+
'//tr[//a[text()="' . $key . '"]]/following-sibling::*//select',
49+
Locator::SELECTOR_XPATH,
50+
'select'
51+
)->setValue($value);
52+
}
53+
$this->clickContinueButton();
54+
}
55+
56+
/**
57+
* Click "Continue to Billing Information" button.
58+
*
59+
* @return void
60+
*/
61+
public function clickContinueButton()
62+
{
63+
$this->_rootElement->find($this->continue)->click();
64+
}
65+
}

0 commit comments

Comments
 (0)