Merge pull request #8591 from filipefurtad0/consumer_specs_into_system

Consumer specs into system
This commit is contained in:
Filipe
2021-12-17 13:52:28 +00:00
committed by GitHub
8 changed files with 28 additions and 21 deletions

View File

@@ -161,7 +161,6 @@ Layout/LineLength:
- 'spec/controllers/user_confirmations_controller_spec.rb'
- 'spec/factories/stock_location_factory.rb'
- 'spec/features/consumer/multilingual_spec.rb'
- 'spec/features/consumer/shops_spec.rb'
- 'spec/helpers/enterprises_helper_spec.rb'
- 'spec/helpers/injection_helper_spec.rb'
- 'spec/helpers/order_cycles_helper_spec.rb'
@@ -1648,7 +1647,6 @@ Style/StringConcatenation:
- 'lib/spree/api/controller_setup.rb'
- 'lib/spree/core/environment_extension.rb'
- 'spec/controllers/user_confirmations_controller_spec.rb'
- 'spec/features/consumer/account_spec.rb'
- 'spec/lib/open_food_network/order_grouper_spec.rb'
- 'spec/models/spree/line_item_spec.rb'
- 'spec/models/spree/product_spec.rb'

View File

@@ -1,11 +1,11 @@
# frozen_string_literal: true
module CookieHelper
def cookie_named(name)
Capybara.current_session.driver.browser.manage.cookie_named(name)
def cookies_name
Capybara.current_session.driver.browser.cookies
end
def cookies
Capybara.current_session.driver.browser.manage.all_cookies
Capybara.current_session.driver.browser.cookies.all
end
end

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true
require 'spec_helper'
require 'system_helper'
describe '
As a consumer
@@ -73,15 +73,15 @@ describe '
href: "#{distributor2.permalink}/shop", count: 1)
expect(page).not_to have_content distributor_without_orders.name
expect(page).to have_content distributor1.name + "\n" + "Balance due"
expect(page).to have_content distributor_credit.name + "\nCredit"
expect(page).to have_content "#{distributor1.name} Balance due"
expect(page).to have_content "#{distributor_credit.name} Credit"
# It reveals table of orders for distributors when clicked
expand_active_table_node distributor1.name
expect(page).to have_link "Order " + d1o1.number, href: "/orders/#{d1o1.number}"
expect(page).to have_link "Order #{d1o1.number}", href: "/orders/#{d1o1.number}"
expand_active_table_node distributor2.name
expect(page).not_to have_content "Order " + d1o1.number.to_s
expect(page).not_to have_content "Order #{d1o1.number}"
end
context "when there is at least one changeable order" do

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true
require 'spec_helper'
require 'system_helper'
describe "Footer Links", js: true do
describe "policy link" do

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true
require 'spec_helper'
require 'system_helper'
describe 'Groups', js: true do
include AuthenticationHelper

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true
require 'spec_helper'
require 'system_helper'
describe 'Multilingual', js: true do
include AuthenticationHelper
@@ -15,7 +15,8 @@ describe 'Multilingual', js: true do
expect(Rails.application.config.i18n[:available_locales]).to eq ['en', 'es', 'pt']
end
it '18n-js fallsback to default language' do # in backend it doesn't until we change enforce_available_locales to `true`
it '18n-js fallsback to default language' do
# in backend it doesn't until we change enforce_available_locales to `true`
visit root_path
set_i18n_locale('it')
expect(get_i18n_translation('label_shops')).to eq 'Shops'
@@ -141,6 +142,6 @@ describe 'Multilingual', js: true do
end
def expect_menu_and_cookie_in_es
expect(cookie_named('locale')[:value]).to eq 'es'
expect(cookies_name['locale']).to have_attributes(value: "es")
expect(page).to have_content 'TIENDAS'
end

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true
require 'spec_helper'
require 'system_helper'
describe '
As a consumer

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true
require 'spec_helper'
require 'system_helper'
describe 'Shops', js: true do
include AuthenticationHelper
@@ -147,8 +147,12 @@ describe 'Shops', js: true do
describe "property badges" do
let!(:order_cycle) {
create(:simple_order_cycle, distributors: [distributor],
coordinator: create(:distributor_enterprise), variants: [product.variants.first])
create(
:simple_order_cycle,
distributors: [distributor],
coordinator: create(:distributor_enterprise),
variants: [product.variants.first]
)
}
let(:product) { create(:simple_product, supplier: producer) }
@@ -176,8 +180,12 @@ describe 'Shops', js: true do
let!(:product) { create(:simple_product, supplier: producer, taxons: [taxon]) }
let!(:taxon) { create(:taxon, name: 'Fruit') }
let!(:order_cycle) {
create(:simple_order_cycle, distributors: [distributor],
coordinator: create(:distributor_enterprise), variants: [product.variants.first])
create(
:simple_order_cycle,
distributors: [distributor],
coordinator: create(:distributor_enterprise),
variants: [product.variants.first]
)
}
it "shows hub producer modals" do