Fix non-deterministic user acceptance tests
This commit is contained in:
parent
47bc9c9da2
commit
730527b836
@ -8,5 +8,5 @@ Feature: layout client management
|
|||||||
Then the window must be mapped
|
Then the window must be mapped
|
||||||
|
|
||||||
Scenario: focuses new client window
|
Scenario: focuses new client window
|
||||||
When a window requests to be mapped
|
When a window is mapped
|
||||||
Then the window must be focused
|
Then the window must be focused
|
||||||
|
@ -30,6 +30,6 @@ Feature: layout protocol
|
|||||||
|
|
||||||
Scenario: tells the layout to unmanage a client with #remove message
|
Scenario: tells the layout to unmanage a client with #remove message
|
||||||
Given uhwm is running with options -v -r./layout -l Layout
|
Given uhwm is running with options -v -r./layout -l Layout
|
||||||
And a window is managed
|
And a window is mapped
|
||||||
When the window is unmapped
|
When the window is unmapped
|
||||||
Then the output must contain "testing_#remove_XClient/default"
|
Then the output must contain "testing_#remove_XClient/default"
|
||||||
|
@ -2,8 +2,8 @@ Feature: layout client unmanagement
|
|||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given uhwm is running
|
Given uhwm is running
|
||||||
And a first window is managed
|
And a first window is mapped
|
||||||
And a second window is managed
|
And a second window is mapped
|
||||||
|
|
||||||
Scenario: maps another window
|
Scenario: maps another window
|
||||||
When the second window is unmapped
|
When the second window is unmapped
|
||||||
|
@ -2,10 +2,10 @@ Feature: manager client unmanagement
|
|||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given uhwm is running
|
Given uhwm is running
|
||||||
And a window is managed
|
And a window is mapped
|
||||||
|
|
||||||
Scenario: logs when a new client is unmanaged
|
Scenario: logs when a new client is unmanaged
|
||||||
When the window requests to be unmapped
|
When the window is unmapped
|
||||||
Then the output must match /unmanag.+xclient/i
|
Then the output must match /unmanag.+xclient/i
|
||||||
|
|
||||||
Scenario: unmanages client on destroy notify X events
|
Scenario: unmanages client on destroy notify X events
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
Given /^a(?:\s(\w+))? window is managed$/ do |ident|
|
Given /^a(?:\s(\w+))? window is mapped$/ do |ident|
|
||||||
ident ||= :default
|
|
||||||
x_client(ident).map.sync
|
x_client(ident).map.sync
|
||||||
uhwm_wait_output /manag.+#{x_client(ident).name}/i
|
timeout_until 'window not mapped after %d seconds' do
|
||||||
|
x_window_map_state(x_client(ident).window_id) == 'IsViewable'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^I press the ([^ ]+) keys?$/ do |keys|
|
When /^I press the ([^ ]+) keys?$/ do |keys|
|
||||||
@ -16,14 +17,11 @@ When /^a window requests to be mapped (\d+) times$/ do |times|
|
|||||||
x_client.map times: times.to_i
|
x_client.map times: times.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^the window requests to be unmapped$/ do
|
|
||||||
x_client.unmap.sync
|
|
||||||
end
|
|
||||||
|
|
||||||
When /^the(?:\s(\w+))? window is unmapped$/ do |ident|
|
When /^the(?:\s(\w+))? window is unmapped$/ do |ident|
|
||||||
ident ||= :default
|
|
||||||
x_client(ident).unmap.sync
|
x_client(ident).unmap.sync
|
||||||
uhwm_wait_output /unmanag.+#{x_client(ident).name}/i
|
timeout_until 'window not unmapped after %d seconds' do
|
||||||
|
x_window_map_state(x_client(ident).window_id) == 'IsUnMapped'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^the window is destroyed$/ do
|
When /^the window is destroyed$/ do
|
||||||
@ -36,12 +34,15 @@ Then /^it must connect to X display$/ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
Then /^the(?:\s(\w+))? window must be mapped$/ do |ident|
|
Then /^the(?:\s(\w+))? window must be mapped$/ do |ident|
|
||||||
ident ||= :default
|
timeout_until 'window not mapped after %d seconds' do
|
||||||
expect(x_window_map_state x_client(ident).window_id).to eq 'IsViewable'
|
x_window_map_state(x_client(ident).window_id) == 'IsViewable'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^the window must be focused$/ do
|
Then /^the window must be focused$/ do
|
||||||
expect(x_focused_window_id).to eq x_client.window_id
|
timeout_until 'window not focused after %d seconds' do
|
||||||
|
x_focused_window_id == x_client.window_id
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^the input event mask must include (.+)$/ do |mask|
|
Then /^the input event mask must include (.+)$/ do |mask|
|
||||||
|
@ -64,7 +64,8 @@ module Uh
|
|||||||
@other_wm
|
@other_wm
|
||||||
end
|
end
|
||||||
|
|
||||||
def x_client ident = :default
|
def x_client ident = nil
|
||||||
|
ident ||= :default
|
||||||
@x_clients ||= {}
|
@x_clients ||= {}
|
||||||
@x_clients[ident] ||= XClient.new(ident)
|
@x_clients[ident] ||= XClient.new(ident)
|
||||||
end
|
end
|
||||||
@ -103,7 +104,7 @@ module Uh
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def timeout_until
|
def timeout_until message = 'condition not met after %d seconds'
|
||||||
timeout = ENV.key?('UHWMTEST_TIMEOUT') ?
|
timeout = ENV.key?('UHWMTEST_TIMEOUT') ?
|
||||||
ENV['UHWMTEST_TIMEOUT'].to_i :
|
ENV['UHWMTEST_TIMEOUT'].to_i :
|
||||||
TIMEOUT_DEFAULT
|
TIMEOUT_DEFAULT
|
||||||
@ -114,7 +115,7 @@ module Uh
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue Timeout::Error
|
rescue Timeout::Error
|
||||||
fail TimeoutError.new('execution expired', timeout)
|
fail TimeoutError.new(message % timeout, timeout)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user