Title: [122880] trunk/LayoutTests
Revision
122880
Author
[email protected]
Date
2012-07-17 15:22:12 -0700 (Tue, 17 Jul 2012)

Log Message

A couple of UI nits about the flagging feature in results.html
https://bugs.webkit.org/show_bug.cgi?id=86798

Reviewed by Dirk Pranke.

-Clicking the flag unflags it now
-There's a flag all link for each test list
-Make the flag list always show up at the bottom of the viewport
when there are flagged tests. This makes it both less annoying
and easier to understand what's going on when you flag a test.
This required wrapping all the content in a div so that we could
make the body be a flexbox.
* fast/harness/resources/results-test.js:
(runSingleRowTest):
* fast/harness/results.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (122879 => 122880)


--- trunk/LayoutTests/ChangeLog	2012-07-17 22:16:51 UTC (rev 122879)
+++ trunk/LayoutTests/ChangeLog	2012-07-17 22:22:12 UTC (rev 122880)
@@ -1,3 +1,21 @@
+2012-07-17  Ojan Vafai  <[email protected]>
+
+        A couple of UI nits about the flagging feature in results.html
+        https://bugs.webkit.org/show_bug.cgi?id=86798
+
+        Reviewed by Dirk Pranke.
+
+        -Clicking the flag unflags it now
+        -There's a flag all link for each test list
+        -Make the flag list always show up at the bottom of the viewport
+        when there are flagged tests. This makes it both less annoying
+        and easier to understand what's going on when you flag a test.
+        This required wrapping all the content in a div so that we could
+        make the body be a flexbox.
+        * fast/harness/resources/results-test.js:
+        (runSingleRowTest):
+        * fast/harness/results.html:
+
 2012-07-17  Bruno de Oliveira Abinader  <[email protected]>
 
         [Qt] fast/forms tests needs update after rebaseline and new testfonts

Modified: trunk/LayoutTests/fast/harness/resources/results-test.js (122879 => 122880)


--- trunk/LayoutTests/fast/harness/resources/results-test.js	2012-07-17 22:16:51 UTC (rev 122879)
+++ trunk/LayoutTests/fast/harness/resources/results-test.js	2012-07-17 22:22:12 UTC (rev 122880)
@@ -105,7 +105,7 @@
         else
             assertTrue(document.querySelector('tbody').className.indexOf('expected') == -1);
 
-        assertTrue(document.querySelector('tbody td:nth-child(1)').textContent == '+' + test);
+        assertTrue(document.querySelector('tbody td:nth-child(1)').textContent == '+' + test + ' \u2691');
         assertTrue(document.querySelector('tbody td:nth-child(2)').textContent == textResults);
         assertTrue(document.querySelector('tbody td:nth-child(3)').textContent == imageResults);
         assertTrue(document.querySelector('tbody td:nth-child(4)').textContent == actual);
@@ -684,22 +684,22 @@
     subtree['bar-missing.html'].is_missing_text = true;
     runTest(results, function() {
         var titles = document.getElementsByTagName('h1');
-        assertTrue(titles[0].textContent == 'Tests that crashed (1):');
-        assertTrue(titles[1].textContent == 'Tests that failed text/pixel/audio diff (3):');
-        assertTrue(titles[2].textContent == 'Tests that had no expected results (probably new) (1):');
-        assertTrue(titles[3].textContent == 'Tests that timed out (0):');
-        assertTrue(titles[4].textContent == 'Tests that had stderr output (1):');
-        assertTrue(titles[5].textContent == 'Tests expected to fail but passed (1):');
+        assertTrue(titles[0].textContent == 'Tests that crashed (1): flag all');
+        assertTrue(titles[1].textContent == 'Tests that failed text/pixel/audio diff (3): flag all');
+        assertTrue(titles[2].textContent == 'Tests that had no expected results (probably new) (1): flag all');
+        assertTrue(titles[3].textContent == 'Tests that timed out (0): flag all');
+        assertTrue(titles[4].textContent == 'Tests that had stderr output (1): flag all');
+        assertTrue(titles[5].textContent == 'Tests expected to fail but passed (1): flag all');
 
         document.getElementById('unexpected-results').checked = false;
         document.getElementById('unexpected-results').onchange();
 
-        assertTrue(titles[0].textContent == 'Tests that crashed (2):');
-        assertTrue(titles[1].textContent == 'Tests that failed text/pixel/audio diff (5):');
-        assertTrue(titles[2].textContent == 'Tests that had no expected results (probably new) (1):');
-        assertTrue(titles[3].textContent == 'Tests that timed out (1):');
-        assertTrue(titles[4].textContent == 'Tests that had stderr output (1):');
-        assertTrue(titles[5].textContent == 'Tests expected to fail but passed (1):');
+        assertTrue(titles[0].textContent == 'Tests that crashed (2): flag all');
+        assertTrue(titles[1].textContent == 'Tests that failed text/pixel/audio diff (5): flag all');
+        assertTrue(titles[2].textContent == 'Tests that had no expected results (probably new) (1): flag all');
+        assertTrue(titles[3].textContent == 'Tests that timed out (1): flag all');
+        assertTrue(titles[4].textContent == 'Tests that had stderr output (1): flag all');
+        assertTrue(titles[5].textContent == 'Tests expected to fail but passed (1): flag all');
     });
 
     results = mockResults();
@@ -710,13 +710,34 @@
     subtree['bar-3.html'] = mockExpectation('PASS TEXT', 'TEXT PASS');
     runTest(results, function() {
         var titles = document.getElementsByTagName('h1');
-        assertTrue(titles[0].textContent == 'Tests that failed text/pixel/audio diff (1):');
-        assertTrue(titles[1].textContent =='Flaky tests (failed the first run and passed on retry) (1):');
+        assertTrue(titles[0].textContent == 'Tests that failed text/pixel/audio diff (1): flag all');
+        assertTrue(titles[1].textContent =='Flaky tests (failed the first run and passed on retry) (1): flag all');
 
         assertTrue(document.querySelectorAll('#results-table tbody').length == 2);
         assertTrue(document.querySelectorAll('#flaky-tests-table tbody').length == 2);
     });
 
+    results = mockResults();
+    var subtree = results.tests['foo'] = {}
+    subtree['bar.html'] = mockExpectation('TEXT', 'IMAGE');
+    subtree['bar1.html'] = mockExpectation('TEXT', 'TEXT');
+    subtree['bar2.html'] = mockExpectation('TEXT', 'TEXT');
+    runTest(results, function() {
+        var flaggedTestsTextbox = document.getElementById('flagged-tests');
+
+        flagAll(document.querySelector('.flag-all'));
+        assertTrue(flaggedTestsTextbox.innerText == 'foo/bar.html');
+
+        document.getElementById('unexpected-results').checked = false;
+        document.getElementById('unexpected-results').onchange();
+
+        flagAll(document.querySelector('.flag-all'));
+        assertTrue(flaggedTestsTextbox.innerText == 'foo/bar.html\nfoo/bar1.html\nfoo/bar2.html');
+
+        unflag(document.querySelector('.flag'));
+        assertTrue(flaggedTestsTextbox.innerText == 'foo/bar1.html\nfoo/bar2.html');
+    });
+
     document.body.innerHTML = '<pre>' + g_log.join('\n') + '</pre>';
 }
 

Modified: trunk/LayoutTests/fast/harness/results-expected.txt (122879 => 122880)


--- trunk/LayoutTests/fast/harness/results-expected.txt	2012-07-17 22:16:51 UTC (rev 122879)
+++ trunk/LayoutTests/fast/harness/results-expected.txt	2012-07-17 22:22:12 UTC (rev 122880)
@@ -221,3 +221,6 @@
 TEST-38: PASS
 TEST-38: PASS
 TEST-38: PASS
+TEST-39: PASS
+TEST-39: PASS
+TEST-39: PASS

Modified: trunk/LayoutTests/fast/harness/results.html (122879 => 122880)


--- trunk/LayoutTests/fast/harness/results.html	2012-07-17 22:16:51 UTC (rev 122879)
+++ trunk/LayoutTests/fast/harness/results.html	2012-07-17 22:22:12 UTC (rev 122880)
@@ -1,13 +1,20 @@
 <!DOCTYPE html>
 <style>
+html {
+    height: 100%;
+}
 body {
-    margin: 4px;
+    margin: 0;
     font-family: Helvetica, sans-serif;
     font-size: 11pt;
+    display: -webkit-flex;
+    -webkit-flex-direction: column;
+    height: 100%;
 }
 
-body > p:first-of-type {
-    margin-top: 0;
+body > * {
+    margin-left: 4px;
+    margin-top: 4px;
 }
 
 h1 {
@@ -44,6 +51,12 @@
     -moz-user-select: none;
 }
 
+.content-container {
+    -webkit-flex: 1;
+    min-height: 0;
+    overflow: auto;
+}
+
 .note {
     color: gray;
     font-size: smaller;
@@ -98,10 +111,14 @@
     left: 1px;
 }
 
-.test-link.flagged:after {
-    content: ' \2691';
+tbody .flag {
+    display: none;
 }
 
+tbody.flagged .flag {
+    display: inline;
+}
+
 .stopped-running-early-message {
     border: 3px solid #d00;
     font-weight: bold;
@@ -193,6 +210,7 @@
 
 #flagged-tests {
     padding: 5px;
+    height: 100px;
 }
 </style>
 <style id="unexpected-style"></style>
@@ -253,8 +271,6 @@
     return null;
 }
 
-
-
 function remove(node)
 {
     node.parentNode.removeChild(node);
@@ -388,6 +404,14 @@
     setTimeout(function() { func.apply(null, args); }, 100);
 }
 
+function visibleTests(container)
+{
+    if (onlyShowUnexpectedFailures())
+        return container.querySelectorAll('tbody:not(.expected)');
+    else
+        return container.querySelectorAll('tbody');
+}
+
 function visibleExpandLinks()
 {
     if (onlyShowUnexpectedFailures())
@@ -428,9 +452,16 @@
     return '<a class=test-link href="" + basePath + test + '">' + test + '</a>';
 }
 
+function unflag(flag)
+{
+    var shouldFlag = false;
+    TestNavigator.flagTest(parentOfType(flag, 'tbody'), shouldFlag);
+}
+
 function testLinkWithExpandButton(test)
 {
-    return '<span class=expand-button _onclick_="toggleExpectations(this)"><span class=expand-button-text>+</span></span>' + testLink(test);
+    return '<span class=expand-button _onclick_="toggleExpectations(this)"><span class=expand-button-text>+</span></span>' + testLink(test) +
+        '<span class=flag _onclick_="unflag(this)"> \u2691</span>';
 }
 
 function resultLink(testPrefix, suffix, contents)
@@ -643,9 +674,18 @@
     })
 }
 
+function flagAll(headerLink)
+{
+    var tests = visibleTests(parentOfType(headerLink, 'div'));
+    forEach(tests, function(tests) {
+        var shouldFlag = true;
+        TestNavigator.flagTest(tests, shouldFlag);
+    })
+}
+
 function testListHeaderHtml(header)
 {
-    return '<h1>' + header + ' (<span class=test-list-count></span>):</h1>';
+    return '<h1>' + header + ' (<span class=test-list-count></span>): <a href="" class=flag-all _onclick_="flagAll(this)">flag all</a></h1>';
 }
 
 function testList(tests, header, tableId)
@@ -1007,15 +1047,21 @@
 
 TestNavigator._toggleCurrentTestFlagged = function()
 {
-    var testLink = parentOfType(TestNavigator._currentTestLink(), 'tbody').querySelector('.test-link');
-    var testName = testLink.innerText;
+    var testLink = parentOfType(TestNavigator._currentTestLink(), 'tbody');
+    TestNavigator.flagTest(testLink, !testLink.classList.contains('flagged'));
+}
+
+// FIXME: Test navigator shouldn't know anything about flagging. It should probably call out to TestFlagger or something.
+TestNavigator.flagTest = function(testTbody, shouldFlag)
+{
+    var testName = testTbody.querySelector('.test-link').innerText;
     
-    if (testLink.classList.contains('flagged')) {
-        testLink.classList.remove('flagged');
+    if (shouldFlag) {
+        testTbody.classList.add('flagged');
+        TestNavigator.flaggedTests[testName] = 1;
+    } else {
+        testTbody.classList.remove('flagged');
         delete TestNavigator.flaggedTests[testName];
-    } else {
-        testLink.classList.add('flagged');
-        TestNavigator.flaggedTests[testName] = 1;
     }
 
     TestNavigator.updateFlaggedTests();
@@ -1258,7 +1304,7 @@
 {
     forEachTest(processGlobalStateFor);
 
-    var html = '<div id=toolbar>' +
+    var html = '<div class=content-container><div id=toolbar>' +
         '<div class="note">Use the i, j, k and l keys to navigate, e, c to expand and collapse, and f to flag</div>' +
         '<a href="" _onclick_="expandAllExpectations()">expand all</a> ' +
         '<a href="" _onclick_="collapseAllExpectations()">collapse all</a> ' +
@@ -1298,7 +1344,7 @@
             '<p>httpd error log: <a href=""
     }
 
-    document.body.innerHTML = html;
+    document.body.innerHTML = html + '</div>';
 
     if (document.getElementById('results-table')) {
         document.getElementById('results-table').addEventListener('click', TableSorter.handleClick, false);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to