Sha256: 17ea3b22cc8990bfbd78d45ba2fcc886397b2767db2cc46df1032c98b9f233e5

Contents?: true

Size: 1.66 KB

Versions: 13

Compression:

Stored size: 1.66 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe "Reports", type: :feature do
  stub_authorization!

  context "visiting the admin reports page" do
    it "should have the right content" do
      visit spree.admin_path
      click_link "Reports"
      click_link "Sales Total"

      expect(page).to have_content("ReportsSales Total")
      expect(page).to have_content("Item Total")
      expect(page).to have_content("Adjustment Total")
      expect(page).to have_content("Sales Total")
    end
  end

  context "searching the admin reports page" do
    before do
      order = create(:order)
      order.update_columns({ adjustment_total: 100 })
      order.completed_at = Time.current
      order.save!

      order = create(:order)
      order.update_columns({ adjustment_total: 200 })
      order.completed_at = Time.current
      order.save!

      # incomplete order
      order = create(:order)
      order.update_columns({ adjustment_total: 50 })
      order.save!

      order = create(:order)
      order.update_columns({ adjustment_total: 200 })
      order.completed_at = 3.years.ago
      order.created_at = 3.years.ago
      order.save!

      order = create(:order)
      order.update_columns({ adjustment_total: 200 })
      order.completed_at = 3.years.from_now
      order.created_at = 3.years.from_now
      order.save!
    end

    it "should allow me to search for reports" do
      visit spree.admin_path
      click_link "Reports"
      click_link "Sales Total"

      fill_in "q_completed_at_gt", with: 1.week.ago
      fill_in "q_completed_at_lt", with: 1.week.from_now
      click_button "Search"

      expect(page).to have_content("$300.00")
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
solidus_backend-2.6.6 spec/features/admin/reports_spec.rb
solidus_backend-2.7.4 spec/features/admin/reports_spec.rb
solidus_backend-2.7.3 spec/features/admin/reports_spec.rb
solidus_backend-2.6.5 spec/features/admin/reports_spec.rb
solidus_backend-2.7.2 spec/features/admin/reports_spec.rb
solidus_backend-2.6.4 spec/features/admin/reports_spec.rb
solidus_backend-2.6.3 spec/features/admin/reports_spec.rb
solidus_backend-2.7.1 spec/features/admin/reports_spec.rb
solidus_backend-2.6.2 spec/features/admin/reports_spec.rb
solidus_backend-2.7.0 spec/features/admin/reports_spec.rb
solidus_backend-2.6.1 spec/features/admin/reports_spec.rb
solidus_backend-2.6.0 spec/features/admin/reports_spec.rb
solidus_backend-2.6.0.rc1 spec/features/admin/reports_spec.rb