diff --git a/lib/davinci_dtr_test_kit/client_groups/resp_assist_device/dtr_questionnaire_rendering_attestation_test.rb b/lib/davinci_dtr_test_kit/client_groups/resp_assist_device/dtr_questionnaire_rendering_attestation_test.rb index aefce2c..67326ce 100644 --- a/lib/davinci_dtr_test_kit/client_groups/resp_assist_device/dtr_questionnaire_rendering_attestation_test.rb +++ b/lib/davinci_dtr_test_kit/client_groups/resp_assist_device/dtr_questionnaire_rendering_attestation_test.rb @@ -12,15 +12,10 @@ class DTRQuestionnaireRenderingAttestationTest < Inferno::Test questionnaire package and attest that the application renders the questionnaire. ) - config(options: { token: SecureRandom.uuid }) - - def token - config.options[:token] - end - run do load_tagged_requests QUESTIONNAIRE_PACKAGE_TAG skip_if request.blank?, 'A Questionnaire Package request must be made prior to running this test' + token = SecureRandom.uuid wait( identifier: token, diff --git a/spec/davinci_dtr_test_kit/dtr_questionnaire_rendering_group_spec.rb b/spec/davinci_dtr_test_kit/dtr_questionnaire_rendering_group_spec.rb index b9d87e3..423e8a1 100644 --- a/spec/davinci_dtr_test_kit/dtr_questionnaire_rendering_group_spec.rb +++ b/spec/davinci_dtr_test_kit/dtr_questionnaire_rendering_group_spec.rb @@ -11,6 +11,7 @@ def app let(:resume_fail_url) { "/custom/#{suite_id}/resume_fail" } let(:session_data_repo) { Inferno::Repositories::SessionData.new } let(:test_session) { repo_create(:test_session, test_suite_id: suite_id) } + let(:test_runs_repo) { Inferno::Repositories::TestRuns.new } def run(runnable, test_session, inputs = {}) test_run_params = { test_session_id: test_session.id }.merge(runnable.reference_hash) @@ -29,11 +30,6 @@ def run(runnable, test_session, inputs = {}) describe 'Behavior of questionnaire rendering attestation test' do let(:runnable) { group.tests.find { |test| test.id.to_s.end_with? 'dtr_questionnaire_rendering_attestation' } } let(:results_repo) { Inferno::Repositories::Results.new } - let(:token) { '1234' } - - before do - allow_any_instance_of(runnable).to receive(:token).and_return(token) - end it 'passes if affirmative attestation is given' do # For some reason it seems to completely ignore an allow...receive for resume_pass_url, so do this instead @@ -48,6 +44,7 @@ def run(runnable, test_session, inputs = {}) result = run(runnable, test_session) expect(result.result).to eq('wait') + token = test_runs_repo.last_test_run(test_session.id).identifier get("#{resume_pass_url}?token=#{token}") result = results_repo.find(result.id) @@ -67,6 +64,7 @@ def run(runnable, test_session, inputs = {}) result = run(runnable, test_session) expect(result.result).to eq('wait') + token = test_runs_repo.last_test_run(test_session.id).identifier get("#{resume_fail_url}?token=#{token}") result = results_repo.find(result.id)