2020-10-24 23:57:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
RSpec.describe QA::Support::WaitForRequests do
|
2020-10-24 23:57:45 +05:30
|
|
|
describe '.wait_for_requests' do
|
|
|
|
before do
|
|
|
|
allow(subject).to receive(:finished_all_ajax_requests?).and_return(true)
|
|
|
|
allow(subject).to receive(:finished_loading?).and_return(true)
|
2022-06-21 17:19:12 +05:30
|
|
|
allow(QA::Support::PageErrorChecker).to receive(:check_page_for_error_code)
|
2020-10-24 23:57:45 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
context 'when skip_finished_loading_check is defaulted to false' do
|
|
|
|
it 'calls finished_loading?' do
|
|
|
|
subject.wait_for_requests
|
2022-06-21 17:19:12 +05:30
|
|
|
|
|
|
|
expect(subject).to have_received(:finished_loading?).with(hash_including(wait: 1))
|
2020-10-24 23:57:45 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-03-02 08:16:31 +05:30
|
|
|
context 'when skip_resp_code_check is true' do
|
|
|
|
it 'does not parse for an error code' do
|
|
|
|
subject.wait_for_requests(skip_resp_code_check: true)
|
2022-06-21 17:19:12 +05:30
|
|
|
|
|
|
|
expect(QA::Support::PageErrorChecker).not_to have_received(:check_page_for_error_code)
|
2022-03-02 08:16:31 +05:30
|
|
|
end
|
|
|
|
end
|
2020-10-24 23:57:45 +05:30
|
|
|
end
|
|
|
|
end
|