|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +require "rails_helper" |
| 4 | + |
| 5 | +RSpec.describe CsrTable::ContactWaitingTimeScoresComponent, type: :component do |
| 6 | + subject { page } |
| 7 | + |
| 8 | + let(:supplier) { build(:supplier, :ranked) } |
| 9 | + |
| 10 | + before do |
| 11 | + render_inline described_class.new(supplier) |
| 12 | + end |
| 13 | + |
| 14 | + it { is_expected.to have_text "Contact waiting time" } |
| 15 | + it { is_expected.to have_text "How long can you expect to wait when contacting this supplier?" } |
| 16 | + |
| 17 | + it { is_expected.to have_text "Emails responded to within 2 days" } |
| 18 | + it { is_expected.to have_text "89%" } |
| 19 | + it { is_expected.to have_text "Average call centre wait time" } |
| 20 | + it { is_expected.to have_text "3 minutes 27 seconds" } |
| 21 | + |
| 22 | + context "when the supplier has synchronous customer contact channels" do |
| 23 | + let(:supplier) { build(:supplier, :sync_contact) } |
| 24 | + |
| 25 | + it { is_expected.to have_text "Average Webchat response time" } |
| 26 | + it { is_expected.to have_text "3 minutes" } |
| 27 | + it { is_expected.to have_text "Average Whatsapp response time" } |
| 28 | + it { is_expected.to have_text "1 hour 23 minutes 10 seconds" } |
| 29 | + it { is_expected.to have_text "Average SMS response time" } |
| 30 | + it { is_expected.to have_text "4 hours 47 minutes" } |
| 31 | + it { is_expected.to have_text "Average response time using the supplier's app" } |
| 32 | + it { is_expected.to have_text "39 minutes 16 seconds" } |
| 33 | + it { is_expected.to have_text "Average response time using a customer account portal" } |
| 34 | + it { is_expected.to have_text "1 hour 1 minute 1 second" } |
| 35 | + end |
| 36 | + |
| 37 | + context "when the supplier has asynchronous customer contact channels" do |
| 38 | + let(:supplier) { build(:supplier, :async_contact) } |
| 39 | + |
| 40 | + it { is_expected.to have_text "Webchat messages responded to within 2 days" } |
| 41 | + it { is_expected.to have_text "45.7%" } |
| 42 | + it { is_expected.to have_text "Whatsapp messages responded to within 2 days" } |
| 43 | + it { is_expected.to have_text "89.3%" } |
| 44 | + it { is_expected.to have_text "SMS messages responded to within 2 days" } |
| 45 | + it { is_expected.to have_text "99.9%" } |
| 46 | + it { is_expected.to have_text "Messages responded to within 2 days using the supplier's app" } |
| 47 | + it { is_expected.to have_text "74.2%" } |
| 48 | + it { is_expected.to have_text "Messages responded to within 2 days using a customer account portal" } |
| 49 | + it { is_expected.to have_text "82.9%" } |
| 50 | + end |
| 51 | + |
| 52 | + context "when the supplier has no asynchronous or synchronous customer contact channels" do |
| 53 | + let(:supplier) { build(:supplier, :no_sync_or_async_contact) } |
| 54 | + |
| 55 | + it { is_expected.to have_text "Emails responded to within 2 days" } |
| 56 | + it { is_expected.to have_text "Average call centre wait time" } |
| 57 | + |
| 58 | + it { is_expected.to have_no_text "Average Webchat response time" } |
| 59 | + it { is_expected.to have_no_text "Average Whatsapp response time" } |
| 60 | + it { is_expected.to have_no_text "Average SMS response time" } |
| 61 | + it { is_expected.to have_no_text "Average response time using the supplier's app" } |
| 62 | + it { is_expected.to have_no_text "Average response time using a customer account portal" } |
| 63 | + it { is_expected.to have_no_text "Webchat messages responded to within 2 days" } |
| 64 | + it { is_expected.to have_no_text "Whatsapp messages responded to within 2 days" } |
| 65 | + it { is_expected.to have_no_text "SMS messages responded to within 2 days" } |
| 66 | + it { is_expected.to have_no_text "Messages responded to within 2 days using the supplier's app" } |
| 67 | + it { is_expected.to have_no_text "Messages responded to within 2 days using a customer account portal" } |
| 68 | + end |
| 69 | + |
| 70 | + context "when there is no supplier" do |
| 71 | + let(:supplier) { nil } |
| 72 | + |
| 73 | + it { is_expected.to have_no_css "body" } |
| 74 | + end |
| 75 | +end |
0 commit comments