forked from abak-press/apress-selenium_products
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ovsyanik-ka
committed
Oct 17, 2017
1 parent
f1a3118
commit 13d992d
Showing
3 changed files
with
113 additions
and
11 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
lib/apress/selenium_eti/spec/company_site/eti/product_creation_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
require 'spec_helper' | ||
|
||
describe 'ЕТИ' do | ||
cs_eti_page = CompanySite::EtiPage.new | ||
cs_main_page = CompanySite::MainPage.new | ||
|
||
before(:all) do | ||
log_in_as(:user) | ||
navigate_to_eti | ||
cs_main_page.close_banner | ||
end | ||
|
||
describe 'Создание товара' do | ||
context 'когда товар без рубрики' do | ||
before(:all) do | ||
@name = Faker::Number.number(5) | ||
cs_eti_page.add_product | ||
cs_eti_page.name = @name | ||
cs_eti_page.wait_until { cs_eti_page.save_status == 'Все изменения сохранены' } | ||
cs_eti_page.refresh | ||
cs_eti_page.wait_until { cs_eti_page.save_status == 'Все изменения сохранены' } | ||
cs_eti_page.search_product(@name) | ||
end | ||
|
||
it 'введенное имя отображается' do | ||
expect(cs_eti_page.product_name?(@name)).to be true | ||
end | ||
|
||
it 'товар не опубликован' do | ||
expect(cs_eti_page.product_unpublished?(@name)).to be true | ||
end | ||
|
||
after(:all) { cs_eti_page.delete_product(@name) } | ||
end | ||
|
||
context 'когда товар с рубрикой' do | ||
before(:all) do | ||
@name = Faker::Number.number(5) | ||
cs_eti_page.add_product | ||
cs_eti_page.set_rubric(CONFIG['eti']['rubric']) | ||
cs_eti_page.name = @name | ||
cs_eti_page.wait_until { cs_eti_page.first_product_status_element.attribute('title') == 'Опубликованные' } | ||
cs_eti_page.refresh | ||
cs_eti_page.wait_until { cs_eti_page.save_status == 'Все изменения сохранены' } | ||
cs_eti_page.search_product(@name) | ||
end | ||
|
||
it 'введенное имя отображается' do | ||
expect(cs_eti_page.product_name?(@name)).to be true | ||
end | ||
|
||
it 'рубрика привязана' do | ||
expect(cs_eti_page.product_rubric_tree(@name)).to include CONFIG['eti']['rubric'] | ||
end | ||
|
||
it 'товар опубликован' do | ||
expect(cs_eti_page.product_published?(@name)).to be true | ||
end | ||
|
||
after(:all) { cs_eti_page.delete_product(@name) } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters