@@ -265,7 +265,7 @@ protected function addSingleCondition($condition, ElementInterface $context)
265
265
$ this ->addCondition ($ condition ['type ' ], $ context );
266
266
$ createdCondition = $ context ->find ($ this ->created , Locator::SELECTOR_XPATH );
267
267
$ this ->waitForCondition ($ createdCondition );
268
- $ this ->fillCondition ($ condition ['rules ' ], $ createdCondition );
268
+ $ this ->fillCondition ($ condition ['rules ' ], $ createdCondition, $ condition [ ' type ' ] );
269
269
}
270
270
271
271
/**
@@ -306,13 +306,14 @@ protected function addCondition($type, ElementInterface $context)
306
306
*
307
307
* @param array $rules
308
308
* @param ElementInterface $element
309
+ * @param string|null $type
309
310
* @return void
310
311
* @throws \Exception
311
312
*
312
313
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
313
314
* @SuppressWarnings(PHPMD.NPathComplexity)
314
315
*/
315
- protected function fillCondition (array $ rules , ElementInterface $ element )
316
+ protected function fillCondition (array $ rules , ElementInterface $ element, $ type = null )
316
317
{
317
318
$ this ->resetKeyParam ();
318
319
foreach ($ rules as $ rule ) {
@@ -333,7 +334,7 @@ protected function fillCondition(array $rules, ElementInterface $element)
333
334
334
335
if ($ this ->fillGrid ($ rule , $ param )) {
335
336
$ isSet = true ;
336
- } elseif ($ this ->fillSelect ($ rule , $ param )) {
337
+ } elseif ($ this ->fillSelect ($ rule , $ param, $ type )) {
337
338
$ isSet = true ;
338
339
} elseif ($ this ->fillText ($ rule , $ param )) {
339
340
$ isSet = true ;
@@ -390,11 +391,15 @@ protected function fillGrid($rule, ElementInterface $param)
390
391
*
391
392
* @param string $rule
392
393
* @param ElementInterface $param
394
+ * @param string|null $type
393
395
* @return bool
394
396
*/
395
- protected function fillSelect ($ rule , ElementInterface $ param )
397
+ protected function fillSelect ($ rule , ElementInterface $ param, $ type = null )
396
398
{
397
- $ value = $ param ->find ('select ' , Locator::SELECTOR_TAG_NAME , 'select ' );
399
+ //Avoid confusion between regions like: "Baja California" and "California".
400
+ $ value = $ type === 'Shipping State/Province '
401
+ ? $ param ->find ('select ' , Locator::SELECTOR_TAG_NAME , 'selectstate ' )
402
+ : $ param ->find ('select ' , Locator::SELECTOR_TAG_NAME , 'select ' );
398
403
if ($ value ->isVisible ()) {
399
404
$ value ->setValue ($ rule );
400
405
$ this ->click ();
0 commit comments