popup 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/popup/exceptions.rb +1 -0
- data/lib/popup/file_ext.rb +1 -1
- data/lib/popup/version.rb +1 -1
- data/spec/alert_popup_spec.rb +11 -0
- data/spec/save_popup_spec.rb +23 -23
- data/spec/spec_helper.rb +11 -0
- data/spec/websserver.rb +56 -0
- metadata +61 -36
data/lib/popup/exceptions.rb
CHANGED
@@ -3,6 +3,7 @@ module ATT
|
|
3
3
|
class RootNotSetError < RootException ; end
|
4
4
|
class WindowNotFoundError < RootException ; end
|
5
5
|
class FileNotFoundError < RootException ; end
|
6
|
+
class FileAlreadyExistError < RootException; end
|
6
7
|
class NotImplementError < RootException ; end
|
7
8
|
class NotRecordError < RootException; end
|
8
9
|
class MutliWindowsMatchError < RootException; end
|
data/lib/popup/file_ext.rb
CHANGED
@@ -7,7 +7,7 @@ module ATT
|
|
7
7
|
|
8
8
|
private
|
9
9
|
def check_file_not_exist?(file_path)
|
10
|
-
raise
|
10
|
+
raise FileAlreadyExistError,"#{file_path} has existed" if File.file?( window_full_path(file_path) )
|
11
11
|
end
|
12
12
|
|
13
13
|
private
|
data/lib/popup/version.rb
CHANGED
data/spec/alert_popup_spec.rb
CHANGED
@@ -19,4 +19,15 @@ 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
|
+
|
22
33
|
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,6 +16,17 @@ 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
|
+
|
19
30
|
def self.start_server
|
20
31
|
@server = PopupServer.new
|
21
32
|
@port = @server.port
|
data/spec/websserver.rb
ADDED
@@ -0,0 +1,56 @@
|
|
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
|
metadata
CHANGED
@@ -1,44 +1,57 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: popup
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 7
|
9
|
+
version: 0.0.7
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- yafei Li
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
|
17
|
+
date: 2011-09-08 00:00:00 +08:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: rautomation
|
16
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
24
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
22
31
|
type: :runtime
|
23
|
-
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Dependency
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
26
34
|
name: ffi
|
27
|
-
|
35
|
+
prerelease: false
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
37
|
none: false
|
29
|
-
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
version: "0"
|
33
44
|
type: :runtime
|
34
|
-
|
35
|
-
version_requirements: *11016912
|
45
|
+
version_requirements: *id002
|
36
46
|
description: popup operation for all windows version.
|
37
47
|
email: lyfi2003@gmail.com
|
38
48
|
executables: []
|
49
|
+
|
39
50
|
extensions: []
|
51
|
+
|
40
52
|
extra_rdoc_files: []
|
41
|
-
|
53
|
+
|
54
|
+
files:
|
42
55
|
- lib/popup/alert_popup.rb
|
43
56
|
- lib/popup/confirm_popup.rb
|
44
57
|
- lib/popup/constants/file_popup.yml
|
@@ -60,33 +73,45 @@ files:
|
|
60
73
|
- spec/save_popup_spec.rb
|
61
74
|
- spec/spec_helper.rb
|
62
75
|
- spec/webserver.rb
|
76
|
+
- spec/websserver.rb
|
63
77
|
- support/file_popup/test.txt
|
64
78
|
- support/file_popup/test1.txt
|
65
79
|
- support/html_popup/file.html
|
66
80
|
- Rakefile
|
67
81
|
- README.md
|
68
|
-
|
82
|
+
has_rdoc: true
|
83
|
+
homepage: https://github.com/windy/popup
|
69
84
|
licenses: []
|
85
|
+
|
70
86
|
post_install_message:
|
71
87
|
rdoc_options: []
|
72
|
-
|
88
|
+
|
89
|
+
require_paths:
|
73
90
|
- lib
|
74
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
92
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
|
80
|
-
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
version: "0"
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
100
|
none: false
|
82
|
-
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
segments:
|
105
|
+
- 1
|
106
|
+
- 3
|
107
|
+
- 5
|
85
108
|
version: 1.3.5
|
86
109
|
requirements: []
|
110
|
+
|
87
111
|
rubyforge_project:
|
88
|
-
rubygems_version: 1.
|
112
|
+
rubygems_version: 1.3.7
|
89
113
|
signing_key:
|
90
114
|
specification_version: 3
|
91
115
|
summary: popup operation for all windows version.
|
92
116
|
test_files: []
|
117
|
+
|