@@ -43,7 +43,23 @@ class SelectVersion extends Form
43
43
*
44
44
* @var string
45
45
*/
46
- private $ otherComponentsGrid = '.admin__data-grid-wrap[ng-show="componentsProcessed"] ' ;
46
+ private $ otherComponentsGrid = '.admin__data-grid-outer-wrap ' ;
47
+
48
+ /**
49
+ * @var string
50
+ */
51
+ private $ empty = '[ng-show="componentsProcessed && total == 0"] ' ;
52
+
53
+ /**
54
+ * @var string
55
+ */
56
+ private $ waitEmpty =
57
+ '//div[contains(@ng-show, "componentsProcessed && total") and not(contains(@class,"ng-hide"))] ' ;
58
+
59
+ /**
60
+ * @var OtherComponentsGrid
61
+ */
62
+ private $ otherComponentGrid ;
47
63
48
64
/**
49
65
* Click on 'Next' button.
@@ -93,7 +109,33 @@ public function chooseUpgradeOtherComponents(array $packages)
93
109
{
94
110
$ this ->_rootElement ->find ("[for=yesUpdateComponents] " )->click ();
95
111
$ this ->waitForElementNotVisible ("[ng-show= \"!componentsProcessed \"" );
96
- $ this ->getOtherComponentsGrid ()->setVersions ($ packages );
112
+
113
+ if (!$ this ->isComponentsEmpty ()) {
114
+ $ otherComponentGrid = $ this ->getOtherComponentsGrid ();
115
+ $ otherComponentGrid ->setItemsPerPage (200 );
116
+ $ otherComponentGrid ->setVersions ($ packages );
117
+ }
118
+ }
119
+
120
+ /**
121
+ * Check that grid is empty.
122
+ *
123
+ * @return bool
124
+ */
125
+ public function isComponentsEmpty ()
126
+ {
127
+ $ this ->waitForElementVisible ($ this ->waitEmpty , Locator::SELECTOR_XPATH );
128
+ return $ this ->_rootElement ->find ($ this ->empty )->isVisible ();
129
+ }
130
+
131
+ /**
132
+ * Returns selected packages.
133
+ *
134
+ * @return array
135
+ */
136
+ public function getSelectedPackages ()
137
+ {
138
+ return $ this ->getOtherComponentsGrid ()->getSelectedPackages ();
97
139
}
98
140
99
141
/**
@@ -103,9 +145,12 @@ public function chooseUpgradeOtherComponents(array $packages)
103
145
*/
104
146
private function getOtherComponentsGrid ()
105
147
{
106
- return $ this ->blockFactory ->create (
107
- OtherComponentsGrid::class,
108
- ['element ' => $ this ->_rootElement ->find ($ this ->otherComponentsGrid )]
109
- );
148
+ if (!isset ($ this ->otherComponentGrid )) {
149
+ $ this ->otherComponentGrid = $ this ->blockFactory ->create (
150
+ OtherComponentsGrid::class,
151
+ ['element ' => $ this ->_rootElement ->find ($ this ->otherComponentsGrid )]
152
+ );
153
+ }
154
+ return $ this ->otherComponentGrid ;
110
155
}
111
156
}
0 commit comments