Merge commit '1959365c2f410aa82874c5c05ab92c4eca4c4055' into glitch-soc/merge-upstream
This commit is contained in:
commit
f35ba6963d
74 files changed
+613
-216
No files matched your search
+14
-22
@@ -3,12 +3,8 @@
|
||||
ENV['RAILS_ENV'] ||= 'test'
|
||||
|
||||
# This needs to be defined before Rails is initialized
|
||||
RUN_SYSTEM_SPECS = ENV.fetch('RUN_SYSTEM_SPECS', false)
|
||||
|
||||
if RUN_SYSTEM_SPECS
|
||||
STREAMING_PORT = ENV.fetch('TEST_STREAMING_PORT', '4020')
|
||||
ENV['STREAMING_API_BASE_URL'] = "http://localhost:#{STREAMING_PORT}"
|
||||
end
|
||||
STREAMING_PORT = ENV.fetch('TEST_STREAMING_PORT', '4020')
|
||||
ENV['STREAMING_API_BASE_URL'] = "http://localhost:#{STREAMING_PORT}"
|
||||
|
||||
require File.expand_path('../config/environment', __dir__)
|
||||
|
||||
@@ -26,10 +22,12 @@ require 'test_prof/recipes/rspec/before_all'
|
||||
Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
|
||||
|
||||
ActiveRecord::Migration.maintain_test_schema!
|
||||
WebMock.disable_net_connect!(allow: Chewy.settings[:host], allow_localhost: RUN_SYSTEM_SPECS)
|
||||
WebMock.disable_net_connect!(
|
||||
allow_localhost: true,
|
||||
allow: Chewy.settings[:host]
|
||||
)
|
||||
Sidekiq.logger = nil
|
||||
|
||||
# System tests config
|
||||
DatabaseCleaner.strategy = [:deletion]
|
||||
|
||||
Devise::Test::ControllerHelpers.module_eval do
|
||||
@@ -49,16 +47,14 @@ Devise::Test::ControllerHelpers.module_eval do
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
# This is set before running spec:system, see lib/tasks/tests.rake
|
||||
config.filter_run_excluding type: lambda { |type|
|
||||
case type
|
||||
when :system
|
||||
!RUN_SYSTEM_SPECS
|
||||
end
|
||||
}
|
||||
# By default, skip specs that need full JS browser
|
||||
config.filter_run_excluding :js
|
||||
|
||||
# By default, skip the elastic search integration specs
|
||||
config.filter_run_excluding search: true
|
||||
# By default, skip specs that need elastic search server
|
||||
config.filter_run_excluding :search
|
||||
|
||||
# By default, skip specs that need the streaming server
|
||||
config.filter_run_excluding :streaming
|
||||
|
||||
config.fixture_paths = [
|
||||
Rails.root.join('spec', 'fixtures'),
|
||||
@@ -81,7 +77,7 @@ RSpec.configure do |config|
|
||||
config.include Devise::Test::ControllerHelpers, type: :controller
|
||||
config.include Devise::Test::ControllerHelpers, type: :helper
|
||||
config.include Devise::Test::ControllerHelpers, type: :view
|
||||
config.include Devise::Test::IntegrationHelpers, type: :feature
|
||||
config.include Devise::Test::IntegrationHelpers, type: :system
|
||||
config.include Devise::Test::IntegrationHelpers, type: :request
|
||||
config.include ActionMailer::TestHelper
|
||||
config.include Paperclip::Shoulda::Matchers
|
||||
@@ -111,10 +107,6 @@ RSpec.configure do |config|
|
||||
stub_reset_connection_pools
|
||||
end
|
||||
|
||||
config.before :each, type: :feature do
|
||||
Capybara.current_driver = :rack_test
|
||||
end
|
||||
|
||||
config.before do |example|
|
||||
allow(Resolv::DNS).to receive(:open).and_raise('Real DNS queries are disabled, stub Resolv::DNS as needed') unless example.metadata[:type] == :system
|
||||
end
|
||||
|
||||
@@ -23,7 +23,7 @@ describe 'Content-Security-Policy' do
|
||||
<<~CSP.split("\n").map(&:strip)
|
||||
base-uri 'none'
|
||||
child-src 'self' blob: https://cb6e6126.ngrok.io
|
||||
connect-src 'self' data: blob: https://cb6e6126.ngrok.io ws://cb6e6126.ngrok.io:4000
|
||||
connect-src 'self' data: blob: https://cb6e6126.ngrok.io #{Rails.configuration.x.streaming_api_base_url}
|
||||
default-src 'none'
|
||||
font-src 'self' https://cb6e6126.ngrok.io
|
||||
form-action 'self'
|
||||
|
||||
@@ -26,6 +26,10 @@ Capybara.javascript_driver = :headless_chrome
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.before(:each, type: :system) do
|
||||
driven_by :rack_test
|
||||
end
|
||||
|
||||
config.before(:each, :js, type: :system) do
|
||||
driven_by Capybara.javascript_driver
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.after(:each, type: :system) do
|
||||
config.after(:each, :js, type: :system) do
|
||||
errors = page.driver.browser.logs.get(:browser)
|
||||
if errors.present?
|
||||
aggregate_failures 'javascript errrors' do
|
||||
|
||||
@@ -95,7 +95,7 @@ RSpec.configure do |config|
|
||||
end
|
||||
end
|
||||
|
||||
config.around :each, type: :system do |example|
|
||||
config.around :each, :streaming, type: :system do |example|
|
||||
# Streaming server needs DB access but `use_transactional_tests` rolls back
|
||||
# every transaction. Disable this feature for streaming tests, and use
|
||||
# DatabaseCleaner to clean the database tables between each test.
|
||||
@@ -125,6 +125,6 @@ RSpec.configure do |config|
|
||||
end
|
||||
|
||||
def streaming_examples_present?
|
||||
RUN_SYSTEM_SPECS
|
||||
RSpec.world.filtered_examples.values.flatten.any? { |example| example.metadata[:streaming] == true }
|
||||
end
|
||||
end
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'NewStatuses', :sidekiq_inline do
|
||||
describe 'NewStatuses', :js, :sidekiq_inline, :streaming do
|
||||
include ProfileStories
|
||||
|
||||
subject { page }
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'Using OAuth from an external app' do
|
||||
let(:client_app) { Doorkeeper::Application.create!(name: 'test', redirect_uri: 'http://localhost/health', scopes: 'read') }
|
||||
describe 'Using OAuth from an external app', :js, :streaming do
|
||||
let(:client_app) { Doorkeeper::Application.create!(name: 'test', redirect_uri: about_url(host: Rails.application.config.x.local_domain), scopes: 'read') }
|
||||
|
||||
context 'when the user is already logged in' do
|
||||
let!(:user) { Fabricate(:user) }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'OCR', :paperclip_processing, :sidekiq_inline do
|
||||
describe 'OCR', :js, :paperclip_processing, :sidekiq_inline, :streaming do
|
||||
include ProfileStories
|
||||
|
||||
let(:email) { 'test@example.com' }
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'report interface', :paperclip_processing do
|
||||
describe 'report interface', :js, :paperclip_processing, :streaming do
|
||||
include ProfileStories
|
||||
|
||||
let(:email) { 'admin@example.com' }
|
||||
|
||||
File renamed without changes.
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'ShareEntrypoint' do
|
||||
describe 'ShareEntrypoint', :js, :streaming do
|
||||
include ProfileStories
|
||||
|
||||
subject { page }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'UnloggedBrowsing' do
|
||||
describe 'UnloggedBrowsing', :js, :streaming do
|
||||
subject { page }
|
||||
|
||||
before do
|
||||
|
||||
Reference in new issue
Block a user