@@ -125,10 +125,11 @@ private function clickOnNextPage()
125
125
*/
126
126
private function canClickOnNextPage ()
127
127
{
128
- return !$ this ->_rootElement ->find (
129
- ".admin__data-grid-pager .action-next " ,
130
- Locator::SELECTOR_CSS
131
- )->isDisabled ();
128
+ $ element = $ this ->_rootElement ->find (".admin__data-grid-pager .action-next " );
129
+ if ($ element ->isVisible ()) {
130
+ return !$ element ->isDisabled ();
131
+ }
132
+ return false ;
132
133
}
133
134
134
135
/**
@@ -184,7 +185,7 @@ private function convertVersionFixtureToRegexp($sampleDataVersion)
184
185
*/
185
186
private function titleContainsSampleData ($ element )
186
187
{
187
- return preg_match ('/magento\/*+ sample-data/ ' , $ element ->getText ());
188
+ return preg_match ('/magento\/.* sample-data/ ' , $ element ->getText ());
188
189
}
189
190
190
191
/**
@@ -194,8 +195,7 @@ private function titleContainsSampleData($element)
194
195
* @param string $sampleDataVersionForRegex
195
196
* @return void
196
197
*/
197
- private function setSampleDataVersionToRowSelect ($ rowIndex , $ sampleDataVersionForRegex )
198
- {
198
+ private function setSampleDataVersionToRowSelect ($ rowIndex , $ sampleDataVersionForRegex ) {
199
199
$ selectElement = $ this ->getSelectFromRow ($ rowIndex );
200
200
$ optionTextArray = [];
201
201
foreach ($ selectElement ->getElements ('option ' ) as $ option ) {
@@ -206,16 +206,18 @@ private function setSampleDataVersionToRowSelect($rowIndex, $sampleDataVersionFo
206
206
}
207
207
}
208
208
209
- uasort (
210
- $ optionTextArray ,
211
- function ($ versionOne , $ versionTwo ) {
212
- return version_compare ($ versionOne , $ versionTwo ) * -1 ;
209
+ if (!empty ($ optionTextArray )) {
210
+ uasort (
211
+ $ optionTextArray ,
212
+ function ($ versionOne , $ versionTwo ) {
213
+ return version_compare ($ versionOne , $ versionTwo ) * -1 ;
214
+ }
215
+ );
216
+
217
+ $ toSelectVersion = key ($ optionTextArray );
218
+ if ($ toSelectVersion !== $ selectElement ->getText ()) {
219
+ $ selectElement ->setValue ($ toSelectVersion );
213
220
}
214
- );
215
-
216
- $ toSelectVersion = key ($ optionTextArray );
217
- if ($ toSelectVersion !== $ selectElement ->getText ()) {
218
- $ selectElement ->setValue ($ optionTextArray []);
219
221
}
220
222
}
221
223
}
0 commit comments