/**
  *@group verify
  */
 public function DeliveryEditElements(DeliveryTester $I)
 {
     $I->wantTo("Verifyy all elements in Delivery Edit page");
     $I->wait("1");
     $method = $I->grabTextFrom(DeliveryPage::ListMethodLine(1));
     $I->comment("Selected method is: {$method}");
     $I->click($method);
     $I->waitForText("Редактирование способа доставки: {$method}");
     $I->see("Редактирование способа доставки: {$method}", '.title');
     $I->see("Редактирование способа доставки", "//thead/tr/th");
     $I->see("Название: *", DeliveryEditPage::$FieldNameLabel);
     $I->see("Описание", DeliveryEditPage::$FieldDescriptionLabel);
     $I->see("Описание цены доставки", DeliveryEditPage::$FieldDescriptionPriceLabel);
     $I->See("Цена:", DeliveryEditPage::$FieldPriceLabel);
     $I->see("Бесплатен от", DeliveryEditPage::$FieldFreeFromLabel);
     $I->see("Цена уточняется", DeliveryEditPage::$CheckboxPriceSpecifiedLabel);
     if ($I->grabAttributeFrom(DeliveryEditPage::$CheckboxPriceSpecified . '/..', 'class') == 'frame_label no_connection') {
         $I->click(DeliveryEditPage::$CheckboxPriceSpecified);
     }
     $I->waitForElement(DeliveryCreatePage::$FieldPriceSpecified);
     //________________________________replace(was Wait for element visible) for QA_server
     $I->see("Сообщение про уточнение цены:", DeliveryEditPage::$FieldPriceSpecifiedLabel);
     $I->see("Сохранить и выйти", DeliveryEditPage::$ButtonSaveExit);
     $I->see("Сохранить", DeliveryEditPage::$ButtonSave);
     $I->see("Вернуться", DeliveryEditPage::$ButtonBack);
     $I->click(DeliveryEditPage::$ButtonBack);
     $I->waitForText("Список способов доставки");
 }
Exemplo n.º 2
0
 /**
  * Works after Autorization before all tests
  * @staticvar int $callCount 0 - first time didn't work, 
  *                           >0 - searching current delivery in list 
  * 
  * @var bool $methodCreated true if current method($this->name) finded in list
  *                          if false Create new delivery method for edit      
  *                   
  * @guy DeliveryTester\DeliverySteps
  */
 public function _before(DeliveryTester\DeliverySteps $I)
 {
     //        static $LoggedIn = false;
     $methodCreated = false;
     if ($this->loggedin == true) {
         $I->amOnPage("/admin/components/run/shop/deliverymethods/index");
         $rows = $I->grabClassCount($I, 'niceCheck') - 1;
         for ($row = 1; $row <= $rows; ++$row) {
             $Cmethod = $I->grabTextFrom(DeliveryPage::ListMethodLine($row));
             if ($this->Name == $Cmethod) {
                 $methodCreated = true;
                 $I->click(DeliveryPage::ListMethodLine($row));
                 break;
             }
         }
         if (!$methodCreated) {
             $I->createDelivery($this->Name);
             $methodCreated = true;
         }
         $I->waitForText("Редактирование способа доставки: {$this->Name}", NULL, ".title");
     }
     $this->CreatedMethods[] = $this->Name;
     //        $LoggedIn = true;
     //        $this->loggedin = true;
 }
 /**
  * @group message
  * @guy DeliveryTester\DeliverySteps
  */
 public function listDeleteAlert(DeliveryTester\DeliverySteps $I)
 {
     $name = "Доставка удаление";
     $I->createDelivery($name);
     $I->waitForText("Редактирование способа доставки: " . $name, null, '.title');
     $I->amOnPage(DeliveryPage::$URL);
     $AllMethodsCount = $I->grabClassCount($I, "niceCheck") - 1;
     for ($row = 1; $row <= $AllMethodsCount; ++$row) {
         $CurrentRowMethod = $I->grabTextFrom(DeliveryPage::ListMethodLine($row));
         if ($CurrentRowMethod == $name) {
             $I->click(DeliveryPage::ListCheckboxLine($row));
         }
     }
     $I->click(DeliveryPage::$DeleteButton);
     $I->waitForText("Удаление способов доставки", NULL, "//*[@id='mainContent']/div/div[1]/div[1]/h3");
     $I->wait(1);
     $I->click(DeliveryPage::$DeleteWindowDelete);
     $I->exactlySeeAlert($I, 'success', 'Способ доставки удален');
     //    $I->CheckForAlertPresent('success', 'delete');
 }
Exemplo n.º 4
0
 /**
  * @param array             $Methods    Names of delivery methods which you want to delete         
  */
 public function deleteDelivery($Methods)
 {
     $I = $this;
     $I->amOnPage(\DeliveryPage::$URL);
     $HaveMethodsToDelete = false;
     $AllMethodsCount = $I->grabClassCount($I, "niceCheck") - 1;
     for ($row = 1; $row <= $AllMethodsCount; ++$row) {
         $CurrentRowMethod = $I->grabTextFrom(\DeliveryPage::ListMethodLine($row));
         if (is_array($Methods)) {
             if (in_array($CurrentRowMethod, $Methods)) {
                 $I->click(\DeliveryPage::ListCheckboxLine($row));
                 $HaveMethodsToDelete = true;
             }
         } else {
             if ($CurrentRowMethod == $Methods) {
                 $I->click(\DeliveryPage::ListCheckboxLine($row));
                 $HaveMethodsToDelete = true;
             }
         }
     }
     if ($HaveMethodsToDelete) {
         $I->click(\DeliveryPage::$DeleteButton);
         $I->waitForText("Удаление способов доставки", NULL, "//*[@id='mainContent']/div/div[1]/div[1]/h3");
         $I->click(\DeliveryPage::$DeleteWindowDelete);
         $I->wait('3');
     }
 }
Exemplo n.º 5
0
 /**
  * Checking current parameters in Delivery List page 
  * if you want to skip verifying of some parameters type null
  * @param sring             $name       Delivery name
  * @param string            $active     Active checkbox on - enabled |off - disabled 
  * @param int|string|float  $price      Delivery price
  * @param int|string|float  $freefrom   Delivery free from
  * @return void
  */
 function CheckInList($name, $active = null, $price = null, $freefrom = null)
 {
     $I = $this;
     $I->wait(3);
     $I->amOnPage(\DeliveryPage::$URL);
     $I->waitForText('Список способов доставки');
     $rows = $I->grabTagCount($I, "tbody tr");
     $I->comment($rows);
     $present = FALSE;
     if ($rows > 0) {
         for ($j = 1; $j <= $rows; ++$j) {
             $method = $I->grabTextFrom(\DeliveryPage::ListMethodLine($j));
             $I->comment($method);
             if ($method == $name) {
                 $present = TRUE;
                 break;
             }
         }
     }
     $I->comment("results: \n Method: \n{$method} Present: {$present} in row: {$j}\n");
     //Error when method isn't present in delivery list page
     $present ? $I->assertEquals($method, $name) : $I->fail("Method wasn't created");
     if ($active) {
         $attribute = $I->grabAttributeFrom(\DeliveryPage::ListActiveButtonLine($j), "class");
         switch ($active) {
             case 'on':
                 $I->assertEquals("prod-on_off ", $attribute);
                 break;
             case 'off':
                 $I->assertEquals("prod-on_off disable_tovar", $attribute);
                 break;
         }
     }
     if ($price) {
         $Cprice = $I->grabTextFrom(\DeliveryPage::ListPriceLine($j));
         $price = number_format($price, 5, ".", "");
         $I->assertEquals(preg_replace('/[^0-9.]*/u', '', $Cprice), $price);
     }
     if ($freefrom) {
         $Cfreefrom = $I->grabTextFrom(\DeliveryPage::ListFreeFromLine($j));
         $freefrom = number_format($freefrom, 5, ".", "");
         $I->assertEquals(preg_replace('/[^0-9.]*/u', '', $Cfreefrom), $freefrom);
     }
 }