Sha256: f20806f038f3ecc62b55d5aae39173aecf16d1772dc46b0efcb739a7eb66c403

Contents?: true

Size: 1.86 KB

Versions: 47

Compression:

Stored size: 1.86 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

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

  before(:each) do
    visit spree.admin_path
  end

  context "editing variant option types", js: true do
    let!(:product) { create(:product) }

    it "should allow an admin to create option types for a variant" do
      click_nav "Products"

      within_row(1) { click_icon :edit }

      within('nav > ul.tabs') { 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_nav "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_path
      click_nav "Products"
      within('table.index tbody tr:nth-child(1)') do
        click_icon :edit
      end

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

      within('nav > ul.tabs') { click_link "Variants" }
      click_link "New Variant"

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

      within(".index") 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

47 entries across 47 versions & 2 rubygems

Version Path
solidus_backend-2.10.5 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.10.3 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.10.2 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.9.6 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.8.6 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.10.1 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.9.5 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.10.0 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.9.4 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.6.6 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.7.4 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.8.5 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.9.3 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.9.2 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.10.0.beta1 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.7.3 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.6.5 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.9.1 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.9.0 spec/features/admin/products/edit/variants_spec.rb
solidus_backend-2.9.0.rc.1 spec/features/admin/products/edit/variants_spec.rb