|
21 | 21 |
|
22 | 22 | module Selenium |
23 | 23 | module WebDriver |
24 | | - # Remote w3c bug: https://github.com/SeleniumHQ/selenium/issues/2856 |
25 | | - not_compliant_on driver: :remote, browser: :firefox do |
26 | | - describe Window do |
27 | | - let(:window) { driver.manage.window } |
| 24 | + describe Window do |
| 25 | + let(:window) { driver.manage.window } |
28 | 26 |
|
29 | | - it 'gets the size of the current window' do |
30 | | - size = window.size |
| 27 | + it 'gets the size of the current window' do |
| 28 | + size = window.size |
31 | 29 |
|
32 | | - expect(size).to be_kind_of(Dimension) |
| 30 | + expect(size).to be_a(Dimension) |
33 | 31 |
|
34 | | - expect(size.width).to be > 0 |
35 | | - expect(size.height).to be > 0 |
36 | | - end |
| 32 | + expect(size.width).to be > 0 |
| 33 | + expect(size.height).to be > 0 |
| 34 | + end |
37 | 35 |
|
38 | | - it 'sets the size of the current window' do |
39 | | - size = window.size |
| 36 | + it 'sets the size of the current window' do |
| 37 | + size = window.size |
40 | 38 |
|
41 | | - target_width = size.width - 20 |
42 | | - target_height = size.height - 20 |
| 39 | + target_width = size.width - 20 |
| 40 | + target_height = size.height - 20 |
43 | 41 |
|
44 | | - window.size = Dimension.new(target_width, target_height) |
| 42 | + window.size = Dimension.new(target_width, target_height) |
45 | 43 |
|
46 | | - new_size = window.size |
47 | | - expect(new_size.width).to eq(target_width) |
48 | | - expect(new_size.height).to eq(target_height) |
49 | | - 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 |
50 | 48 |
|
51 | | - not_compliant_on browser: :firefox do |
52 | | - it 'gets the position of the current window' do |
53 | | - pos = driver.manage.window.position |
| 49 | + it 'gets the position of the current window' do |
| 50 | + pos = driver.manage.window.position |
54 | 51 |
|
55 | | - expect(pos).to be_kind_of(Point) |
| 52 | + expect(pos).to be_a(Point) |
56 | 53 |
|
57 | | - expect(pos.x).to be >= 0 |
58 | | - expect(pos.y).to be >= 0 |
59 | | - end |
60 | | - end |
| 54 | + expect(pos.x).to be >= 0 |
| 55 | + expect(pos.y).to be >= 0 |
| 56 | + end |
61 | 57 |
|
62 | | - not_compliant_on browser: [:phantomjs, :firefox] do |
63 | | - it 'sets the position of the current window' do |
64 | | - pos = window.position |
| 58 | + not_compliant_on browser: :phantomjs do |
| 59 | + it 'sets the position of the current window' do |
| 60 | + pos = window.position |
65 | 61 |
|
66 | | - target_x = pos.x + 10 |
67 | | - target_y = pos.y + 10 |
| 62 | + target_x = pos.x + 10 |
| 63 | + target_y = pos.y + 10 |
68 | 64 |
|
69 | | - window.position = Point.new(target_x, target_y) |
| 65 | + window.position = Point.new(target_x, target_y) |
70 | 66 |
|
71 | | - wait.until { window.position.x != pos.x && window.position.y != pos.y } |
| 67 | + wait.until { window.position.x != pos.x && window.position.y != pos.y } |
72 | 68 |
|
73 | | - new_pos = window.position |
74 | | - expect(new_pos.x).to eq(target_x) |
75 | | - expect(new_pos.y).to eq(target_y) |
76 | | - end |
| 69 | + new_pos = window.position |
| 70 | + expect(new_pos.x).to eq(target_x) |
| 71 | + expect(new_pos.y).to eq(target_y) |
77 | 72 | end |
| 73 | + end |
78 | 74 |
|
79 | | - # TODO: - Create Window Manager guard |
80 | | - not_compliant_on platform: :linux do |
81 | | - it 'can maximize the current window' do |
82 | | - window.size = old_size = Dimension.new(200, 200) |
| 75 | + # TODO: - Create Window Manager guard |
| 76 | + not_compliant_on platform: :linux do |
| 77 | + it 'can maximize the current window' do |
| 78 | + window.size = old_size = Dimension.new(200, 200) |
83 | 79 |
|
84 | | - window.maximize |
| 80 | + window.maximize |
85 | 81 |
|
86 | | - wait.until { window.size != old_size } |
| 82 | + wait.until { window.size != old_size } |
87 | 83 |
|
88 | | - new_size = window.size |
89 | | - expect(new_size.width).to be > old_size.width |
90 | | - expect(new_size.height).to be > old_size.height |
91 | | - end |
| 84 | + new_size = window.size |
| 85 | + expect(new_size.width).to be > old_size.width |
| 86 | + expect(new_size.height).to be > old_size.height |
92 | 87 | end |
| 88 | + end |
93 | 89 |
|
94 | | - compliant_on browser: [:firefox, :edge] do |
95 | | - # Firefox - https://bugzilla.mozilla.org/show_bug.cgi?id=1189749 |
96 | | - # Edge: Not Yet - https://dev.windows.com/en-us/microsoft-edge/platform/status/webdriver/details/ |
97 | | - not_compliant_on browser: [:firefox, :edge] do |
98 | | - it 'can make window full screen' do |
99 | | - window.maximize |
100 | | - old_size = window.size |
| 90 | + compliant_on browser: [:firefox, :edge] do |
| 91 | + # Firefox - https://bugzilla.mozilla.org/show_bug.cgi?id=1189749 |
| 92 | + # Edge: Not Yet - https://dev.windows.com/en-us/microsoft-edge/platform/status/webdriver/details/ |
| 93 | + not_compliant_on browser: [:firefox, :edge] do |
| 94 | + it 'can make window full screen' do |
| 95 | + window.maximize |
| 96 | + old_size = window.size |
101 | 97 |
|
102 | | - window.full_screen |
| 98 | + window.full_screen |
103 | 99 |
|
104 | | - new_size = window.size |
105 | | - expect(new_size.height).to be > old_size.height |
106 | | - end |
| 100 | + new_size = window.size |
| 101 | + expect(new_size.height).to be > old_size.height |
107 | 102 | end |
108 | 103 | end |
109 | 104 | end |
|
0 commit comments