Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

FBTest for issue 5867

  • Loading branch information...
commit 6478c16dac2aff69f8a436009fb46f4b12f0534d 1 parent d07d337
@janodvarko janodvarko authored
View
25 tests/content/commandLine/api/dir.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <title>Test Case for command line</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+</head>
+<body>
+
+<h1>Command Line API: dir</h1>
+
+<p>This test-case is intended for <b>dir</b> method.
+<br/>
+<i>Jan Odvarko, odvarko@gmail.com</i>
+</p>
+
+<ol>
+<li>Open Firebug and enable the Console panel.</li>
+<li>Execute the following expression in the command line:<br/>
+<code style="color:green">dir({'a': {'b': {'c': 1}}});</code></li>
+<li>the console panel should display a log (one row) with variable a and value Object { b={...} }.</li>
+<li>Expand the object a, expand the object b, collapse b and collapse a. All should work as expected.</li>
+</ol>
+
+</body>
+</html>
View
97 tests/content/commandLine/api/dir.js
@@ -0,0 +1,97 @@
+function runTest()
+{
+ FBTest.sysout("console.dir.START");
+
+ FBTest.openNewTab(basePath + "console/api/dir.html", function(win)
+ {
+ FBTest.openFirebug();
+ FBTest.enableConsolePanel(function(win)
+ {
+ var tasks = new FBTest.TaskList();
+ tasks.push(test1, win);
+ tasks.push(test2, win);
+ tasks.run(function() {
+ FBTest.testDone("console.dir.DONE");
+ });
+ });
+ });
+}
+
+function test1(callback, win)
+{
+ var config = {tagName: "div", classes: "logRow logRow-dir"};
+ FBTest.waitForDisplayedElement("console", config, function(row)
+ {
+ var name = row.getElementsByClassName("memberLabelCell")[0];
+ var value = row.getElementsByClassName("memberValueCell")[0];
+
+ FBTest.compare("a", name.textContent, "The variable name must be: 'a'");
+ FBTest.compare("\"b\"", value.textContent, "The variable value must be: 'b'");
+
+ callback();
+ });
+
+ // Execute test 1 implemented on the page.
+ FBTest.executeCommand("dir({'a': 'b'});");
+}
+
+function test2(callback, win)
+{
+ var config = {tagName: "div", classes: "logRow logRow-dir"};
+ FBTest.waitForDisplayedElement("console", config, function(row)
+ {
+ var domTable = row.getElementsByClassName("domTable")[0];
+
+ FBTest.compare(2, domTable.rows.length, "There should be 1 row (excluding header)");
+
+ // Expand object 'a'.
+ var labelA = domTable.getElementsByClassName("memberLabel")[0];
+ expandMembers(labelA, function(rowA)
+ {
+ FBTest.compare(3, domTable.rows.length, "There should be 2 rows (excluding header)");
+
+ // Expand object 'b'.
+ var labelB = domTable.getElementsByClassName("memberLabel")[1];
+ expandMembers(labelB, function(rowB)
+ {
+ FBTest.compare(4, domTable.rows.length, "There should be 3 rows (excluding header)");
+
+ // Close object 'b';
+ collapseMembers(labelB, function()
+ {
+ FBTest.compare(3, domTable.rows.length, "There should be 2 rows (excluding header)");
+
+ // Close object 'a';
+ collapseMembers(labelA, function()
+ {
+ FBTest.compare(2, domTable.rows.length, "There should be 1 rows (excluding header)");
+
+ callback();
+ });
+ });
+ });
+ });
+ });
+
+ // Execute test 1 implemented on the page.
+ FBTest.executeCommand("dir({'a': {'b': {'c': 1}}})");
+}
+
+// xxxHonza: how to avoid following timeouts?
+function expandMembers(node, callback)
+{
+ setTimeout(function()
+ {
+ callback();
+ }, 200);
+ FBTest.click(node);
+}
+
+function collapseMembers(node, callback)
+{
+ setTimeout(function()
+ {
+ callback();
+ }, 200);
+ FBTest.click(node);
+}
View
1  tests/content/firebug.html
@@ -155,6 +155,7 @@
{group: "commandLine/api", uri: "commandLine/api/monitorEvents.js", desc: "Verify command line monitorEvents API.", testPage: "commandLine/api/monitorEvents.html" },
{group: "commandLine/api", uri: "commandLine/api/profile.js", desc: "Verify command line profile & profileEnd API.", testPage: "commandLine/api/profile.html" },
{group: "commandLine/api", uri: "commandLine/api/help.js", desc: "Verify command line help API", testPage: "commandLine/api/help.html"},
+ {group: "commandLine/api", uri: "commandLine/api/dir.js", desc: "Verify command line dir API.", testPage: "commandLine/api/dir.html" },
{group: "commandLine", uri: "commandLine/dom.js", desc: "Verify command line DOM access.", testPage: "commandLine/dom.html" },
{group: "commandLine", uri: "commandLine/objects.js", desc: "Page objects used on the command line", testPage: "commandLine/objects.html"},
{group: "commandLine", uri: "commandLine/2934/issue2934.js", desc: "1.6a7 console and auto-complete (needs 'window.' prefix)", testPage: "commandLine/2934/issue2934.html" },

0 comments on commit 6478c16

Please sign in to comment.
Something went wrong with that request. Please try again.