Sha256: c9c626d8ed88153d6ed6b357ec093955e9fb72e95a31a7b5d0c603df4c851b17

Contents?: true

Size: 1.88 KB

Versions: 10

Compression:

Stored size: 1.88 KB

Contents

# frozen_string_literal: true

require "rails_helper"
require_relative "../page_object"
require "capybara-select-2"

module Pages
  module Medications
    class HomeDeliveryDialog < PageObject
      include CapybaraSelect2
      pattr_initialize [:patient!]

      def path
        patient_prescriptions_path(
          patient,
          treatable_type: patient.class.to_s,
          treatable_id: patient
        )
      end

      def open
        visit path
        within ".page-actions" do
          click_on "Print home delivery drugs"
        end
      end

      def drug_type
        within("#print-home-delivery-drugs-modal") do
          find("#event_drug_type_id").find("option[selected]").text
        end
      end

      def prescription_duration
        within("#print-home-delivery-drugs-modal") do
          find("#event_prescription_duration").find("option[selected]").text
        end
      end

      def print
        within("#print-home-delivery-drugs-modal") do
          click_on "Print"
        end
      end

      def drug_type_css
        "#print-home-delivery-drugs-modal #event_drug_type_id"
      end

      def prescription_duration_css
        "#print-home-delivery-drugs-modal #event_prescription_duration"
      end

      def indicate_printing_was_succesful
        within("#print-home-delivery-drugs-modal") do
          click_on "Yes - mark as printed"
        end
      end

      def invisible?
        page.has_no_css?("#print-home-delivery-drugs-modal .modal", visible: true)
      end

      def has_enabled_print_button?
        within("#print-home-delivery-drugs-modal") do
          has_css?("a.home-delivery--print:not([disabled])")
        end
      end

      def has_no_prescriptions_error?
        within("#print-home-delivery-drugs-modal") do
          has_content?("There are no home delivery prescriptions for this drug type")
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
renalware-core-2.0.153 spec/support/pages/medications/home_delivery_dialog.rb
renalware-core-2.0.152 spec/support/pages/medications/home_delivery_dialog.rb
renalware-core-2.0.151 spec/support/pages/medications/home_delivery_dialog.rb
renalware-core-2.0.149 spec/support/pages/medications/home_delivery_dialog.rb
renalware-core-2.0.148 spec/support/pages/medications/home_delivery_dialog.rb
renalware-core-2.0.147 spec/support/pages/medications/home_delivery_dialog.rb
renalware-core-2.0.146 spec/support/pages/medications/home_delivery_dialog.rb
renalware-core-2.0.145 spec/support/pages/medications/home_delivery_dialog.rb
renalware-core-2.0.144 spec/support/pages/medications/home_delivery_dialog.rb
renalware-core-2.0.143 spec/support/pages/medications/home_delivery_dialog.rb