Skip to content

Commit

Permalink
fix(selenium): fix/AT-383
Browse files Browse the repository at this point in the history
  • Loading branch information
ovsyanik-ka committed Apr 9, 2021
1 parent cf532a7 commit 38c8247
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
describe 'Создание товара' do
context 'когда товар без рубрики' do
before(:all) do
@name = Faker::Number.number(5)
@name = Faker::Number.number(digits: 5)
@cs_eti_page.add_product
@cs_eti_page.set_name(@name)
@cs_eti_page.wait_saving
Expand All @@ -35,7 +35,7 @@

context 'когда товар с рубрикой' do
before(:all) do
@name = Faker::Number.number(5)
@name = Faker::Number.number(digits: 5)
@cs_eti_page.add_product
@cs_eti_page.set_name(@name)
@cs_eti_page.wait_saving
Expand Down Expand Up @@ -63,13 +63,13 @@
context 'когда копируем товар' do
before(:all) do
@product = {
name: Faker::Number.number(5),
name: Faker::Number.number(digits: 5),
rubric: CONFIG['eti']['rubric'],
exists: CONFIG['eti']['exists']['in stock'],
short_description: CONFIG['product_creation']['short_description']['valid'],
description: 'description',
price_from_to: {from: Faker::Number.number(3), to: Faker::Number.number(4)},
wholesale_price: {wholesale_price: Faker::Number.number(2), wholesale_number: Faker::Number.number(2)}
price_from_to: {from: Faker::Number.number(digits: 3), to: Faker::Number.number(digits: 4)},
wholesale_price: {wholesale_price: Faker::Number.number(digits: 2), wholesale_number: Faker::Number.number(digits: 2)}
}

@portal_traits = {
Expand All @@ -94,7 +94,6 @@
expect(@cs_eti_page.product_rows_elements[1].text).to eq @first_product
end

after(:all) { 2.times { @cs_eti_page.delete_product(@product[:name]) } }
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
describe 'Добавление групп' do
context 'когда привязываем группу к товару' do
before(:all) do
@product = {name: Faker::Number.number(5)}
@product = {name: Faker::Number.number(digits: 5)}
@cs_eti_page.create_and_set_product_fields(@product)
@cs_eti_page.set_group(CONFIG['product_creation']['group'])
@cs_eti_page.wait_saving
Expand Down
30 changes: 15 additions & 15 deletions lib/apress/selenium_eti/spec/company_site/eti/product_price_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,90 +13,90 @@

describe 'Установка цен', feature: 'company_site/eti/product_price_spec: Установка цен' do
before do
@name = Faker::Number.number(5)
@name = Faker::Number.number(digits: 5)
@cs_eti_page.add_product
@cs_eti_page.set_name(@name)
end

context 'когда цена точная', story: 'когда цена точная' do
before do
@price = Faker::Number.number(2)
@price = Faker::Number.number(digits: 2)
@cs_eti_page.set_price(@price)
@cs_eti_page.wait_saving
@cs_eti_page.search_product(@name)
end

it 'введеная цена отображается' do
expect(@cs_eti_page.product_price(@name)).to eq @price + ' руб.'
expect(@cs_eti_page.product_price(@name)).to eq @price.to_s + ' руб.'
end
end

context 'когда цена от и до', story: 'когда цена от и до' do
context 'когда только "от"' do
before do
@price_from = {from: Faker::Number.number(2)}
@price_from = {from: Faker::Number.number(digits: 2)}
@cs_eti_page.set_price_from_to(@price_from)
@cs_eti_page.wait_saving
@cs_eti_page.search_product(@name)
end

it 'введеная цена отображается' do
expect(@cs_eti_page.product_price(@name)).to eq 'от ' + @price_from[:from] + ' руб.'
expect(@cs_eti_page.product_price(@name)).to eq 'от ' + @price_from[:from].to_s + ' руб.'
end
end

context 'когда только "до"' do
before do
@price_to = {to: Faker::Number.number(2)}
@price_to = {to: Faker::Number.number(digits: 2)}
@cs_eti_page.set_price_from_to(@price_to)
@cs_eti_page.wait_saving
@cs_eti_page.search_product(@name)
end

it 'введеная цена отображается' do
expect(@cs_eti_page.product_price(@name)).to eq 'до ' + @price_to[:to] + ' руб.'
expect(@cs_eti_page.product_price(@name)).to eq 'до ' + @price_to[:to].to_s + ' руб.'
end
end

context 'когда заполняем "от" и "до"' do
before do
@price_from_to = {from: Faker::Number.number(2), to: Faker::Number.number(3)}
@price_from_to = {from: Faker::Number.number(digits: 2), to: Faker::Number.number(digits: 3)}
@cs_eti_page.set_price_from_to(@price_from_to)
@cs_eti_page.wait_saving
@cs_eti_page.search_product(@name)
end

it 'введеная цена отображается' do
expect(@cs_eti_page.price_value).to include @price_from_to[:from], @price_from_to[:to]
expect(@cs_eti_page.price_value).to include @price_from_to[:from].to_s, @price_from_to[:to].to_s
end
end
end

context 'когда цена со скидкой', story: 'когда цена со скидкой' do
before do
@discount_price = {previous: Faker::Number.number(3), discount: Faker::Number.number(2)}
@discount_price = {previous: Faker::Number.number(digits: 3), discount: Faker::Number.number(digits: 2)}
@cs_eti_page.set_discount_price(@discount_price)
@cs_eti_page.wait_saving
@cs_eti_page.search_product(@name)
end

it 'введеная цена отображается' do
expect(@cs_eti_page.discount_price_value).to include @discount_price[:discount]
expect(@cs_eti_page.previous_price_value).to include @discount_price[:previous]
expect(@cs_eti_page.discount_price_value).to include @discount_price[:discount].to_s
expect(@cs_eti_page.previous_price_value).to include @discount_price[:previous].to_s
end
end

context 'когда цена оптовая', story: 'когда цена оптовая' do
before do
@price = {wholesale_price: Faker::Number.number(2), wholesale_number: Faker::Number.number(1)}
@price = {wholesale_price: Faker::Number.number(digits: 2), wholesale_number: Faker::Number.number(digits: 1)}
@cs_eti_page.set_wholesale_price(@price)
@cs_eti_page.wait_saving
@cs_eti_page.search_product(@name)
end

it 'введеная цена отображается' do
expect(@cs_eti_page.price_value).to eq @price[:wholesale_price] + ' руб. /шт.'
expect(@cs_eti_page.wholesale_count_element.text).to eq 'от ' + @price[:wholesale_number] + ' шт.'
expect(@cs_eti_page.price_value).to eq @price[:wholesale_price].to_s + ' руб. /шт.'
expect(@cs_eti_page.wholesale_count_element.text).to eq 'от ' + @price[:wholesale_number].to_s + ' шт.'
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@
@cs_eti_page.close_support_contacts if @cs_eti_page.close_support_contacts?(2)

@product_1 = {
name: Faker::Name.title,
name: Faker::Name.name,
rubric: CONFIG['eti']['rubric']
}

@product_2 = {
name: Faker::Name.title,
name: Faker::Name.name,
rubric: CONFIG['eti']['rubric']
}

@product_3 = {
name: Faker::Name.title,
name: Faker::Name.name,
rubric: CONFIG['eti']['rubric']
}

@product_4 = {
name: Faker::Name.title,
name: Faker::Name.name,
rubric: CONFIG['eti']['rubric']
}

Expand All @@ -52,14 +52,6 @@
@cs_eti_page.change_status_to_archived(@product_4[:name])
end

after(:all) do
navigate_to_eti
@cs_eti_page.delete_product(@product_1[:name])
@cs_eti_page.delete_product(@product_2[:name])
@cs_eti_page.delete_product(@product_3[:name])
@cs_eti_page.delete_product(@product_4[:name])
end

context 'когда товары подтверждены' do
before(:all) { navigate_to_eti }

Expand Down
22 changes: 11 additions & 11 deletions lib/apress/selenium_eti/spec/company_site/minieti_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
context 'когда заполняем цену' do
before(:all) do
@cs_eti_page.add_product
@cs_eti_page.set_name(Faker::Number.number(5))
@cs_eti_page.set_name(Faker::Number.number(digits: 5))
@thermometer_value = @cs_eti_page.thermometer_value
@price = Faker::Number.number(3)
@price = Faker::Number.number(digits: 3)

@cs_eti_page.set_price(@price)
end
Expand All @@ -65,10 +65,10 @@
context 'когда заполняем цену от и до' do
before(:all) do
@cs_eti_page.add_product
@cs_eti_page.set_name(Faker::Number.number(5))
@cs_eti_page.set_name(Faker::Number.number(digits: 5))

@thermometer_value = @cs_eti_page.thermometer_value
@price_from_to = {from: Faker::Number.number(2), to: Faker::Number.number(3)}
@price_from_to = {from: Faker::Number.number(digits: 2), to: Faker::Number.number(digits: 3)}

@cs_eti_page.set_price_from_to(@price_from_to)
end
Expand All @@ -81,10 +81,10 @@
context 'когда заполняем цену со скидкой' do
before(:all) do
@cs_eti_page.add_product
@cs_eti_page.set_name(Faker::Number.number(5))
@cs_eti_page.set_name(Faker::Number.number(digits: 5))

@thermometer_value = @cs_eti_page.thermometer_value
@discount_price = {previous: Faker::Number.number(3), discount: Faker::Number.number(2)}
@discount_price = {previous: Faker::Number.number(digits: 3), discount: Faker::Number.number(digits: 2)}

@cs_eti_page.set_discount_price(@discount_price)
end
Expand All @@ -99,7 +99,7 @@
context 'когда заполняем наличие' do
before do
@cs_eti_page.add_product
@cs_eti_page.set_name(Faker::Number.number(5))
@cs_eti_page.set_name(Faker::Number.number(digits: 5))
@cs_eti_page.set_exists(CONFIG['eti']['exists']['in stock'])
end

Expand All @@ -111,7 +111,7 @@
context 'когда заполняем рубрику' do
before(:all) do
@cs_eti_page.add_product
@cs_eti_page.set_name(Faker::Number.number(5))
@cs_eti_page.set_name(Faker::Number.number(digits: 5))
@rubric = @cs_eti_page.rubric_cell
@cs_eti_page.set_rubric(CONFIG['eti']['rubric'])
end
Expand Down Expand Up @@ -165,7 +165,7 @@
describe 'Удаление товара' do
before do
@cs_eti_page.add_product
@name = Faker::Number.number(5)
@name = Faker::Number.number(digits: 5)
@cs_eti_page.set_name(@name)
@cs_mini_eti_page.delete_first_product
end
Expand All @@ -178,9 +178,9 @@
describe 'Копирование товара' do
before do
@cs_eti_page.add_product
@name = Faker::Pokemon.name
@name = Faker::Games::Pokemon.name
@cs_eti_page.set_name(@name)
@cs_eti_page.set_price(@price = Faker::Number.number(5))
@cs_eti_page.set_price(@price = Faker::Number.number(digits: 5))
@cs_eti_page.wait_saving

@cs_mini_eti_page.copy_product
Expand Down

0 comments on commit 38c8247

Please sign in to comment.