123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- # encoding: utf-8
- require 'browser_test_helper'
- class MaintenanceMessageTest < TestCase
- def test_websocket
- message = 'message 1äöüß ' + rand(99999999999999999).to_s
- tests = [
- {
- :name => 'check #1',
- :instance1 => browser_instance,
- :instance2 => browser_instance,
- :instance1_username => 'master@example.com',
- :instance1_password => 'test',
- :instance2_username => 'agent1@example.com',
- :instance2_password => 'test',
- :url => browser_url,
- :action => [
- {
- :execute => 'wait',
- :value => 1,
- },
- {
- :where => :instance1,
- :execute => 'click',
- :css => 'a[href="#manage"]',
- },
- {
- :where => :instance1,
- :execute => 'click',
- :css => 'a[href="#system/maintenance"]',
- },
- {
- :where => :instance1,
- :execute => 'set',
- :css => '#content input[name="title"]',
- :value => message,
- },
- {
- :where => :instance1,
- :execute => 'set',
- :css => '#content textarea[name="message"]',
- :value => message,
- },
- {
- :where => :instance1,
- :execute => 'click',
- :css => '#content button[type="submit"]',
- },
- {
- :execute => 'wait',
- :value => 5,
- },
- {
- :where => :instance1,
- :execute => 'match',
- :css => 'body',
- :value => message,
- :match_result => false,
- },
- {
- :where => :instance2,
- :execute => 'check',
- :css => '.modal-header',
- :result => true,
- },
- {
- :where => :instance2,
- :execute => 'watch_for',
- :area => 'body',
- :value => message,
- },
- {
- :where => :instance2,
- :execute => 'click',
- :css => 'div.modal-header .close',
- },
- {
- :execute => 'wait',
- :value => 2,
- },
- ],
- },
- {
- :name => 'check #2',
- :action => [
- {
- :where => :instance1,
- :execute => 'click',
- :css => 'a[href="#manage"]',
- },
- {
- :where => :instance1,
- :execute => 'click',
- :css => 'a[href="#system/maintenance"]',
- },
- {
- :where => :instance1,
- :execute => 'set',
- :css => '#content input[name="title"]',
- :value => message + ' #2',
- },
- {
- :where => :instance1,
- :execute => 'set',
- :css => '#content textarea[name="message"]',
- :value => message + ' #2',
- },
- {
- :where => :instance1,
- :execute => 'click',
- :css => '#content button[type="submit"]',
- },
- {
- :execute => 'wait',
- :value => 5,
- },
- {
- :where => :instance1,
- :execute => 'match',
- :css => 'body',
- :value => message + ' #2',
- :match_result => false,
- },
- {
- :where => :instance1,
- :execute => 'check',
- :css => 'div.modal-backdrop.fade.in',
- :result => false,
- },
- {
- :where => :instance2,
- :execute => 'watch_for',
- :area => 'body',
- :value => message + ' #2',
- },
- {
- :where => :instance2,
- :execute => 'click',
- :css => 'div.modal-header .close',
- },
- {
- :execute => 'wait',
- :value => 2,
- },
- ],
- },
- {
- :name => 'check #3',
- :action => [
- {
- :where => :instance1,
- :execute => 'click',
- :css => 'a[href="#manage"]',
- },
- {
- :where => :instance1,
- :execute => 'click',
- :css => 'a[href="#system/maintenance"]',
- },
- {
- :where => :instance1,
- :execute => 'set',
- :css => '#content input[name="title"]',
- :value => message + ' #3' ,
- },
- {
- :where => :instance1,
- :execute => 'set',
- :css => '#content textarea[name="message"]',
- :value => message + ' #3',
- },
- {
- :where => :instance1,
- :execute => 'setCheck',
- :css => '#content input[name="reload"][value="1"]',
- },
- {
- :where => :instance1,
- :execute => 'click',
- :css => '#content button[type="submit"]',
- },
- {
- :execute => 'wait',
- :value => 5,
- },
- {
- :where => :instance1,
- :execute => 'check',
- :css => 'div.modal-backdrop.fade.in',
- :result => false,
- },
- {
- :where => :instance1,
- :execute => 'match',
- :css => 'body',
- :value => message + ' #3',
- :match_result => false,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => 'body',
- :value => message + ' #3',
- :match_result => true,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => 'body',
- :value => 'Reload application',
- :match_result => true,
- },
- ],
- },
- ]
- browser_double_test(tests)
- end
- end
|