Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  *
  * @throws TimeoutException
  */
 public function fillField($locator, $value, Element $modal = null)
 {
     $selectContainer = $this->spin(function () use($modal) {
         return $modal->find('css', '.select2-container');
     });
     $placeholder = $selectContainer->find('css', sprintf('.select2-chosen:contains("%s")', $locator));
     if ($placeholder) {
         $this->fillSelect2Field($selectContainer, $value);
     } else {
         parent::fillField($locator, $value, $modal);
     }
 }
Ejemplo n.º 2
0
 /**
  * This method allows to fill a field by passing the label
  *
  * @param string  $label
  * @param string  $value
  * @param Element $element
  */
 public function fillField($label, $value, Element $element = null)
 {
     $this->getSession()->wait(5000);
     $isLabel = false;
     try {
         $fieldContainer = $this->findFieldContainer($label);
     } catch (ElementNotFoundException $e) {
         $isLabel = true;
         $fieldContainer = $this->extractLabelElement($label, $element);
     }
     $fieldType = $this->getFieldType($fieldContainer, $isLabel);
     switch ($fieldType) {
         case 'text':
         case 'date':
         case 'number':
             $this->fillTextField($fieldContainer, $value);
             break;
         case 'textArea':
             $this->fillTextAreaField($fieldContainer, $value);
             break;
         case 'metric':
             $this->fillMetricField($fieldContainer, $value);
             break;
         case 'multiSelect':
             $this->fillMultiSelectField($fieldContainer, $value);
             break;
         case 'price':
             $this->fillPriceField($fieldContainer, $value);
             break;
         case 'select':
             $this->fillSelectField($fieldContainer, $value);
             break;
         default:
             parent::fillField($fieldContainer->labelContent, $value);
             break;
     }
 }