Sha256: eab3e7ad338e3f686e8a592786b931623ba7cb53a5edf1e198e875f1aefc01b2
Contents?: true
Size: 1.73 KB
Versions: 5
Compression:
Stored size: 1.73 KB
Contents
require 'spec_helper' describe Uia do context '#children' do Then { Uia.children.find { |e| e.name =~ /MainFormWindow/ } != nil } end context '#find_element' do Given(:main_window) { Uia.find_element id: 'MainFormWindow' } context 'by id' do Then { expect(Uia.find_element(id: 'MainFormWindow')).to be_instance_of(Element) } Then { expect(Uia.find_element(id: /[Mm]ain/)).to be_instance_of(Element) } Then { Uia.find_element(id: 'not there') == nil } end context 'by name' do Then { expect(Uia.find_element(name: 'MainFormWindow')).to be_instance_of(Element) } Then { expect(Uia.find_element(name: /[Mm]ain.*Window/ )).to be_instance_of(Element) } Then { Uia.find_element(name: 'not there') == nil } end context 'by process id' do Then { expect(Uia.find_element(pid: @app.pid)).to be_instance_of(Element) } Then { Uia.find_element(pid: -1) == nil } end context 'by runtime id' do Then { expect(Uia.find_element(runtime_id: main_window.runtime_id)).to be_instance_of(Element) } context 'can search descendants' do Given(:element_with_no_handle) { Uia.find_element(id: 'MainFormWindow').find(name: 'Parent Two') } Then { element_with_no_handle.click.should be_true } end end context 'by window handle' do Then { expect(Uia.find_element(handle: main_window.handle)).to be_instance_of(Element) } Then { expect { Uia.find_element(handle: 0x0) }.to raise_error } end context 'invalid locators' do When(:bad_input) { Uia.find_element(bad: 123) } Then { bad_input.should have_failed(Uia::BadLocator, '{:bad=>123} is not a valid locator') } end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
uia-0.0.7.3 | spec/uia_spec.rb |
uia-0.0.7.2 | spec/uia_spec.rb |
uia-0.0.7.1 | spec/uia_spec.rb |
uia-0.0.7 | spec/uia_spec.rb |
uia-0.0.6.1 | spec/uia_spec.rb |