@@ -24,87 +24,85 @@ module WebDriver
24
24
describe Window do
25
25
let ( :window ) { driver . manage . window }
26
26
27
- compliant_on :browser => [ :firefox , :chrome , :edge ] do
28
- it "gets the size of the current window" do
29
- size = window . size
27
+ it "gets the size of the current window" do
28
+ size = window . size
30
29
31
- expect ( size ) . to be_kind_of ( Dimension )
30
+ expect ( size ) . to be_kind_of ( Dimension )
32
31
33
- expect ( size . width ) . to be > 0
34
- expect ( size . height ) . to be > 0
35
- end
32
+ expect ( size . width ) . to be > 0
33
+ expect ( size . height ) . to be > 0
34
+ end
36
35
37
- it "sets the size of the current window" do
38
- size = window . size
36
+ it "sets the size of the current window" do
37
+ size = window . size
39
38
40
- target_width = size . width - 20
41
- target_height = size . height - 20
39
+ target_width = size . width - 20
40
+ target_height = size . height - 20
42
41
43
- window . size = Dimension . new ( target_width , target_height )
42
+ window . size = Dimension . new ( target_width , target_height )
44
43
45
- new_size = window . size
46
- expect ( new_size . width ) . to eq ( target_width )
47
- expect ( new_size . height ) . to eq ( target_height )
48
- end
44
+ new_size = window . size
45
+ expect ( new_size . width ) . to eq ( target_width )
46
+ expect ( new_size . height ) . to eq ( target_height )
47
+ end
49
48
50
- # Marionette BUG -
51
- # GET /session/2146a9d2-690a-4844-a5f4-e38b02d670c3/window/:window_handle/position
52
- # did not match a known command
53
- not_compliant_on ( { :driver => :marionette } ,
54
- { :driver => :remote , :browser => :firefox , :platform => :linux } ) do
55
- it "gets the position of the current window" do
56
- pos = driver . manage . window . position
49
+ # Marionette BUG -
50
+ # GET /session/2146a9d2-690a-4844-a5f4-e38b02d670c3/window/:window_handle/position
51
+ # did not match a known command
52
+ not_compliant_on ( { :driver => :marionette } ,
53
+ { :driver => :remote , :browser => :firefox , :platform => :linux } ) do
54
+ it "gets the position of the current window" do
55
+ pos = driver . manage . window . position
57
56
58
- expect ( pos ) . to be_kind_of ( Point )
57
+ expect ( pos ) . to be_kind_of ( Point )
59
58
60
- expect ( pos . x ) . to be >= 0
61
- expect ( pos . y ) . to be >= 0
62
- end
59
+ expect ( pos . x ) . to be >= 0
60
+ expect ( pos . y ) . to be >= 0
63
61
end
62
+ end
64
63
65
- not_compliant_on :driver => [ :remote , :marionette ] , :browser => :firefox , :platform => :linux do
66
- it "sets the position of the current window" do
67
- pos = window . position
64
+ not_compliant_on :driver => [ :remote , :marionette ] , :browser => :firefox , :platform => :linux do
65
+ it "sets the position of the current window" do
66
+ pos = window . position
68
67
69
- target_x = pos . x + 10
70
- target_y = pos . y + 10
68
+ target_x = pos . x + 10
69
+ target_y = pos . y + 10
71
70
72
- window . position = Point . new ( target_x , target_y )
71
+ window . position = Point . new ( target_x , target_y )
73
72
74
- wait . until { window . position . x != pos . x && window . position . y != pos . y }
73
+ wait . until { window . position . x != pos . x && window . position . y != pos . y }
75
74
76
- new_pos = window . position
77
- expect ( new_pos . x ) . to eq ( target_x )
78
- expect ( new_pos . y ) . to eq ( target_y )
79
- end
75
+ new_pos = window . position
76
+ expect ( new_pos . x ) . to eq ( target_x )
77
+ expect ( new_pos . y ) . to eq ( target_y )
80
78
end
81
79
end
80
+ end
82
81
83
- compliant_on ( { :browser => :ie } ,
84
- { :browser => :edge } ,
85
- { :browser => :firefox , :platform => [ :windows , :macosx ] } ) do
86
- it "can maximize the current window" do
87
- window . size = old_size = Dimension . new ( 200 , 200 )
82
+ compliant_on ( { :browser => :ie } ,
83
+ { :browser => :edge } ,
84
+ { :browser => :firefox , :platform => [ :windows , :macosx ] } ) do
85
+ it "can maximize the current window" do
86
+ window . size = old_size = Dimension . new ( 200 , 200 )
88
87
89
- window . maximize
88
+ window . maximize
90
89
91
- new_size = window . size
92
- expect ( new_size . width ) . to be > old_size . width
93
- expect ( new_size . height ) . to be > old_size . height
94
- end
90
+ new_size = window . size
91
+ expect ( new_size . width ) . to be > old_size . width
92
+ expect ( new_size . height ) . to be > old_size . height
95
93
end
94
+ end
96
95
97
- compliant_on :browser => [ :marionette , :edge ] do
98
- not_compliant_on :browser => [ :marionette , :edge ] do
99
- it "can make window full screen" do
100
- window . maximize
101
- old_size = window . size
96
+ compliant_on :browser => [ :marionette , :edge ] do
97
+ not_compliant_on :browser => [ :marionette , :edge ] do
98
+ it "can make window full screen" do
99
+ window . maximize
100
+ old_size = window . size
102
101
103
- window . full_screen
102
+ window . full_screen
104
103
105
- new_size = window . size
106
- expect ( new_size . height ) . to be > old_size . height
107
- end
104
+ new_size = window . size
105
+ expect ( new_size . height ) . to be > old_size . height
108
106
end
109
107
end
110
108
end
0 commit comments