/** * Check Paymement in list * * Checks that passed method present at "payment list" page , * then checks the passed parameters and return his row, * or fail test if something wrong * * @param string $name Name of Payment method * @param string $CurrencyName checks currency name if isset * @param string $CurrencySymbol checks currency symbol if isset * @param bool $active checks that method: true - active || false unactive if isset * @return int return row of passed payment */ public function checkInList($name, $CurrencyName = null, $CurrencySymbol = null, $active = null) { $I = $this; isset($name) ? $I->comment("I search method {$name} in list") : $I->fail("name of payment method must be passed"); $I->amOnPage(\PaymentListPage::$URL); $I->waitForText("Список способов оплаты", NULL, ".title"); $present = false; $rows = $I->grabClassCount($I, 'niceCheck') - 1; if ($rows > 0) { for ($row = 1; $row <= $rows; ++$row) { $PaymentMethod = $I->grabTextFrom(\PaymentListPage::MethodNameLine($row)); if ($PaymentMethod == $name) { $I->assertEquals($PaymentMethod, $name, "Method {$PaymentMethod} present in row {$row}"); $present = true; break; } } } else { $I->fail("Couldn't find {$name}, there are no created payments"); } if (!$present) { $I->fail("There is no payment {$name} in list"); } if (isset($CurrencyName)) { $grabbedCurrencyName = $I->grabTextFrom(\PaymentListPage::CurrencyNameLine($row)); $I->assertEquals($grabbedCurrencyName, $CurrencyName); } if (isset($CurrencySymbol)) { $grabbedCurrencySymbol = $I->grabTextFrom(\PaymentListPage::CurrencySymbolLine($row)); $I->assertEquals($grabbedCurrencySymbol, $CurrencySymbol); } if (isset($active)) { $grabbedActiveClass = $I->grabAttributeFrom(\PaymentListPage::ActiveLine($row), 'class'); $active ? $I->assertEquals($grabbedActiveClass, 'prod-on_off ') : $I->assertEquals($grabbedActiveClass, 'prod-on_off disable_tovar'); } return $row; }