sirius-client-web 2013.4.1.0 → 2013.4.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +31 -1
- data/lib/sirius/web.rb +9 -6
- data/lib/sirius/web/classes/form.rb +3 -4
- data/lib/sirius/web/classes/frame.rb +10 -11
- data/lib/sirius/web/classes/page.rb +17 -18
- data/lib/sirius/web/classes/web_button.rb +7 -10
- data/lib/sirius/web/classes/web_checkbox.rb +4 -5
- data/lib/sirius/web/classes/web_control.rb +20 -21
- data/lib/sirius/web/classes/web_edit.rb +8 -9
- data/lib/sirius/web/classes/web_popup_list.rb +34 -35
- data/lib/sirius/web/classes/web_radio_button.rb +7 -8
- data/lib/sirius/web/core.rb +20 -11
- data/lib/sirius/web/core/WebCoreService.rb +75 -41
- data/lib/sirius/web/core/WebCoreServiceClient.rb +1 -1
- data/lib/sirius/web/core/WebCoreServiceDriver.rb +61 -59
- data/lib/sirius/web/core/WebCoreServiceMappingRegistry.rb +2 -1
- data/lib/sirius/web/core/select/WebSelectService.rb +188 -120
- data/lib/sirius/web/core/select/WebSelectServiceClient.rb +4 -4
- data/lib/sirius/web/core/select/WebSelectServiceDriver.rb +94 -95
- data/lib/sirius/web/core/select/WebSelectServiceMappingRegistry.rb +582 -585
- metadata +2 -2
data/Rakefile
CHANGED
@@ -2,6 +2,8 @@ require 'rubygems'
|
|
2
2
|
require 'rubygems/package_task'
|
3
3
|
require 'cucumber'
|
4
4
|
require 'cucumber/rake/task'
|
5
|
+
require 'rake/testtask'
|
6
|
+
require 'fileutils'
|
5
7
|
|
6
8
|
spec = Gem::Specification.new do |s|
|
7
9
|
s.platform = Gem::Platform::RUBY
|
@@ -16,9 +18,37 @@ spec = Gem::Specification.new do |s|
|
|
16
18
|
s.email="kolesnik.nickolay@gmail.com"
|
17
19
|
end
|
18
20
|
|
21
|
+
task :clean do |t|
|
22
|
+
FileUtils.rm_r 'pkg', :force => true
|
23
|
+
end
|
24
|
+
|
25
|
+
task :rubocop do |t|
|
26
|
+
includes = Dir['lib/**/*']
|
27
|
+
excludes = Dir['lib/sirius/web/core/**/*']
|
28
|
+
|
29
|
+
file_list = (includes - excludes ).reject {|fn| File.directory?(fn)}
|
30
|
+
|
31
|
+
file_list.each do |path|
|
32
|
+
sh "call rubocop -c .rubocop.yml -e #{path}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
Rake::TestTask.new(:install_test) do |task|
|
37
|
+
task.name = 'install_test'
|
38
|
+
task.libs << "test"
|
39
|
+
task.test_files = FileList['tests/install/**/*.rb']
|
40
|
+
task.verbose = true
|
41
|
+
end
|
42
|
+
|
19
43
|
Gem::PackageTask.new(spec) do |pkg|
|
20
44
|
end
|
21
45
|
|
22
46
|
Cucumber::Rake::Task.new(:test) do |t|
|
23
47
|
t.cucumber_opts = "tests/features --format pretty --guess"
|
24
|
-
end
|
48
|
+
end
|
49
|
+
|
50
|
+
task :push => [:package] do |t|
|
51
|
+
sh "call gem push -V pkg/#{spec.name}-#{spec.version}.gem"
|
52
|
+
end
|
53
|
+
|
54
|
+
task :all => [:clean,:rubocop,:package,:install_test]
|
data/lib/sirius/web.rb
CHANGED
@@ -1,24 +1,27 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'sirius/web/core.rb'
|
3
|
+
|
1
4
|
module Sirius
|
2
5
|
module Client
|
3
6
|
module Web
|
4
7
|
class Web
|
5
8
|
attr_accessor :core
|
6
9
|
attr_accessor :token
|
7
|
-
def initialize(host=
|
8
|
-
@core = Core::Core.new(host,port)
|
10
|
+
def initialize(host = 'localhost', port = '21212')
|
11
|
+
@core = Core::Core.new(host, port)
|
9
12
|
@token = nil
|
10
13
|
end
|
11
14
|
|
12
|
-
def start
|
15
|
+
def start
|
13
16
|
@token = @core.start
|
14
17
|
end
|
15
18
|
|
16
|
-
def stop
|
19
|
+
def stop
|
17
20
|
@core.stop @token
|
18
21
|
end
|
19
22
|
|
20
|
-
def method_missing?
|
21
|
-
@core.method(name).call(@token,args)
|
23
|
+
def method_missing?(name, *args)
|
24
|
+
@core.method(name).call(@token, args)
|
22
25
|
end
|
23
26
|
end
|
24
27
|
end
|
@@ -2,21 +2,20 @@ module Sirius
|
|
2
2
|
module Client
|
3
3
|
module Web
|
4
4
|
module Classes
|
5
|
-
|
6
5
|
class Form < Frame
|
7
6
|
attr_accessor :client
|
8
7
|
attr_accessor :locator
|
9
8
|
|
10
9
|
def initialize(client, locator)
|
11
10
|
@client = client
|
12
|
-
@locator = locator
|
13
|
-
end
|
11
|
+
@locator = locator
|
12
|
+
end
|
14
13
|
|
15
14
|
def submit
|
16
15
|
@client.core.submit(nil, locator);
|
17
16
|
end
|
18
17
|
|
19
|
-
def method_missing?(name
|
18
|
+
def method_missing?(name, *args)
|
20
19
|
@client.core.getAttribute(nil, @locator, name)
|
21
20
|
end
|
22
21
|
end
|
@@ -2,33 +2,32 @@ module Sirius
|
|
2
2
|
module Client
|
3
3
|
module Web
|
4
4
|
module Classes
|
5
|
-
|
6
5
|
class Frame
|
7
6
|
attr_accessor :client
|
8
7
|
attr_accessor :locator
|
9
8
|
|
10
9
|
def initialize(client, locator)
|
11
10
|
@client = client
|
12
|
-
@locator = locator
|
13
|
-
end
|
14
|
-
|
11
|
+
@locator = locator
|
12
|
+
end
|
13
|
+
|
15
14
|
def url
|
16
15
|
@client.core.getURL
|
17
16
|
end
|
18
|
-
|
17
|
+
|
19
18
|
def location
|
20
19
|
@client.core.getLocation(nil, locator)
|
21
20
|
end
|
22
|
-
|
21
|
+
|
23
22
|
def size
|
24
23
|
@client.core.getSize(nil, locator);
|
25
24
|
end
|
26
|
-
|
27
|
-
def
|
28
|
-
@client.core.getAttribute(nil, @locator,
|
25
|
+
|
26
|
+
def inner_html
|
27
|
+
@client.core.getAttribute(nil, @locator, 'innerHTML')
|
29
28
|
end
|
30
|
-
|
31
|
-
def
|
29
|
+
|
30
|
+
def switch_to(frame)
|
32
31
|
@client.core.selectFrameByName(frame.locator)
|
33
32
|
end
|
34
33
|
end
|
@@ -2,37 +2,36 @@ module Sirius
|
|
2
2
|
module Client
|
3
3
|
module Web
|
4
4
|
module Classes
|
5
|
-
|
6
5
|
class Page < Frame
|
7
6
|
attr_accessor :client
|
8
7
|
attr_accessor :locator
|
9
8
|
|
10
9
|
def initialize(client, locator = nil)
|
11
10
|
@client = client
|
12
|
-
@locator = locator
|
13
|
-
end
|
14
|
-
|
15
|
-
def title()
|
16
|
-
@client.core.getTitle()
|
11
|
+
@locator = locator
|
17
12
|
end
|
18
|
-
|
19
|
-
def
|
20
|
-
@client.core.
|
13
|
+
|
14
|
+
def title
|
15
|
+
@client.core.getTitle
|
21
16
|
end
|
22
|
-
|
23
|
-
def
|
24
|
-
@client.core.
|
17
|
+
|
18
|
+
def back
|
19
|
+
@client.core.back
|
25
20
|
end
|
26
|
-
|
27
|
-
def
|
28
|
-
@client.core.
|
21
|
+
|
22
|
+
def forward
|
23
|
+
@client.core.forward
|
29
24
|
end
|
30
|
-
|
25
|
+
|
26
|
+
def refresh
|
27
|
+
@client.core.refresh
|
28
|
+
end
|
29
|
+
|
31
30
|
def open(url)
|
32
31
|
@client.core.open(url)
|
33
32
|
end
|
34
|
-
|
35
|
-
def
|
33
|
+
|
34
|
+
def switch_to(page)
|
36
35
|
@client.core.selectWindow(page.locator)
|
37
36
|
end
|
38
37
|
end
|
@@ -2,23 +2,20 @@ module Sirius
|
|
2
2
|
module Client
|
3
3
|
module Web
|
4
4
|
module Classes
|
5
|
-
|
6
5
|
class WebButton < WebControl
|
7
6
|
attr_accessor :parent
|
8
|
-
attr_accessor :
|
7
|
+
attr_accessor :parent_element
|
9
8
|
attr_accessor :locator
|
10
9
|
|
11
|
-
def initialize(parent, locator,
|
10
|
+
def initialize(parent, locator, parent_element = nil)
|
12
11
|
@parent = parent
|
13
|
-
@
|
14
|
-
@locator = locator
|
15
|
-
end
|
12
|
+
@parent_element = parent_element
|
13
|
+
@locator = locator
|
14
|
+
end
|
16
15
|
|
17
|
-
def text
|
16
|
+
def text
|
18
17
|
res = self.value
|
19
|
-
if
|
20
|
-
res = self.innerText
|
21
|
-
end
|
18
|
+
res = self.inner_text if res == nil
|
22
19
|
res
|
23
20
|
end
|
24
21
|
end
|
@@ -3,14 +3,13 @@ module Sirius
|
|
3
3
|
module Web
|
4
4
|
module Classes
|
5
5
|
class WebCheckBox < WebRadioButton
|
6
|
-
def initialize(parent, locator, parentElement=nil)
|
7
|
-
super(parent,locator,parentElement)
|
6
|
+
def initialize(parent, locator, parentElement = nil)
|
7
|
+
super(parent, locator, parentElement)
|
8
8
|
end
|
9
|
-
|
10
|
-
def uncheck
|
9
|
+
|
10
|
+
def uncheck
|
11
11
|
click if checked?
|
12
12
|
end
|
13
|
-
|
14
13
|
end
|
15
14
|
end
|
16
15
|
end
|
@@ -2,43 +2,42 @@ module Sirius
|
|
2
2
|
module Client
|
3
3
|
module Web
|
4
4
|
module Classes
|
5
|
-
|
6
5
|
class WebControl
|
7
6
|
attr_accessor :parent
|
8
|
-
attr_accessor :
|
7
|
+
attr_accessor :parent_element
|
9
8
|
attr_accessor :locator
|
10
9
|
|
11
|
-
def initialize(parent, locator,
|
10
|
+
def initialize(parent, locator, parent_element = nil)
|
12
11
|
@parent = parent
|
13
|
-
@
|
14
|
-
@locator = locator
|
15
|
-
end
|
12
|
+
@parent_element = parent_element
|
13
|
+
@locator = locator
|
14
|
+
end
|
16
15
|
|
17
16
|
def client
|
18
17
|
@parent.client
|
19
18
|
end
|
20
|
-
|
21
|
-
def location
|
22
|
-
client
|
19
|
+
|
20
|
+
def location
|
21
|
+
client.core.getLocation(@parentElement, @locator)
|
23
22
|
end
|
24
|
-
|
25
|
-
def size
|
26
|
-
client
|
23
|
+
|
24
|
+
def size
|
25
|
+
client.core.getSize(@parentElement, @locator)
|
27
26
|
end
|
28
|
-
|
29
|
-
def focused?
|
27
|
+
|
28
|
+
def focused?
|
30
29
|
false
|
31
30
|
end
|
32
|
-
|
33
|
-
def click
|
34
|
-
client
|
31
|
+
|
32
|
+
def click
|
33
|
+
client.core.click(@parentElement, @locator)
|
35
34
|
end
|
36
|
-
|
35
|
+
|
37
36
|
def get_attribute(attribute)
|
38
|
-
client
|
37
|
+
client.core.getAttribute(@parentElement, @locator, attribute)
|
39
38
|
end
|
40
|
-
|
41
|
-
def method_missing?(name
|
39
|
+
|
40
|
+
def method_missing?(name, *args)
|
42
41
|
get_attribute(@parentElement, @locator, name)
|
43
42
|
end
|
44
43
|
end
|
@@ -2,23 +2,22 @@ module Sirius
|
|
2
2
|
module Client
|
3
3
|
module Web
|
4
4
|
module Classes
|
5
|
-
|
6
5
|
class WebEdit < WebControl
|
7
6
|
attr_accessor :parent
|
8
|
-
attr_accessor :
|
7
|
+
attr_accessor :parent_element
|
9
8
|
attr_accessor :locator
|
10
9
|
|
11
|
-
def initialize(parent, locator, parentElement=nil)
|
10
|
+
def initialize(parent, locator, parentElement = nil)
|
12
11
|
@parent = parent
|
13
|
-
@
|
14
|
-
@locator = locator
|
15
|
-
end
|
12
|
+
@parent_element = parent_element
|
13
|
+
@locator = locator
|
14
|
+
end
|
16
15
|
|
17
16
|
def type(content)
|
18
|
-
client
|
17
|
+
client.core.sendKeys(@parent_element, @locator, content)
|
19
18
|
end
|
20
|
-
|
21
|
-
def text
|
19
|
+
|
20
|
+
def text
|
22
21
|
self.value
|
23
22
|
end
|
24
23
|
end
|
@@ -3,54 +3,53 @@ module Sirius
|
|
3
3
|
module Web
|
4
4
|
module Classes
|
5
5
|
class WebPopupList < WebControl
|
6
|
-
def initialize(parent, locator, parentElement=nil)
|
7
|
-
super(parent,locator,
|
6
|
+
def initialize(parent, locator, parentElement = nil)
|
7
|
+
super(parent, locator, parent_element)
|
8
8
|
end
|
9
9
|
|
10
|
-
def multi?
|
11
|
-
client
|
10
|
+
def multi?
|
11
|
+
client.core.isMultiple(@parent_element, @locator)
|
12
12
|
end
|
13
|
-
|
14
|
-
def
|
15
|
-
client
|
13
|
+
|
14
|
+
def deselect_all
|
15
|
+
client.core.deselectAll(@parent_element, @locator)
|
16
16
|
end
|
17
|
-
|
18
|
-
def
|
19
|
-
client
|
17
|
+
|
18
|
+
def deselect_by_index(index)
|
19
|
+
client.core.deselectByIndex(@parent_element, @locator, index)
|
20
20
|
end
|
21
|
-
|
22
|
-
def
|
23
|
-
client
|
21
|
+
|
22
|
+
def deselect_by_value(value)
|
23
|
+
client.core.deselectByValue(@parent_element, @locator, value)
|
24
24
|
end
|
25
|
-
|
26
|
-
def
|
27
|
-
client
|
25
|
+
|
26
|
+
def deselect_by_visible_text(text)
|
27
|
+
client.core.deselectByVisibleText(@parent_element, @locator, text)
|
28
28
|
end
|
29
|
-
|
30
|
-
def
|
31
|
-
client
|
29
|
+
|
30
|
+
def get_all_options
|
31
|
+
client.core.getAllOptions(@parent_element, @locator)
|
32
32
|
end
|
33
|
-
|
34
|
-
def
|
35
|
-
client
|
33
|
+
|
34
|
+
def select_by_index(index)
|
35
|
+
client.core.selectByIndex(@parent_element, @locator, index)
|
36
36
|
end
|
37
|
-
|
38
|
-
def
|
39
|
-
client
|
37
|
+
|
38
|
+
def select_by_value(value)
|
39
|
+
client.core.selectByValue(@parent_element, @locator, value)
|
40
40
|
end
|
41
|
-
|
42
|
-
def
|
43
|
-
client
|
41
|
+
|
42
|
+
def select_by_visible_text(text)
|
43
|
+
client.core.selectByVisibleText(@parent_element, @locator, text)
|
44
44
|
end
|
45
|
-
|
46
|
-
def
|
47
|
-
client
|
45
|
+
|
46
|
+
def get_all_selected_options
|
47
|
+
client.core.getAllSelectedOptions(@parent_element, @locator)
|
48
48
|
end
|
49
|
-
|
50
|
-
def
|
51
|
-
client
|
49
|
+
|
50
|
+
def get_first_selected_option
|
51
|
+
client.core.getFirstSelectedOption(@parent_element, @locator)
|
52
52
|
end
|
53
|
-
|
54
53
|
end
|
55
54
|
end
|
56
55
|
end
|
@@ -3,16 +3,15 @@ module Sirius
|
|
3
3
|
module Web
|
4
4
|
module Classes
|
5
5
|
class WebRadioButton < WebButton
|
6
|
-
|
7
|
-
|
8
|
-
super(parent,locator,parentElement)
|
6
|
+
def initialize(parent, locator, parent_element = nil)
|
7
|
+
super(parent, locator, parent_element)
|
9
8
|
end
|
10
|
-
|
11
|
-
def checked?
|
12
|
-
client
|
9
|
+
|
10
|
+
def checked?
|
11
|
+
client.core.isSelected(@parent_element, @locator)
|
13
12
|
end
|
14
|
-
|
15
|
-
def check
|
13
|
+
|
14
|
+
def check
|
16
15
|
click unless checked?
|
17
16
|
end
|
18
17
|
end
|