summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/sanity/interception_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/specs/features/sanity/interception_spec.rb')
-rw-r--r--qa/qa/specs/features/sanity/interception_spec.rb42
1 files changed, 22 insertions, 20 deletions
diff --git a/qa/qa/specs/features/sanity/interception_spec.rb b/qa/qa/specs/features/sanity/interception_spec.rb
index f8930db3aa5..67be832055d 100644
--- a/qa/qa/specs/features/sanity/interception_spec.rb
+++ b/qa/qa/specs/features/sanity/interception_spec.rb
@@ -1,39 +1,41 @@
# frozen_string_literal: true
module QA
- RSpec.describe 'Browser request interception', :orchestrated, :framework do
- before(:context) do
- skip 'Only can test for chrome' unless QA::Runtime::Env.can_intercept?
- end
+ RSpec.describe 'Framework sanity', :orchestrated, :framework do
+ describe 'Browser request interception' do
+ before(:context) do
+ skip 'Only can test for chrome' unless QA::Runtime::Env.can_intercept?
+ end
- before do
- Runtime::Browser.visit(:gitlab, Page::Main::Login)
- end
+ before do
+ Runtime::Browser.visit(:gitlab, Page::Main::Login)
+ end
- let(:page) { Capybara.current_session }
- let(:logger) { class_double('QA::Runtime::Logger') }
+ let(:page) { Capybara.current_session }
+ let(:logger) { class_double('QA::Runtime::Logger') }
- it 'intercepts failed graphql calls' do
- page.execute_script <<~JS
+ it 'intercepts failed graphql calls' do
+ page.execute_script <<~JS
fetch('/api/graphql', {
method: 'POST',
body: JSON.stringify({ query: 'query {}'}),
headers: { 'Content-Type': 'application/json' }
})
- JS
+ JS
- Support::Waiter.wait_until do
- !get_cached_error.nil?
+ Support::Waiter.wait_until do
+ !get_cached_error.nil?
+ end
+ expect(**get_cached_error).to include({ 'method' => 'POST', 'status' => 200, 'url' => '/api/graphql' })
end
- expect(**get_cached_error).to include({ 'method' => 'POST', 'status' => 200, 'url' => '/api/graphql' })
- end
- def get_cached_error
- cache = page.execute_script <<~JS
+ def get_cached_error
+ cache = page.execute_script <<~JS
return Interceptor.getCache()
- JS
+ JS
- cache['errors']&.first
+ cache['errors']&.first
+ end
end
end
end