Skip to content

Commit 1b2c266

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-60965' into 2.0-prs
2 parents eba28fa + 0ef9256 commit 1b2c266

File tree

10 files changed

+281
-8
lines changed

10 files changed

+281
-8
lines changed

app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@
1313

1414
<!-- ko foreach: { data: currentBillingAddress().customAttributes, as: 'element' } -->
1515
<!-- ko foreach: { data: Object.keys(element), as: 'attribute' } -->
16-
<!-- ko text: element[attribute].value --><!-- /ko -->
16+
<!-- ko if: (typeof element[attribute] === "object") -->
17+
<!-- ko text: element[attribute].value --><!-- /ko -->
18+
<!-- /ko -->
19+
20+
<!-- ko if: (typeof element[attribute] === "string") -->
21+
<!-- ko text: element[attribute] --><!-- /ko -->
22+
<!-- /ko --><br/>
1723
<!-- /ko -->
1824
<!-- /ko -->
1925

app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@
1313

1414
<!-- ko foreach: { data: address().customAttributes, as: 'element' } -->
1515
<!-- ko foreach: { data: Object.keys(element), as: 'attribute' } -->
16-
<!-- ko text: element[attribute].value --><!-- /ko -->
16+
<!-- ko if: (typeof element[attribute] === "object") -->
17+
<!-- ko text: element[attribute].value --><!-- /ko -->
18+
<!-- /ko -->
19+
20+
<!-- ko if: (typeof element[attribute] === "string") -->
21+
<!-- ko text: element[attribute] --><!-- /ko -->
22+
<!-- /ko --><br/>
1723
<!-- /ko -->
1824
<!-- /ko -->
1925

app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@
1313

1414
<!-- ko foreach: { data: address().customAttributes, as: 'element' } -->
1515
<!-- ko foreach: { data: Object.keys(element), as: 'attribute' } -->
16-
<!-- ko text: element[attribute].value --><!-- /ko -->
16+
<!-- ko if: (typeof element[attribute] === "object") -->
17+
<!-- ko text: element[attribute].value --><!-- /ko -->
18+
<!-- /ko -->
19+
20+
<!-- ko if: (typeof element[attribute] === "string") -->
21+
<!-- ko text: element[attribute] --><!-- /ko -->
22+
<!-- /ko --><br/>
1723
<!-- /ko -->
1824
<!-- /ko -->
25+
1926
<!-- /ko -->

dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/CreateProductsStep.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class CreateProductsStep implements TestStepInterface
1919
/**
2020
* Products names in data set
2121
*
22-
* @var string
22+
* @var string|array
2323
*/
2424
protected $products;
2525

@@ -60,8 +60,12 @@ public function __construct(FixtureFactory $fixtureFactory, $products, array $da
6060
public function run()
6161
{
6262
$products = [];
63-
$productsDataSets = explode(',', $this->products);
64-
foreach ($productsDataSets as $key => $productDataSet) {
63+
64+
if (!is_array($this->products)) { // for backward compatible changes
65+
$this->products = explode(',', $this->products);
66+
}
67+
68+
foreach ($this->products as $key => $productDataSet) {
6569
$productDataSet = explode('::', $productDataSet);
6670
$fixtureClass = $productDataSet[0];
6771
$dataset = isset($productDataSet[1]) ? $productDataSet[1] : '';

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

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,70 @@
66

77
namespace Magento\Checkout\Test\Block\Onepage;
88

9+
use Magento\Checkout\Test\Block\Onepage\Shipping\AddressModal;
910
use Magento\Mtf\Block\Form;
11+
use Magento\Mtf\Client\Locator;
1012

1113
/**
1214
* Checkout shipping address block.
1315
*/
1416
class Shipping extends Form
1517
{
16-
//
18+
/**
19+
* CSS Selector for "New Address" button
20+
*
21+
* @var string
22+
*/
23+
private $newAddressButton = '[data-bind*="isNewAddressAdded"]';
24+
25+
/**
26+
* Wait element.
27+
*
28+
* @var string
29+
*/
30+
private $waitElement = '.loading-mask';
31+
32+
/**
33+
* SCC Selector for Address Modal block.
34+
*
35+
* @var string
36+
*/
37+
private $addressModalBlock = '//*[@id="opc-new-shipping-address"]/../..';
38+
39+
/**
40+
* @var string
41+
*/
42+
private $selectedAddress = '.shipping-address-item.selected-item';
43+
44+
/**
45+
* Click on "New Address" button.
46+
*
47+
* @return void
48+
*/
49+
public function clickOnNewAddressButton()
50+
{
51+
$this->waitForElementNotVisible($this->waitElement);
52+
$this->_rootElement->find($this->newAddressButton)->click();
53+
}
54+
55+
/**
56+
* Get Address Modal Block.
57+
*
58+
* @return AddressModal
59+
*/
60+
public function getAddressModalBlock()
61+
{
62+
return $this->blockFactory->create(
63+
AddressModal::class,
64+
['element' => $this->browser->find($this->addressModalBlock, Locator::SELECTOR_XPATH)]
65+
);
66+
}
67+
68+
/**
69+
* @return array
70+
*/
71+
public function getSelectedAddress()
72+
{
73+
return $this->_rootElement->find($this->selectedAddress, Locator::SELECTOR_CSS)->getText();
74+
}
1775
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Checkout\Test\Block\Onepage\Shipping;
8+
9+
use Magento\Mtf\Block\Form;
10+
11+
/**
12+
* Checkout shipping address modal block.
13+
*/
14+
class AddressModal extends Form
15+
{
16+
/**
17+
* CSS Selector for Save button.
18+
*
19+
* @var string
20+
*/
21+
private $saveButton = '.action-save-address';
22+
23+
/**
24+
* Selector for field's error message.
25+
*
26+
* @var string
27+
*/
28+
private $errorMessage = '.mage-error';
29+
30+
/**
31+
* Selector for error fields.
32+
*
33+
* @var string
34+
*/
35+
private $errorField = '._error';
36+
37+
/**
38+
* Selector for field label that have error message.
39+
*
40+
* @var string
41+
*/
42+
private $fieldLabel = '.label';
43+
44+
/**
45+
* Click on 'Save Address' button.
46+
*
47+
* @return void
48+
*/
49+
public function save()
50+
{
51+
$this->_rootElement->find($this->saveButton)->click();
52+
}
53+
54+
/**
55+
* Get Error messages for attributes.
56+
*
57+
* @return array
58+
*/
59+
public function getErrorMessages()
60+
{
61+
$result = [];
62+
63+
foreach ($this->_rootElement->getElements($this->errorField) as $item) {
64+
$result[$item->find($this->fieldLabel)->getText()] = $item->find($this->errorMessage)->getText();
65+
}
66+
67+
return $result;
68+
}
69+
70+
/**
71+
* Fixture mapping.
72+
*
73+
* @param array|null $fields
74+
* @param string|null $parent
75+
* @return array
76+
*/
77+
protected function dataMapping(array $fields = null, $parent = null)
78+
{
79+
if (isset($fields['custom_attribute'])) {
80+
$this->placeholders = ['attribute_code' => $fields['custom_attribute']['code']];
81+
$this->applyPlaceholders();
82+
}
83+
84+
return parent::dataMapping($fields, $parent);
85+
}
86+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" ?>
2+
<!--
3+
/**
4+
* Copyright © 2016 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<mapping strict="0">
9+
<fields>
10+
<firstname />
11+
<lastname />
12+
<company />
13+
<street>
14+
<selector>input[name="street[0]"]</selector>
15+
</street>
16+
<city />
17+
<region_id>
18+
<input>select</input>
19+
</region_id>
20+
<country_id>
21+
<input>select</input>
22+
</country_id>
23+
<telephone />
24+
<postcode />
25+
<custom_attribute>
26+
<selector>[name="custom_attributes[%attribute_code%]"]</selector>
27+
</custom_attribute>
28+
</fields>
29+
</mapping>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Checkout\Test\TestStep;
8+
9+
use Magento\Checkout\Test\Page\CheckoutOnepage;
10+
use Magento\Customer\Test\Fixture\Address;
11+
use Magento\Mtf\TestStep\TestStepInterface;
12+
13+
/**
14+
* Create customer custom attribute step.
15+
*/
16+
class AddNewShippingAddressStep implements TestStepInterface
17+
{
18+
/**
19+
* Checkout One page.
20+
*
21+
* @var CheckoutOnepage
22+
*/
23+
private $checkoutOnepage;
24+
25+
/**
26+
* Shipping Address fixture.
27+
*
28+
* @var Address
29+
*/
30+
private $address;
31+
32+
/**
33+
* @constructor
34+
* @param CheckoutOnepage $checkoutOnepage
35+
* @param Address|null $address [optional]
36+
*/
37+
public function __construct(CheckoutOnepage $checkoutOnepage, Address $address = null)
38+
{
39+
$this->checkoutOnepage = $checkoutOnepage;
40+
$this->address = $address;
41+
}
42+
43+
/**
44+
* Create customer account.
45+
*
46+
* @return void
47+
*/
48+
public function run()
49+
{
50+
$shippingBlock = $this->checkoutOnepage->getShippingBlock();
51+
$shippingBlock->clickOnNewAddressButton();
52+
53+
if ($this->address) {
54+
$shippingBlock->getAddressModalBlock()->fill($this->address);
55+
}
56+
57+
$shippingBlock->getAddressModalBlock()->save();
58+
}
59+
}

dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Edit.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,22 @@ public function saveAddress()
6161
{
6262
$this->_rootElement->find($this->saveAddress)->click();
6363
}
64+
65+
/**
66+
* Fixture mapping.
67+
*
68+
* @param array|null $fields
69+
* @param string|null $parent
70+
* @return array
71+
*/
72+
protected function dataMapping(array $fields = null, $parent = null)
73+
{
74+
if (isset($fields['custom_attribute'])) {
75+
$this->placeholders =
76+
['attribute_code' => $fields['custom_attribute']['code']];
77+
$this->applyPlaceholders();
78+
}
79+
80+
return parent::dataMapping($fields, $parent);
81+
}
6482
}

dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAddressEdit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function initUrl()
4545
public function getEditForm()
4646
{
4747
return Factory::getBlockFactory()->getMagentoCustomerAddressEdit(
48-
$this->browser->find($this->editForm, Locator::SELECTOR_CSS)
48+
$this->browser->find($this->editForm, Locator::SELECTOR_CSS)
4949
);
5050
}
5151
}

0 commit comments

Comments
 (0)