/** * @guy CurrenciesTester\CurrenciesSteps */ public function CreateAndExitButton(CurrenciesTester\CurrenciesSteps $I) { $name = "лира"; $isocode = "лира"; $symbol = "лира"; $rate = "01030.2"; $save = "saveexit"; $I->CreateCurrency($name, $isocode, $symbol, $rate, $save); // $I->waitForElementVisible('.alert.in.fade.alert-success'); $I->waitForText('Валюта создана'); // $I->waitForElementNotVisible('.alert.in.fade.alert-success'); $I->waitForText('Список валют'); $name1 = "лира"; $isocode1 = "лира"; $symbol1 = "лира"; $rate1 = "1030.2000"; $I->CheckInListLanding($name1, $isocode1, $symbol1); $I->click(CurrenciesPage::CurrencyNameLine("last()")); $I->CheckInFields($name1, $isocode1, $symbol1, $rate1); InitTest::ClearAllCach($I); }
/** * Grab all currencies * * Grab all currencies in currencies list page and add them to array * If $settedTodeleteName passed olso delete currencies with this name * * @param AcceptanceTester $I * @param array|string $settedTodeleteName set it, to delete one currency or array of currencies * @return array all creted currencies */ public function grabAllCreatedCurrencies() { $I = $this; $Currencies = []; $I->amOnPage(\CurrenciesPage::$URL); $CurrenciesAmount = $I->grabClassCount($I, 'mainCurrency'); for ($row = 1; $row <= $CurrenciesAmount; ++$row) { $findedCur = $I->grabTextFrom(\CurrenciesPage::CurrencyNameLine($row)); $Currencies[] = $findedCur; } return $Currencies; }
public function DeleteCurUsedInProducts(CurrenciesTester $I) { //Проверка возможности удаления валюты, которая используется в товарах $I->amOnPage("/admin/components/run/shop/currencies"); $I->click(CurrenciesPage::RadioButtonLine('1')); $I->wait('1'); $IsoCur = $I->grabTextFrom(".//*[@class='']/tr[3]/td[3]"); $id = $I->grabTextFrom(".//*[@class='']/tr[3]/td[1]"); $SymbCur = $I->grabTextFrom(".//*[@class='']/tr[3]/td[4]"); $I->comment("{$IsoCur}"); $I->comment("{$id}"); $I->comment("{$SymbCur}"); $MainCurIso = $I->grabTextFrom(".//*[@class='']/tr[1]/td[3]"); $this->MainCurSymb = $I->grabTextFrom(".//*[@class='']/tr[1]/td[4]"); $I->comment("{$MainCurIso}"); $I->comment("{$this->MainCurSymb}"); $I->click(CurrenciesPage::CurrencyNameLine('1')); $I->waitForText('Редактирование валют'); $I->fillField(CurrenciesPage::$Rate, '1'); $I->click(CurrenciesPage::$SaveAndExitButton); $I->waitForText('Список валют'); $I->click(CurrenciesPage::CurrencyNameLine('3')); $I->waitForText('Редактирование валют'); $I->fillField(CurrenciesPage::$Rate, '2'); $I->click(CurrenciesPage::$SaveAndExitButton); $I->waitForText('Список валют'); $I->amOnPage('/admin/components/run/shop/products/create'); $I->waitForText('Создание товара'); $this->price = 100; $I->fillField('.//*[@id="Name"]', 'Товар2'); $I->fillField(".//*[@id='ProductVariantRow_0']/td[2]/input", "{$this->price}"); $I->click(".//*[@id='ProductVariantRow_0']/td[3]/select"); $I->click(".//*[@id='ProductVariantRow_0']/td[3]/select/option[3]"); $I->wait('1'); $IsoProduct = $I->grabTextFrom(".//*[@id='ProductVariantRow_0']/td[3]/select/option[3]"); $I->comment("{$IsoProduct}"); $I->click(CurrenciesPage::$SaveButton); $I->waitForText("Продукт был успешно создан"); $I->assertEquals($IsoProduct, $IsoCur); $I->amOnPage("/"); $I->fillField(".//*[@id='inputString']", 'товар2'); $I->click("html/body/div[1]/div[1]/header/div[2]/div/div/div[2]/div[2]/div/form/span/button"); $I->wait('1'); $k = $I->grabTextFrom(".//*[@id='items-catalog-main']/li/div[1]/div[2]/span/span/span/span[1]"); $sym = $I->grabTextFrom(".//*[@id='items-catalog-main']/li/div[1]/div[2]/span/span/span/span[2]"); $i = $k * 2; $I->comment("{$i}", "{$k}", "{$sym}"); $I->assertEquals($i, $this->price); $I->assertEquals($sym, $this->MainCurSymb); $I->amOnPage("/admin/components/run/shop/currencies"); $I->click(CurrenciesPage::CurrencyNameLine('3')); $I->waitForText('Редактирование валют'); $I->fillField(CurrenciesPage::$Rate, '4'); $I->click(CurrenciesPage::$SaveAndExitButton); $I->waitForText('Список валют'); $I->waitForElementVisible('.alert.in.fade.alert-success'); $I->see('Изменения сохранены'); $I->waitForElementNotVisible('.alert.in.fade.alert-success'); $I->click(CurrenciesPage::$VerifyPrices); $I->waitForElementVisible('.alert.in.fade.alert-success'); $I->see('Цены обновлены', '.alert.in.fade.alert-success'); $I->amOnPage("/"); $I->fillField(".//*[@id='inputString']", 'товар2'); $I->click("html/body/div[1]/div[1]/header/div[2]/div/div/div[2]/div[2]/div/form/span/button"); $I->wait('1'); $k3 = $I->grabTextFrom(".//*[@id='items-catalog-main']/li/div[1]/div[2]/span/span/span/span[1]"); $sym3 = $I->grabTextFrom(".//*[@id='items-catalog-main']/li/div[1]/div[2]/span/span/span/span[2]"); $i3 = $k3 * 4; $I->comment("{$i3}", "{$k3}", "{$sym3}"); $I->assertEquals($i3, $this->price); $I->assertEquals($sym, $this->MainCurSymb); $I->amOnPage("/admin/components/run/shop/currencies"); $I->click(CurrenciesPage::DeleteButtonLine('3')); $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->waitForElement(".//*[@id='recount']"); $I->wait('1'); $I->see('Пересчет'); $I->see('Валюта используется в товарах. Пересчитать?'); $I->see('Пересчитать', ".//*[@id='recount']/div[3]/a[1]"); $I->see('Отменить', ".//*[@id='recount']/div[3]/a[2]"); $I->click(".//*[@id='recount']/div[3]/a[1]"); $I->waitForElementVisible('.alert.in.fade.alert-success'); $I->see('Преобразование завершено. Сейчас валюта может быть удалена'); $I->waitForElementNotVisible('.alert.in.fade.alert-success'); $I->click(CurrenciesPage::DeleteButtonLine('3')); $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; } } $I->click(CurrenciesPage::$VerifyPrices); $I->waitForElementVisible('.alert.in.fade.alert-success'); $I->see('Цены обновлены'); $I->waitForElementNotVisible('.alert.in.fade.alert-success'); }