Sha256: fe296468f7e4b116fe3a30a2b7c76a1e1730bc665b528422ee8df333c794fc21

Contents?: true

Size: 1.88 KB

Versions: 3

Compression:

Stored size: 1.88 KB

Contents

require "test_helper"

module Workarea
  module Storefront
    class ProductVideosSystemTest < Workarea::SystemTest
      include Storefront::SystemTest

      def test_showing_embedded_videos_on_product_detail_page
        product = create_product(
          name: "Awesome Product with embedded video",
          videos: [{ embed_code: youtube_embed, display_option: "embedded" }]
        )

        visit storefront.product_path(product)

        assert(page.has_selector?("iframe.product-video__iframe"))
      end

      def test_showing_dialog_videos_on_product_detail_page
        product = create_product(
          name: "Awesome Product with dialog video",
          videos: [{ embed_code: youtube_embed, display_option: "dialog" }]
        )

        visit storefront.product_path(product)

        assert(page.has_content?(t("workarea.storefront.products.watch_this_video")))

        click_link t("workarea.storefront.products.watch_this_video")
        wait_for_xhr

        assert(page.has_selector?("iframe.product-video__iframe"))
      end

      def test_showing_thumbnail_videos_on_product_detail_page
        product = create_product(
          name: "Awesome Product with thumbnail video",
          videos: [{ embed_code: youtube_embed, display_option: "thumbnail" }]
        )

        product.images.build(image: product_image_file_path, option: "green", position: 0).save
        product.images.build(image: product_image_file_path, option: "red", position: 1).save
        product.save

        visit storefront.product_path(product)

        assert(page.has_selector?(".product-video__thumbnail"))
        refute(page.has_selector?("iframe.product-video__iframe"))

        within ".product-details__alt-images" do
          page.find(".product-video--thumbnail").click
        end

        wait_for_xhr

        assert(page.has_selector?("iframe.product-video__iframe"))
      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/storefront/product_videos_system_test.rb
workarea-product_videos-1.2.3 test/system/workarea/storefront/product_videos_system_test.rb
workarea-product_videos-1.2.2 test/system/workarea/storefront/product_videos_system_test.rb