spec/windows_spec.rb in rautomation-0.6.3 vs spec/windows_spec.rb in rautomation-0.7.0
- old
+ new
@@ -17,10 +17,20 @@
RAutomation::Window.new(:pid => @pid1),
RAutomation::Window.new(:pid => @pid2)
]
should have_all_windows(expected_windows, windows)
end
+
+ it "Window.windows accepts locators too" do
+ windows = RAutomation::Window.windows(:title => SpecHelper::DATA[:window1_title])
+ windows.should be_a(RAutomation::Windows)
+ windows.size.should == 1
+ expected_windows = [
+ RAutomation::Window.new(:pid => @pid1),
+ ]
+ should have_all_windows(expected_windows, windows)
+ end
it "Windows#windows returns all similar windows" do
windows = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).windows
windows.should be_a(RAutomation::Windows)
windows.size.should == 1
@@ -37,9 +47,18 @@
windows.size.should == 1
expected_windows = [
RAutomation::Window.new(:pid => @pid2),
]
should have_all_windows(expected_windows, windows)
+ end
+
+ it "Window.windows doesn't allow :hwnd or :pid as it's locators" do
+ RAutomation::Window.wait_timeout = 0.1
+ expect { RAutomation::Window.windows(:hwnd => 123) }.
+ to raise_exception(RAutomation::ElementCollections::UnsupportedLocatorException)
+
+ expect { RAutomation::Window.windows(:pid => 123) }.
+ to raise_exception(RAutomation::ElementCollections::UnsupportedLocatorException)
end
after :each do
Process.kill(9, @pid2) rescue nil
end