Skip to content

Commit cb3347b

Browse files
juangjjleyba
authored andcommitted
Update browser automation atoms tests for Edge.
Signed-off-by: Jason Leyba <jmleyba@gmail.com>
1 parent 2c04320 commit cb3347b

File tree

10 files changed

+39
-24
lines changed

10 files changed

+39
-24
lines changed

javascript/atoms/events.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ bot.events.KeyboardEventFactory_.prototype.create = function(target, opt_args) {
434434
event.metaKey = args.metaKey;
435435
event.shiftKey = args.shiftKey;
436436
event.keyCode = args.charCode || args.keyCode;
437-
if (goog.userAgent.WEBKIT) {
437+
if (goog.userAgent.WEBKIT || goog.userAgent.EDGE) {
438438
event.charCode = (this == bot.events.EventType.KEYPRESS) ?
439439
event.keyCode : 0;
440440
}

javascript/atoms/keyboard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ bot.Keyboard.prototype.pressKey = function(key) {
459459
bot.Keyboard.prototype.requiresKeyPress_ = function(key) {
460460
if (key.character || key == bot.Keyboard.Keys.ENTER) {
461461
return true;
462-
} else if (goog.userAgent.WEBKIT) {
462+
} else if (goog.userAgent.WEBKIT || goog.userAgent.EDGE) {
463463
return false;
464464
} else if (goog.userAgent.IE) {
465465
return key == bot.Keyboard.Keys.ESC;

javascript/atoms/test/clientrect_test.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
goog.require('goog.dom');
1212
goog.require('goog.style');
1313
goog.require('goog.testing.jsunit');
14+
goog.require('goog.testing.ExpectedFailures');
1415
goog.require('goog.userAgent');
1516
</script>
1617

@@ -63,11 +64,14 @@
6364
}
6465

6566
function testAreaWithDefaultShape() {
66-
// IE doesn't support shape="default".
67-
if (!goog.userAgent.IE) {
67+
var expect = new goog.testing.ExpectedFailures();
68+
expect.expectFailureFor(goog.userAgent.IE || goog.userAgent.EDGE,
69+
"IE and Edge don't support shape=default");
70+
71+
expect.run(function() {
6872
var e = document.getElementById('default');
6973
assertClientRect(e, 300, 25, 200, 100);
70-
}
74+
});
7175
}
7276

7377
function testAreaWithRectShape() {

javascript/atoms/test/history_test.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
goog.require('goog.dom');
1313
goog.require('goog.events');
1414
goog.require('goog.Promise');
15+
goog.require('goog.testing.TestCase');
1516
goog.require('goog.testing.asserts');
1617
goog.require('goog.testing.jsunit');
1718
goog.require('goog.userAgent');
@@ -64,6 +65,10 @@
6465
}, 0);
6566
}
6667

68+
function setUpPage() {
69+
goog.testing.TestCase.getActiveTestCase().promiseTimeout = 10000; // 10s
70+
}
71+
6772
function setUp() {
6873
// setUpPage does not wait on returned promises, so return a promise from
6974
// each setUp to make sure we wait for the initial frame setup.

javascript/atoms/test/html5/location_test.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,22 @@
1111
goog.require('bot.userAgent');
1212
goog.require('goog.Promise');
1313
goog.require('goog.labs.userAgent.platform');
14+
goog.require('goog.testing.TestCase');
1415
goog.require('goog.testing.jsunit');
1516
goog.require('goog.userAgent');
1617
goog.require('goog.userAgent.product');
1718
</script>
1819

1920
<script type="text/javascript">
2021
// WebDriver does not enable geolocation for Android.
22+
// WebDriver does not enable geolocation for Edge.
2123
// WebDriver does not enable geolocation for Firefox.
2224
// WebDriver does not enable geolocation for IE 9.
2325
// WebDriver does not enable geolocation for Safari.
2426
var GEOLOCATION_NOT_WORKING =
2527
!bot.html5.isSupported(bot.html5.API.GEOLOCATION) ||
2628
goog.userAgent.product.ANDROID ||
29+
goog.userAgent.product.EDGE ||
2730
goog.userAgent.product.FIREFOX ||
2831
goog.userAgent.product.SAFARI ||
2932
// Geolocation is blocked by user consent screen on Chrome for Android.
@@ -32,6 +35,10 @@
3235
bot.userAgent.IE_DOC_9;
3336

3437

38+
function setUpPage() {
39+
goog.testing.TestCase.getActiveTestCase().promiseTimeout = 10000; // 10s
40+
}
41+
3542
/**
3643
* This method checks if the device location
3744
* can be retrieved, i.e. non-null value of Position within the timeout

javascript/atoms/test/keyboard_test.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
browser = 'GECKO';
2424
} else if (goog.userAgent.IE) {
2525
browser = 'IE';
26-
} else if (goog.userAgent.WEBKIT) {
26+
} else if (goog.userAgent.WEBKIT || goog.userAgent.EDGE) {
2727
browser = 'WEBKIT';
2828
} else {
2929
fail('unknown browser');

javascript/atoms/test/select_test.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,8 @@
369369
if (goog.userAgent.product.CHROME && bot.userAgent.isProductVersion(45)) {
370370
// Chrome 45 and above do not fire the change event.
371371
return false;
372-
} else if (goog.userAgent.WEBKIT || bot.userAgent.IE_DOC_9) {
372+
} else if (goog.userAgent.WEBKIT || bot.userAgent.IE_DOC_9 ||
373+
goog.userAgent.EDGE) {
373374
// Other browsers with goog.userAgent.WEBKIT fire the change event.
374375
// IE 9 standards mode fires the change event.
375376
return true;

javascript/atoms/test/text_box_test.html

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -230,25 +230,23 @@
230230
}
231231

232232

233-
// TODO: tests for display: run-in
234-
235-
236233
function testRunIn_followedByBlock() {
237-
// - Firefox does not implement display:run-in,
238-
// see https://bugzilla.mozilla.org/show_bug.cgi?id=2056
239-
//
240-
// - Blink removed display:run-in support, effective with Chrome 32.
241-
// see https://code.google.com/p/chromium/issues/detail?id=260388
242-
//
243-
// - IE<8 does not support display:run-in,
244-
// see http://quirksmode.org/css/css2/display.html
234+
// Currently, only IE supports this use of display:run-in, having supported it
235+
// starting with IE 8. See http://quirksmode.org/css/css2/display.html. The
236+
// Android native browser also supports it.
245237
//
238+
// No other major desktop browsers support this now:
239+
// - Firefox has never supported it.
240+
// See https://bugzilla.mozilla.org/show_bug.cgi?id=2056
241+
// - Blink removed support, effective with Chrome 32.
242+
// See https://code.google.com/p/chromium/issues/detail?id=260388
246243
// - Safari appears to have dropped support in Safari 7.1.
244+
// - Edge does not support it.
247245
var supportsRunIn =
248-
!goog.userAgent.GECKO &&
249-
!(goog.userAgent.product.CHROME && bot.userAgent.isProductVersion(32)) &&
250-
!(goog.userAgent.IE && !bot.userAgent.isProductVersion(8)) &&
251-
!(goog.userAgent.product.SAFARI && bot.userAgent.isProductVersion(7.1));
246+
(goog.userAgent.IE && bot.userAgent.isProductVersion(8)) ||
247+
(goog.userAgent.product.CHROME && !bot.userAgent.isProductVersion(32)) ||
248+
(goog.userAgent.product.SAFARI && !bot.userAgent.isProductVersion(7.1)) ||
249+
(goog.userAgent.product.ANDROID);
252250

253251
var expectedText = supportsRunIn ? 'Hello, world.' : 'Hello\n, world.';
254252
new DisplayBoxTester('run-in').

javascript/atoms/test/text_test.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@
246246
function testGetVisibleTextShouldHandleCssContentReplacement() {
247247
var expect = new goog.testing.ExpectedFailures();
248248
expect.expectFailureFor(goog.userAgent.GECKO || goog.userAgent.IE ||
249-
goog.userAgent.SAFARI || goog.userAgent.WEBKIT,
249+
goog.userAgent.SAFARI || goog.userAgent.WEBKIT || goog.userAgent.EDGE,
250250
"Does not support CSS3 content: 'foo' replacement");
251251

252252
expect.run(function() {

javascript/atoms/test/useragent_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function testIsEngineVersionLower() {
4141
}
4242

4343
function testIsEngineVersionLittleHigher() {
44-
assertFalse(bot.userAgent.isEngineVersion(engineVersion + 0.111));
44+
assertFalse(bot.userAgent.isEngineVersion(engineVersion + 0.00111));
4545
}
4646

4747
function testIsEngineVersionHigher() {

0 commit comments

Comments
 (0)