Skip to content

Commit 992a82e

Browse files
author
Vitaliy Boyko
committed
Fixed test names, and selector contributor
1 parent edea912 commit 992a82e

File tree

9 files changed

+84
-18
lines changed

9 files changed

+84
-18
lines changed

src/com/magento/idea/magento2plugin/completion/xml/XmlCompletionContributor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ public XmlCompletionContributor() {
209209
// mftf selector completion contributor
210210
extend(CompletionType.BASIC,
211211
psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
212-
.inside(XmlPatterns.xmlAttribute())
212+
.inside(XmlPatterns.xmlAttribute()
213+
.withName(MftfActionGroup.SELECTOR_ATTRIBUTE))
213214
.inFile(xmlFile().withName(string().endsWith("Test.xml"))),
214215
new SelectorCompletionProvider()
215216
);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
package com.magento.idea.magento2plugin.magento.files;
6+
7+
public class MftfActionGroup {
8+
9+
public static String SELECTOR_ATTRIBUTE = "selector";
10+
}
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="Section<caret>" stepKey="product">
14+
<requiredEntity createDataKey="category"/>
15+
</createData>
16+
</before>
17+
</test>
18+
</tests>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="TestAdminProductsSection">
12+
<element name="testaddSelectedProducts" type="button" selector=".product_form_product_form_bundle-items_modal button.action-primary" timeout="30"/>
13+
<element name="testfilters" type="button" selector=".product_form_product_form_bundle-items_modal button[data-action='grid-filter-expand']" timeout="30"/>
14+
<element name="testapplyFilters" type="button" selector=".product_form_product_form_bundle-items_modal [data-action='grid-filter-apply']" timeout="30"/>
15+
</section>
16+
</sections>
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="TestAdminProductsPanelSection">
12+
<element name="testaddSelectedProducts" type="button" selector=".product_form_product_form_bundle-items_modal button.action-primary" timeout="30"/>
13+
</section>
14+
</sections>

tests/com/magento/idea/magento2plugin/completion/xml/BackendModelXmlCompletionRegistrarTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ public void testSystemXmlBackendModelAttributeMatchWithFile() {
3737
ModuleSystemXml.FILE_NAME
3838
);
3939

40-
assertCompletionMatchWithFilePositiveCase(filePath, systemXmlBackendModelLookupStringCheck);
40+
assertFileConatainsCompletions(filePath, systemXmlBackendModelLookupStringCheck);
4141
}
4242

4343
public void testSystemXmlBackendModelAttributeDontMatchWithFile() {
4444
String filePath = this.getFixturePath(
4545
"other-file-than-system.xml"
4646
);
4747

48-
assertCompletionMatchWithFileNegativeCase(
48+
assertFileNotConatainsCompletions(
4949
filePath,
5050
systemXmlBackendModelLookupStringCheck
5151
);
@@ -74,15 +74,15 @@ public void testConfigXmlBackendModelAttributeMatchWithFile() {
7474
ModuleConfigXml.FILE_NAME
7575
);
7676

77-
assertCompletionMatchWithFilePositiveCase(filePath, configXmlBackendModelLookupStringCheck);
77+
assertFileConatainsCompletions(filePath, configXmlBackendModelLookupStringCheck);
7878
}
7979

8080
public void testConfigXmlBackendModelAttributeDontMatchWithFile() {
8181
String filePath = this.getFixturePath(
8282
"other-file-than-config.xml"
8383
);
8484

85-
assertCompletionMatchWithFileNegativeCase(
85+
assertFileNotConatainsCompletions(
8686
filePath,
8787
configXmlBackendModelLookupStringCheck
8888
);

tests/com/magento/idea/magento2plugin/completion/xml/CompletionXmlFixtureTestCase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void assertCompletionContains(String filePath, String... lookupStrings) {
2929
checkContainsCompletion(lookupStrings);
3030
}
3131

32-
protected void assertCompletionMatchWithFilePositiveCase(
32+
protected void assertFileConatainsCompletions(
3333
String positiveFilePath,
3434
String... lookupStrings
3535
) {
@@ -42,7 +42,7 @@ protected void assertCompletionMatchWithFilePositiveCase(
4242
checkContainsCompletion(lookupStrings, messageEmptyLookup, messageCompletionContains);
4343
}
4444

45-
protected void assertCompletionMatchWithFileNegativeCase(
45+
protected void assertFileNotConatainsCompletions(
4646
String negativeFilePath,
4747
String... lookupStrings
4848
) {

tests/com/magento/idea/magento2plugin/completion/xml/MftfEntityNameCompletionRegistrarTest.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,48 +19,55 @@ public void testCreateDataActionGroupMustProvideCompletion () {
1919
);
2020
myFixture.copyFileToProject(filePath);
2121

22-
assertCompletionMatchWithFilePositiveCase(filePath, lookupStringsEntities);
22+
assertFileConatainsCompletions(filePath, lookupStringsEntities);
2323
}
2424

2525
public void testCreateDataInTestMustProvideCompletion () {
2626
String filePath = this.getFixturePath("TestMftfTest.xml");
2727
myFixture.copyFileToProject(filePath);
2828

29-
assertCompletionMatchWithFilePositiveCase(filePath, lookupStringsEntities);
29+
assertFileConatainsCompletions(filePath, lookupStringsEntities);
30+
}
31+
32+
public void testCreateDataInTestWithSectionMustBeEmpty () {
33+
String filePath = this.getFixturePath("TestMftfTest.xml");
34+
myFixture.copyFileToProject(filePath);
35+
36+
assertCompletionNotShowing(filePath);
3037
}
3138

3239
public void testUpdateDataActionGroupMustProvideCompletion () {
3340
String filePath = this.getFixturePath("TestActionGroup.xml");
3441
myFixture.copyFileToProject(filePath);
3542

36-
assertCompletionMatchWithFilePositiveCase(filePath, lookupStringsEntities);
43+
assertFileConatainsCompletions(filePath, lookupStringsEntities);
3744
}
3845

3946
public void testUpdateDataInTestMustProvideCompletion () {
4047
String filePath = this.getFixturePath("TestMftfTest.xml");
4148
myFixture.copyFileToProject(filePath);
4249

43-
assertCompletionMatchWithFilePositiveCase(filePath, lookupStringsEntities);
50+
assertFileConatainsCompletions(filePath, lookupStringsEntities);
4451
}
4552

4653
public void testUserInputInActionGroupMustProvideCompletion () {
4754
String filePath = this.getFixturePath("TestActionGroup.xml");
4855
myFixture.copyFileToProject(filePath);
4956

50-
assertCompletionMatchWithFilePositiveCase(filePath, lookupStringsEntities);
57+
assertFileConatainsCompletions(filePath, lookupStringsEntities);
5158
}
5259

5360
public void testUserInputInTestMustProvideCompletion () {
5461
String filePath = this.getFixturePath("TestMftfTest.xml");
5562
myFixture.copyFileToProject(filePath);
5663

57-
assertCompletionMatchWithFilePositiveCase(filePath, lookupStringsEntities);
64+
assertFileConatainsCompletions(filePath, lookupStringsEntities);
5865
}
5966

6067
public void testEntityExtendsInDataMustProvideCompletion () {
6168
String filePath = this.getFixturePath("TestData.xml");
6269
myFixture.copyFileToProject(filePath);
6370

64-
assertCompletionMatchWithFilePositiveCase(filePath, lookupStringsEntities);
71+
assertFileConatainsCompletions(filePath, lookupStringsEntities);
6572
}
6673
}

tests/com/magento/idea/magento2plugin/completion/xml/SourceModelXmlCompletionRegistrarTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ public void testSourceModelXmlElementMatchWithFilePositiveCase() {
2525
String filePath = this.getFixturePath(ModuleSystemXml.FILE_NAME);
2626
myFixture.copyFileToProject(filePath);
2727

28-
assertCompletionMatchWithFilePositiveCase(filePath, lookupStringsCheck);
28+
assertFileConatainsCompletions(filePath, lookupStringsCheck);
2929
}
3030

3131
public void testSourceModelXmlElementMatchWithFileNegativeCase() {
3232
String filePath = this.getFixturePath("not-system.xml");
3333
myFixture.copyFileToProject(filePath);
3434

35-
assertCompletionMatchWithFileNegativeCase(
35+
assertFileNotConatainsCompletions(
3636
filePath,
3737
lookupStringsCheck
3838
);
@@ -49,14 +49,14 @@ public void testSourceModelXmlAttributeMatchWithFilePositiveCase() {
4949
String filePath = this.getFixturePath(ModuleWidgetXml.FILE_NAME);
5050
myFixture.copyFileToProject(filePath);
5151

52-
assertCompletionMatchWithFilePositiveCase(filePath, lookupStringsCheck);
52+
assertFileConatainsCompletions(filePath, lookupStringsCheck);
5353
}
5454

5555
public void testSourceModelXmlAttributeMatchWithFileNegativeCase() throws IOException {
5656
String filePath = this.getFixturePath("not-widget.xml");
5757
myFixture.copyFileToProject(filePath);
5858

59-
assertCompletionMatchWithFileNegativeCase(
59+
assertFileNotConatainsCompletions(
6060
filePath,
6161
lookupStringsCheck
6262
);

0 commit comments

Comments
 (0)