osaka 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/osaka/applicationwrapper.rb +68 -47
- data/lib/osaka/applicationwrapperexpectations.rb +46 -0
- data/lib/osaka/pages.rb +3 -3
- data/lib/osaka/typicalapplication.rb +12 -7
- data/lib/osaka/version.rb +1 -1
- data/lib/osaka.rb +1 -0
- data/spec/applicationwrapper_spec.rb +26 -37
- data/spec/keynote_spec.rb +5 -0
- data/spec/pages_spec.rb +7 -6
- data/spec/typicalapplication_spec.rb +29 -13
- metadata +3 -2
@@ -1,12 +1,66 @@
|
|
1
1
|
|
2
2
|
module Osaka
|
3
|
+
|
4
|
+
class ConditionAndActionProxy
|
5
|
+
|
6
|
+
def initialize(wrapper)
|
7
|
+
@wrapper = wrapper
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_condition_class_based_on_name(sym)
|
11
|
+
classname = "#{sym.to_s[0].upcase}#{sym.to_s[1..-1]}Condition"
|
12
|
+
eval(classname).new
|
13
|
+
end
|
14
|
+
|
15
|
+
def method_missing(sym, *args, &block)
|
16
|
+
condition = create_condition_class_based_on_name(sym)
|
17
|
+
@wrapper.enter_nested_action
|
18
|
+
yield unless block.nil?
|
19
|
+
@wrapper.exit_nested_action
|
20
|
+
@wrapper.system_event!("repeat until #{condition.as_script(*args)}; #{@wrapper.nested_action} end repeat")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class ExistsCondition
|
25
|
+
def as_script(element_to_wait_for)
|
26
|
+
"exists #{element_to_wait_for}"
|
27
|
+
end
|
28
|
+
end
|
3
29
|
|
30
|
+
class Not_existsCondition
|
31
|
+
def as_script(element_to_wait_for)
|
32
|
+
"not exists #{element_to_wait_for}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
4
36
|
class ApplicationWrapper
|
5
37
|
|
6
38
|
def initialize(name)
|
7
39
|
@name = name
|
40
|
+
@nested = false
|
8
41
|
end
|
9
|
-
|
42
|
+
|
43
|
+
def enter_nested_action
|
44
|
+
@nested = true
|
45
|
+
@nested_action = ""
|
46
|
+
end
|
47
|
+
|
48
|
+
def nested_action
|
49
|
+
@nested_action
|
50
|
+
end
|
51
|
+
|
52
|
+
def exit_nested_action
|
53
|
+
@nested = false
|
54
|
+
end
|
55
|
+
|
56
|
+
def execute_script(script)
|
57
|
+
if @nested
|
58
|
+
@nested_action += "#{script};"
|
59
|
+
else
|
60
|
+
ScriptRunner::execute(script) unless @nested
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
10
64
|
def activate
|
11
65
|
tell("activate")
|
12
66
|
end
|
@@ -16,36 +70,31 @@ module Osaka
|
|
16
70
|
end
|
17
71
|
|
18
72
|
def tell(command)
|
19
|
-
|
73
|
+
execute_script("tell application \"#{@name}\"; #{command}; end tell")
|
20
74
|
end
|
21
75
|
|
22
76
|
def system_event!(event)
|
23
|
-
|
77
|
+
execute_script("tell application \"System Events\"; tell process \"#{@name}\"; #{event}; end tell; end tell")
|
24
78
|
end
|
25
79
|
|
26
80
|
def system_event(event)
|
27
81
|
activate
|
28
82
|
system_event!(event)
|
29
83
|
end
|
30
|
-
|
31
|
-
def wait_until_exists!(element_to_wait_for)
|
32
|
-
system_event!("repeat until exists #{element_to_wait_for}; end repeat")
|
33
|
-
end
|
34
84
|
|
35
|
-
def
|
85
|
+
def wait_until
|
36
86
|
activate
|
37
|
-
|
87
|
+
wait_until!
|
38
88
|
end
|
39
89
|
|
40
|
-
def
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
def wait_until_not_exists(element_to_wait_for)
|
45
|
-
activate
|
46
|
-
wait_until_not_exists!(element_to_wait_for)
|
90
|
+
def wait_until!
|
91
|
+
ConditionAndActionProxy.new(self)
|
47
92
|
end
|
48
93
|
|
94
|
+
def until!
|
95
|
+
ConditionAndActionProxy.new(self)
|
96
|
+
end
|
97
|
+
|
49
98
|
def construct_modifier_statement(modifier_keys)
|
50
99
|
modified_key_string = [ modifier_keys ].flatten.collect! { |mod_key| mod_key.to_s + " down"}.join(", ")
|
51
100
|
modifier_command = " using {#{modified_key_string}}" unless modifier_keys.empty?
|
@@ -54,6 +103,7 @@ module Osaka
|
|
54
103
|
|
55
104
|
def keystroke!(key, modifier_keys = [])
|
56
105
|
system_event!("keystroke \"#{key}\"#{construct_modifier_statement(modifier_keys)}")
|
106
|
+
self
|
57
107
|
end
|
58
108
|
|
59
109
|
def keystroke(key, modifier_keys = [])
|
@@ -61,45 +111,16 @@ module Osaka
|
|
61
111
|
keystroke!(key, modifier_keys)
|
62
112
|
end
|
63
113
|
|
64
|
-
def keystroke_and_wait_until_exists!(key, modifier_keys, element)
|
65
|
-
keystroke!(key, modifier_keys)
|
66
|
-
wait_until_exists!(element)
|
67
|
-
end
|
68
|
-
|
69
|
-
def keystroke_and_wait_until_exists(key, modifier_keys, element)
|
70
|
-
activate
|
71
|
-
keystroke_and_wait_until_exists!(key, modifier_keys, element)
|
72
|
-
end
|
73
|
-
|
74
114
|
def click!(element)
|
75
115
|
system_event!("click #{element}")
|
116
|
+
self
|
76
117
|
end
|
77
118
|
|
78
119
|
def click(element)
|
79
120
|
activate
|
80
121
|
click!(element)
|
81
122
|
end
|
82
|
-
|
83
|
-
def click_and_wait_until_exists!(element, wait_condition)
|
84
|
-
click!(element)
|
85
|
-
wait_until_exists!(wait_condition)
|
86
|
-
end
|
87
|
-
|
88
|
-
def click_and_wait_until_exists(element, wait_condition)
|
89
|
-
activate
|
90
|
-
click_and_wait_until_exists!(element, wait_condition)
|
91
|
-
end
|
92
|
-
|
93
|
-
def click_and_wait_until_not_exists!(element, wait_condition)
|
94
|
-
click!(element)
|
95
|
-
wait_until_not_exists!(wait_condition)
|
96
|
-
end
|
97
|
-
|
98
|
-
def click_and_wait_until_not_exists(element, wait_condition)
|
99
|
-
activate
|
100
|
-
click_and_wait_until_not_exists!(element, wait_condition)
|
101
|
-
end
|
102
|
-
|
123
|
+
|
103
124
|
def set!(element, value)
|
104
125
|
system_event!("set #{element} to \"#{value}\"")
|
105
126
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
|
2
|
+
module Osaka
|
3
|
+
module ApplicationWrapperExpectations
|
4
|
+
|
5
|
+
def should_wait(wait_command, wait_condition, wait_element)
|
6
|
+
condition = double(:ConditionAndActionProxy)
|
7
|
+
@wrapper.should_receive(wait_command).and_return(condition)
|
8
|
+
condition.should_receive(wait_condition).with(wait_element)
|
9
|
+
end
|
10
|
+
|
11
|
+
def should_wait_until(wait_condition, wait_element)
|
12
|
+
should_wait(:wait_until, wait_condition, wait_element)
|
13
|
+
end
|
14
|
+
|
15
|
+
def should_wait_until!(wait_condition, wait_element)
|
16
|
+
should_wait(:wait_until!, wait_condition, wait_element)
|
17
|
+
end
|
18
|
+
|
19
|
+
def should_do_until!(wait_condition, wait_element)
|
20
|
+
should_wait(:until!, wait_condition, wait_element).and_yield
|
21
|
+
yield
|
22
|
+
end
|
23
|
+
|
24
|
+
def expect_keystroke(key, modifier)
|
25
|
+
@wrapper.should_receive(:keystroke).with(key, modifier).and_return(@wrapper)
|
26
|
+
end
|
27
|
+
|
28
|
+
def expect_click!(location)
|
29
|
+
@wrapper.should_receive(:click!).with(location).and_return(@wrapper)
|
30
|
+
end
|
31
|
+
|
32
|
+
def expect_click(location)
|
33
|
+
@wrapper.should_receive(:click).with(location).and_return(@wrapper)
|
34
|
+
end
|
35
|
+
|
36
|
+
def expect_tell(do_this)
|
37
|
+
@wrapper.should_receive(:tell).with(do_this)
|
38
|
+
end
|
39
|
+
|
40
|
+
def expect_system_event(event)
|
41
|
+
@wrapper.should_receive(:system_event).with(event)
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
data/lib/osaka/pages.rb
CHANGED
@@ -10,7 +10,7 @@ module Osaka
|
|
10
10
|
def merge
|
11
11
|
@wrapper.click!('button "Merge" of sheet 1 of window 1')
|
12
12
|
print_dialog_location = 'window "Print"'
|
13
|
-
@wrapper.
|
13
|
+
@wrapper.wait_until!.exists("menu button \"PDF\" of #{print_dialog_location}")
|
14
14
|
TypicalPrintDialog.new(print_dialog_location, @wrapper)
|
15
15
|
end
|
16
16
|
|
@@ -23,8 +23,8 @@ module Osaka
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def mail_merge
|
26
|
-
@wrapper.
|
27
|
-
@wrapper.
|
26
|
+
@wrapper.system_event("tell menu bar 1; tell menu \"Edit\"; click menu item 20; end tell; end tell")
|
27
|
+
@wrapper.wait_until.exists('button "Merge" of sheet 1 of window 1')
|
28
28
|
PagesMailMergeDialog.new(@wrapper)
|
29
29
|
end
|
30
30
|
|
@@ -14,13 +14,13 @@ module Osaka
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def set_folder(pathname)
|
17
|
-
@wrapper.
|
17
|
+
@wrapper.keystroke("g", [ :command, :shift ]).wait_until.exists ("sheet 1 of #{@location}")
|
18
18
|
@wrapper.set("value of text field 1 of sheet 1 of #{@location}", pathname)
|
19
|
-
@wrapper.
|
19
|
+
@wrapper.click("button \"Go\" of sheet 1 of #{@location}").wait_until.not_exists("sheet 1 of #{@location}")
|
20
20
|
end
|
21
21
|
|
22
22
|
def click_save
|
23
|
-
@wrapper.
|
23
|
+
@wrapper.click("button \"Save\" of #{@location}").wait_until.not_exists("#{@location}")
|
24
24
|
end
|
25
25
|
|
26
26
|
def save(filename)
|
@@ -44,11 +44,16 @@ module Osaka
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def save_as_pdf(filename)
|
47
|
-
@wrapper.
|
48
|
-
@wrapper.
|
47
|
+
@wrapper.click!("menu button \"PDF\" of #{@location}").wait_until!.exists ("menu 1 of menu button \"PDF\" of #{@location}")
|
48
|
+
@wrapper.click!("menu item 2 of menu 1 of menu button \"PDF\" of #{@location}").wait_until!.exists('window "Save"')
|
49
49
|
save_dialog = create_save_dialog("window \"Save\"", @wrapper)
|
50
50
|
save_dialog.save(filename)
|
51
|
-
|
51
|
+
|
52
|
+
@wrapper.until!.not_exists(@location) {
|
53
|
+
# Weird, but sometimes the dialog "hangs around" and clicking this checkbox will make it go away.
|
54
|
+
# Anyone who knows a better solution, please let me know!
|
55
|
+
@wrapper.click!('checkbox 1 of window "Print"')
|
56
|
+
}
|
52
57
|
end
|
53
58
|
end
|
54
59
|
|
@@ -83,7 +88,7 @@ module Osaka
|
|
83
88
|
|
84
89
|
def print_dialog
|
85
90
|
location = "sheet 1 of window 1"
|
86
|
-
@wrapper.
|
91
|
+
@wrapper.keystroke("p", :command).wait_until.exists(location)
|
87
92
|
create_print_dialog(location)
|
88
93
|
end
|
89
94
|
|
data/lib/osaka/version.rb
CHANGED
data/lib/osaka.rb
CHANGED
@@ -39,25 +39,19 @@ describe "Osaka::ApplicationWrapper" do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it "Should be able to wait for for a specific element existing" do
|
42
|
-
Osaka::ScriptRunner.should_receive(:execute).with(/repeat until exists window 1;
|
43
|
-
subject.
|
42
|
+
Osaka::ScriptRunner.should_receive(:execute).with(/repeat until exists window 1; end repeat/)
|
43
|
+
subject.wait_until!.exists("window 1")
|
44
44
|
end
|
45
45
|
|
46
46
|
it "Should be able to wait until exists and activate the application first" do
|
47
47
|
subject.should_receive(:activate)
|
48
|
-
|
49
|
-
subject.
|
48
|
+
Osaka::ScriptRunner.should_receive(:execute).with(/repeat until exists window 1; end repeat/)
|
49
|
+
subject.wait_until.exists("window 1")
|
50
50
|
end
|
51
51
|
|
52
52
|
it "Should be able to wait for a specific element to not exist anymore" do
|
53
|
-
Osaka::ScriptRunner.should_receive(:execute).with(/repeat until not exists window 1;
|
54
|
-
subject.
|
55
|
-
end
|
56
|
-
|
57
|
-
it "Should be able to wait_until_not_exists and activate" do
|
58
|
-
subject.should_receive(:activate)
|
59
|
-
subject.should_receive(:wait_until_not_exists!).with("window 1")
|
60
|
-
subject.wait_until_not_exists("window 1")
|
53
|
+
Osaka::ScriptRunner.should_receive(:execute).with(/repeat until not exists window 1; end repeat/)
|
54
|
+
subject.wait_until!.not_exists("window 1")
|
61
55
|
end
|
62
56
|
|
63
57
|
it "Should be able to generate keystroke events" do
|
@@ -81,16 +75,17 @@ describe "Osaka::ApplicationWrapper" do
|
|
81
75
|
subject.keystroke!("p", [ :option, :command ])
|
82
76
|
end
|
83
77
|
|
84
|
-
it "Should be able to do a keystroke and wait until something happen in one easy
|
85
|
-
|
86
|
-
|
87
|
-
subject.
|
78
|
+
it "Should be able to do a keystroke and wait until something happen in one easy line" do
|
79
|
+
Osaka::ScriptRunner.should_receive(:execute).with(/keystroke "p"/)
|
80
|
+
Osaka::ScriptRunner.should_receive(:execute).with(/repeat until exists window 1; end repeat/)
|
81
|
+
subject.keystroke!("p", []).wait_until!.exists("window 1")
|
88
82
|
end
|
89
83
|
|
90
84
|
it "Should be able to keystroke_and_wait_until_exists and activate" do
|
91
85
|
subject.should_receive(:activate)
|
92
|
-
|
93
|
-
|
86
|
+
Osaka::ScriptRunner.should_receive(:execute).with(/keystroke "p"/)
|
87
|
+
Osaka::ScriptRunner.should_receive(:execute).with(/repeat until exists window 1; end repeat/)
|
88
|
+
subject.keystroke("p", []).wait_until!.exists("window 1")
|
94
89
|
end
|
95
90
|
|
96
91
|
it "Should be able to do clicks" do
|
@@ -104,30 +99,19 @@ describe "Osaka::ApplicationWrapper" do
|
|
104
99
|
subject.click("button")
|
105
100
|
end
|
106
101
|
|
107
|
-
it "Should be able to do clicks and wait until something happened in one easy
|
108
|
-
|
109
|
-
|
110
|
-
subject.
|
102
|
+
it "Should be able to do clicks and wait until something happened in one easy line" do
|
103
|
+
Osaka::ScriptRunner.should_receive(:execute).with(/click/)
|
104
|
+
Osaka::ScriptRunner.should_receive(:execute).with(/repeat until exists window; end repeat/)
|
105
|
+
subject.click!("button").wait_until!.exists("window")
|
111
106
|
end
|
112
107
|
|
113
108
|
it "Should be able to click_and_wait_until_exists and activate" do
|
114
109
|
subject.should_receive(:activate)
|
115
|
-
|
116
|
-
|
110
|
+
Osaka::ScriptRunner.should_receive(:execute).with(/click/)
|
111
|
+
Osaka::ScriptRunner.should_receive(:execute).with(/repeat until exists window; end repeat/)
|
112
|
+
subject.click("button").wait_until!.exists("window")
|
117
113
|
end
|
118
114
|
|
119
|
-
it "Should be able to click and wait until something doesn't exist anymore" do
|
120
|
-
subject.should_receive(:click!).with("button1")
|
121
|
-
subject.should_receive(:wait_until_not_exists!).with("window 1")
|
122
|
-
subject.click_and_wait_until_not_exists!('button1', 'window 1')
|
123
|
-
end
|
124
|
-
|
125
|
-
it "Should be able to click_and_wait_until_not_exists and activate" do
|
126
|
-
subject.should_receive(:activate)
|
127
|
-
subject.should_receive(:click_and_wait_until_not_exists!).with("button", "window")
|
128
|
-
subject.click_and_wait_until_not_exists('button', 'window')
|
129
|
-
end
|
130
|
-
|
131
115
|
it "Should be able to set a value to an element" do
|
132
116
|
subject.should_receive(:system_event!).with(/set value of window to "newvalue"/)
|
133
117
|
subject.set!("value of window", "newvalue")
|
@@ -139,6 +123,11 @@ describe "Osaka::ApplicationWrapper" do
|
|
139
123
|
subject.set("value of window", "newvalue")
|
140
124
|
end
|
141
125
|
|
142
|
-
|
126
|
+
it "Should be able to loop over some script until something happens" do
|
127
|
+
Osaka::ScriptRunner.should_receive(:execute).with(/repeat until exists window; tell application \"ApplicationName\"; activate; end tell; end repeat/)
|
128
|
+
subject.until!.exists("window") {
|
129
|
+
subject.activate
|
130
|
+
}
|
131
|
+
end
|
143
132
|
|
144
133
|
end
|
data/spec/keynote_spec.rb
CHANGED
@@ -8,4 +8,9 @@ describe "Osaka::Keynote" do
|
|
8
8
|
before (:each) do
|
9
9
|
subject.wrapper = double("Osaka::ApplicationWrapper").as_null_object
|
10
10
|
end
|
11
|
+
|
12
|
+
it "Should create the correct keynote print dialog" do
|
13
|
+
subject.create_print_dialog("window").class.should == Osaka::KeynotePrintDialog
|
14
|
+
end
|
15
|
+
|
11
16
|
end
|
data/spec/pages_spec.rb
CHANGED
@@ -3,10 +3,12 @@ require 'osaka'
|
|
3
3
|
|
4
4
|
describe "Osaka::Pages" do
|
5
5
|
|
6
|
+
include(*Osaka::ApplicationWrapperExpectations)
|
7
|
+
|
6
8
|
subject { Osaka::Pages.new }
|
7
9
|
|
8
10
|
before (:each) do
|
9
|
-
subject.wrapper = double("Osaka::ApplicationWrapper").as_null_object
|
11
|
+
@wrapper = subject.wrapper = double("Osaka::ApplicationWrapper").as_null_object
|
10
12
|
end
|
11
13
|
|
12
14
|
it "Should be able to do mail merge to a PDF flow" do
|
@@ -19,18 +21,17 @@ describe "Osaka::Pages" do
|
|
19
21
|
print_dialog.should_receive(:save_as_pdf).with("filename")
|
20
22
|
|
21
23
|
subject.mail_merge_to_pdf("filename")
|
22
|
-
|
23
24
|
end
|
24
25
|
|
25
26
|
it "Should be able to select the Mail Merge" do
|
26
|
-
|
27
|
-
|
27
|
+
expect_system_event('tell menu bar 1; tell menu "Edit"; click menu item 20; end tell; end tell')
|
28
|
+
should_wait_until(:exists, 'button "Merge" of sheet 1 of window 1')
|
28
29
|
subject.mail_merge
|
29
30
|
end
|
30
31
|
|
31
32
|
it "Should click the merge button of the mail merge dialog" do
|
32
|
-
|
33
|
-
|
33
|
+
expect_click!('button "Merge" of sheet 1 of window 1')
|
34
|
+
should_wait_until!(:exists, 'menu button "PDF" of window "Print"')
|
34
35
|
subject.mail_merge.merge
|
35
36
|
end
|
36
37
|
|
@@ -3,37 +3,40 @@ require 'osaka'
|
|
3
3
|
|
4
4
|
describe "Osaka::TypicalApplication" do
|
5
5
|
|
6
|
+
include(*Osaka::ApplicationWrapperExpectations)
|
7
|
+
|
6
8
|
subject { Osaka::TypicalApplication.new("ApplicationName") }
|
7
9
|
|
8
10
|
before (:each) do
|
9
|
-
subject.wrapper = double("Osaka::ApplicationWrapper")
|
11
|
+
@wrapper = subject.wrapper = double("Osaka::ApplicationWrapper")
|
10
12
|
end
|
11
13
|
|
12
14
|
it "Should pass the right open string to the Keynote application osascript" do
|
13
15
|
filename = "filename.key"
|
14
|
-
|
16
|
+
expect_tell("open \"#{File.absolute_path(filename)}\"")
|
15
17
|
subject.open(filename)
|
16
18
|
end
|
17
19
|
|
18
20
|
it "Should be able to quit" do
|
19
|
-
|
21
|
+
@wrapper.should_receive(:quit)
|
20
22
|
subject.quit
|
21
23
|
end
|
22
24
|
|
23
25
|
it "Should be able to save" do
|
24
|
-
|
26
|
+
expect_keystroke("s", :command)
|
25
27
|
subject.save
|
26
28
|
end
|
27
29
|
|
28
30
|
it "Should be able to activate keynote" do
|
29
|
-
|
31
|
+
@wrapper.should_receive(:activate)
|
30
32
|
subject.activate
|
31
33
|
end
|
32
34
|
|
33
35
|
it "Should be able to retrieve a print dialog" do
|
34
|
-
|
36
|
+
expect_keystroke("p", :command)
|
37
|
+
should_wait_until(:exists, "sheet 1 of window 1")
|
35
38
|
subject.print_dialog
|
36
|
-
end
|
39
|
+
end
|
37
40
|
|
38
41
|
describe "Generic Print Dialog" do
|
39
42
|
|
@@ -42,11 +45,20 @@ describe "Osaka::TypicalApplication" do
|
|
42
45
|
|
43
46
|
it "Should be able to save the PDF in a print dialog" do
|
44
47
|
save_dialog_mock = double(:GenericSaveDialog)
|
45
|
-
|
46
|
-
|
48
|
+
|
49
|
+
expect_click!('menu button "PDF" of window 1')
|
50
|
+
should_wait_until!(:exists, 'menu 1 of menu button "PDF" of window 1')
|
51
|
+
|
52
|
+
expect_click!('menu item 2 of menu 1 of menu button "PDF" of window 1')
|
53
|
+
should_wait_until!(:exists, 'window "Save"')
|
54
|
+
|
47
55
|
subject.should_receive(:create_save_dialog).with("window \"Save\"", subject.wrapper).and_return(save_dialog_mock)
|
48
56
|
save_dialog_mock.should_receive(:save).with("filename")
|
49
|
-
|
57
|
+
|
58
|
+
should_do_until!(:not_exists, 'window 1') {
|
59
|
+
expect_click!('checkbox 1 of window "Print"')
|
60
|
+
}
|
61
|
+
|
50
62
|
subject.save_as_pdf("filename")
|
51
63
|
end
|
52
64
|
end
|
@@ -70,13 +82,15 @@ describe "Osaka::TypicalApplication" do
|
|
70
82
|
end
|
71
83
|
|
72
84
|
it "Should set the path when a full path is given" do
|
85
|
+
subject.wrapper.as_null_object
|
73
86
|
subject.should_receive(:set_filename)
|
74
87
|
subject.should_receive(:set_folder).with("/path/second")
|
75
88
|
subject.save("/path/second/name")
|
76
89
|
end
|
77
90
|
|
78
91
|
it "Should be able to click save" do
|
79
|
-
|
92
|
+
expect_click('button "Save" of window 1')
|
93
|
+
should_wait_until(:not_exists, 'window 1')
|
80
94
|
subject.click_save
|
81
95
|
end
|
82
96
|
|
@@ -86,9 +100,11 @@ describe "Osaka::TypicalApplication" do
|
|
86
100
|
end
|
87
101
|
|
88
102
|
it "Should be able to set the path" do
|
89
|
-
|
103
|
+
expect_keystroke("g", [ :command, :shift ])
|
104
|
+
should_wait_until(:exists, "sheet 1 of window 1")
|
90
105
|
subject.wrapper.should_receive(:set).with("value of text field 1 of sheet 1 of window 1", "path")
|
91
|
-
|
106
|
+
expect_click('button "Go" of sheet 1 of window 1')
|
107
|
+
should_wait_until(:not_exists, "sheet 1 of window 1")
|
92
108
|
subject.set_folder("path")
|
93
109
|
end
|
94
110
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: osaka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.2.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Bas Vodde
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-02-
|
13
|
+
date: 2012-02-18 00:00:00 +08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- Rakefile
|
49
49
|
- lib/osaka.rb
|
50
50
|
- lib/osaka/applicationwrapper.rb
|
51
|
+
- lib/osaka/applicationwrapperexpectations.rb
|
51
52
|
- lib/osaka/keynote.rb
|
52
53
|
- lib/osaka/numbers.rb
|
53
54
|
- lib/osaka/pages.rb
|