popup 0.0.7 → 0.0.8
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/lib/popup.rb +2 -1
- data/lib/popup/popup.rb +2 -0
- data/lib/popup/version.rb +1 -1
- data/spec/alert_popup_spec.rb +0 -11
- data/spec/popup_spec.rb +3 -1
- data/spec/save_popup_spec.rb +23 -23
- data/spec/spec_helper.rb +0 -11
- metadata +35 -60
- data/spec/websserver.rb +0 -56
data/lib/popup.rb
CHANGED
data/lib/popup/popup.rb
CHANGED
@@ -27,10 +27,12 @@ module ATT
|
|
27
27
|
@@windows = nil
|
28
28
|
RAutomation::Window.wait_timeout = Config::timeout
|
29
29
|
ENV["RAUTOMATION_ADAPTER"] = "autoit"
|
30
|
+
|
30
31
|
def initialize(window) # :nodoc:
|
31
32
|
@window = window
|
32
33
|
end
|
33
34
|
|
35
|
+
attr_reader :window
|
34
36
|
# Get a popup between record() and find(),
|
35
37
|
# * If not found, it will raise +WindowNotFoundError
|
36
38
|
# * Else, if found more than one windows, it will raise MutliWindowsMatchError
|
data/lib/popup/version.rb
CHANGED
data/spec/alert_popup_spec.rb
CHANGED
@@ -19,15 +19,4 @@ describe ATT::AlertPopup do
|
|
19
19
|
alert = @b.button(:id,"alert_popup")
|
20
20
|
ATT::AlertPopup.find_when { alert.click_no_wait }.click
|
21
21
|
end
|
22
|
-
|
23
|
-
it "#find_when in one block" do
|
24
|
-
alert = @b.button(:id,"alert_popup")
|
25
|
-
b2 = TestBrowser.get2
|
26
|
-
alert2 = b2.button(:id,"alert_popup")
|
27
|
-
ATT::AlertPopup.find_when {
|
28
|
-
ATT::AlertPopup.find_when { alert2.click_no_wait }.click
|
29
|
-
alert.click_no_wait
|
30
|
-
}.click
|
31
|
-
end
|
32
|
-
|
33
22
|
end
|
data/spec/popup_spec.rb
CHANGED
@@ -22,13 +22,15 @@ describe ATT::Popup do
|
|
22
22
|
o.should_not be_nil
|
23
23
|
o.close
|
24
24
|
end
|
25
|
-
it "#find multi" do
|
25
|
+
it "#find multi and test window" do
|
26
26
|
b = TestBrowser.get
|
27
27
|
ATT::Popup.record
|
28
28
|
b.file_field(:id,"file_popup").click_no_wait
|
29
29
|
c = Watir::IE.new
|
30
30
|
o = ATT::Popup.find
|
31
31
|
o.should_not be_nil
|
32
|
+
# read window obj for more
|
33
|
+
o.window.should_not be_nil
|
32
34
|
o.close
|
33
35
|
c.close
|
34
36
|
end
|
data/spec/save_popup_spec.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ATT::SavePopup do
|
4
|
-
before(:each) do
|
5
|
-
#@b = TestBrowser.get
|
6
|
-
end
|
7
|
-
|
8
|
-
it "#exist?" do
|
9
|
-
window = RAutomation::Window.new(:title=>"notexist")
|
10
|
-
o = ATT::SavePopup.new(window)
|
11
|
-
o.should respond_to("exist?")
|
12
|
-
o.should respond_to("assert_exist?")
|
13
|
-
end
|
14
|
-
|
15
|
-
it "#set #saveas" do
|
16
|
-
window = RAutomation::Window.new(:title=>"notexist")
|
17
|
-
o = ATT::SavePopup.new(window)
|
18
|
-
o.should respond_to("set")
|
19
|
-
o.should respond_to("saveas")
|
20
|
-
|
21
|
-
end
|
22
|
-
#saveas
|
23
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ATT::SavePopup do
|
4
|
+
before(:each) do
|
5
|
+
#@b = TestBrowser.get
|
6
|
+
end
|
7
|
+
|
8
|
+
it "#exist?" do
|
9
|
+
window = RAutomation::Window.new(:title=>"notexist")
|
10
|
+
o = ATT::SavePopup.new(window)
|
11
|
+
o.should respond_to("exist?")
|
12
|
+
o.should respond_to("assert_exist?")
|
13
|
+
end
|
14
|
+
|
15
|
+
it "#set #saveas" do
|
16
|
+
window = RAutomation::Window.new(:title=>"notexist")
|
17
|
+
o = ATT::SavePopup.new(window)
|
18
|
+
o.should respond_to("set")
|
19
|
+
o.should respond_to("saveas")
|
20
|
+
|
21
|
+
end
|
22
|
+
#saveas
|
23
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -16,17 +16,6 @@ class TestBrowser
|
|
16
16
|
at_exit { close rescue nil }
|
17
17
|
@browser
|
18
18
|
end
|
19
|
-
|
20
|
-
def self.get2(type= :ie)
|
21
|
-
@server || start_server
|
22
|
-
if @browser2.nil?
|
23
|
-
@browser2 = Watir::Browser.new()
|
24
|
-
@browser2.goto("http://localhost:#{@port}/file.html")
|
25
|
-
end
|
26
|
-
at_exit { @browser2.close rescue nil }
|
27
|
-
@browser2
|
28
|
-
end
|
29
|
-
|
30
19
|
def self.start_server
|
31
20
|
@server = PopupServer.new
|
32
21
|
@port = @server.port
|
metadata
CHANGED
@@ -1,57 +1,44 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: popup
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 7
|
9
|
-
version: 0.0.7
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.8
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- yafei Li
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-09-08 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rautomation
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &22677144 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
- 0
|
30
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
31
22
|
type: :runtime
|
32
|
-
version_requirements: *id001
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: ffi
|
35
23
|
prerelease: false
|
36
|
-
|
24
|
+
version_requirements: *22677144
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: ffi
|
27
|
+
requirement: &22676736 !ruby/object:Gem::Requirement
|
37
28
|
none: false
|
38
|
-
requirements:
|
39
|
-
- -
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
|
42
|
-
- 0
|
43
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
44
33
|
type: :runtime
|
45
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *22676736
|
46
36
|
description: popup operation for all windows version.
|
47
37
|
email: lyfi2003@gmail.com
|
48
38
|
executables: []
|
49
|
-
|
50
39
|
extensions: []
|
51
|
-
|
52
40
|
extra_rdoc_files: []
|
53
|
-
|
54
|
-
files:
|
41
|
+
files:
|
55
42
|
- lib/popup/alert_popup.rb
|
56
43
|
- lib/popup/confirm_popup.rb
|
57
44
|
- lib/popup/constants/file_popup.yml
|
@@ -73,45 +60,33 @@ files:
|
|
73
60
|
- spec/save_popup_spec.rb
|
74
61
|
- spec/spec_helper.rb
|
75
62
|
- spec/webserver.rb
|
76
|
-
- spec/websserver.rb
|
77
63
|
- support/file_popup/test.txt
|
78
64
|
- support/file_popup/test1.txt
|
79
65
|
- support/html_popup/file.html
|
80
66
|
- Rakefile
|
81
67
|
- README.md
|
82
|
-
has_rdoc: true
|
83
68
|
homepage: https://github.com/windy/popup
|
84
69
|
licenses: []
|
85
|
-
|
86
70
|
post_install_message:
|
87
71
|
rdoc_options: []
|
88
|
-
|
89
|
-
require_paths:
|
72
|
+
require_paths:
|
90
73
|
- lib
|
91
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
75
|
none: false
|
93
|
-
requirements:
|
94
|
-
- -
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
|
97
|
-
|
98
|
-
version: "0"
|
99
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
81
|
none: false
|
101
|
-
requirements:
|
102
|
-
- -
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
segments:
|
105
|
-
- 1
|
106
|
-
- 3
|
107
|
-
- 5
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
108
85
|
version: 1.3.5
|
109
86
|
requirements: []
|
110
|
-
|
111
87
|
rubyforge_project:
|
112
|
-
rubygems_version: 1.
|
88
|
+
rubygems_version: 1.8.10
|
113
89
|
signing_key:
|
114
90
|
specification_version: 3
|
115
91
|
summary: popup operation for all windows version.
|
116
92
|
test_files: []
|
117
|
-
|
data/spec/websserver.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'webrick'
|
2
|
-
require 'timeout'
|
3
|
-
require 'webrick/https'
|
4
|
-
class PopupServer
|
5
|
-
|
6
|
-
attr_reader :port,:run
|
7
|
-
def initialize(port=12346)
|
8
|
-
@run = false
|
9
|
-
@port = port
|
10
|
-
@s = WEBrick::HTTPServer.new(
|
11
|
-
:Port=> @port,
|
12
|
-
:DocumentRoot => File.join(File.join(__FILE__,'..','..','support'),"html_popup"),
|
13
|
-
:SSLEnable=> true,
|
14
|
-
:SSLVerifyClient =>OpenSSL::SSL::VERIFY_NONE,
|
15
|
-
:SSLCertName => [ ["CN", "Hello" ] ]
|
16
|
-
)
|
17
|
-
trap("INT") { @s.shutdown }
|
18
|
-
@s.mount("/html_popup",WEBrick::HTTPServlet::FileHandler,"/file.html")
|
19
|
-
end
|
20
|
-
|
21
|
-
def start(wait_forever = false)
|
22
|
-
raise "popup server is running,can NOT run again" if @run
|
23
|
-
@run = true
|
24
|
-
@s_thread = Thread.new do
|
25
|
-
@s.start
|
26
|
-
end
|
27
|
-
wait
|
28
|
-
@s_thread.join if wait_forever
|
29
|
-
end
|
30
|
-
|
31
|
-
def wait(timeout=10)
|
32
|
-
Timeout.timeout(timeout,"after #{timeout} popup server still can NOT start") do
|
33
|
-
loop do
|
34
|
-
begin
|
35
|
-
TCPSocket.new("127.0.0.1",@port)
|
36
|
-
return true
|
37
|
-
rescue
|
38
|
-
sleep 0.5
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def stop
|
45
|
-
@s.shutdown
|
46
|
-
@run = false
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
if $0 == __FILE__
|
52
|
-
a = PopupServer.new
|
53
|
-
a.start(true)
|
54
|
-
#sleep 100
|
55
|
-
#a.stop
|
56
|
-
end
|