Sha256: eb12d0525406c2b6eb6228fe4413e4c53b34db6a76c7bd67283af2452adb63e0

Contents?: true

Size: 1.78 KB

Versions: 22

Compression:

Stored size: 1.78 KB

Contents

require 'spec_helper'

describe "Product Variants", type: :feature, js: true do
  stub_authorization!

  let!(:product) { create(:product) }

  before(:each) do
    visit spree.admin_products_path
  end

  context "editing variant option types" do
    it "should allow an admin to create option types for a variant" do
      within_row(1) { click_icon :edit }

      within('#sidebar') { click_link "Variants" }
      expect(page).to have_content("To add variants, you must first define")
    end

    it "allows admin to create a variant if there are option types" do
      click_link "Products"
      click_link "Option Types"
      click_link "new_option_type_link"
      fill_in "option_type_name", with: "shirt colors"
      fill_in "option_type_presentation", with: "colors"
      click_button "Create"
      expect(page).to have_content("successfully created!")

      page.find('#option_type_option_values_attributes_0_name').set('color')
      page.find('#option_type_option_values_attributes_0_presentation').set('black')
      click_button "Update"
      expect(page).to have_content("successfully updated!")

      visit spree.admin_products_path
      within_row(1) { click_icon :edit }

      select2_search "shirt", from: "Option Types"
      click_button "Update"
      expect(page).to have_content("successfully updated!")

      within('#sidebar') { click_link "Variants" }
      click_link "New Variant"

      targetted_select2 "black", from: "#s2id_variant_option_value_ids"
      fill_in "variant_sku", with: "A100"
      click_button "Create"
      expect(page).to have_content("successfully created!")

      within(".table") do
        expect(page).to have_content("19.99")
        expect(page).to have_content("black")
        expect(page).to have_content("A100")
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
spree_backend-3.3.0.rc1 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.1.5 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.2.1 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.2.0 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.1.4 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.2.0.rc3 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.2.0.rc2 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.2.0.rc1 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.1.3 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.1.2 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.0.10 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.1.1 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.1.0 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.1.0.rc4 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.0.9 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.1.0.rc3 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.1.0.rc2 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.1.0.rc1 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.0.8 spec/features/admin/products/edit/variants_spec.rb
spree_backend-3.0.7 spec/features/admin/products/edit/variants_spec.rb