Skip to content

Commit

Permalink
Update browser automation atoms tests for Edge.
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Leyba <[email protected]>
  • Loading branch information
juangj authored and jleyba committed Oct 18, 2015
1 parent 2c04320 commit cb3347b
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 24 deletions.
2 changes: 1 addition & 1 deletion javascript/atoms/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ bot.events.KeyboardEventFactory_.prototype.create = function(target, opt_args) {
event.metaKey = args.metaKey;
event.shiftKey = args.shiftKey;
event.keyCode = args.charCode || args.keyCode;
if (goog.userAgent.WEBKIT) {
if (goog.userAgent.WEBKIT || goog.userAgent.EDGE) {
event.charCode = (this == bot.events.EventType.KEYPRESS) ?
event.keyCode : 0;
}
Expand Down
2 changes: 1 addition & 1 deletion javascript/atoms/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ bot.Keyboard.prototype.pressKey = function(key) {
bot.Keyboard.prototype.requiresKeyPress_ = function(key) {
if (key.character || key == bot.Keyboard.Keys.ENTER) {
return true;
} else if (goog.userAgent.WEBKIT) {
} else if (goog.userAgent.WEBKIT || goog.userAgent.EDGE) {
return false;
} else if (goog.userAgent.IE) {
return key == bot.Keyboard.Keys.ESC;
Expand Down
10 changes: 7 additions & 3 deletions javascript/atoms/test/clientrect_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
goog.require('goog.dom');
goog.require('goog.style');
goog.require('goog.testing.jsunit');
goog.require('goog.testing.ExpectedFailures');
goog.require('goog.userAgent');
</script>

Expand Down Expand Up @@ -63,11 +64,14 @@
}

function testAreaWithDefaultShape() {
// IE doesn't support shape="default".
if (!goog.userAgent.IE) {
var expect = new goog.testing.ExpectedFailures();
expect.expectFailureFor(goog.userAgent.IE || goog.userAgent.EDGE,
"IE and Edge don't support shape=default");

expect.run(function() {
var e = document.getElementById('default');
assertClientRect(e, 300, 25, 200, 100);
}
});
}

function testAreaWithRectShape() {
Expand Down
5 changes: 5 additions & 0 deletions javascript/atoms/test/history_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
goog.require('goog.dom');
goog.require('goog.events');
goog.require('goog.Promise');
goog.require('goog.testing.TestCase');
goog.require('goog.testing.asserts');
goog.require('goog.testing.jsunit');
goog.require('goog.userAgent');
Expand Down Expand Up @@ -64,6 +65,10 @@
}, 0);
}

function setUpPage() {
goog.testing.TestCase.getActiveTestCase().promiseTimeout = 10000; // 10s
}

function setUp() {
// setUpPage does not wait on returned promises, so return a promise from
// each setUp to make sure we wait for the initial frame setup.
Expand Down
7 changes: 7 additions & 0 deletions javascript/atoms/test/html5/location_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,22 @@
goog.require('bot.userAgent');
goog.require('goog.Promise');
goog.require('goog.labs.userAgent.platform');
goog.require('goog.testing.TestCase');
goog.require('goog.testing.jsunit');
goog.require('goog.userAgent');
goog.require('goog.userAgent.product');
</script>

<script type="text/javascript">
// WebDriver does not enable geolocation for Android.
// WebDriver does not enable geolocation for Edge.
// WebDriver does not enable geolocation for Firefox.
// WebDriver does not enable geolocation for IE 9.
// WebDriver does not enable geolocation for Safari.
var GEOLOCATION_NOT_WORKING =
!bot.html5.isSupported(bot.html5.API.GEOLOCATION) ||
goog.userAgent.product.ANDROID ||
goog.userAgent.product.EDGE ||
goog.userAgent.product.FIREFOX ||
goog.userAgent.product.SAFARI ||
// Geolocation is blocked by user consent screen on Chrome for Android.
Expand All @@ -32,6 +35,10 @@
bot.userAgent.IE_DOC_9;


function setUpPage() {
goog.testing.TestCase.getActiveTestCase().promiseTimeout = 10000; // 10s
}

/**
* This method checks if the device location
* can be retrieved, i.e. non-null value of Position within the timeout
Expand Down
2 changes: 1 addition & 1 deletion javascript/atoms/test/keyboard_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
browser = 'GECKO';
} else if (goog.userAgent.IE) {
browser = 'IE';
} else if (goog.userAgent.WEBKIT) {
} else if (goog.userAgent.WEBKIT || goog.userAgent.EDGE) {
browser = 'WEBKIT';
} else {
fail('unknown browser');
Expand Down
3 changes: 2 additions & 1 deletion javascript/atoms/test/select_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@
if (goog.userAgent.product.CHROME && bot.userAgent.isProductVersion(45)) {
// Chrome 45 and above do not fire the change event.
return false;
} else if (goog.userAgent.WEBKIT || bot.userAgent.IE_DOC_9) {
} else if (goog.userAgent.WEBKIT || bot.userAgent.IE_DOC_9 ||
goog.userAgent.EDGE) {
// Other browsers with goog.userAgent.WEBKIT fire the change event.
// IE 9 standards mode fires the change event.
return true;
Expand Down
28 changes: 13 additions & 15 deletions javascript/atoms/test/text_box_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,25 +230,23 @@
}


// TODO: tests for display: run-in


function testRunIn_followedByBlock() {
// - Firefox does not implement display:run-in,
// see https://bugzilla.mozilla.org/show_bug.cgi?id=2056
//
// - Blink removed display:run-in support, effective with Chrome 32.
// see https://code.google.com/p/chromium/issues/detail?id=260388
//
// - IE<8 does not support display:run-in,
// see http://quirksmode.org/css/css2/display.html
// Currently, only IE supports this use of display:run-in, having supported it
// starting with IE 8. See http://quirksmode.org/css/css2/display.html. The
// Android native browser also supports it.
//
// No other major desktop browsers support this now:
// - Firefox has never supported it.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=2056
// - Blink removed support, effective with Chrome 32.
// See https://code.google.com/p/chromium/issues/detail?id=260388
// - Safari appears to have dropped support in Safari 7.1.
// - Edge does not support it.
var supportsRunIn =
!goog.userAgent.GECKO &&
!(goog.userAgent.product.CHROME && bot.userAgent.isProductVersion(32)) &&
!(goog.userAgent.IE && !bot.userAgent.isProductVersion(8)) &&
!(goog.userAgent.product.SAFARI && bot.userAgent.isProductVersion(7.1));
(goog.userAgent.IE && bot.userAgent.isProductVersion(8)) ||
(goog.userAgent.product.CHROME && !bot.userAgent.isProductVersion(32)) ||
(goog.userAgent.product.SAFARI && !bot.userAgent.isProductVersion(7.1)) ||
(goog.userAgent.product.ANDROID);

var expectedText = supportsRunIn ? 'Hello, world.' : 'Hello\n, world.';
new DisplayBoxTester('run-in').
Expand Down
2 changes: 1 addition & 1 deletion javascript/atoms/test/text_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
function testGetVisibleTextShouldHandleCssContentReplacement() {
var expect = new goog.testing.ExpectedFailures();
expect.expectFailureFor(goog.userAgent.GECKO || goog.userAgent.IE ||
goog.userAgent.SAFARI || goog.userAgent.WEBKIT,
goog.userAgent.SAFARI || goog.userAgent.WEBKIT || goog.userAgent.EDGE,
"Does not support CSS3 content: 'foo' replacement");

expect.run(function() {
Expand Down
2 changes: 1 addition & 1 deletion javascript/atoms/test/useragent_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function testIsEngineVersionLower() {
}

function testIsEngineVersionLittleHigher() {
assertFalse(bot.userAgent.isEngineVersion(engineVersion + 0.111));
assertFalse(bot.userAgent.isEngineVersion(engineVersion + 0.00111));
}

function testIsEngineVersionHigher() {
Expand Down

0 comments on commit cb3347b

Please sign in to comment.