diff --git a/lib/apress/selenium_eti/spec/company_site/eti/product_creation_spec.rb b/lib/apress/selenium_eti/spec/company_site/eti/product_creation_spec.rb index daf4567..6e88ad4 100644 --- a/lib/apress/selenium_eti/spec/company_site/eti/product_creation_spec.rb +++ b/lib/apress/selenium_eti/spec/company_site/eti/product_creation_spec.rb @@ -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 @@ -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 @@ -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 = { @@ -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 diff --git a/lib/apress/selenium_eti/spec/company_site/eti/product_groups_spec.rb b/lib/apress/selenium_eti/spec/company_site/eti/product_groups_spec.rb index a89e8e4..8f2c802 100644 --- a/lib/apress/selenium_eti/spec/company_site/eti/product_groups_spec.rb +++ b/lib/apress/selenium_eti/spec/company_site/eti/product_groups_spec.rb @@ -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 diff --git a/lib/apress/selenium_eti/spec/company_site/eti/product_price_spec.rb b/lib/apress/selenium_eti/spec/company_site/eti/product_price_spec.rb index 16c4a3c..ca0bc06 100644 --- a/lib/apress/selenium_eti/spec/company_site/eti/product_price_spec.rb +++ b/lib/apress/selenium_eti/spec/company_site/eti/product_price_spec.rb @@ -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 diff --git a/lib/apress/selenium_eti/spec/company_site/eti/product_statuses_spec.rb b/lib/apress/selenium_eti/spec/company_site/eti/product_statuses_spec.rb index cde05c8..9a67965 100644 --- a/lib/apress/selenium_eti/spec/company_site/eti/product_statuses_spec.rb +++ b/lib/apress/selenium_eti/spec/company_site/eti/product_statuses_spec.rb @@ -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'] } @@ -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 } diff --git a/lib/apress/selenium_eti/spec/company_site/minieti_spec.rb b/lib/apress/selenium_eti/spec/company_site/minieti_spec.rb index 2604938..7168457 100644 --- a/lib/apress/selenium_eti/spec/company_site/minieti_spec.rb +++ b/lib/apress/selenium_eti/spec/company_site/minieti_spec.rb @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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