Skip to content

Commit cd7a8c3

Browse files
author
Vitaliy Boyko
committed
Fixed user input, adjusted test coverage
1 parent 992a82e commit cd7a8c3

File tree

13 files changed

+218
-8
lines changed

13 files changed

+218
-8
lines changed

src/com/magento/idea/magento2plugin/magento/files/MftfActionGroup.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@
77
public class MftfActionGroup {
88

99
public static String SELECTOR_ATTRIBUTE = "selector";
10+
public static String ENTITY_ATTRIBUTE = "entity";
11+
public static String CREATE_DATA_TAG = "createData";
12+
public static String UPDATE_DATA_TAG = "updateData";
13+
public static String USER_INPUT_TAG = "userInput";
1014
}

src/com/magento/idea/magento2plugin/reference/xml/XmlReferenceContributor.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.intellij.psi.PsiReferenceContributor;
99
import com.intellij.psi.PsiReferenceRegistrar;
1010
import com.intellij.psi.xml.XmlTokenType;
11+
import com.magento.idea.magento2plugin.magento.files.MftfActionGroup;
1112
import com.magento.idea.magento2plugin.php.util.PhpRegex;
1213
import com.magento.idea.magento2plugin.reference.provider.*;
1314
import com.magento.idea.magento2plugin.reference.provider.mftf.*;
@@ -157,22 +158,28 @@ public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar)
157158
)
158159
);
159160

160-
// <someXmlTag someAttribute="{{someValue}}" />
161+
// <someXmlTag userInput="{{someValue}}" />
161162
registrar.registerReferenceProvider(
162-
XmlPatterns.xmlAttributeValue().withValue(string().matches(".*\\{\\{[^\\}]+\\}\\}.*")),
163+
XmlPatterns.xmlAttributeValue().withValue(
164+
string().matches(".*\\{\\{[^\\}]+\\}\\}.*")
165+
).withParent(XmlPatterns.xmlAttribute().withName(
166+
MftfActionGroup.USER_INPUT_TAG
167+
)),
163168
new CompositeReferenceProvider(
164-
new DataReferenceProvider(),
165-
new PageReferenceProvider(),
166-
new SectionReferenceProvider()
169+
new DataReferenceProvider()
167170
)
168171
);
169172

170173
// <createData entity="SimpleProduct" />
174+
// <updateData entity="SimpleProduct" />
171175
registrar.registerReferenceProvider(
172-
XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute().withName(string().oneOf("entity", "value", "userInput", "url"))),
176+
XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute()
177+
.withName(MftfActionGroup.ENTITY_ATTRIBUTE).
178+
withParent(XmlPatterns.xmlTag().withName(
179+
string().oneOf(MftfActionGroup.CREATE_DATA_TAG, MftfActionGroup.UPDATE_DATA_TAG)
180+
))),
173181
new CompositeReferenceProvider(
174-
new DataReferenceProvider(),
175-
new SectionReferenceProvider()
182+
new DataReferenceProvider()
176183
)
177184
);
178185

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="TestAdminMenuCatalog" extends="Section<caret>">
12+
<data key="pageTitle">TestCatalog</data>
13+
</entity>
14+
</entities>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="Test">
11+
<updateData entity="Section<caret>" stepKey="createSimpleData"/>
12+
</actionGroup>
13+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="TestAddOutOfStockProductToCompareListTest">
12+
<before>
13+
<updateData entity="Section<caret>" stepKey="product">
14+
<requiredEntity createDataKey="category"/>
15+
</updateData>
16+
</before>
17+
</test>
18+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="Test">
11+
<fillField userInput="{{Section<caret>}}" stepKey="fillPassword"/>
12+
</actionGroup>
13+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="TestAddOutOfStockProductToCompareListTest">
12+
<fillField userInput="{{Section<caret>}}" stepKey="fillBannerName" />
13+
</test>
14+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="TestAddOutOfStockProductToCompareListTest">
12+
<before>
13+
<createData entity="TestAdminProductsSection<caret>" stepKey="product">
14+
<requiredEntity createDataKey="category"/>
15+
</createData>
16+
</before>
17+
</test>
18+
</tests>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="TestAdminMenuCatalog" extends="TestAdminProductsSection<caret>">
12+
<data key="pageTitle">TestCatalog</data>
13+
</entity>
14+
</entities>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="TestAddOutOfStockProductToCompareListTest">
12+
<before>
13+
<updateData entity="TestAdminProductsSection<caret>" stepKey="product">
14+
<requiredEntity createDataKey="category"/>
15+
</updateData>
16+
</before>
17+
</test>
18+
</tests>

0 commit comments

Comments
 (0)