Bug 1171903 - Test for storage inspector endless scrolling. r=miker
authorTim Nguyen <ntim.bugs@gmail.com>
Thu, 07 Jan 2016 13:19:00 +0100
changeset 323467 424bd0dc72e03eb4413f475698fdbcfed4b75694
parent 323466 3e9da0e581c79218c2fc521ff349a3960bd6fde3
child 323468 9331d1f393c2a70538a511c90d6a65ac6066a6e0
push id9727
push usergijskruitbosch@gmail.com
push dateWed, 20 Jan 2016 11:11:12 +0000
reviewersmiker
bugs1171903
milestone46.0a1
Bug 1171903 - Test for storage inspector endless scrolling. r=miker
devtools/client/storage/test/browser.ini
devtools/client/storage/test/browser_storage_overflow.js
devtools/client/storage/test/storage-overflow.html
--- a/devtools/client/storage/test/browser.ini
+++ b/devtools/client/storage/test/browser.ini
@@ -1,15 +1,17 @@
 [DEFAULT]
 tags = devtools
 subsuite = devtools
 support-files =
   storage-complex-values.html
   storage-listings.html
+  storage-overflow.html
   storage-secured-iframe.html
   storage-unsecured-iframe.html
   storage-updates.html
   head.js
 
 [browser_storage_basic.js]
 [browser_storage_dynamic_updates.js]
+[browser_storage_overflow.js]
 [browser_storage_sidebar.js]
 [browser_storage_values.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/storage/test/browser_storage_overflow.js
@@ -0,0 +1,41 @@
+// Test endless scrolling when a lot of items are present in the storage
+// inspector table.
+"use strict";
+
+add_task(function*() {
+  yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-overflow.html");
+
+  let $ = id => gPanelWindow.document.querySelector(id);
+  let $$ = sel => gPanelWindow.document.querySelectorAll(sel);
+
+  gUI.tree.expandAll();
+  yield selectTreeItem(["localStorage", "http://test1.example.org"]);
+
+  let table = $("#storage-table .table-widget-body");
+  let cellHeight = $(".table-widget-cell").getBoundingClientRect().height;
+
+  is($$("#value .table-widget-cell").length, 50,
+     "Table should initially display 50 items");
+
+  let onStoresUpdate = gUI.once("store-objects-updated");
+  table.scrollTop += cellHeight * 50;
+  yield onStoresUpdate;
+
+  is($$("#value .table-widget-cell").length, 100,
+     "Table should display 100 items after scrolling");
+
+  onStoresUpdate = gUI.once("store-objects-updated");
+  table.scrollTop += cellHeight * 50;
+  yield onStoresUpdate;
+
+  is($$("#value .table-widget-cell").length, 150,
+     "Table should display 150 items after scrolling");
+
+  onStoresUpdate = gUI.once("store-objects-updated");
+  table.scrollTop += cellHeight * 50;
+  yield onStoresUpdate;
+
+  is($$("#value .table-widget-cell").length, 200,
+     "Table should display all 200 items after scrolling");
+  yield finishTests();
+});
new file mode 100644
--- /dev/null
+++ b/devtools/client/storage/test/storage-overflow.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+Bug 1171903 - Storage Inspector endless scrolling
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Storage inspector endless scrolling test</title>
+</head>
+<body>
+<script type="text/javascript;version=1.8">
+"use strict";
+window.clear = () => {
+  localStorage.clear();
+};
+
+let array = new Array(200);
+
+for (let i = 0; i < array.length; i++) {
+  localStorage.setItem(`item-${i}`, `value-${i}`);
+}
+</script>
+</body>
+</html>