Maintenance: improves Websocket stability in CI
This commit is contained in:
parent
c59a627383
commit
62a6d5e2ca
6 changed files with 33 additions and 5 deletions
|
@ -361,7 +361,7 @@ browser:build:
|
|||
|
||||
.variables_browser_template: &variables_browser_definition
|
||||
RAILS_ENV: "production"
|
||||
APP_RESTART_CMD: "bundle exec rake zammad:ci:app:restart"
|
||||
APP_RESTART_CMD: "bundle exec rake environment zammad:ci:app:restart"
|
||||
|
||||
.test_browser_core_template: &test_browser_core_definition
|
||||
<<: *base_env
|
||||
|
|
|
@ -52,7 +52,7 @@ class _webSocketSingleton extends App.Controller
|
|||
connectionEstablished: false
|
||||
connectionWasEstablished: false
|
||||
tryToConnect: false
|
||||
backend: 'websocket'
|
||||
backend: undefined # set in constructor when config is available
|
||||
backend_port: ''
|
||||
client_id: undefined
|
||||
error: false
|
||||
|
@ -60,6 +60,8 @@ class _webSocketSingleton extends App.Controller
|
|||
constructor: (@args) ->
|
||||
super
|
||||
|
||||
@backend = @Config.get('websocket_backend') || 'websocket'
|
||||
|
||||
# on auth, send new auth data to server
|
||||
App.Event.bind(
|
||||
'auth'
|
||||
|
|
15
db/migrate/20200419204445_setting_websocket_backend.rb
Normal file
15
db/migrate/20200419204445_setting_websocket_backend.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
class SettingWebsocketBackend < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
# return if it's a new setup
|
||||
return if !Setting.find_by(name: 'system_init_done')
|
||||
|
||||
Setting.create_if_not_exists(
|
||||
title: 'Websocket backend',
|
||||
name: 'websocket_backend',
|
||||
area: 'System::WebSocket',
|
||||
description: 'Defines how to reach websocket server. "websocket" is default on production, "websocketPort" is for CI',
|
||||
state: Rails.env.production? ? 'websocket' : 'websocketPort',
|
||||
frontend: true
|
||||
)
|
||||
end
|
||||
end
|
|
@ -277,6 +277,14 @@ Setting.create_if_not_exists(
|
|||
},
|
||||
frontend: true
|
||||
)
|
||||
Setting.create_if_not_exists(
|
||||
title: 'Websocket backend',
|
||||
name: 'websocket_backend',
|
||||
area: 'System::WebSocket',
|
||||
description: 'Defines how to reach websocket server. "websocket" is default on production, "websocketPort" is for CI',
|
||||
state: Rails.env.production? ? 'websocket' : 'websocketPort',
|
||||
frontend: true
|
||||
)
|
||||
Setting.create_if_not_exists(
|
||||
title: 'Websocket port',
|
||||
name: 'websocket_port',
|
||||
|
|
|
@ -6,6 +6,9 @@ namespace :zammad do
|
|||
|
||||
desc 'Starts the application and uses BROWSER_PORT, RAILS_ENV and WS_PORT ENVs'
|
||||
task :start do # rubocop:disable Rails/RakeEnvironment
|
||||
# runs in CI old browser tests as RAILS_ENV=production, thus needs setting in here
|
||||
Setting.set('websocket_backend', 'websocketPort')
|
||||
|
||||
Rake::Task['zammad:ci:service:puma:start'].invoke(ENV['BROWSER_PORT'], ENV['RAILS_ENV'])
|
||||
Rake::Task['zammad:ci:service:websocket:start'].invoke(ENV['WS_PORT'])
|
||||
Rake::Task['zammad:ci:service:scheduler:start'].invoke
|
||||
|
|
|
@ -21,7 +21,7 @@ RSpec.describe 'Login Message', type: :system, authenticated: false do
|
|||
|
||||
Setting.set 'maintenance_login', false
|
||||
|
||||
wait(10).until_disappears { find '.js-maintenanceLogin', text: message }
|
||||
wait(10).until_disappears { find '.js-maintenanceLogin', text: message, wait: false }
|
||||
|
||||
expect(page).not_to have_css('.js-maintenanceLogin')
|
||||
end
|
||||
|
@ -31,7 +31,7 @@ RSpec.describe 'Login Message', type: :system, authenticated: false do
|
|||
|
||||
Setting.set 'maintenance_login_message', alt_message
|
||||
|
||||
wait(10).until_exists { find '.js-maintenanceLogin', text: alt_message }
|
||||
wait(10).until_exists { find '.js-maintenanceLogin', text: alt_message, wait: false }
|
||||
|
||||
expect(page).to have_css('.js-maintenanceLogin', text: alt_message)
|
||||
end
|
||||
|
@ -51,7 +51,7 @@ RSpec.describe 'Login Message', type: :system, authenticated: false do
|
|||
|
||||
Setting.set 'maintenance_login', true
|
||||
|
||||
wait(10).until_exists { find '.js-maintenanceLogin', text: message }
|
||||
wait(10).until_exists { find '.js-maintenanceLogin', text: message, wait: false }
|
||||
|
||||
expect(page).to have_css('.js-maintenanceLogin', text: message)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue