Welcome to mirror list, hosted at ThFree Co, Russian Federation.

wait_for_requests_spec.rb « support « spec « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2492820b67f5da848c1972dd020dc6d1066e4218 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# frozen_string_literal: true

RSpec.describe QA::Support::WaitForRequests do
  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)
    end

    context 'when skip_finished_loading_check is defaulted to false' do
      it 'calls finished_loading?' do
        expect(subject).to receive(:finished_loading?).with(hash_including(wait: 1))

        subject.wait_for_requests
      end
    end

    context 'when skip_finished_loading_check is true' do
      it 'does not call finished_loading?' do
        expect(subject).not_to receive(:finished_loading?)

        subject.wait_for_requests(skip_finished_loading_check: true)
      end
    end

    context 'when skip_resp_code_check is defaulted to false' do
      it 'call report' do
        allow(QA::Support::PageErrorChecker).to receive(:check_page_for_error_code).with(Capybara.page)

        subject.wait_for_requests
      end
    end

    context 'when skip_resp_code_check is true' do
      it 'does not parse for an error code' do
        expect(QA::Support::PageErrorChecker).not_to receive(:check_page_for_error_code)

        subject.wait_for_requests(skip_resp_code_check: true)
      end
    end
  end
end