+
+
history_test.html
+
+
+
+
+
diff --git a/javascript/atoms/test/html5/appcache_test.html b/javascript/atoms/test/html5/appcache_test.html
index 9f87c5f508b23..300f5ff51dd40 100644
--- a/javascript/atoms/test/html5/appcache_test.html
+++ b/javascript/atoms/test/html5/appcache_test.html
@@ -1,14 +1,17 @@
+
HTML5 application cache test with manifest
+
+
+
@@ -25,18 +28,25 @@
});
}
- function testGetStatusWithHtmlManifest() {
+ QUnit.test('getStatusWithHtmlManifest', function(assert) {
if (APPCACHE_NOT_WORKING) {
+ assert.ok(true, 'Skipping: appcache not working');
return;
}
// On most browsers, the app is cached by now. This check should not be
// made asynch because one cannot reliably detect the cached event.
if (isCached) {
- assertEquals(window.applicationCache.IDLE,
- bot.appcache.getStatus(window));
+ assert.strictEqual(bot.appcache.getStatus(window),
+ window.applicationCache.IDLE);
+ } else {
+ assert.ok(true, 'App not yet cached');
}
- }
+ });
+
+
+
+
diff --git a/javascript/atoms/test/html5/database_test.html b/javascript/atoms/test/html5/database_test.html
index f7978bb461638..af25ce5d4df49 100644
--- a/javascript/atoms/test/html5/database_test.html
+++ b/javascript/atoms/test/html5/database_test.html
@@ -1,14 +1,17 @@
+
Web database storage
+
+
+
-
+
+
+
+
diff --git a/javascript/atoms/test/html5/location_test.html b/javascript/atoms/test/html5/location_test.html
index d4bcb2b5170c1..5790d3e2273e0 100644
--- a/javascript/atoms/test/html5/location_test.html
+++ b/javascript/atoms/test/html5/location_test.html
@@ -1,7 +1,11 @@
+
HTML5 Geo-location test
+
+
+
@@ -37,47 +39,52 @@
goog.userAgent.product.CHROME) ||
bot.userAgent.IE_DOC_9;
-
- function setUpPage() {
- goog.testing.TestCase.getActiveTestCase().promiseTimeout = 10000; // 10s
- }
+ QUnit.config.testTimeout = 10000; // 10s
/**
* This method checks if the device location
* can be retrieved, i.e. non-null value of Position within the timeout
* period.
*/
- function testLocationWithinDefaultInterval() {
+ QUnit.test('locationWithinDefaultInterval', function(assert) {
if (GEOLOCATION_NOT_WORKING) {
+ assert.ok(true, 'Skipping: geolocation not working');
return;
}
- return new goog.Promise(function(success, fail) {
- try {
- bot.geolocation.getCurrentPosition(success, function(error) {
- switch (error.code) {
- case error.POSITION_UNAVAILABLE:
- // Some test machines run on a private ip address range where
- // location is not be available, so do not consider this case
- // as an error.
- success();
- return;
- case error.PERMISSION_DENIED:
- fail('User denied the request for Geolocation.');
- return;
- case error.TIMEOUT:
- fail('When enabled, location should be known within ' +
- (bot.geolocation.DEFAULT_OPTIONS.timeout / 1000) + 's');
- return;
- default:
- fail('An unknown error occurred. ' + error.message);
- return;
- }
- });
- } catch (e) {
- assertEquals(e.code, bot.ErrorCode.UNKNOWN_ERROR);
- }
- });
- }
+ var done = assert.async();
+ try {
+ bot.geolocation.getCurrentPosition(function() {
+ assert.ok(true, 'Location retrieved');
+ done();
+ }, function(error) {
+ switch (error.code) {
+ case error.POSITION_UNAVAILABLE:
+ // Some test machines run on a private ip address range where
+ // location is not be available, so do not consider this case
+ // as an error.
+ assert.ok(true, 'Position unavailable - acceptable');
+ done();
+ return;
+ case error.PERMISSION_DENIED:
+ assert.ok(false, 'User denied the request for Geolocation.');
+ done();
+ return;
+ case error.TIMEOUT:
+ assert.ok(false, 'When enabled, location should be known within ' +
+ (bot.geolocation.DEFAULT_OPTIONS.timeout / 1000) + 's');
+ done();
+ return;
+ default:
+ assert.ok(false, 'An unknown error occurred. ' + error.message);
+ done();
+ return;
+ }
+ });
+ } catch (e) {
+ assert.strictEqual(e.code, bot.ErrorCode.UNKNOWN_ERROR);
+ done();
+ }
+ });
/**
* Tested with Chrome and Firefox. It checks if the device location cannot
@@ -88,8 +95,9 @@
* invoke the errorCallback (if present) with a new PositionError object
* whose code attribute is set to TIMEOUT.
*/
- function testLocationNoTimeout() {
+ QUnit.test('locationNoTimeout', function(assert) {
if (GEOLOCATION_NOT_WORKING) {
+ assert.ok(true, 'Skipping: geolocation not working');
return;
}
@@ -99,23 +107,29 @@
timeout: 0
};
- return new goog.Promise(function(success, fail) {
- try {
- bot.geolocation.getCurrentPosition(
- goog.partial(fail,
- 'Location within 0s timeout interval and 0s max age fails'),
- success,
- posOptions);
- } catch (e) {
- assertEquals(e.code, bot.ErrorCode.UNKNOWN_ERROR);
- success();
- }
- });
- }
+ var done = assert.async();
+ try {
+ bot.geolocation.getCurrentPosition(
+ function() {
+ assert.ok(false, 'Location within 0s timeout interval and 0s max age fails');
+ done();
+ },
+ function() {
+ assert.ok(true, 'Expected timeout error');
+ done();
+ },
+ posOptions);
+ } catch (e) {
+ assert.strictEqual(e.code, bot.ErrorCode.UNKNOWN_ERROR);
+ done();
+ }
+ });
// TODO: Add more tests to check the returned value.
+
+
diff --git a/javascript/atoms/test/html5/nested_window_storage_test.html b/javascript/atoms/test/html5/nested_window_storage_test.html
index c9f1e2e46f4e0..8e95f74068ab3 100644
--- a/javascript/atoms/test/html5/nested_window_storage_test.html
+++ b/javascript/atoms/test/html5/nested_window_storage_test.html
@@ -1,63 +1,70 @@
+
HTML5 storage with nested frames
+
+
+
-
+
+
+
diff --git a/javascript/atoms/test/html5/no_manifest_appcache_test.html b/javascript/atoms/test/html5/no_manifest_appcache_test.html
index 8132bd44a6763..615c1419b1b8e 100644
--- a/javascript/atoms/test/html5/no_manifest_appcache_test.html
+++ b/javascript/atoms/test/html5/no_manifest_appcache_test.html
@@ -1,29 +1,33 @@
+
HTML5 application cache without html manifest attribute
+
+
+
-Test
-

+
+
+ Test
+

-
-
diff --git a/javascript/atoms/test/html5/shadow_dom_test.html b/javascript/atoms/test/html5/shadow_dom_test.html
index e5c39c40c9c73..237d3966ba07e 100644
--- a/javascript/atoms/test/html5/shadow_dom_test.html
+++ b/javascript/atoms/test/html5/shadow_dom_test.html
@@ -1,13 +1,19 @@
+
+
+
+
+
+
+
Page for Shadow DOM tests
Foo
@@ -92,20 +98,22 @@
Page for Shadow DOM tests
'
DefaultDefault';
}
- function testIsShown() {
+ QUnit.test('isShown', function(assert) {
if (!bot.dom.IS_SHADOW_DOM_ENABLED) {
+ assert.ok(true, 'Skipping: shadow DOM not enabled');
return;
}
- assert(bot.dom.isShown(elementIsShown));
+ assert.ok(bot.dom.isShown(elementIsShown));
elementIsShown.style.display = 'none';
- assertFalse(bot.dom.isShown(elementIsShown));
- }
+ assert.notOk(bot.dom.isShown(elementIsShown));
+ });
- function testIsShownInShadow() {
+ QUnit.test('isShownInShadow', function(assert) {
if (!bot.dom.IS_SHADOW_DOM_ENABLED) {
+ assert.ok(true, 'Skipping: shadow DOM not enabled');
return;
}
@@ -113,15 +121,16 @@
Page for Shadow DOM tests
.shadowRoot
.querySelector('.test');
- assert(bot.dom.isShown(el));
+ assert.ok(bot.dom.isShown(el));
elementIsShownInShadow.style.display = 'none';
- assertFalse(bot.dom.isShown(el));
- }
+ assert.notOk(bot.dom.isShown(el));
+ });
- function testIsShownDirectlyInShadow() {
+ QUnit.test('isShownDirectlyInShadow', function(assert) {
if (!bot.dom.IS_SHADOW_DOM_ENABLED) {
+ assert.ok(true, 'Skipping: shadow DOM not enabled');
return;
}
@@ -129,85 +138,91 @@
Page for Shadow DOM tests
.shadowRoot
.querySelector('div');
- assert(bot.dom.isShown(el));
+ assert.ok(bot.dom.isShown(el));
elementIsShownDirectlyInShadow.style.display = 'none';
- assertFalse(bot.dom.isShown(el));
- }
+ assert.notOk(bot.dom.isShown(el));
+ });
- function testIsShownInSlot() {
+ QUnit.test('isShownInSlot', function(assert) {
if (!bot.dom.IS_SHADOW_DOM_ENABLED) {
+ assert.ok(true, 'Skipping: shadow DOM not enabled');
return;
}
var el = elementIsShownInSlot.children[0];
- assert(bot.dom.isShown(el));
+ assert.ok(bot.dom.isShown(el));
elementIsShownInSlot.style.display = 'none';
- assertFalse(bot.dom.isShown(el));
+ assert.notOk(bot.dom.isShown(el));
elementIsShownInSlot.style.display = '';
// Remove the slot, so our child is no longer slotted
elementIsShownInSlot.shadowRoot.innerHTML = '';
- assertFalse(bot.dom.isShown(el));
- }
+ assert.notOk(bot.dom.isShown(el));
+ });
- function testGetParentNodeInComposedDom() {
+ QUnit.test('getParentNodeInComposedDom', function(assert) {
if (!bot.dom.IS_SHADOW_DOM_ENABLED) {
+ assert.ok(true, 'Skipping: shadow DOM not enabled');
return;
}
var el = elementGetParent.children[0];
- assertEquals(elementGetParent, bot.dom.getParentNodeInComposedDom(el));
+ assert.strictEqual(bot.dom.getParentNodeInComposedDom(el), elementGetParent);
el = elementGetParentSlot.children[0];
- assertEquals(
- elementGetParentSlot.shadowRoot.querySelector('div'),
- bot.dom.getParentNodeInComposedDom(el)
+ assert.strictEqual(
+ bot.dom.getParentNodeInComposedDom(el),
+ elementGetParentSlot.shadowRoot.querySelector('div')
);
elementGetParentSlot.shadowRoot.innerHTML = '';
- assertEquals(null, bot.dom.getParentNodeInComposedDom(el));
- }
+ assert.strictEqual(bot.dom.getParentNodeInComposedDom(el), null);
+ });
- function testGetVisibleText() {
+ QUnit.test('getVisibleText', function(assert) {
if (!bot.dom.IS_SHADOW_DOM_ENABLED) {
+ assert.ok(true, 'Skipping: shadow DOM not enabled');
return;
}
- assertEquals('Foo', bot.dom.getVisibleText(elementGetText));
- }
+ assert.strictEqual(bot.dom.getVisibleText(elementGetText), 'Foo');
+ });
- function testGetVisibleTextInShadow() {
+ QUnit.test('getVisibleTextInShadow', function(assert) {
if (!bot.dom.IS_SHADOW_DOM_ENABLED) {
+ assert.ok(true, 'Skipping: shadow DOM not enabled');
return;
}
- assertEquals('foo', bot.dom.getVisibleText(elementGetTextShadow));
- }
+ assert.strictEqual(bot.dom.getVisibleText(elementGetTextShadow), 'foo');
+ });
- function testGetVisibleTextInSlot() {
+ QUnit.test('getVisibleTextInSlot', function(assert) {
if (!bot.dom.IS_SHADOW_DOM_ENABLED) {
+ assert.ok(true, 'Skipping: shadow DOM not enabled');
return;
}
- assertEquals('aFoob', bot.dom.getVisibleText(elementGetTextSlot));
- }
+ assert.strictEqual(bot.dom.getVisibleText(elementGetTextSlot), 'aFoob');
+ });
- function testGetVisibleTextInSlots() {
+ QUnit.test('getVisibleTextInSlots', function(assert) {
if (!bot.dom.IS_SHADOW_DOM_ENABLED) {
+ assert.ok(true, 'Skipping: shadow DOM not enabled');
return;
}
- assertEquals('Foo\nBar', bot.dom.getVisibleText(elementGetTextSlots));
- }
+ assert.strictEqual(bot.dom.getVisibleText(elementGetTextSlots), 'Foo\nBar');
+ });
diff --git a/javascript/atoms/test/html5/storage_test.html b/javascript/atoms/test/html5/storage_test.html
index 4640d9ee6c1cf..13e6bdc077e85 100644
--- a/javascript/atoms/test/html5/storage_test.html
+++ b/javascript/atoms/test/html5/storage_test.html
@@ -1,14 +1,17 @@
+
HTML5 storage
+
+
+
@@ -21,63 +24,69 @@
!bot.html5.isSupported(bot.html5.API.SESSION_STORAGE) ||
goog.userAgent.product.FIREFOX;
- function testGetLocalStorage() {
+ QUnit.test('getLocalStorage', function(assert) {
if (LOCAL_STORAGE_NOT_WORKING) {
+ assert.ok(true, 'Skipping: local storage not working');
return;
}
var storage = bot.storage.getLocalStorage();
- assertEquals(storage.getStorageMap(), localStorage);
- }
+ assert.strictEqual(storage.getStorageMap(), localStorage);
+ });
- function testGetLocalStorageWithWindow() {
+ QUnit.test('getLocalStorageWithWindow', function(assert) {
if (LOCAL_STORAGE_NOT_WORKING) {
+ assert.ok(true, 'Skipping: local storage not working');
return;
}
var storage = bot.storage.getLocalStorage(bot.getWindow());
- assertEquals(storage.getStorageMap(), localStorage);
- }
+ assert.strictEqual(storage.getStorageMap(), localStorage);
+ });
- function testGetSessionStorage() {
+ QUnit.test('getSessionStorage', function(assert) {
if (SESSION_STORAGE_NOT_WORKING) {
+ assert.ok(true, 'Skipping: session storage not working');
return;
}
var storage = bot.storage.getSessionStorage();
- assertEquals(storage.getStorageMap(), sessionStorage);
- }
+ assert.strictEqual(storage.getStorageMap(), sessionStorage);
+ });
- function testGetSessionStorageWithWindow() {
+ QUnit.test('getSessionStorageWithWindow', function(assert) {
if (SESSION_STORAGE_NOT_WORKING) {
+ assert.ok(true, 'Skipping: session storage not working');
return;
}
var storage = bot.storage.getSessionStorage(bot.getWindow());
- assertEquals(storage.getStorageMap(), storage.getStorageMap());
- }
+ assert.strictEqual(storage.getStorageMap(), storage.getStorageMap());
+ });
- function testClear() {
+ QUnit.test('clear', function(assert) {
if (LOCAL_STORAGE_NOT_WORKING) {
+ assert.ok(true, 'Skipping: local storage not working');
return;
}
var storage = bot.storage.getLocalStorage();
storage.clear();
- assertEquals(0, storage.size());
+ assert.strictEqual(storage.size(), 0);
storage.setItem('first', 'one');
storage.setItem('second', 'two');
storage.setItem('third', 'two');
storage.clear();
- assertEquals(0, storage.size());
- assertNull(storage.getItem('first'));
- assertNull(storage.getItem('second'));
- assertNull(storage.getItem('third'));
- }
+ assert.strictEqual(storage.size(), 0);
+ assert.strictEqual(storage.getItem('first'), null);
+ assert.strictEqual(storage.getItem('second'), null);
+ assert.strictEqual(storage.getItem('third'), null);
+ });
- function testSetAndGetSimpleItem() {
+ QUnit.test('setAndGetSimpleItem', function(assert) {
if (SESSION_STORAGE_NOT_WORKING) {
+ assert.ok(true, 'Skipping: session storage not working');
return;
}
@@ -85,20 +94,21 @@
// set-get
storage.setItem('first', 'one');
- assertEquals('one', storage.getItem('first'));
+ assert.strictEqual(storage.getItem('first'), 'one');
storage.setItem('second', 2);
- assertEquals('2', storage.getItem('second'));
- assertNull(storage.getItem('third'));
+ assert.strictEqual(storage.getItem('second'), '2');
+ assert.strictEqual(storage.getItem('third'), null);
// resetItem
storage.setItem('first', '1');
- assertEquals('1', storage.getItem('first'));
+ assert.strictEqual(storage.getItem('first'), '1');
storage.clear();
- }
+ });
- function testSetArbitraryValue() {
+ QUnit.test('setArbitraryValue', function(assert) {
if (SESSION_STORAGE_NOT_WORKING) {
+ assert.ok(true, 'Skipping: session storage not working');
return;
}
@@ -106,22 +116,23 @@
// set different types of value
storage.setItem('foo', '');
- assertEquals('', storage.getItem('foo'));
+ assert.strictEqual(storage.getItem('foo'), '');
var d = new Date(2011, 02, 29, 12, 33, 44, 44);
storage.setItem('date', d);
- assertEquals(d.toString(), storage.getItem('date'));
+ assert.strictEqual(storage.getItem('date'), d.toString());
// set null value.
storage.setItem('foo1', null);
- assertEquals('null', storage.getItem('foo1'));
+ assert.strictEqual(storage.getItem('foo1'), 'null');
storage.setItem('foo2', 'null');
- assertEquals(storage.getItem('foo1'), storage.getItem('foo2'));
+ assert.strictEqual(storage.getItem('foo1'), storage.getItem('foo2'));
storage.clear();
- }
+ });
- function testRemoveItem() {
+ QUnit.test('removeItem', function(assert) {
if (SESSION_STORAGE_NOT_WORKING) {
+ assert.ok(true, 'Skipping: session storage not working');
return;
}
@@ -131,14 +142,15 @@
storage.setItem('first', 'one');
storage.setItem('second', 'two');
- assertEquals('one', storage.removeItem('first'));
- assertEquals('two', storage.removeItem('second'));
- assertEquals(null, storage.removeItem('first'));
- assertEquals(null, storage.removeItem('foo'));
- }
+ assert.strictEqual(storage.removeItem('first'), 'one');
+ assert.strictEqual(storage.removeItem('second'), 'two');
+ assert.strictEqual(storage.removeItem('first'), null);
+ assert.strictEqual(storage.removeItem('foo'), null);
+ });
- function testSize() {
+ QUnit.test('size', function(assert) {
if (SESSION_STORAGE_NOT_WORKING) {
+ assert.ok(true, 'Skipping: session storage not working');
return;
}
@@ -148,11 +160,12 @@
storage.setItem('first', 'one');
storage.setItem('second', 'two');
storage.setItem('third', 'three');
- assertEquals(3, storage.size());
- }
+ assert.strictEqual(storage.size(), 3);
+ });
- function testKeySet() {
+ QUnit.test('keySet', function(assert) {
if (SESSION_STORAGE_NOT_WORKING) {
+ assert.ok(true, 'Skipping: session storage not working');
return;
}
@@ -162,39 +175,41 @@
storage.setItem('third', 'three');
storage.setItem('first', 'one');
storage.setItem('second', 'two');
- assertEquals(3, storage.size());
+ assert.strictEqual(storage.size(), 3);
// keySet
var keys = storage.keySet();
// Use goog.array.indexOf because IE9 doesn't have Array.indexOf
- assertNotEquals(-1, goog.array.indexOf(keys, 'first'));
- assertNotEquals(-1, goog.array.indexOf(keys, 'second'));
- assertEquals(-1, goog.array.indexOf(keys, 'five'));
+ assert.notStrictEqual(goog.array.indexOf(keys, 'first'), -1);
+ assert.notStrictEqual(goog.array.indexOf(keys, 'second'), -1);
+ assert.strictEqual(goog.array.indexOf(keys, 'five'), -1);
var sortedKeys = keys.sort();
- assertArrayEquals(['first', 'second', 'third'], sortedKeys);
- }
+ assert.deepEqual(sortedKeys, ['first', 'second', 'third']);
+ });
- function testIdenticalLocalStorage() {
+ QUnit.test('identicalLocalStorage', function(assert) {
if (LOCAL_STORAGE_NOT_WORKING) {
+ assert.ok(true, 'Skipping: local storage not working');
return;
}
var localStorage1 = bot.storage.getLocalStorage();
var localStorage2 = bot.storage.getLocalStorage();
localStorage1.clear();
- assertEquals(0, localStorage1.size());
- assertEquals(0, localStorage2.size());
+ assert.strictEqual(localStorage1.size(), 0);
+ assert.strictEqual(localStorage2.size(), 0);
localStorage1.setItem('foo', 'bar');
- assertEquals('bar', localStorage1.getItem('foo'));
- assertEquals('bar', localStorage2.getItem('foo'));
+ assert.strictEqual(localStorage1.getItem('foo'), 'bar');
+ assert.strictEqual(localStorage2.getItem('foo'), 'bar');
localStorage2.removeItem('foo');
- assertNull(localStorage1.getItem('foo'));
- assertNull(localStorage2.getItem('foo'));
- }
+ assert.strictEqual(localStorage1.getItem('foo'), null);
+ assert.strictEqual(localStorage2.getItem('foo'), null);
+ });
- function testPersistentLocalStorage() {
+ QUnit.test('persistentLocalStorage', function(assert) {
if (LOCAL_STORAGE_NOT_WORKING) {
+ assert.ok(true, 'Skipping: local storage not working');
return;
}
@@ -203,13 +218,15 @@
if (localStorage.getItem('foosession') === null) {
localStorage.setItem('foosession', 'barsession');
}
- assertEquals('barsession', localStorage.getItem('foosession'));
+ assert.strictEqual(localStorage.getItem('foosession'), 'barsession');
localStorage.removeItem('foosession');
- assertNull(localStorage.getItem('foosession'));
- }
+ assert.strictEqual(localStorage.getItem('foosession'), null);
+ });
+
+
diff --git a/javascript/atoms/test/inject_test.html b/javascript/atoms/test/inject_test.html
index 494ae7acf0122..4382ae7da0825 100644
--- a/javascript/atoms/test/inject_test.html
+++ b/javascript/atoms/test/inject_test.html
@@ -17,7 +17,11 @@
-->
+
Unit Tests for bot.inject
+
+
+
+
+
@@ -43,415 +48,400 @@
var frame, frameWin, frameDoc;
- function setUpPage() {
- goog.testing.TestCase.getActiveTestCase().promiseTimeout = 30000; // 30s
- }
-
- function setUp() {
+ QUnit.testStart(function() {
frame = goog.dom.$('test-frame');
frameWin = goog.dom.getFrameContentWindow(frame);
frameDoc = goog.dom.getFrameContentDocument(frame);
- // Force the cache to be recreated on the next access. We cannot "delete"
- // it here because IE complains about it being an unsupported operation.
document[bot.inject.cache.CACHE_KEY_] = null;
-
- // Delete the cache in our test frame, if it was created.
frameDoc[bot.inject.cache.CACHE_KEY_] = null;
- }
+ });
- function testAddWindowToCache() {
+ QUnit.test('AddWindowToCache', function(assert) {
var id = bot.inject.cache.addElement(frameWin);
- assertEquals(frameWin, bot.inject.cache.getElement(id));
- }
+ assert.strictEqual(bot.inject.cache.getElement(id), frameWin);
+ });
- function testAddWindowToCacheMultipleTimesReusesIds() {
+ QUnit.test('AddWindowToCacheMultipleTimesReusesIds', function(assert) {
var id1 = bot.inject.cache.addElement(frameWin);
var id2 = bot.inject.cache.addElement(frameWin);
- assertEquals(id1, id2);
- }
+ assert.strictEqual(id2, id1);
+ });
- function testGetElementThrowsIfWindowIsClosed() {
+ QUnit.test('GetElementThrowsIfWindowIsClosed', function(assert) {
var win = {document: 1, closed: 1};
var id = bot.inject.cache.addElement(win);
- assertThrows(goog.partial(bot.inject.cache.getElement, id));
- }
+ assert.throws(function() { bot.inject.cache.getElement(id); });
+ });
- function testShouldWrapAndUnwrapWindow() {
+ QUnit.test('ShouldWrapAndUnwrapWindow', function(assert) {
var wrapped = bot.inject.wrapValue(frameWin);
- assertNotNull(wrapped);
- assertNotUndefined(wrapped);
- assertTrue(goog.isObject(wrapped));
- assertTrue(goog.object.containsKey(wrapped, bot.inject.WINDOW_KEY));
+ assert.ok(wrapped !== null);
+ assert.ok(wrapped !== undefined);
+ assert.ok(goog.isObject(wrapped));
+ assert.ok(goog.object.containsKey(wrapped, bot.inject.WINDOW_KEY));
var id = wrapped[bot.inject.WINDOW_KEY];
var res = bot.inject.cache.getElement(id);
- assertEquals(frameWin, res);
- assertEquals(frameWin, bot.inject.unwrapValue(wrapped));
- }
+ assert.strictEqual(res, frameWin);
+ assert.strictEqual(bot.inject.unwrapValue(wrapped), frameWin);
+ });
- function testShouldBeAbleToCacheElements() {
+ QUnit.test('ShouldBeAbleToCacheElements', function(assert) {
var id = bot.inject.cache.addElement(document.body);
var el = bot.inject.cache.getElement(id);
- assertEquals(document.body, el);
- }
+ assert.strictEqual(el, document.body);
+ });
- function testShouldReuseExistingIdIfElementAlreadyExistsInTheCache() {
+ QUnit.test('ShouldReuseExistingIdIfElementAlreadyExistsInTheCache', function(assert) {
var id1 = bot.inject.cache.addElement(document.body);
var id2 = bot.inject.cache.addElement(document.body);
- assertEquals(id1, id2);
- }
+ assert.strictEqual(id2, id1);
+ });
- function testShouldThrowIfElementDoesNotExistInTheCache() {
- assertThrows(goog.partial(bot.inject.cache.getElement, 'not-there'));
- }
+ QUnit.test('ShouldThrowIfElementDoesNotExistInTheCache', function(assert) {
+ assert.throws(function() { bot.inject.cache.getElement('not-there'); });
+ });
- function testShouldDecodeIdsWhenRetrievingFromTheCache() {
+ QUnit.test('ShouldDecodeIdsWhenRetrievingFromTheCache', function(assert) {
var id = bot.inject.cache.addElement(document.body);
id = encodeURIComponent(id);
var el = bot.inject.cache.getElement(id);
- assertEquals(document.body, el);
- }
+ assert.strictEqual(el, document.body);
+ });
- function testShouldThrowIfCachedElementIsNoLongerAttachedToTheDom() {
+ QUnit.test('ShouldThrowIfCachedElementIsNoLongerAttachedToTheDom', function(assert) {
if (goog.userAgent.IE) {
- // TODO: Don't skip this.
+ assert.ok(true, 'Skipping: TODO fix for IE');
return;
}
var div = document.createElement('DIV');
document.body.appendChild(div);
var id = bot.inject.cache.addElement(div);
- assertEquals(div, bot.inject.cache.getElement(id));
+ assert.strictEqual(bot.inject.cache.getElement(id), div);
document.body.removeChild(div);
- assertThrows(goog.partial(bot.inject.cache.getElement, id));
- }
+ assert.throws(function() { bot.inject.cache.getElement(id); });
+ });
- function testDoesNotWrapStringBooleansNumbersOrNull() {
- assertEquals('foo', bot.inject.wrapValue('foo'));
- assertEquals(123, bot.inject.wrapValue(123));
- assertTrue(bot.inject.wrapValue(true));
- assertNull(bot.inject.wrapValue(null));
- }
+ QUnit.test('DoesNotWrapStringBooleansNumbersOrNull', function(assert) {
+ assert.strictEqual(bot.inject.wrapValue('foo'), 'foo');
+ assert.strictEqual(bot.inject.wrapValue(123), 123);
+ assert.ok(bot.inject.wrapValue(true));
+ assert.strictEqual(bot.inject.wrapValue(null), null);
+ });
- function testConvertsUndefinedValueToNullForWrapping() {
- assertNull(bot.inject.wrapValue(undefined));
- }
+ QUnit.test('ConvertsUndefinedValueToNullForWrapping', function(assert) {
+ assert.strictEqual(bot.inject.wrapValue(undefined), null);
+ });
- function testShouldAddElementsToCacheWhenWrapping() {
+ QUnit.test('ShouldAddElementsToCacheWhenWrapping', function(assert) {
var wrapped = bot.inject.wrapValue(document.body);
- assertNotNull(wrapped);
- assertNotUndefined(wrapped);
- assertTrue(goog.isObject(wrapped));
- assertTrue(goog.object.containsKey(wrapped, bot.inject.ELEMENT_KEY));
+ assert.ok(wrapped !== null);
+ assert.ok(wrapped !== undefined);
+ assert.ok(goog.isObject(wrapped));
+ assert.ok(goog.object.containsKey(wrapped, bot.inject.ELEMENT_KEY));
var id = wrapped[bot.inject.ELEMENT_KEY];
var el = bot.inject.cache.getElement(id);
- assertEquals(document.body, el);
- }
+ assert.strictEqual(el, document.body);
+ });
- function testShouldRecursivelyWrapArrays() {
+ QUnit.test('ShouldRecursivelyWrapArrays', function(assert) {
var unwrapped = [123, 'abc', null, document.body];
var wrapped = bot.inject.wrapValue(unwrapped);
- assertEquals(unwrapped.length, wrapped.length);
- assertEquals(unwrapped[0], wrapped[0]);
- assertEquals(unwrapped[1], wrapped[1]);
- assertEquals(unwrapped[2], wrapped[2]);
+ assert.strictEqual(wrapped.length, unwrapped.length);
+ assert.strictEqual(wrapped[0], unwrapped[0]);
+ assert.strictEqual(wrapped[1], unwrapped[1]);
+ assert.strictEqual(wrapped[2], unwrapped[2]);
- assertTrue(goog.object.containsKey(wrapped[3], bot.inject.ELEMENT_KEY));
- assertEquals(unwrapped[3], bot.inject.cache.getElement(
- wrapped[3][bot.inject.ELEMENT_KEY]));
- }
+ assert.ok(goog.object.containsKey(wrapped[3], bot.inject.ELEMENT_KEY));
+ assert.strictEqual(bot.inject.cache.getElement(
+ wrapped[3][bot.inject.ELEMENT_KEY]), unwrapped[3]);
+ });
- function testShouldBeAbleToWrapNodeListsAsArrays() {
+ QUnit.test('ShouldBeAbleToWrapNodeListsAsArrays', function(assert) {
var unwrapped = document.getElementsByTagName('body');
var wrapped = bot.inject.wrapValue(unwrapped);
- assertTrue('should return an array, but was ' + goog.typeOf(wrapped),
- Array.isArray(wrapped));
- assertEquals(unwrapped.length, wrapped.length);
- assertTrue(goog.object.containsKey(wrapped[0], bot.inject.ELEMENT_KEY));
- assertEquals(document.body, bot.inject.cache.getElement(
- wrapped[0][bot.inject.ELEMENT_KEY]));
- }
+ assert.ok(Array.isArray(wrapped), 'should return an array, but was ' + goog.typeOf(wrapped));
+ assert.strictEqual(wrapped.length, unwrapped.length);
+ assert.ok(goog.object.containsKey(wrapped[0], bot.inject.ELEMENT_KEY));
+ assert.strictEqual(bot.inject.cache.getElement(
+ wrapped[0][bot.inject.ELEMENT_KEY]), document.body);
+ });
- function testShouldThrowWhenWrappingRecursiveStructure() {
+ QUnit.test('ShouldThrowWhenWrappingRecursiveStructure', function(assert) {
var obj1 = {};
var obj2 = {};
obj1['obj2'] = obj2;
obj2['obj1'] = obj1;
- assertThrows(goog.partial(bot.inject.wrapValue, obj1));
- }
+ assert.throws(function() { bot.inject.wrapValue(obj1); });
+ });
- function testShouldBeAbleToUnWrapWrappedValues() {
+ QUnit.test('ShouldBeAbleToUnWrapWrappedValues', function(assert) {
var unwrapped = [123, 'abc', null, document.body];
var wrapped = bot.inject.wrapValue(unwrapped);
var roundTripped = bot.inject.unwrapValue(wrapped);
- assertArrayEquals(unwrapped, roundTripped);
- }
+ assert.deepEqual(roundTripped, unwrapped);
+ });
- function testShouldBeAbleToUnWrapNestedArrays() {
+ QUnit.test('ShouldBeAbleToUnWrapNestedArrays', function(assert) {
var unwrapped = [123, 'abc', null, [document.body, null,
[document.body]]];
var wrapped = bot.inject.wrapValue(unwrapped);
var roundTripped = bot.inject.unwrapValue(wrapped);
- assertArrayEquals(unwrapped, roundTripped);
- }
+ assert.deepEqual(roundTripped, unwrapped);
+ });
- function testShouldBeAbleToUnWrapNestedObjects() {
+ QUnit.test('ShouldBeAbleToUnWrapNestedObjects', function(assert) {
var unwrapped = {'foo': {'bar': document.body}};
var wrapped = bot.inject.wrapValue(unwrapped);
var roundTripped = bot.inject.unwrapValue(wrapped);
- assertTrue(goog.object.containsKey(roundTripped, 'foo'));
+ assert.ok(goog.object.containsKey(roundTripped, 'foo'));
var foo = roundTripped['foo'];
- assertTrue(goog.object.containsKey(foo, 'bar'));
- assertEquals(document.body, foo['bar']);
- }
+ assert.ok(goog.object.containsKey(foo, 'bar'));
+ assert.strictEqual(foo['bar'], document.body);
+ });
- function testShouldUnWrapElementsUsingTheGivenDocumentsCache() {
+ QUnit.test('ShouldUnWrapElementsUsingTheGivenDocumentsCache', function(assert) {
var wrapped = bot.inject.wrapValue(frameDoc.body);
- assertNotNull(wrapped);
- assertNotUndefined(wrapped);
- assertTrue(goog.isObject(wrapped));
- assertTrue(goog.object.containsKey(wrapped, bot.inject.ELEMENT_KEY));
+ assert.ok(wrapped !== null);
+ assert.ok(wrapped !== undefined);
+ assert.ok(goog.isObject(wrapped));
+ assert.ok(goog.object.containsKey(wrapped, bot.inject.ELEMENT_KEY));
- // Should not be able to unwrap using our document since the element
- // was cached on its ownerDocument.
- assertThrows(goog.partial(bot.inject.unwrapValue, wrapped));
+ assert.throws(function() { bot.inject.unwrapValue(wrapped); });
var unwrapped = bot.inject.unwrapValue(wrapped, frameDoc);
- assertEquals(frameDoc.body, unwrapped);
- }
+ assert.strictEqual(unwrapped, frameDoc.body);
+ });
- function testShouldBeAbleToUnwrapArgumentsExecuteScriptAndWrapResult() {
+ QUnit.test('ShouldBeAbleToUnwrapArgumentsExecuteScriptAndWrapResult', function(assert) {
var id = bot.inject.cache.addElement(document.body);
var args = [{}];
args[0][bot.inject.ELEMENT_KEY] = id;
var result = bot.inject.executeScript(
function() { return arguments[0]; }, args);
- assertTrue(goog.object.containsKey(result, 'status'));
- assertEquals(bot.ErrorCode.SUCCESS, result['status']);
+ assert.ok(goog.object.containsKey(result, 'status'));
+ assert.strictEqual(result['status'], bot.ErrorCode.SUCCESS);
- assertTrue(goog.object.containsKey(result, 'value'));
- assertTrue(goog.object.containsKey(result['value'],
+ assert.ok(goog.object.containsKey(result, 'value'));
+ assert.ok(goog.object.containsKey(result['value'],
bot.inject.ELEMENT_KEY));
- assertEquals(document.body, bot.inject.cache.getElement(
- result['value'][bot.inject.ELEMENT_KEY]));
- }
+ assert.strictEqual(bot.inject.cache.getElement(
+ result['value'][bot.inject.ELEMENT_KEY]), document.body);
+ });
- function testShouldTrapAndReturnWrappedErrorsFromInjectedScripts() {
+ QUnit.test('ShouldTrapAndReturnWrappedErrorsFromInjectedScripts', function(assert) {
var result = bot.inject.executeScript(
function() { throw Error('ouch'); }, []);
- assertTrue(goog.object.containsKey(result, 'status'));
- assertTrue(goog.object.containsKey(result, 'value'));
+ assert.ok(goog.object.containsKey(result, 'status'));
+ assert.ok(goog.object.containsKey(result, 'value'));
- assertEquals(bot.ErrorCode.UNKNOWN_ERROR, result['status']);
+ assert.strictEqual(result['status'], bot.ErrorCode.UNKNOWN_ERROR);
result = result['value'];
- assertTrue(goog.object.containsKey(result, 'message'));
- assertEquals('ouch', result['message']);
- }
+ assert.ok(goog.object.containsKey(result, 'message'));
+ assert.strictEqual(result['message'], 'ouch');
+ });
- function testShouldResetCacheWhenPageIsRefreshed() {
+ QUnit.test('ShouldResetCacheWhenPageIsRefreshed', function(assert) {
+ var done = assert.async();
var id = bot.inject.cache.addElement(frameDoc.body);
- assertEquals(frameDoc.body, bot.inject.cache.getElement(id, frameDoc));
+ assert.strictEqual(bot.inject.cache.getElement(id, frameDoc), frameDoc.body);
- return new goog.Promise(function(loaded) {
- goog.events.listenOnce(frame, 'load', loaded);
- frameWin.location.reload();
- }).then(function() {
+ goog.events.listenOnce(frame, 'load', function() {
frameDoc = goog.dom.getFrameContentDocument(frame);
- assertThrows(goog.partial(bot.inject.cache.getElement, id, frameDoc));
+ assert.throws(function() { bot.inject.cache.getElement(id, frameDoc); });
+ done();
});
- }
+ frameWin.location.reload();
+ });
- function testShouldStringifyResultsWhenAskedToDoSo() {
+ QUnit.test('ShouldStringifyResultsWhenAskedToDoSo', function(assert) {
var result = bot.inject.executeScript(function() {
return arguments[0] + arguments[1];
}, ['abc', 123], true);
- assertEquals('string', goog.typeOf(result));
+ assert.strictEqual(goog.typeOf(result), 'string');
var json = bot.json.parse(result);
- assertTrue('No status: ' + result, 'status' in json);
- assertTrue('No value: ' + result, 'value' in json);
- assertEquals(0, json['status']);
- assertEquals('abc123', json['value']);
- }
+ assert.ok('status' in json, 'No status: ' + result);
+ assert.ok('value' in json, 'No value: ' + result);
+ assert.strictEqual(json['status'], 0);
+ assert.strictEqual(json['value'], 'abc123');
+ });
- function testShouldStringifyErrorsWhenAskedForStringResults() {
+ QUnit.test('ShouldStringifyErrorsWhenAskedForStringResults', function(assert) {
var result = bot.inject.executeScript(function() {
throw new bot.Error(bot.ErrorCode.NO_SUCH_ELEMENT, 'ouch');
}, [], true);
- assertEquals('string', goog.typeOf(result));
+ assert.strictEqual(goog.typeOf(result), 'string');
var json = bot.json.parse(result);
- assertTrue('No status: ' + result, 'status' in json);
- assertTrue('No value: ' + result, 'value' in json);
- assertEquals(bot.ErrorCode.NO_SUCH_ELEMENT, json['status']);
- assertTrue('No message: ' + result, 'message' in json['value']);
- assertEquals('ouch', json['value']['message']);
- }
-
-
- function testShouldBeAbleToExecuteAsyncScript() {
- return new goog.Promise(function(done) {
- bot.inject.executeAsyncScript(
- 'window.setTimeout(goog.partial(arguments[0], 1), 10)',
- [], 250, done);
- }).then(function(result) {
- assertTrue(goog.object.containsKey(result, 'status'));
- assertEquals(bot.ErrorCode.SUCCESS, result['status']);
- assertTrue(goog.object.containsKey(result, 'value'));
- assertEquals(1, result['value']);
+ assert.ok('status' in json, 'No status: ' + result);
+ assert.ok('value' in json, 'No value: ' + result);
+ assert.strictEqual(json['status'], bot.ErrorCode.NO_SUCH_ELEMENT);
+ assert.ok('message' in json['value'], 'No message: ' + result);
+ assert.strictEqual(json['value']['message'], 'ouch');
+ });
+
+
+ QUnit.test('ShouldBeAbleToExecuteAsyncScript', function(assert) {
+ var done = assert.async();
+ bot.inject.executeAsyncScript(
+ 'window.setTimeout(goog.partial(arguments[0], 1), 10)',
+ [], 250, function(result) {
+ assert.ok(goog.object.containsKey(result, 'status'));
+ assert.strictEqual(result['status'], bot.ErrorCode.SUCCESS);
+ assert.ok(goog.object.containsKey(result, 'value'));
+ assert.strictEqual(result['value'], 1);
+ done();
});
- }
+ });
- function testShouldBeAbleToExecuteAsyncScriptThatCallsbackSynchronously() {
- return new goog.Promise(function(done) {
- bot.inject.executeAsyncScript('arguments[0](1)', [], 0, done);
- }).then(function(result) {
- assertTrue(goog.object.containsKey(result, 'status'));
- assertEquals(bot.ErrorCode.SUCCESS, result['status']);
- assertTrue(goog.object.containsKey(result, 'value'));
- assertEquals(1, result['value']);
+ QUnit.test('ShouldBeAbleToExecuteAsyncScriptThatCallsbackSynchronously', function(assert) {
+ var done = assert.async();
+ bot.inject.executeAsyncScript('arguments[0](1)', [], 0, function(result) {
+ assert.ok(goog.object.containsKey(result, 'status'));
+ assert.strictEqual(result['status'], bot.ErrorCode.SUCCESS);
+ assert.ok(goog.object.containsKey(result, 'value'));
+ assert.strictEqual(result['value'], 1);
+ done();
});
- }
-
-
- function testShouldBeAbleToExecuteAsyncFunc() {
- return new goog.Promise(function(done) {
- bot.inject.executeAsyncScript(
- function(callback) { callback(1) }, [], 0, done);
- }).then(function(result) {
- assertTrue(goog.object.containsKey(result, 'status'));
- assertEquals(bot.ErrorCode.SUCCESS, result['status']);
- assertTrue(goog.object.containsKey(result, 'value'));
- assertEquals(1, result['value']);
+ });
+
+
+ QUnit.test('ShouldBeAbleToExecuteAsyncFunc', function(assert) {
+ var done = assert.async();
+ bot.inject.executeAsyncScript(
+ function(callback) { callback(1) }, [], 0, function(result) {
+ assert.ok(goog.object.containsKey(result, 'status'));
+ assert.strictEqual(result['status'], bot.ErrorCode.SUCCESS);
+ assert.ok(goog.object.containsKey(result, 'value'));
+ assert.strictEqual(result['value'], 1);
+ done();
});
- }
+ });
- function testShouldThrowOnExecuteAsyncException() {
- return new goog.Promise(function(done) {
- bot.inject.executeAsyncScript('nosuchfunc()', [], 0, done);
- }).then(function(result) {
- assertTrue(goog.object.containsKey(result, 'status'));
- assertEquals(bot.ErrorCode.UNKNOWN_ERROR, result['status']);
+ QUnit.test('ShouldThrowOnExecuteAsyncException', function(assert) {
+ var done = assert.async();
+ bot.inject.executeAsyncScript('nosuchfunc()', [], 0, function(result) {
+ assert.ok(goog.object.containsKey(result, 'status'));
+ assert.strictEqual(result['status'], bot.ErrorCode.UNKNOWN_ERROR);
+ done();
});
- }
+ });
- function testShouldTimeoutInExecuteAsync() {
- return new goog.Promise(function(done) {
- bot.inject.executeAsyncScript('', [], 0, done);
- }).then(function(result) {
- assertTrue(goog.object.containsKey(result, 'status'));
- assertEquals(bot.ErrorCode.SCRIPT_TIMEOUT, result['status']);
+ QUnit.test('ShouldTimeoutInExecuteAsync', function(assert) {
+ var done = assert.async();
+ bot.inject.executeAsyncScript('', [], 0, function(result) {
+ assert.ok(goog.object.containsKey(result, 'status'));
+ assert.strictEqual(result['status'], bot.ErrorCode.SCRIPT_TIMEOUT);
+ done();
});
- }
+ });
- function testShouldBeAbleToStringifyResult() {
- return new goog.Promise(function(done) {
- bot.inject.executeAsyncScript('', [], 0, done, true);
- }).then(function(jsonResult) {
+ QUnit.test('ShouldBeAbleToStringifyResult', function(assert) {
+ var done = assert.async();
+ bot.inject.executeAsyncScript('', [], 0, function(jsonResult) {
var result = bot.json.parse(jsonResult);
- assertTrue(goog.object.containsKey(result, 'status'));
- assertEquals(bot.ErrorCode.SCRIPT_TIMEOUT, result['status']);
- });
- }
-
-
- function testShouldBeAbleToWrapAndUnwrapInExecuteAsyncScript() {
- return new goog.Promise(function(done) {
- var id = bot.inject.cache.addElement(document.body);
- var args = [{}];
- args[0][bot.inject.ELEMENT_KEY] = id;
- bot.inject.executeAsyncScript(
- 'arguments[1](arguments[0])', args, 0, done);
- }).then(function(result) {
- assertTrue(goog.object.containsKey(result, 'status'));
- assertEquals(bot.ErrorCode.SUCCESS, result['status']);
-
- assertTrue(goog.object.containsKey(result, 'value'));
- assertTrue(goog.object.containsKey(result['value'],
+ assert.ok(goog.object.containsKey(result, 'status'));
+ assert.strictEqual(result['status'], bot.ErrorCode.SCRIPT_TIMEOUT);
+ done();
+ }, true);
+ });
+
+
+ QUnit.test('ShouldBeAbleToWrapAndUnwrapInExecuteAsyncScript', function(assert) {
+ var done = assert.async();
+ var id = bot.inject.cache.addElement(document.body);
+ var args = [{}];
+ args[0][bot.inject.ELEMENT_KEY] = id;
+ bot.inject.executeAsyncScript(
+ 'arguments[1](arguments[0])', args, 0, function(result) {
+ assert.ok(goog.object.containsKey(result, 'status'));
+ assert.strictEqual(result['status'], bot.ErrorCode.SUCCESS);
+
+ assert.ok(goog.object.containsKey(result, 'value'));
+ assert.ok(goog.object.containsKey(result['value'],
bot.inject.ELEMENT_KEY));
- assertEquals(document.body, bot.inject.cache.getElement(
- result['value'][bot.inject.ELEMENT_KEY]));
+ assert.strictEqual(bot.inject.cache.getElement(
+ result['value'][bot.inject.ELEMENT_KEY]), document.body);
+ done();
});
- }
+ });
- function testShouldExecuteAsyncScriptsInTheContextOfTheSpecifiedWindow() {
+ QUnit.test('ShouldExecuteAsyncScriptsInTheContextOfTheSpecifiedWindow', function(assert) {
if (goog.userAgent.IE || goog.userAgent.product.SAFARI ||
(goog.userAgent.product.ANDROID &&
!bot.userAgent.isProductVersion(4))) {
- // Android prior to Ice Cream Sandwich has a known issue, b/5006213.
- // TODO: Don't skip this.
+ assert.ok(true, 'Skipping: known issue on this browser');
return;
}
- return new goog.Promise(function(done) {
- bot.inject.executeAsyncScript(function(callback) {
- callback({
- 'this == window': (this == window),
- 'this == top': (this == window.top),
- 'typeof window.MY_GLOBAL_CONSTANT': (typeof MY_GLOBAL_CONSTANT),
- 'typeof window.top.MY_GLOBAL_CONSTANT':
- (typeof window.top.MY_GLOBAL_CONSTANT)
- });
- }, [], 0, done, false, frameWin);
- }).then(function(result) {
+ var done = assert.async();
+ bot.inject.executeAsyncScript(function(callback) {
+ callback({
+ 'this == window': (this == window),
+ 'this == top': (this == window.top),
+ 'typeof window.MY_GLOBAL_CONSTANT': (typeof MY_GLOBAL_CONSTANT),
+ 'typeof window.top.MY_GLOBAL_CONSTANT':
+ (typeof window.top.MY_GLOBAL_CONSTANT)
+ });
+ }, [], 0, function(result) {
var jsonResult = bot.json.stringify(result);
- assertTrue(jsonResult, goog.object.containsKey(result, 'status'));
- assertEquals(jsonResult, bot.ErrorCode.SUCCESS, result['status']);
+ assert.ok(goog.object.containsKey(result, 'status'), jsonResult);
+ assert.strictEqual(result['status'], bot.ErrorCode.SUCCESS, jsonResult);
- assertTrue(jsonResult, goog.object.containsKey(result, 'value'));
+ assert.ok(goog.object.containsKey(result, 'value'), jsonResult);
var value = result['value'];
- assertEquals(jsonResult, true, value['this == window']);
- assertEquals(jsonResult, false, value['this == top']);
- assertEquals(jsonResult, 'undefined',
- value['typeof window.MY_GLOBAL_CONSTANT']);
- assertEquals(jsonResult, 'number',
- value['typeof window.top.MY_GLOBAL_CONSTANT']);
- });
- }
+ assert.strictEqual(value['this == window'], true, jsonResult);
+ assert.strictEqual(value['this == top'], false, jsonResult);
+ assert.strictEqual(value['typeof window.MY_GLOBAL_CONSTANT'], 'undefined', jsonResult);
+ assert.strictEqual(value['typeof window.top.MY_GLOBAL_CONSTANT'], 'number', jsonResult);
+ done();
+ }, false, frameWin);
+ });
- function testShouldExecuteScriptsInTheContextOfTheSpecifiedWindow() {
+ QUnit.test('ShouldExecuteScriptsInTheContextOfTheSpecifiedWindow', function(assert) {
if (goog.userAgent.IE || goog.userAgent.product.SAFARI ||
(goog.userAgent.product.ANDROID &&
!bot.userAgent.isProductVersion(4))) {
- // Android prior to Ice Cream Sandwich has a known issue, b/5006213.
- // TODO: Don't skip this.
+ assert.ok(true, 'Skipping: known issue on this browser');
return;
}
@@ -467,43 +457,41 @@
var jsonResult = bot.json.stringify(result);
- assertTrue(jsonResult, goog.object.containsKey(result, 'status'));
- assertEquals(jsonResult, bot.ErrorCode.SUCCESS, result['status']);
+ assert.ok(goog.object.containsKey(result, 'status'), jsonResult);
+ assert.strictEqual(result['status'], bot.ErrorCode.SUCCESS, jsonResult);
- assertTrue(jsonResult, goog.object.containsKey(result, 'value'));
+ assert.ok(goog.object.containsKey(result, 'value'), jsonResult);
var value = result['value'];
- assertEquals(jsonResult, true, value['this == window']);
- assertEquals(jsonResult, false, value['this == top']);
- assertEquals(jsonResult, 'undefined',
- value['typeof window.MY_GLOBAL_CONSTANT']);
- assertEquals(jsonResult, 'number',
- value['typeof window.top.MY_GLOBAL_CONSTANT']);
- }
+ assert.strictEqual(value['this == window'], true, jsonResult);
+ assert.strictEqual(value['this == top'], false, jsonResult);
+ assert.strictEqual(value['typeof window.MY_GLOBAL_CONSTANT'], 'undefined', jsonResult);
+ assert.strictEqual(value['typeof window.top.MY_GLOBAL_CONSTANT'], 'number', jsonResult);
+ });
- function testCorrectlyUnwrapsFunctionArgsForInjectedScripts() {
+ QUnit.test('CorrectlyUnwrapsFunctionArgsForInjectedScripts', function(assert) {
var result = bot.inject.executeScript(function() {
return arguments[0]();
}, [function() {return 1;}]);
- assertEquals(bot.ErrorCode.SUCCESS, result['status']);
- assertEquals(1, result['value']);
- }
-
- function testCorrectlyUnwrapsFunctionArgsForInjectedAsyncScripts() {
- return new goog.Promise(function(done) {
- bot.inject.executeAsyncScript(function() {
- var callback = arguments[arguments.length - 1];
- callback(arguments[0]());
- }, [function() {return 1;}], 0, done, false);
- }).then(function(result) {
- assertEquals(bot.ErrorCode.SUCCESS, result['status']);
- assertEquals(1, result['value']);
- });
- }
-
- function testCorrectlyUnwrapsArgsForInjectedScripts() {
+ assert.strictEqual(result['status'], bot.ErrorCode.SUCCESS);
+ assert.strictEqual(result['value'], 1);
+ });
+
+ QUnit.test('CorrectlyUnwrapsFunctionArgsForInjectedAsyncScripts', function(assert) {
+ var done = assert.async();
+ bot.inject.executeAsyncScript(function() {
+ var callback = arguments[arguments.length - 1];
+ callback(arguments[0]());
+ }, [function() {return 1;}], 0, function(result) {
+ assert.strictEqual(result['status'], bot.ErrorCode.SUCCESS);
+ assert.strictEqual(result['value'], 1);
+ done();
+ }, false);
+ });
+
+ QUnit.test('CorrectlyUnwrapsArgsForInjectedScripts', function(assert) {
if (goog.userAgent.IE) {
- // TODO: Don't skip this.
+ assert.ok(true, 'Skipping: TODO fix for IE');
return;
}
var wrapped = bot.inject.wrapValue(frameDoc.body);
@@ -512,67 +500,67 @@
return [arguments[0], arguments[0].tagName.toUpperCase()];
}, [wrapped], false, frameWin);
- assertEquals(bot.ErrorCode.SUCCESS, result['status']);
+ assert.strictEqual(result['status'], bot.ErrorCode.SUCCESS);
var value = result['value'];
- assertTrue(Array.isArray(value));
- assertEquals(2, value.length);
+ assert.ok(Array.isArray(value));
+ assert.strictEqual(value.length, 2);
- assertTrue(goog.isObject(value[0]));
- assertTrue(goog.object.containsKey(value[0], bot.inject.ELEMENT_KEY));
- assertEquals(wrapped[bot.inject.ELEMENT_KEY],
- value[0][bot.inject.ELEMENT_KEY]);
+ assert.ok(goog.isObject(value[0]));
+ assert.ok(goog.object.containsKey(value[0], bot.inject.ELEMENT_KEY));
+ assert.strictEqual(value[0][bot.inject.ELEMENT_KEY],
+ wrapped[bot.inject.ELEMENT_KEY]);
- assertEquals('BODY', value[1]);
- }
+ assert.strictEqual(value[1], 'BODY');
+ });
- function testCorrectlyUnwrapsArgsForInjectedAsyncScripts() {
+ QUnit.test('CorrectlyUnwrapsArgsForInjectedAsyncScripts', function(assert) {
if (goog.userAgent.IE) {
- // TODO: Don't skip this.
+ assert.ok(true, 'Skipping: TODO fix for IE');
return;
}
var wrapped = bot.inject.wrapValue(frameDoc.body);
- return new goog.Promise(function(done) {
- bot.inject.executeAsyncScript(function(element, callback) {
- callback([element, element.tagName.toUpperCase()]);
- }, [wrapped], 0, done, false, frameWin);
- }).then(function(result) {
- assertEquals(bot.ErrorCode.SUCCESS, result['status']);
+ var done = assert.async();
+ bot.inject.executeAsyncScript(function(element, callback) {
+ callback([element, element.tagName.toUpperCase()]);
+ }, [wrapped], 0, function(result) {
+ assert.strictEqual(result['status'], bot.ErrorCode.SUCCESS);
var value = result['value'];
- assertTrue(Array.isArray(value));
- assertEquals(2, value.length);
+ assert.ok(Array.isArray(value));
+ assert.strictEqual(value.length, 2);
- assertTrue(goog.isObject(value[0]));
- assertTrue(goog.object.containsKey(value[0], bot.inject.ELEMENT_KEY));
- assertEquals(wrapped[bot.inject.ELEMENT_KEY],
- value[0][bot.inject.ELEMENT_KEY]);
+ assert.ok(goog.isObject(value[0]));
+ assert.ok(goog.object.containsKey(value[0], bot.inject.ELEMENT_KEY));
+ assert.strictEqual(value[0][bot.inject.ELEMENT_KEY],
+ wrapped[bot.inject.ELEMENT_KEY]);
- assertEquals('BODY', value[1]);
- });
- }
+ assert.strictEqual(value[1], 'BODY');
+ done();
+ }, false, frameWin);
+ });
- function testExecuteScriptShouldBeAbleToRecurseOnItself() {
+ QUnit.test('ExecuteScriptShouldBeAbleToRecurseOnItself', function(assert) {
if (goog.userAgent.IE) {
- // TODO: Don't skip this.
+ assert.ok(true, 'Skipping: TODO fix for IE');
return;
}
var json = bot.inject.executeScript(bot.inject.executeScript,
['return 1 +2;'], true);
var result = bot.json.parse(json);
- assertTrue(json, goog.object.containsKey(result, 'status'));
- assertEquals(json, bot.ErrorCode.SUCCESS, result['status']);
- assertTrue(json, goog.object.containsKey(result, 'value'));
+ assert.ok(goog.object.containsKey(result, 'status'), json);
+ assert.strictEqual(result['status'], bot.ErrorCode.SUCCESS, json);
+ assert.ok(goog.object.containsKey(result, 'value'), json);
var innerResult = result['value'];
- assertTrue(json, goog.isObject(innerResult));
- assertTrue(json, goog.object.containsKey(innerResult, 'status'));
- assertEquals(json, bot.ErrorCode.SUCCESS, innerResult['status']);
- assertTrue(json, goog.object.containsKey(innerResult, 'value'));
- assertEquals(json, 3, innerResult['value']);
- }
+ assert.ok(goog.isObject(innerResult), json);
+ assert.ok(goog.object.containsKey(innerResult, 'status'), json);
+ assert.strictEqual(innerResult['status'], bot.ErrorCode.SUCCESS, json);
+ assert.ok(goog.object.containsKey(innerResult, 'value'), json);
+ assert.strictEqual(innerResult['value'], 3, json);
+ });
diff --git a/javascript/atoms/test/interactable_size_test.html b/javascript/atoms/test/interactable_size_test.html
index 8231f518d9f36..b3609cc6603c8 100644
--- a/javascript/atoms/test/interactable_size_test.html
+++ b/javascript/atoms/test/interactable_size_test.html
@@ -1,15 +1,17 @@
+
interactable_size_test
-
+
+
+
@@ -22,44 +24,41 @@
return bot.window.getInteractableSize(win);
}
- function testShouldReturnViewportSizeIfThatIsLargest() {
+ QUnit.test('should return viewport size if that is largest', function(assert) {
var size = getSizeOfFrameWithId('set_size');
- assertEquals(110, size.width);
- assertEquals(100, size.height);
- }
+ assert.strictEqual(size.width, 110);
+ assert.strictEqual(size.height, 100);
+ });
- function testShouldReturnDocumentSizeIfThatIsGreatestAndInStandardsMode() {
+ QUnit.test('should return document size if that is greatest and in standards mode', function(assert) {
var size = getSizeOfFrameWithId('doc_size');
- assertEquals(700, size.width);
- assertEquals(500, size.height);
- }
+ assert.strictEqual(size.width, 700);
+ assert.strictEqual(size.height, 500);
+ });
- function testShouldReturnDocumentSizeIfThatIsGreatestAndInQuirksMode() {
+ QUnit.test('should return document size if that is greatest and in quirks mode', function(assert) {
var size = getSizeOfFrameWithId('quirks_size');
- // In quirks mode IE limits the size of the frame to the content
var width = bot.userAgent.IE_DOC_PRE9 ? 110 : 700;
var height = bot.userAgent.IE_DOC_PRE9 ? 100 : 500;
- assertEquals(width, size.width);
- assertEquals(height, size.height);
- }
+ assert.strictEqual(size.width, width);
+ assert.strictEqual(size.height, height);
+ });
- function testSizeShouldBeBasedOnLargestElementInThePage() {
+ QUnit.test('size should be based on largest element in the page', function(assert) {
var size = getSizeOfFrameWithId('table_size');
- // We can't be sure of the size of the window, but it's at least these
- // values, which are based on the table size in the doc.
- assertTrue('Width needs to be at least 349px. It is: ' + size.width,
- size.width > 349);
- assertTrue('Height needs to be at least 199px. It is: ' + size.height,
- size.height > 199);
- }
+ assert.ok(size.width > 349, 'Width needs to be at least 349px. It is: ' + size.width);
+ assert.ok(size.height > 199, 'Height needs to be at least 199px. It is: ' + size.height);
+ });
+
+
diff --git a/javascript/atoms/test/keyboard_test.html b/javascript/atoms/test/keyboard_test.html
index f096658ebedb6..87cbe3af2cc47 100644
--- a/javascript/atoms/test/keyboard_test.html
+++ b/javascript/atoms/test/keyboard_test.html
@@ -1,47 +1,52 @@
-
keyboard_test
-
-
+
+
keyboard_test
+
+
+
+
+
+
+
diff --git a/javascript/atoms/test/locator_test.html b/javascript/atoms/test/locator_test.html
index 97026cd88a869..4b21a5e13f298 100644
--- a/javascript/atoms/test/locator_test.html
+++ b/javascript/atoms/test/locator_test.html
@@ -17,443 +17,528 @@
-->
-
locator_test.html
-
-
-
-
+
+
+
- var second = bot.locators.findElement(locator);
- assertEquals('tiger', second.getAttribute('name'));
- } finally {
- delete Object.prototype.cheese;
- delete Object.prototype.Inherits;
- }
- }
+
-
Para
-
-
nope
-
yup
-
simba
-
shere khan
-
dotted class
-
another dotted class
-
-
-
-
-
-
Furrfu
-
-
- - item
-
- item
-
- item
-
- item
-
-
apóstrofo
-
comilla
-
barra invertida
-
space
-
queso!
-
-
this is a link
-
this is a link
-
this is a link
-
this is a link
-
this is a link
-
-
unrelated
-
-
has, a comma
-
-
+
+
diff --git a/javascript/atoms/test/mouse_test.html b/javascript/atoms/test/mouse_test.html
index cfc8469451b2c..cdaa813cf1583 100644
--- a/javascript/atoms/test/mouse_test.html
+++ b/javascript/atoms/test/mouse_test.html
@@ -1,36 +1,40 @@
-
mouse_test
-
-
+
+
mouse_test
+
+
+
+
+
+
-
-
-
diff --git a/javascript/atoms/test/opacity_test.html b/javascript/atoms/test/opacity_test.html
index 17777710e337d..71836081bcc0d 100644
--- a/javascript/atoms/test/opacity_test.html
+++ b/javascript/atoms/test/opacity_test.html
@@ -1,6 +1,7 @@
+
opacity_test.html
-
+
+
+
@@ -33,20 +35,6 @@
var findElement = bot.locators.findElement;
var helper = new goog.dom.DomHelper();
- function testOpacity() {
- var suite = buildTestSuites();
-
- if(!bot.userAgent.IE_DOC_PRE9) {
- runTestSuite(suite, 'others');
- } else if(bot.userAgent.isEngineVersion(8)) {
- runTestSuite(suite, 'ie8');
- } else if(bot.userAgent.isEngineVersion(7)) {
- runTestSuite(suite, 'ie7');
- } else if(bot.userAgent.isEngineVersion(6)) {
- runTestSuite(suite, 'ie6');
- }
- }
-
function buildMap(headers, row) {
var map = {};
var values = helper.getElementsByTagNameAndClass(goog.dom.TagName.TD, undefined, row);
@@ -74,22 +62,36 @@
return suites;
}
- function runTestSuite(testSpecs, browser) {
+ function runTestSuite(assert, testSpecs, browser) {
goog.iter.forEach(testSpecs, function(testSpec) {
var node = testSpec['example'];
var comment = "Test no." + testSpec['id'] + " for browser " + browser + ": " + testSpec['style'];
try {
- assertEquals(comment, Number(testSpec[browser]), bot.dom.getOpacity(node));
- //alert(comment + " expected: " + Number(testSpec[browser]) + " value: " + bot.dom.getOpacity(node));
+ assert.strictEqual(bot.dom.getOpacity(node), Number(testSpec[browser]), comment);
} catch(e) {
- fail("Test no." + testSpec['id'] + " failed with exception: " + e.message);
+ assert.ok(false, "Test no." + testSpec['id'] + " failed with exception: " + e.message);
}
});
- //alert("run " + testSpecs.length);
}
+
+ QUnit.test('opacity', function(assert) {
+ var suite = buildTestSuites();
+
+ if(!bot.userAgent.IE_DOC_PRE9) {
+ runTestSuite(assert, suite, 'others');
+ } else if(bot.userAgent.isEngineVersion(8)) {
+ runTestSuite(assert, suite, 'ie8');
+ } else if(bot.userAgent.isEngineVersion(7)) {
+ runTestSuite(assert, suite, 'ie7');
+ } else if(bot.userAgent.isEngineVersion(6)) {
+ runTestSuite(assert, suite, 'ie6');
+ }
+ });
+
+
To determine opacity, it is not enough to simply read a property
diff --git a/javascript/atoms/test/orientation_test.html b/javascript/atoms/test/orientation_test.html
index 960847fe92fa0..345dcb7aecd75 100644
--- a/javascript/atoms/test/orientation_test.html
+++ b/javascript/atoms/test/orientation_test.html
@@ -1,26 +1,31 @@
+
orientation_test
+
+
+
+
+
diff --git a/javascript/atoms/test/overflow_test.html b/javascript/atoms/test/overflow_test.html
index 6c98b4cd04d9a..8c4e3b2a84473 100644
--- a/javascript/atoms/test/overflow_test.html
+++ b/javascript/atoms/test/overflow_test.html
@@ -1,14 +1,17 @@
+
overflow_test.html
+
+
+
@@ -17,14 +20,11 @@
var HIDDEN = bot.dom.OverflowState.HIDDEN;
var SCROLL = bot.dom.OverflowState.SCROLL;
- function tearDown() {
+ QUnit.testDone(function() {
document.documentElement.style.position = '';
- }
+ });
- function testElemHiddenByParent() {
- // Column 1: position style of the element
- // Column 2: position style of the element's parent
- // Column 3: expected overflow state of the element
+ QUnit.test('elemHiddenByParent', function(assert) {
var positionStylesToOverflowStateTable = [
['absolute', 'absolute', HIDDEN],
['absolute', 'fixed', HIDDEN],
@@ -61,16 +61,12 @@
parent.appendChild(elem);
document.body.appendChild(parent);
- assertEquals('position: ' + position + '; parent position: ' +
- parentPosition, expectedState, bot.dom.getOverflowState(elem));
+ assert.strictEqual(bot.dom.getOverflowState(elem), expectedState,
+ 'position: ' + position + '; parent position: ' + parentPosition);
});
- }
+ });
- function testElemHiddenByGrandparent() {
- // Column 1: position style of the element
- // Column 2: position style of the element's parent
- // Column 3: position style of the element's grandparent
- // Column 4: expected overflow state of the element
+ QUnit.test('elemHiddenByGrandparent', function(assert) {
var positionStylesToOverflowStateTable = [
['absolute', 'absolute', 'absolute', HIDDEN],
['absolute', 'absolute', 'fixed' , HIDDEN],
@@ -161,41 +157,38 @@
grandparent.appendChild(parent);
document.body.appendChild(grandparent);
- assertEquals('position: ' + position + '; parent position: ' +
- parentPosition + '; grandparent position: ' + grandparentPosition,
- expectedState, bot.dom.getOverflowState(elem));
+ assert.strictEqual(bot.dom.getOverflowState(elem), expectedState,
+ 'position: ' + position + '; parent position: ' +
+ parentPosition + '; grandparent position: ' + grandparentPosition);
});
- }
+ });
- function testChildOfScrollStyleHasScrollStatus() {
+ QUnit.test('childOfScrollStyleHasScrollStatus', function(assert) {
var e = document.getElementById('overflowScroll');
- assertEquals(SCROLL, bot.dom.getOverflowState(e));
- }
+ assert.strictEqual(bot.dom.getOverflowState(e), SCROLL);
+ });
- function testChildOfAutoStyleHasScrollStatus() {
+ QUnit.test('childOfAutoStyleHasScrollStatus', function(assert) {
var e = document.getElementById('overflowAuto');
- assertEquals(SCROLL, bot.dom.getOverflowState(e));
- }
+ assert.strictEqual(bot.dom.getOverflowState(e), SCROLL);
+ });
- function testChildOfScrollStyleInHiddenHasScrollStatusWhenParentNotInOverflow() {
+ QUnit.test('childOfScrollStyleInHiddenHasScrollStatusWhenParentNotInOverflow', function(assert) {
var e = document.getElementById('overflowScrollInHiddenIsScroll');
- assertEquals(SCROLL, bot.dom.getOverflowState(e));
- }
+ assert.strictEqual(bot.dom.getOverflowState(e), SCROLL);
+ });
- function testChildOfScrollStyleInHiddenHasHiddenStatusWhenParentInOverflow() {
+ QUnit.test('childOfScrollStyleInHiddenHasHiddenStatusWhenParentInOverflow', function(assert) {
var e = document.getElementById('overflowScrollInHiddenIsHidden');
- assertEquals(HIDDEN, bot.dom.getOverflowState(e));
- }
+ assert.strictEqual(bot.dom.getOverflowState(e), HIDDEN);
+ });
- function testOverflowOfHtmlAndBodyElements() {
+ QUnit.test('overflowOfHtmlAndBodyElements', function(assert) {
if (bot.userAgent.ANDROID_PRE_GINGERBREAD) {
+ assert.ok(true, 'Skipping: Android pre-Gingerbread');
return;
}
- // Column 1: overflow style of the element
- // Column 2: overflow style of the element
- // Column 3: expected overflow state of the overflowsBodyNotDoc element
- // Column 4: expected overflow state of the overflowsBodyAndDoc element
var overflowStylesToOverflowStateTable = [
['auto' , 'auto' , SCROLL, SCROLL],
['auto' , 'hidden' , HIDDEN, HIDDEN],
@@ -232,53 +225,49 @@
var msg = 'html overflow style: ' + htmlOverflowStyle + '; ' +
'body overflow style: ' + bodyOverflowStyle;
overflowsNothing.innerHTML = msg;
- assertEquals(msg, NONE,
- bot.dom.getOverflowState(overflowsNothing));
- assertEquals(msg, expectedOverflowsBodyNotDocState,
- bot.dom.getOverflowState(overflowsBodyNotDoc));
- assertEquals(msg, expectedOverflowsBodyAndDocState,
- bot.dom.getOverflowState(overflowsBodyAndDoc));
+ assert.strictEqual(bot.dom.getOverflowState(overflowsNothing), NONE, msg);
+ assert.strictEqual(bot.dom.getOverflowState(overflowsBodyNotDoc),
+ expectedOverflowsBodyNotDocState, msg);
+ assert.strictEqual(bot.dom.getOverflowState(overflowsBodyAndDoc),
+ expectedOverflowsBodyAndDocState, msg);
});
- }
+ });
- function testChildOfAnElementWithZeroHeightAndWidthAndOverflowHiddenIsNotVisible() {
+ QUnit.test('childOfAnElementWithZeroHeightAndWidthAndOverflowHiddenIsNotVisible', function(assert) {
var child = document.getElementById('bug5140-1-child');
- assertEquals(HIDDEN, bot.dom.getOverflowState(child));
- }
+ assert.strictEqual(bot.dom.getOverflowState(child), HIDDEN);
+ });
- function testFarShiftedChildOfAnElementWitOverflowHiddenIsNotVisible() {
+ QUnit.test('farShiftedChildOfAnElementWitOverflowHiddenIsNotVisible', function(assert) {
var child = document.getElementById('bug5140-2-child');
- assertEquals(HIDDEN, bot.dom.getOverflowState(child));
- }
+ assert.strictEqual(bot.dom.getOverflowState(child), HIDDEN);
+ });
- function testNotFarShiftedChildOfAnElementWithOverflowHiddenIsVisible() {
+ QUnit.test('notFarShiftedChildOfAnElementWithOverflowHiddenIsVisible', function(assert) {
var child = document.getElementById('bug5140-3-child');
- assertEquals(NONE, bot.dom.getOverflowState(child));
- }
+ assert.strictEqual(bot.dom.getOverflowState(child), NONE);
+ });
- function testFarShiftedGrandchildOfAnElementWitOverflowHiddenIsNotVisible() {
+ QUnit.test('farShiftedGrandchildOfAnElementWitOverflowHiddenIsNotVisible', function(assert) {
var child = document.getElementById('bug5140-4-grandchild');
- assertEquals(HIDDEN, bot.dom.getOverflowState(child));
- }
+ assert.strictEqual(bot.dom.getOverflowState(child), HIDDEN);
+ });
- function testFloatingElemHiddenByBlockParent() {
+ QUnit.test('floatingElemHiddenByBlockParent', function(assert) {
var elem = document.getElementById('floatingInsideBlockParent');
- assertEquals(HIDDEN, bot.dom.getOverflowState(elem));
- }
+ assert.strictEqual(bot.dom.getOverflowState(elem), HIDDEN);
+ });
- function testFloatingElemNotHiddenByInlineParent() {
+ QUnit.test('floatingElemNotHiddenByInlineParent', function(assert) {
var elem = document.getElementById('floatingInsideInlineParent');
- assertEquals(NONE, bot.dom.getOverflowState(elem));
- }
+ assert.strictEqual(bot.dom.getOverflowState(elem), NONE);
+ });
- function testNegativePositionInOverflowVisibleParent() {
- // IE 6 does not support fixed-position elements properly.
+ QUnit.test('negativePositionInOverflowVisibleParent', function(assert) {
if (goog.userAgent.IE && !bot.userAgent.isProductVersion(7)) {
+ assert.ok(true, 'Skipping: IE 6 does not support fixed-position elements properly');
return;
}
- // Column 1: position style of the element
- // Column 2: position style of the element's parent
- // Column 3: expected overflow state of element
var positionStylesToOverflowStateTable = [
['absolute', 'absolute', NONE ],
['absolute', 'fixed', NONE ],
@@ -322,19 +311,16 @@
parent.appendChild(elem);
parentContainer.appendChild(parent);
- assertEquals('position: ' + position + '; parent position: ' +
- parentPosition, expectedState, bot.dom.getOverflowState(elem));
+ assert.strictEqual(bot.dom.getOverflowState(elem), expectedState,
+ 'position: ' + position + '; parent position: ' + parentPosition);
});
- }
+ });
- function testNegativePositionNotInOverflowVisibleParent() {
- // IE 6 does not support fixed-position elements properly.
+ QUnit.test('negativePositionNotInOverflowVisibleParent', function(assert) {
if (goog.userAgent.IE && !bot.userAgent.isProductVersion(7)) {
+ assert.ok(true, 'Skipping: IE 6 does not support fixed-position elements properly');
return;
}
- // Column 1: position style of the element
- // Column 2: position style of the element's parent
- // Column 3: expected overflow state
var positionStylesToOverflowStateTable = [
['absolute', 'absolute', HIDDEN],
['absolute', 'fixed', HIDDEN],
@@ -381,93 +367,93 @@
goog.array.forEach(nonVisibleOverflowStyles, function(parentOverflowStyle) {
parent.style['overflow'] = parentOverflowStyle;
- assertEquals('position: ' + position + '; parent position: ' +
- parentPosition, expectedState, bot.dom.getOverflowState(elem));
+ assert.strictEqual(bot.dom.getOverflowState(elem), expectedState,
+ 'position: ' + position + '; parent position: ' + parentPosition);
});
});
- }
+ });
- function testScrollingInAndOutOfView() {
+ QUnit.test('scrollingInAndOutOfView', function(assert) {
var line1 = document.getElementById('line1');
var line5 = document.getElementById('line5');
- assertEquals(NONE, bot.dom.getOverflowState(line1));
- assertEquals(SCROLL, bot.dom.getOverflowState(line5));
+ assert.strictEqual(bot.dom.getOverflowState(line1), NONE);
+ assert.strictEqual(bot.dom.getOverflowState(line5), SCROLL);
line5.scrollIntoView();
- assertEquals(SCROLL, bot.dom.getOverflowState(line1));
- assertEquals(NONE, bot.dom.getOverflowState(line5));
+ assert.strictEqual(bot.dom.getOverflowState(line1), SCROLL);
+ assert.strictEqual(bot.dom.getOverflowState(line5), NONE);
line1.scrollIntoView();
- assertEquals(NONE, bot.dom.getOverflowState(line1));
- assertEquals(SCROLL, bot.dom.getOverflowState(line5));
- }
+ assert.strictEqual(bot.dom.getOverflowState(line1), NONE);
+ assert.strictEqual(bot.dom.getOverflowState(line5), SCROLL);
+ });
- function testInOverflowHiddenByTransform() {
- // IE versions < 9 do not support CSS transform styles.
+ QUnit.test('inOverflowHiddenByTransform', function(assert) {
if (goog.userAgent.IE && !bot.userAgent.isProductVersion(9)) {
+ assert.ok(true, 'Skipping: IE versions < 9 do not support CSS transform styles');
return;
}
var hiddenTransformX = document.getElementById('hidden-transformX');
- assertEquals(HIDDEN, bot.dom.getOverflowState(hiddenTransformX));
+ assert.strictEqual(bot.dom.getOverflowState(hiddenTransformX), HIDDEN);
var hiddenTransformY = document.getElementById('hidden-transformY');
- assertEquals(HIDDEN, bot.dom.getOverflowState(hiddenTransformY));
- }
+ assert.strictEqual(bot.dom.getOverflowState(hiddenTransformY), HIDDEN);
+ });
- function testOverflowStateOfRelativeCoordinate() {
- // IE 6 does not support overflow state properly.
+ QUnit.test('overflowStateOfRelativeCoordinate', function(assert) {
if (goog.userAgent.IE && !bot.userAgent.isProductVersion(7)) {
+ assert.ok(true, 'Skipping: IE 6 does not support overflow state properly');
return;
}
var elem = document.getElementById('halfHidden');
- assertEquals(NONE, bot.dom.getOverflowState(elem,
- new goog.math.Coordinate(1, 1)));
- assertEquals(HIDDEN, bot.dom.getOverflowState(elem,
- new goog.math.Coordinate(60, 60)));
- }
+ assert.strictEqual(bot.dom.getOverflowState(elem,
+ new goog.math.Coordinate(1, 1)), NONE);
+ assert.strictEqual(bot.dom.getOverflowState(elem,
+ new goog.math.Coordinate(60, 60)), HIDDEN);
+ });
- function testOverflowStateOfRelativeRectangle() {
- // IE 6 does not support overflow state properly.
+ QUnit.test('overflowStateOfRelativeRectangle', function(assert) {
if (goog.userAgent.IE && !bot.userAgent.isProductVersion(7)) {
+ assert.ok(true, 'Skipping: IE 6 does not support overflow state properly');
return;
}
var elem = document.getElementById('halfHidden');
- assertEquals(NONE, bot.dom.getOverflowState(elem,
- new goog.math.Rect(25, 25, 50, 50)));
- assertEquals(HIDDEN, bot.dom.getOverflowState(elem,
- new goog.math.Coordinate(60, 60, 50, 50)));
- }
+ assert.strictEqual(bot.dom.getOverflowState(elem,
+ new goog.math.Rect(25, 25, 50, 50)), NONE);
+ assert.strictEqual(bot.dom.getOverflowState(elem,
+ new goog.math.Coordinate(60, 60, 50, 50)), HIDDEN);
+ });
- function testFixedPositionOffscreenIsHidden() {
- // IE 6 does not support fixed-position elements properly.
+ QUnit.test('fixedPositionOffscreenIsHidden', function(assert) {
if (goog.userAgent.IE && !bot.userAgent.isProductVersion(7)) {
+ assert.ok(true, 'Skipping: IE 6 does not support fixed-position elements properly');
return;
}
var fixedOffscreen = document.getElementById('fixed-offscreen');
- assertEquals(HIDDEN, bot.dom.getOverflowState(fixedOffscreen));
- }
+ assert.strictEqual(bot.dom.getOverflowState(fixedOffscreen), HIDDEN);
+ });
- function testChildOfFixedTreatedAsFixed() {
- // IE 6 does not support fixed-position elements properly.
+ QUnit.test('childOfFixedTreatedAsFixed', function(assert) {
if (goog.userAgent.IE && !bot.userAgent.isProductVersion(7)) {
+ assert.ok(true, 'Skipping: IE 6 does not support fixed-position elements properly');
return;
}
var fixedParent = document.getElementById('fixed-parent');
- assertEquals(NONE, bot.dom.getOverflowState(fixedParent));
+ assert.strictEqual(bot.dom.getOverflowState(fixedParent), NONE);
var childOfFixed = document.getElementById('child-of-fixed');
- assertEquals(HIDDEN, bot.dom.getOverflowState(childOfFixed));
- }
+ assert.strictEqual(bot.dom.getOverflowState(childOfFixed), HIDDEN);
+ });
- function testElementHiddenByZeroSizedContainer() {
+ QUnit.test('elementHiddenByZeroSizedContainer', function(assert) {
var elem = document.getElementById('hasZeroSizedContainer');
- assertEquals(HIDDEN, bot.dom.getOverflowState(elem));
- }
+ assert.strictEqual(bot.dom.getOverflowState(elem), HIDDEN);
+ });
- function testElementWithHtmlElementFixed() {
+ QUnit.test('elementWithHtmlElementFixed', function(assert) {
document.documentElement.style.position = 'fixed';
var elem = document.getElementById('line1');
- assertEquals(NONE, bot.dom.getOverflowState(elem));
- }
+ assert.strictEqual(bot.dom.getOverflowState(elem), NONE);
+ });
+
+
scroll down to see element
diff --git a/javascript/atoms/test/property_test.html b/javascript/atoms/test/property_test.html
index c32d015ecf2da..fca6a1b78996e 100644
--- a/javascript/atoms/test/property_test.html
+++ b/javascript/atoms/test/property_test.html
@@ -17,69 +17,74 @@
-->
+
property_test.html
+
+
+
+
+
Cheddar
Brie
Gouda
diff --git a/javascript/atoms/test/relative_locator_test.html b/javascript/atoms/test/relative_locator_test.html
index bd35c18bcbc39..03896e9b2a6b2 100644
--- a/javascript/atoms/test/relative_locator_test.html
+++ b/javascript/atoms/test/relative_locator_test.html
@@ -1,252 +1,222 @@
+
relative_locator_test.html
-
-
+
+
+
+
-
-
Relative Locator Tests
-
- This text is above.
- This is a paragraph of text in the middle.
- This text is below.
-
-
-
-
- | 1 |
- 2 |
- 3 |
-
-
- | 4 |
- 5 |
- 6 |
-
-
- | 7 |
- 8 |
- 9 |
-
-
-
-
- El-A
- El-B
- El-C
- El-D
- El-E
- El-F
-
-
-
+
+
diff --git a/javascript/atoms/test/response_test.html b/javascript/atoms/test/response_test.html
index ed237c1ca4b3d..ab21fec248986 100644
--- a/javascript/atoms/test/response_test.html
+++ b/javascript/atoms/test/response_test.html
@@ -16,23 +16,28 @@
-->
+
response_test
+
+
+
+
+
diff --git a/javascript/atoms/test/scrolling_test.html b/javascript/atoms/test/scrolling_test.html
index 91a3c788d539e..81efaacab0b25 100644
--- a/javascript/atoms/test/scrolling_test.html
+++ b/javascript/atoms/test/scrolling_test.html
@@ -1,7 +1,11 @@
-
+
+
scrolling_test.html
+
+
+
+
+
diff --git a/javascript/atoms/test/select_test.html b/javascript/atoms/test/select_test.html
index de5a6e698df0f..ef28d54e69473 100644
--- a/javascript/atoms/test/select_test.html
+++ b/javascript/atoms/test/select_test.html
@@ -3,7 +3,11 @@
+
select_test.html
+
+
+
+
+