コード例 #1
0
 /**
  * Check that all created currencies present is select menu
  * 
  * @group create
  * @guy PaymentTester\PaymentSteps
  */
 public function currenciesCheck(PaymentTester\PaymentSteps $I)
 {
     $CreatedCurrencies = $I->GrabAllCreatedCurrencies();
     //add options of <select> at create page to array $Options[]
     $I->amOnPage(PaymentCreatePage::$URL);
     $OptionsAmount = $I->grabTagCount($I, 'select option', 0);
     $I->comment("{$OptionsAmount}");
     for ($row = 0; $row < $OptionsAmount; ++$row) {
         $Options[$row] = $I->grabTextFrom(PaymentCreatePage::SelectCurrency($row + 1));
         $Options[$row] = trim(array_shift(explode('(', $Options[$row])));
         //to get only name of currency
     }
     foreach ($CreatedCurrencies as $key => $Currecy) {
         $I->assertEquals($Currecy, $Options[$key]);
     }
 }
コード例 #2
0
 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);
 }