[test] Make iOS UI helper search from the key window instead.

Fixes http://hipbyte.myjetbrains.com/youtrack/issue/RM-382.
This commit is contained in:
Eloy Durán
2014-01-16 12:06:31 +01:00
parent 55f1322e4e
commit fb53ff0948
3 changed files with 27 additions and 9 deletions

View File

@@ -99,7 +99,7 @@ describe "UIView extensions" do
end
end
describe "Bacon::Functional::API, concerning device events" do
describe "Bacon::Functional::API, concerning view helpers shortcuts" do
tests SimpleViewController
it "finds a view by its accessibility label" do
@@ -120,6 +120,27 @@ describe "Bacon::Functional::API, concerning device events" do
view(view).should == view
end
it "finds a view on the current key window" do
begin
alert = UIAlertView.alloc.initWithTitle(nil,
message:'Overlapping all views',
delegate:nil,
cancelButtonTitle:'OK',
otherButtonTitles:nil)
alert.show
proper_wait(1)
alertWindow = UIApplication.sharedApplication.keyWindow
alertWindow.should.not == @window
view('OK').window.should == alertWindow
views(UIView).first.window.should == alertWindow
ensure
alert.dismissWithClickedButtonIndex(0, animated:false)
end
end
it "raises if no view by label could be found after the `timeout` passes" do
start = Time.now.to_i
e = catch_bacon_error { view('Does not exist') }