Skip to content

Commit 0f9ad56

Browse files
author
Dmytro Aponasenko
committed
MTA-571: Re-factor Test for Automatic Tax Applying
1 parent 55c8e98 commit 0f9ad56

37 files changed

+749
-379
lines changed

dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public function getTabElement($tabName)
273273
* Open tab
274274
*
275275
* @param string $tabName
276-
* @return Tab
276+
* @return FormTabs
277277
*/
278278
public function openTab($tabName)
279279
{

dev/tests/functional/tests/app/Magento/Backend/Test/Repository/ConfigData.xml

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd">
99
<repository class="Magento\Config\Test\Repository\ConfigData">
10-
<dataset name="store_information">
10+
<dataset name="store_information_US">
1111
<field name="general/store_information/name" xsi:type="array">
1212
<item name="scope" xsi:type="string">general</item>
1313
<item name="scope_id" xsi:type="number">1</item>
@@ -58,6 +58,57 @@
5858
</field>
5959
</dataset>
6060

61+
<dataset name="store_information_DE_with_VAT">
62+
<field name="general/store_information/name" xsi:type="array">
63+
<item name="scope" xsi:type="string">general</item>
64+
<item name="scope_id" xsi:type="number">1</item>
65+
<item name="label" xsi:type="string"/>
66+
<item name="value" xsi:type="string">DE Store</item>
67+
</field>
68+
<field name="general/store_information/phone" xsi:type="array">
69+
<item name="scope" xsi:type="string">general</item>
70+
<item name="scope_id" xsi:type="number">1</item>
71+
<item name="label" xsi:type="string"/>
72+
<item name="value" xsi:type="string">630-371-7008</item>
73+
</field>
74+
<field name="general/store_information/country_id" xsi:type="array">
75+
<item name="scope" xsi:type="string">general</item>
76+
<item name="scope_id" xsi:type="number">1</item>
77+
<item name="label" xsi:type="string">Germany</item>
78+
<item name="value" xsi:type="string">DE</item>
79+
</field>
80+
<field name="general/store_information/region_id" xsi:type="array">
81+
<item name="scope" xsi:type="string">general</item>
82+
<item name="scope_id" xsi:type="number">1</item>
83+
<item name="label" xsi:type="string">Berlin</item>
84+
<item name="value" xsi:type="number">82</item>
85+
</field>
86+
<field name="general/store_information/postcode" xsi:type="array">
87+
<item name="scope" xsi:type="string">general</item>
88+
<item name="scope_id" xsi:type="number">1</item>
89+
<item name="label" xsi:type="string"/>
90+
<item name="value" xsi:type="number">10789</item>
91+
</field>
92+
<field name="general/store_information/city" xsi:type="array">
93+
<item name="scope" xsi:type="string">general</item>
94+
<item name="scope_id" xsi:type="number">1</item>
95+
<item name="label" xsi:type="string"/>
96+
<item name="value" xsi:type="string">Berlin</item>
97+
</field>
98+
<field name="general/store_information/street_line1" xsi:type="array">
99+
<item name="scope" xsi:type="string">general</item>
100+
<item name="scope_id" xsi:type="number">1</item>
101+
<item name="label" xsi:type="string"/>
102+
<item name="value" xsi:type="string">Augsburger Strabe 41</item>
103+
</field>
104+
<field name="general/store_information/merchant_vat_number" xsi:type="array">
105+
<item name="scope" xsi:type="string">general</item>
106+
<item name="scope_id" xsi:type="number">1</item>
107+
<item name="label" xsi:type="string"/>
108+
<item name="value" xsi:type="string">111607872</item>
109+
</field>
110+
</dataset>
111+
61112
<dataset name="admin_session_lifetime_1_hour">
62113
<field name="admin/security/session_lifetime" xsi:type="array">
63114
<item name="scope" xsi:type="string">default</item>

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@
456456
<data name="product/data/price/value" xsi:type="string">10</data>
457457
<data name="product/data/stock_data/manage_stock" xsi:type="string">Yes</data>
458458
<data name="product/data/stock_data/qty" xsi:type="string">1</data>
459-
<data name="tag" xsi:type="string">test_type:acceptance_test</data>
459+
<data name="tag" xsi:type="string">test_type:acceptance_test, stable:no</data>
460460
<constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" />
461461
<constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" />
462462
</variation>

dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Magento\Customer\Test\Fixture\Customer;
1010
use Magento\CatalogRule\Test\Fixture\CatalogRule;
1111
use Magento\Catalog\Test\Fixture\CatalogProductSimple;
12-
use Magento\Customer\Test\Fixture\CustomerGroupInjectable;
12+
use Magento\Customer\Test\Fixture\CustomerGroup;
1313

1414
/**
1515
* Steps:
@@ -90,13 +90,13 @@ public function testCreate(
9090
*
9191
* @param CatalogRule $catalogPriceRule
9292
* @param Customer|null $customer
93-
* @return CustomerGroupInjectable
93+
* @return CustomerGroup
9494
*/
9595
public function applyCustomerGroup(CatalogRule $catalogPriceRule, Customer $customer = null)
9696
{
9797
if ($customer !== null) {
9898
$customer->persist();
99-
/** @var \Magento\Customer\Test\Fixture\CustomerGroupInjectable $customerGroup */
99+
/** @var \Magento\Customer\Test\Fixture\CustomerGroup $customerGroup */
100100
$customerGroup = $customer->getDataFieldConfig('group_id')['source']->getCustomerGroup();
101101
$catalogPriceRule = $this->fixtureFactory->createByCode(
102102
'catalogRule',

dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class CreateCmsPageEntityTest extends Injectable
3030
const DOMAIN = 'PS';
3131
const TEST_TYPE = 'acceptance_test';
3232
const TO_MAINTAIN = 'yes';
33+
const STABLE = 'no';
3334
/* end tags */
3435

3536
/**

dev/tests/functional/tests/app/Magento/Config/Test/Fixture/ConfigData.xml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd">
9-
<fixture name="configData"
10-
module="Magento_Config"
11-
type="flat"
12-
entity_type="core_config_data"
13-
collection="Magento\Config\Model\Resource\Config\Data\Collection"
14-
repository_class="Magento\Config\Test\Repository\ConfigData"
15-
handler_interface="Magento\Config\Test\Handler\ConfigData\ConfigDataInterface"
16-
class="Magento\Config\Test\Fixture\ConfigData">
17-
<field name="section"/>
18-
<field name="config_id" is_required="1">
19-
<default_value xsi:type="null"/>
20-
</field>
21-
<field name="scope" is_required="">
22-
<default_value xsi:type="string">default</default_value>
23-
</field>
24-
<field name="scope_id" is_required="">
25-
<default_value xsi:type="number">0</default_value>
26-
</field>
27-
<field name="path" is_required="">
28-
<default_value xsi:type="string">general</default_value>
29-
</field>
30-
<field name="value" is_required="">
31-
<default_value xsi:type="null"/>
32-
</field>
33-
</fixture>
9+
<fixture name="configData"
10+
module="Magento_Config"
11+
type="flat"
12+
entity_type="core_config_data"
13+
collection="Magento\Config\Model\Resource\Config\Data\Collection"
14+
repository_class="Magento\Config\Test\Repository\ConfigData"
15+
handler_interface="Magento\Config\Test\Handler\ConfigData\ConfigDataInterface"
16+
class="Magento\Config\Test\Fixture\ConfigData">
17+
<field name="section" />
18+
<field name="config_id" is_required="1">
19+
<default_value xsi:type="null" />
20+
</field>
21+
<field name="scope" is_required="">
22+
<default_value xsi:type="string">default</default_value>
23+
</field>
24+
<field name="scope_id" is_required="">
25+
<default_value xsi:type="number">0</default_value>
26+
</field>
27+
<field name="path" is_required="">
28+
<default_value xsi:type="string">general</default_value>
29+
</field>
30+
<field name="value" is_required="">
31+
<default_value xsi:type="null" />
32+
</field>
33+
</fixture>
3434
</config>

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ class CustomerForm extends FormTabs
4444
*/
4545
protected $fieldWrapperControl = './/*[contains(@class, "admin__field")]/*[contains(@class,"control")]';
4646

47+
/**
48+
* Selector for wainting tab content to load.
49+
*
50+
* @var string
51+
*/
52+
protected $tabReadiness = 'div:not([style="display: none;"])>.admin__fieldset-wrapper.opened > [class*=content]';
53+
4754
/**
4855
* Fill Customer forms on tabs by customer, addresses data.
4956
*
@@ -137,4 +144,18 @@ protected function waitFields()
137144
/* Wait for field's control block is visible in the form */
138145
$this->waitForElementVisible($this->fieldWrapperControl, Locator::SELECTOR_XPATH);
139146
}
147+
148+
/**
149+
* Open tab.
150+
*
151+
* @param string $tabName
152+
* @return CustomerForm
153+
*/
154+
public function openTab($tabName)
155+
{
156+
parent::openTab($tabName);
157+
$this->waitForElementVisible($this->tabReadiness);
158+
159+
return $this;
160+
}
140161
}

dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerForm.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
use Magento\Mtf\Constraint\AbstractConstraint;
1414

1515
/**
16-
* Class AssertCustomerForm
17-
*
16+
* Assert customer data on customer backend form.
1817
*/
1918
class AssertCustomerForm extends AbstractConstraint
2019
{
@@ -23,7 +22,7 @@ class AssertCustomerForm extends AbstractConstraint
2322
/* end tags */
2423

2524
/**
26-
* Skipped fields for verify data
25+
* Skipped fields for verify data.
2726
*
2827
* @var array
2928
*/
@@ -32,10 +31,11 @@ class AssertCustomerForm extends AbstractConstraint
3231
'password',
3332
'password_confirmation',
3433
'is_subscribed',
34+
'address'
3535
];
3636

3737
/**
38-
* Assert that displayed customer data on edit page(backend) equals passed from fixture
38+
* Assert that displayed customer data on edit page(backend) equals passed from fixture.
3939
*
4040
* @param Customer $customer
4141
* @param CustomerIndex $pageCustomerIndex
@@ -81,7 +81,7 @@ public function processAssert(
8181
}
8282

8383
/**
84-
* Verify data in form equals to passed from fixture
84+
* Verify data in form equals to passed from fixture.
8585
*
8686
* @param array $dataFixture
8787
* @param array $dataForm
@@ -111,15 +111,14 @@ protected function verify(array $dataFixture, array $dataForm)
111111
} else {
112112
$result[] = "\naddress #{$key} {$name}: Field absent. Expected value \"{$value}\"";
113113
}
114-
115114
}
116115
}
117116

118117
return $result;
119118
}
120119

121120
/**
122-
* Text success verify Customer form
121+
* Text success verify Customer form.
123122
*
124123
* @return string
125124
*/

dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupForm.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Magento\Customer\Test\Constraint;
88

9-
use Magento\Customer\Test\Fixture\CustomerGroupInjectable;
9+
use Magento\Customer\Test\Fixture\CustomerGroup;
1010
use Magento\Customer\Test\Page\Adminhtml\CustomerGroupIndex;
1111
use Magento\Customer\Test\Page\Adminhtml\CustomerGroupNew;
1212
use Magento\Mtf\Constraint\AbstractConstraint;
@@ -34,15 +34,15 @@ class AssertCustomerGroupForm extends AbstractConstraint
3434
*
3535
* @param CustomerGroupIndex $customerGroupIndex
3636
* @param CustomerGroupNew $customerGroupNew
37-
* @param CustomerGroupInjectable $customerGroup
38-
* @param CustomerGroupInjectable $customerGroupOriginal
37+
* @param CustomerGroup $customerGroup
38+
* @param CustomerGroup $customerGroupOriginal
3939
* @return void
4040
*/
4141
public function processAssert(
4242
CustomerGroupIndex $customerGroupIndex,
4343
CustomerGroupNew $customerGroupNew,
44-
CustomerGroupInjectable $customerGroup,
45-
CustomerGroupInjectable $customerGroupOriginal = null
44+
CustomerGroup $customerGroup,
45+
CustomerGroup $customerGroupOriginal = null
4646
) {
4747
$data = ($customerGroupOriginal !== null)
4848
? array_merge($customerGroupOriginal->getData(), $customerGroup->getData())

dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupInGrid.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Magento\Customer\Test\Constraint;
88

9-
use Magento\Customer\Test\Fixture\CustomerGroupInjectable;
9+
use Magento\Customer\Test\Fixture\CustomerGroup;
1010
use Magento\Customer\Test\Page\Adminhtml\CustomerGroupIndex;
1111
use Magento\Mtf\Constraint\AbstractConstraint;
1212

@@ -22,12 +22,12 @@ class AssertCustomerGroupInGrid extends AbstractConstraint
2222
/**
2323
* Assert that customer group in grid
2424
*
25-
* @param CustomerGroupInjectable $customerGroup
25+
* @param CustomerGroup $customerGroup
2626
* @param CustomerGroupIndex $customerGroupIndex
2727
* @return void
2828
*/
2929
public function processAssert(
30-
CustomerGroupInjectable $customerGroup,
30+
CustomerGroup $customerGroup,
3131
CustomerGroupIndex $customerGroupIndex
3232
) {
3333
$customerGroupIndex->open();

0 commit comments

Comments
 (0)