/** * @group verify */ public function miniMessagesActive(PaymentTester $I) { $Class = $I->grabAttributeFrom(PaymentListPage::ActiveLine(1), 'class'); $I->comment($Class); //BUG HERE------------------------------------------------------------------------------------------ // $I->click(PaymentListPage::ActiveLine(1)); //BUG HERE inscription ACTIVE //-------------------------------------------------------------------------------------------------- $I->wait(1); $I->moveMouseOver(PaymentListPage::ActiveLine(1)); $I->waitForElementVisible('.tooltip-inner'); if ($Class == 'prod-on_off') { $I->see('показать', '.tooltip-inner'); } else { $I->see('не показывать', '.tooltip-inner'); } $I->click(PaymentListPage::ActiveLine(1)); $I->moveMouseOver('//tbody//tr[3]'); $Class = $I->grabAttributeFrom(PaymentListPage::ActiveLine(1), 'class'); $I->comment($Class); $I->moveMouseOver(PaymentListPage::ActiveLine(1)); if ($Class == 'prod-on_off') { $I->see('показать', '.tooltip-inner'); } else { $I->see('не показывать', '.tooltip-inner'); } }
/** * Delete Payments * * Delete all payment methods with names from array, * or all methods with current name if passed string * * @param AcceptanceTester $I controller * @param array|string $paymethods Names of payment methods witch you want to delete */ public function deletePayments($paymethods) { $I = $this; $haveSomethingToRemove = false; $I->amOnPage(\PaymentListPage::$URL); $MethodsAmount = $I->grabClassCount($I, 'niceCheck') - 1; for ($row = 1; $row <= $MethodsAmount; ++$row) { $MethodName = $I->grabTextFrom(\PaymentListPage::MethodNameLine($row)); if (is_array($paymethods)) { if (in_array($MethodName, $paymethods)) { $I->click(\PaymentListPage::CheckboxLine($row)); $haveSomethingToRemove = true; } } elseif (is_string($paymethods)) { if ($paymethods == $MethodName) { $I->click(\PaymentListPage::CheckboxLine($row)); $haveSomethingToRemove = true; } } } if ($haveSomethingToRemove) { $I->click(\PaymentListPage::$ButtonDelete); $I->waitForElementVisible(\PaymentListPage::$DeleteWindowQuestion); $I->click(\PaymentListPage::$DeleteWindowButtonDelete); $I->waitForElementNotVisible(\PaymentListPage::$DeleteWindowQuestion); } else { $I->comment('nothing to delete'); } return $haveSomethingToRemove; }
/** * Grab all payments from payment methods list page and record them to array $PaymentMethods * @param AcceptanceTester $I * @return array $PaymentMethods */ function GrabAllCreatedPayments() { $I = $this; $I->amOnPage(\PaymentListPage::$URL); $I->waitForText("Список способов оплаты", NULL, ".title"); /** * @var int $rows Count of table rows * @var int $row Current row in table */ $rows = $I->grabClassCount($I, 'niceCheck') - 1; if ($rows > 0) { //was !=0 $I->comment("I want to read and remember all created payment methods"); for ($row = 1; $row <= $rows; ++$row) { $PaymentMethods[$row] = $I->grabTextFrom(\PaymentListPage::MethodNameLine($row)); } } else { $I->fail("there are no created payments"); } return $PaymentMethods; }
public function DeleteCurUsedInPaymentMethods(CurrenciesTester $I) { //Проверка возможности удаления валюты, которая используется в способах оплаты $I->amOnPage("/admin/components/run/shop/currencies"); $SymbolCur = $I->grabTextFrom(".//*[@class='']/tr[4]/td[4]"); $id = $I->grabTextFrom(".//*[@class='']/tr[4]/td[1]"); $I->comment("{$SymbolCur}"); $I->comment("{$id}"); $I->amOnPage('/admin/components/run/shop/paymentmethods/create'); $I->waitForText('Создание способа оплаты'); $I->fillField(PaymentCreatePage::$FieldName, 'Оплата'); $I->click(PaymentCreatePage::$SelectCurrency); $I->click(PaymentCreatePage::SelectCurrency('4')); $I->wait('1'); $SelectCur = $I->grabTextFrom(PaymentCreatePage::SelectCurrency('4')); $I->comment("{$SelectCur}"); $SelectCur = trim(preg_replace("/\\s+/", " ", $SelectCur)); $Cur = explode(" ", $SelectCur); foreach ($Cur as $key => $value) { if ($value) { $I->comment("{$key}: {$value}"); } } $text = $Cur[2]; $I->comment($text); $I->click(PaymentCreatePage::$ButtonCreate); $I->waitForText("Способ оплаты создан"); $I->assertEquals($SymbolCur, $text); $I->amOnPage("/admin/components/run/shop/currencies"); $I->click(CurrenciesPage::DeleteButtonLine('4')); $I->waitForElement(".//div[@class='modal hide fade in']"); $I->see('Удалить валюту'); $I->see('Удалить выбранную валюту?'); $I->see('Удалить', './/*[@id="first"]/div[3]/a[1]'); $I->see('Отменить', './/*[@id="first"]/div[3]/a[2]'); $I->click('.//*[@id="first"]/div[3]/a[1]'); $I->waitForElementVisible('.alert.in.fade.alert-error'); $I->see('Невозможно удалить валюту. Эта валюта используется в Способах оплаты.'); $I->waitForElementNotVisible('.alert.in.fade.alert-error'); $I->amOnPage('/admin/components/run/shop/paymentmethods/index'); $I->click(PaymentListPage::CheckboxLine('last()')); $I->wait('2'); $I->click(PaymentListPage::$ButtonDelete); $I->waitForElement(".//*[@id='mainContent']/div/div[1]"); $I->wait('1'); $I->click(".//*[@id='mainContent']/div/div[1]/div[3]/a[1]"); $I->waitForElementVisible('.alert.in.fade.alert-success'); $I->see('Способ оплаты удален'); $I->waitForElementNotVisible('.alert.in.fade.alert-success'); $I->amOnPage("/admin/components/run/shop/currencies"); $I->click(CurrenciesPage::DeleteButtonLine('4')); $I->waitForElement(".//div[@class='modal hide fade in']"); $I->see('Удалить валюту'); $I->see('Удалить выбранную валюту?'); $I->see('Удалить', './/*[@id="first"]/div[3]/a[1]'); $I->see('Отменить', './/*[@id="first"]/div[3]/a[2]'); $I->click('.//*[@id="first"]/div[3]/a[1]'); $I->waitForElementVisible('.alert.in.fade.alert-success'); $I->see('Валюта успешно удалена'); $I->waitForElementNotVisible('.alert.in.fade.alert-success'); $rows = $I->grabTagCount($I, "tbody tr"); for ($j = 1; $j <= $rows; $j++) { $idAfter = $I->grabTextFrom("//tbody/tr[{$j}]/td[1]"); $I->comment($idAfter); if ($idAfter == $id) { $I->fail("NOT DELETED"); break; } } InitTest::ClearAllCach($I); }