Sha256: 3398ff8703ec833d652873da365b7af5d9ab16b84c8197db6592ad2b9ccb4a08

Contents?: true

Size: 1.99 KB

Versions: 3

Compression:

Stored size: 1.99 KB

Contents

require "test_helper"

module Workarea
  module Admin
    class ProductVideosSystemTest < Workarea::SystemTest
      include Admin::IntegrationTest

      def test_managing_videos
        product = create_product
        visit admin.catalog_product_path(product)
        click_link t("workarea.admin.catalog_products.cards.videos.title")

        assert(page.has_content?(t("workarea.admin.catalog_product_videos.index.heading")))
        click_link t("workarea.admin.catalog_product_videos.index.add_new")

        fill_in "video[embed_code]", with: youtube_embed
        select "embedded", from: "video[display_option]"
        click_button "create_video"

        assert_equal(admin.catalog_product_videos_path(product), current_path)
        assert(page.has_content?("Success"))
        assert(page.has_content?("embedded"))

        click_button "delete_video"

        assert_equal(admin.catalog_product_videos_path(product), current_path)
        assert(page.has_content?("Success"))
        refute(page.has_content?("embedded"))
      end

      def test_creating_a_product_video_with_thumbnail
        asset = create_asset
        product = create_product
        visit admin.catalog_product_path(product)
        click_link t("workarea.admin.catalog_products.cards.videos.title")

        assert(page.has_content?(t("workarea.admin.catalog_product_videos.index.heading")))
        click_link t("workarea.admin.catalog_product_videos.index.add_new")

        fill_in "video[embed_code]", with: youtube_embed
        select "thumbnail", from: "video[display_option]"
        find(".asset-picker-field a").click
        within "#takeover" do
          click_link "Test Asset"
        end

        within ".asset-picker-field" do
          assert(page.has_content?("Test Asset"))
        end
        click_button "create_video"

        assert_equal(admin.catalog_product_videos_path(product), current_path)
        assert(page.has_content?("Success"))
        assert(page.has_content?("thumbnail"))
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
workarea-product_videos-1.3.0 test/system/workarea/admin/product_videos_system_test.rb
workarea-product_videos-1.2.3 test/system/workarea/admin/product_videos_system_test.rb
workarea-product_videos-1.2.2 test/system/workarea/admin/product_videos_system_test.rb