Sha256: b2172447aa0691b2ede09f0dd4a0d21899fb444322876d9ba73883b2cf9261d9

Contents?: true

Size: 1.77 KB

Versions: 62

Compression:

Stored size: 1.77 KB

Contents

require 'test_helper'

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

      setup :set_per_page
      teardown :reset_per_page

      def set_per_page
        @per_page = Workarea.config.per_page
        Workarea.config.per_page = 7
      end

      def reset_per_page
        Workarea.config.per_page = @per_page
      end

      def test_displaying_sitemap
        foo = create_taxon(name: 'Landing', url: '/')
        placeholder = create_taxon(name: 'Placeholder')

        create_taxon(name: "Page Active", parent: foo, navigable: create_page)
        create_taxon(name: "Page Inactive", parent: foo, navigable: create_page(active: false))
        create_taxon(name: "Category Active", parent: placeholder, navigable: create_category)
        create_taxon(name: "Category Inactive", parent: placeholder, navigable: create_category(active: false))

        visit storefront.sitemap_path
        within '.view' do
          assert(
            page.has_ordered_text?(
              'Home > Landing > Page Active',
              'Home > Landing',
              'Home > Placeholder > Category Active'
            )
          )
          assert(page.has_no_content?('Page Inactive'))
          assert(page.has_no_content?('Category Inactive'))
        end
      end

      def test_sitemap_pagination
        7.times { |i| create_taxon(name: "Link #{i}", url: '/') }

        visit storefront.sitemap_path
        assert(page.has_content?('Link 0'))
        assert(page.has_content?('Link 5'))
        assert(page.has_no_content?('Link 6'))

        click_link t('workarea.storefront.sitemaps.pagination.next')
        assert(page.has_content?('Link 6'))
        assert(page.has_no_content?('Link 0'))
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.4.27 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.5.4 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.4.26 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.5.3 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.4.25 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.5.2 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.4.24 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.5.1 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.4.23 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.4.22 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.5.0 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.4.21 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.5.0.beta.1 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.4.20 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.4.19 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.4.18 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.4.17 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.4.16 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.4.15 test/system/workarea/storefront/sitemap_system_test.rb
workarea-storefront-3.4.14 test/system/workarea/storefront/sitemap_system_test.rb