diff --git a/engines/admin_ui/spec/acceptance/product_colors.feature b/engines/admin_ui/spec/acceptance/product_colors.feature new file mode 100644 index 0000000000..bd7db4856e --- /dev/null +++ b/engines/admin_ui/spec/acceptance/product_colors.feature @@ -0,0 +1,22 @@ +Feature: Assign colors to products + + Background: + Given A sample database with valid data + And The example admin is signed in + + @javascript + Scenario: + When I am on the product colors page + And I click on "Create a Color" link + And I select "Connie" product from chosen select box + And I select "Coral" color from chosen select box + And I click on "Create" button + Then I should see "Color 'coral' for the product 'Connie' successfully created" + + Scenario: + When I am on the product colors page + And I click on "Create a Color" link + And I select "Connie" product from chosen select box + And I click on "Create" button + Then I should see "can't be blank" + diff --git a/engines/admin_ui/spec/support/steps/admin_steps.rb b/engines/admin_ui/spec/support/steps/admin_steps.rb new file mode 100644 index 0000000000..f719d4a7cf --- /dev/null +++ b/engines/admin_ui/spec/support/steps/admin_steps.rb @@ -0,0 +1,16 @@ +module Acceptance + module AdminSteps + step 'The example admin is signed in' do + visit '/login' + fill_in('Email', with: 'admin@example.com') + fill_in('Password', with: '123456') + click_button 'Login' + visit '/fame_admin' + expect(page).to have_text('Welcome to #new Admin') + end + end +end + +RSpec.configure do |config| + config.include Acceptance::AdminSteps, type: :feature +end diff --git a/engines/admin_ui/spec/support/steps/product_colors_steps.rb b/engines/admin_ui/spec/support/steps/product_colors_steps.rb new file mode 100644 index 0000000000..09be306ed6 --- /dev/null +++ b/engines/admin_ui/spec/support/steps/product_colors_steps.rb @@ -0,0 +1,22 @@ +module Acceptance + module ProductColorsSteps + + step 'I am on the product colors page' do + visit '/fame_admin/product_colors' + end + + step 'I select "Connie" product from chosen select box' do + chosen_select('Connie (SKU: 4B453)', from: '#product_color_value_product_id') + end + + step 'I select "Coral" color from chosen select box' do + chosen_select('coral', from: '#product_color_value_option_value_id') + end + + end +end + +RSpec.configure do |config| + config.include Chosen::Rspec::FeatureHelpers, type: :feature + config.include Acceptance::ProductColorsSteps, type: :feature +end