/** * @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'); }
/** * @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'); } }
/** * @group list * @guy DeliveryTester\DeliverySteps */ public function buttonDelete(DeliveryTester\DeliverySteps $I) { $I->amOnPage(DeliveryPage::$URL); $row = $I->SearchDeliveryMethod($this->name); if (!$row) { $I->createDelivery($this->name); $row = $I->SearchDeliveryMethod($this->name); } $I->comment("{$row}"); $I->click(DeliveryPage::ListCheckboxLine($row)); $I->click(DeliveryPage::$DeleteButton); $I->waitForText("Удаление способов доставки", NULL, "//*[@id='mainContent']/div/div[1]/div[1]/h3"); $I->wait(2); $I->click(DeliveryPage::$DeleteWindowDelete); $I->exactlySeeAlert($I, 'success', 'Способ доставки удален'); }