Sha256: 71028cf1107dfffd0fd4a99e3d15ab7fc2280859cc68a399fe66f1d51379acac

Contents?: true

Size: 1.5 KB

Versions: 40

Compression:

Stored size: 1.5 KB

Contents

require 'rails_helper'

describe "Admin slideshow management workflow", type: :feature, js: true do
  include CapybaraCommon

  before :all do
    @admin = create :user
    login_as(@admin, :scope => :user)
  end

  it "should let me add a new editor in admin" do
    visit virgo.admin_slideshows_path

    click_link 'new-slideshow-link'

    fill_in "slideshow_name", with: "Slideshow #{Time.now.to_i}"

    find('#slideshow-form-submit').click

    expect(page).to have_content("Slideshow successfully created")

    upload_slide(image_file_paths.first)

    upload_slide(image_file_paths.second)

    find('#slideshow-form-submit').click

    expect(page).to have_content('Slideshow settings saved')
  end

  private

  def upload_slide(fpath)
    click_link 'new-slide-link'

    click_link 'add-slide-image'

    click_link 'upload-tab-btn'

    expect(page).to have_selector('#new_image')

    # page.execute_script "$('#image-upload-file-field').css({opacity: 1, zIndex: 999})"

    include_hidden_fields do
      attach_file 'image-upload-file-field', fpath
    end

    fill_in 'image_name', with: "Image #{Time.now.to_i}"

    first(:css, '#upload-button').click

    expect(page).to have_selector('#upload-success-dismiss')

    first(:css, '#upload-success-dismiss').click

    js_click '#save-slide'

    expect(page).to have_content('Your new slide has been added')
  end

  def image_file_paths
    ["doge.jpg", "doge2.jpg"].map do |filename|
      File.expand_path("../../../data/#{filename}", __FILE__)
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
virgo-0.3.17 spec/features/admin/slideshow_management_spec.rb
virgo-0.3.16 spec/features/admin/slideshow_management_spec.rb
virgo-0.3.15 spec/features/admin/slideshow_management_spec.rb
virgo-0.3.14 spec/features/admin/slideshow_management_spec.rb
virgo-0.3.13 spec/features/admin/slideshow_management_spec.rb
virgo-0.3.12 spec/features/admin/slideshow_management_spec.rb
virgo-0.3.11 spec/features/admin/slideshow_management_spec.rb
virgo-0.3.10 spec/features/admin/slideshow_management_spec.rb
virgo-0.3.9 spec/features/admin/slideshow_management_spec.rb
virgo-0.3.8 spec/features/admin/slideshow_management_spec.rb
virgo-0.3.7 spec/features/admin/slideshow_management_spec.rb
virgo-0.3.6 spec/features/admin/slideshow_management_spec.rb
virgo-0.3.4 spec/features/admin/slideshow_management_spec.rb
virgo-0.3.3 spec/features/admin/slideshow_management_spec.rb
virgo-0.3.2 spec/features/admin/slideshow_management_spec.rb
virgo-0.3.1 spec/features/admin/slideshow_management_spec.rb
virgo-0.3 spec/features/admin/slideshow_management_spec.rb
virgo-0.2.9 spec/features/admin/slideshow_management_spec.rb
virgo-0.2.8 spec/features/admin/slideshow_management_spec.rb
virgo-0.2.7 spec/features/admin/slideshow_management_spec.rb