forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JariBakken: Beta implementation of window resize/move for Firefox + R…
…uby/Java. This adds two resources to the wire protocol: /session/:sessionId/window/:windowHandle/size /session/:sessionId/window/:windowHandle/position Both resources accept GET and POST requests to get and set the values. Update issue 174 Labels: -Browser-All Browser-IE Browser-Chrome Browser-HtmlUnit Browser-Opera Lang-CSharp Lang-Python Status: Started r14578
- Loading branch information
Showing
18 changed files
with
496 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
Copyright 2011 WebDriver committers | ||
Copyright 2011 Software Freedom Conservancy. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package org.openqa.selenium; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.greaterThan; | ||
import static org.hamcrest.Matchers.greaterThanOrEqualTo; | ||
import static org.hamcrest.Matchers.is; | ||
import static org.openqa.selenium.Ignore.Driver.ANDROID; | ||
import static org.openqa.selenium.Ignore.Driver.CHROME; | ||
import static org.openqa.selenium.Ignore.Driver.HTMLUNIT; | ||
import static org.openqa.selenium.Ignore.Driver.IE; | ||
import static org.openqa.selenium.Ignore.Driver.IPHONE; | ||
import static org.openqa.selenium.Ignore.Driver.OPERA; | ||
import static org.openqa.selenium.Ignore.Driver.SELENESE; | ||
|
||
@Ignore(value = {ANDROID, CHROME, HTMLUNIT, IE, IPHONE, OPERA, SELENESE}, | ||
reason = "Not yet implemented.") | ||
public class WindowTest extends AbstractDriverTestCase { | ||
|
||
public void testGetsTheSizeOfTheCurrentWindow() { | ||
Dimension size = driver.manage().window().getSize(); | ||
|
||
assertThat(size.width, is(greaterThan(0))); | ||
assertThat(size.height, is(greaterThan(0))); | ||
} | ||
|
||
public void testSetsTheSizeOfTheCurrentWindow() { | ||
WebDriver.Window window = driver.manage().window(); | ||
Dimension size = window.getSize(); | ||
|
||
// resize relative to the initial size, since we don't know what it is | ||
Dimension targetSize = new Dimension(size.width - 20, size.height - 20); | ||
window.setSize(targetSize); | ||
|
||
Dimension newSize = window.getSize(); | ||
assertEquals(targetSize.width, newSize.width); | ||
assertEquals(targetSize.height, newSize.height); | ||
} | ||
|
||
public void testGetsThePositionOfTheCurrentWindow() { | ||
Point position = driver.manage().window().getPosition(); | ||
|
||
assertThat(position.x, is(greaterThanOrEqualTo(0))); | ||
assertThat(position.y, is(greaterThanOrEqualTo(0))); | ||
} | ||
|
||
public void testSetsThePositionOfTheCurrentWindow() { | ||
WebDriver.Window window = driver.manage().window(); | ||
Point position = window.getPosition(); | ||
|
||
Point targetPosition = new Point(position.x + 10, position.y + 10); | ||
window.setPosition(targetPosition); | ||
|
||
Point newLocation = window.getPosition(); | ||
|
||
assertEquals(targetPosition.x, newLocation.x); | ||
assertEquals(targetPosition.y, newLocation.y); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.