File tree 5 files changed +44
-12
lines changed
app/code/Magento/Customer
Model/ResourceModel/Group
dev/tests/functional/tests/app/Magento/Customer/Test
5 files changed +44
-12
lines changed Original file line number Diff line number Diff line change 12
12
*/
13
13
class Collection extends \Magento \Framework \Model \ResourceModel \Db \Collection \AbstractCollection
14
14
{
15
+ /**
16
+ * @var string
17
+ */
18
+ protected $ _idFieldName = 'customer_group_id ' ;
19
+
15
20
/**
16
21
* Resource initialization
17
22
*
Original file line number Diff line number Diff line change 439
439
<argument name =" mainTable" xsi : type =" string" >customer_group</argument >
440
440
<argument name =" eventPrefix" xsi : type =" string" >customer_group_grid_collection</argument >
441
441
<argument name =" eventObject" xsi : type =" string" >customer_group_collection</argument >
442
- <argument name =" resourceModel" xsi : type =" string" >Magento\Customer\Model\ResourceModel\Group\Collection </argument >
442
+ <argument name =" resourceModel" xsi : type =" string" >Magento\Customer\Model\ResourceModel\Group</argument >
443
443
</arguments >
444
444
</type >
445
445
</config >
Original file line number Diff line number Diff line change 6
6
7
7
namespace Magento \Customer \Test \Block \Adminhtml \Group ;
8
8
9
- use Magento \Backend \Test \Block \Widget \Grid ;
9
+ use \Magento \Ui \Test \Block \Adminhtml \DataGrid ;
10
+ use Magento \Mtf \Client \Element \SimpleElement ;
10
11
11
12
/**
12
13
* Class CustomerGroupGrid
13
14
* Adminhtml customer group grid
14
15
*/
15
- class CustomerGroupGrid extends Grid
16
+ class CustomerGroupGrid extends DataGrid
16
17
{
18
+ /**
19
+ * Select action toggle.
20
+ *
21
+ * @var string
22
+ */
23
+ protected $ selectAction = '.action-select ' ;
24
+
17
25
/**
18
26
* Initialize block elements
19
27
*
20
28
* @var array $filters
21
29
*/
22
30
protected $ filters = [
23
31
'code ' => [
24
- 'selector ' => '#customerGroupGrid_filter_type ' ,
32
+ 'selector ' => '.admin__data-grid-filters input[name*=customer_group_code] ' ,
25
33
],
26
34
];
27
35
28
36
/**
29
- * Locator value for grid to click
37
+ * Click on "Edit" link.
30
38
*
31
- * @var string
39
+ * @param SimpleElement $rowItem
40
+ * @return void
32
41
*/
33
- protected $ editLink = 'td[data-column="time"] ' ;
42
+ protected function clickEditLink (SimpleElement $ rowItem )
43
+ {
44
+ if ($ rowItem ->find ($ this ->selectAction )->isVisible ()) {
45
+ $ rowItem ->find ($ this ->selectAction )->click ();
46
+ }
47
+ $ rowItem ->find ($ this ->editLink )->click ();
48
+ }
34
49
}
Original file line number Diff line number Diff line change 9
9
use Magento \Backend \Test \Handler \Extractor ;
10
10
use Magento \Mtf \Fixture \FixtureInterface ;
11
11
use Magento \Mtf \Handler \Curl as AbstractCurl ;
12
+ use Magento \Mtf \Util \Protocol \CurlInterface ;
12
13
use Magento \Mtf \Util \Protocol \CurlTransport ;
13
14
use Magento \Mtf \Util \Protocol \CurlTransport \BackendDecorator ;
14
15
@@ -59,11 +60,22 @@ public function persist(FixtureInterface $fixture = null)
59
60
*/
60
61
public function getCustomerGroupId (array $ data )
61
62
{
62
- $ url = 'customer/group/index/sort/time/dir/desc ' ;
63
- $ regExp = '/.*id\/(\d+)\/.* ' . $ data ['code ' ] . '/siu ' ;
64
- $ extractor = new Extractor ($ url , $ regExp );
65
- $ match = $ extractor ->getData ();
63
+ $ url = $ _ENV ['app_backend_url ' ] . 'mui/index/render/ ' ;
64
+ $ data = [
65
+ 'namespace ' => 'customer_group_listing ' ,
66
+ 'filters ' => [
67
+ 'placeholder ' => true ,
68
+ 'customer_group_code ' => $ data ['code ' ]
69
+ ],
70
+ 'isAjax ' => true
71
+ ];
72
+ $ curl = new BackendDecorator (new CurlTransport (), $ this ->_configuration );
73
+
74
+ $ curl ->write ($ url , $ data , CurlInterface::POST );
75
+ $ response = $ curl ->read ();
76
+ $ curl ->close ();
66
77
78
+ preg_match ('/customer_group_listing_data_source.+items.+"customer_group_id":"(\d+)"/ ' , $ response , $ match );
67
79
return empty ($ match [1 ]) ? null : $ match [1 ];
68
80
}
69
81
}
Original file line number Diff line number Diff line change 9
9
<page name =" CustomerGroupIndex" area =" Adminhtml" mca =" customer/group/index" module =" Magento_Customer" >
10
10
<block name =" messagesBlock" class =" Magento\Backend\Test\Block\Messages" locator =" #messages .messages" strategy =" css selector" />
11
11
<block name =" gridPageActions" class =" Magento\Backend\Test\Block\GridPageActions" locator =" .page-main-actions" strategy =" css selector" />
12
- <block name =" customerGroupGrid" class =" Magento\Customer\Test\Block\Adminhtml\Group\CustomerGroupGrid" locator =" #customerGroupGrid " strategy =" css selector " />
12
+ <block name =" customerGroupGrid" class =" Magento\Customer\Test\Block\Adminhtml\Group\CustomerGroupGrid" locator =" //div[contains(@data-bind, 'customer_group_listing')] " strategy =" xpath " />
13
13
</page >
14
14
</config >
You can’t perform that action at this time.
0 commit comments