3 new revisions:

Revision: 291259a35c72
Branch:   default
Author:   Pekka Klärck
Date:     Tue Feb  4 14:19:36 2014 UTC
Log:      report/util.js: Smallish enhancements to Matcher.
http://code.google.com/p/robotframework/source/detail?r=291259a35c72

Revision: 49e1887c5981
Branch:   default
Author:   Pekka Klärck
Date:     Wed Feb  5 13:03:09 2014 UTC
Log:      missing ;
http://code.google.com/p/robotframework/source/detail?r=49e1887c5981

Revision: 921d89c1b685
Branch:   default
Author:   Pekka Klärck
Date:     Wed Feb  5 13:17:55 2014 UTC
Log:      report: Generic search by suite and tests names and tags...
http://code.google.com/p/robotframework/source/detail?r=921d89c1b685

==============================================================================
Revision: 291259a35c72
Branch:   default
Author:   Pekka Klärck
Date:     Tue Feb  4 14:19:36 2014 UTC
Log:      report/util.js: Smallish enhancements to Matcher.
http://code.google.com/p/robotframework/source/detail?r=291259a35c72

Modified:
 /src/robot/htmldata/rebot/model.js
 /src/robot/htmldata/rebot/util.js
 /utest/webcontent/spec/ContainsTag.js

=======================================
--- /src/robot/htmldata/rebot/model.js  Fri Jan 24 11:08:45 2014 UTC
+++ /src/robot/htmldata/rebot/model.js  Tue Feb  4 14:19:36 2014 UTC
@@ -72,8 +72,7 @@
                 return containsTagPattern(testTags, p);
             }));
         }
-        testTags = util.map(testTags, util.normalize);
-        return util.any(util.map(testTags, util.Matcher(pattern).matches));
+        return util.Matcher(pattern).matchesAny(testTags);
     }

     function findSuiteByName(suite, name) {
=======================================
--- /src/robot/htmldata/rebot/util.js   Fri Jan 31 11:48:06 2014 UTC
+++ /src/robot/htmldata/rebot/util.js   Tue Feb  4 14:19:36 2014 UTC
@@ -65,8 +65,17 @@
         pattern = regexpEscape(normalize(pattern));
var rePattern = '^' + pattern.replace(/\\\?/g, ".").replace(/\\\*/g, ".*") + '$';
         var regexp = new RegExp(rePattern);
+        function matches(string) {
+            return regexp.test(normalize(string));
+        }
         return {
-            matches: function (string) { return regexp.test(string); }
+            matches: matches,
+            matchesAny: function (strings) {
+                for (var i = 0, len = strings.length; i < len; i++)
+                    if (matches(strings[i]))
+                        return true;
+                return false;
+            }
         }
     }

=======================================
--- /utest/webcontent/spec/ContainsTag.js       Mon Jan 27 12:25:28 2014 UTC
+++ /utest/webcontent/spec/ContainsTag.js       Tue Feb  4 14:19:36 2014 UTC
@@ -7,13 +7,30 @@
         expect(model.containsTag(['x', 'y'], 'notthere')).not.toBeTruthy();
     });

-    it("should find tags case and space insensitively", function() {
+    it("should find tags case insensitively", function() {
         expect(model.containsTag(['name'], 'Name')).toBeTruthy();
-        expect(model.containsTag(['NaMe'], 'name')).toBeTruthy();
+        expect(model.containsTag(['NaMe'], 'namE')).toBeTruthy();
+    });
+
+    it("should find tags space insensitively", function() {
         expect(model.containsTag(['xx', 'yy', 'zz'], 'y y')).toBeTruthy();
expect(model.containsTag(['x x', 'y y', 'z z'], 'XX')).toBeTruthy();
     });

+    it("should find tags underscore insensitively", function() {
+ expect(model.containsTagPattern(['a_a_1', 'x'], 'a_a_*')).toBeTruthy(); + expect(model.containsTagPattern(['a_a_1', 'x'], 'a a *')).toBeTruthy(); + expect(model.containsTagPattern(['a a 1', 'x'], '_a__a__*_')).toBeTruthy();
+    });
+
+    it("should find tags with patterns * and ?", function() {
+        expect(model.containsTagPattern(['x', 'y'], 'x*')).toBeTruthy();
+        expect(model.containsTagPattern(['xxxyyy'], 'x*')).toBeTruthy();
+        expect(model.containsTagPattern(['xyz'], 'x?z')).toBeTruthy();
+        expect(model.containsTagPattern(['-x-'], '*x*')).toBeTruthy();
+        expect(model.containsTagPattern(['x', 'y'], 'x')).toBeTruthy();
+    });
+
     it("should find tags combined with AND", function() {
         expect(model.containsTagPattern(['x', 'y'], 'xANDy')).toBeTruthy();
expect(model.containsTagPattern(['xx', 'Yy', 'ZZ'], 'Y Y AND X X AND zz')).toBeTruthy();
@@ -71,30 +88,15 @@
expect(model.containsTagPattern(['x', 'y'], 'x OR a NOT y')).not.toBeTruthy();
     });

-    it("should ignore underscore in patterns and tag names", function() {
- expect(model.containsTagPattern(['a_a_1', 'x'], '* NOT a_a_*')).not.toBeTruthy(); - expect(model.containsTagPattern(['a_a_1', 'x'], '* NOT a a *')).not.toBeTruthy(); - expect(model.containsTagPattern(['a a 1', 'x'], '* NOT a_a_*')).not.toBeTruthy(); - expect(model.containsTagPattern(['a a 1', 'x'], '* NOT a a *')).not.toBeTruthy();
-    });
-
-    it("should find tags combined with patterns (* and ?)", function() {
-        expect(model.containsTagPattern(['x', 'y'], 'x*')).toBeTruthy();
-        expect(model.containsTagPattern(['xxxyyy'], 'x*')).toBeTruthy();
-        expect(model.containsTagPattern(['xyz'], 'x?z')).toBeTruthy();
-        expect(model.containsTagPattern(['-x-'], '*x*')).toBeTruthy();
-        expect(model.containsTagPattern(['x', 'y'], 'x')).toBeTruthy();
-    });
-
it("should find tags combined with patterns and AND and NOT", function() { expect(model.containsTagPattern(['xx', 'yy'], 'x* AND y?')).toBeTruthy(); - expect(model.containsTagPattern(['xxxyyy'], 'x* NOT y')).toBeTruthy(); + expect(model.containsTagPattern(['xxxyyy'], 'x* NOT y*')).toBeTruthy(); expect(model.containsTagPattern(['xxxyyy'], 'x* NOT *y')).not.toBeTruthy(); expect(model.containsTagPattern(['xx', 'yy'], '* NOT x? NOT ?y')).not.toBeTruthy();
     });

-    it("should esacpe regex metacharacters in patterns", function() {
+    it("should escape regex meta characters in patterns", function() {
         expect(model.containsTagPattern(['xyz'], 'x.*')).not.toBeTruthy();
-        expect(model.containsTagPattern(['x.z'], 'x.*')).toBeTruthy();
+        expect(model.containsTagPattern(['+.z'], '+.?')).toBeTruthy();
     });
 });

==============================================================================
Revision: 49e1887c5981
Branch:   default
Author:   Pekka Klärck
Date:     Wed Feb  5 13:03:09 2014 UTC
Log:      missing ;
http://code.google.com/p/robotframework/source/detail?r=49e1887c5981

Modified:
 /src/robot/htmldata/rebot/util.js

=======================================
--- /src/robot/htmldata/rebot/util.js   Tue Feb  4 14:19:36 2014 UTC
+++ /src/robot/htmldata/rebot/util.js   Wed Feb  5 13:03:09 2014 UTC
@@ -76,7 +76,7 @@
                         return true;
                 return false;
             }
-        }
+        };
     }

     function formatParentName(item) {

==============================================================================
Revision: 921d89c1b685
Branch:   default
Author:   Pekka Klärck
Date:     Wed Feb  5 13:17:55 2014 UTC
Log:      report: Generic search by suite and tests names and tags

Update issue 1634
Implemented generic search in new Search tab. It suppors searching by suite and test names and tags same way as --suite, --test, --include and --exclude work from the command line.

TODO:
- Fix handing " in values (w/o breaking handling <>&).
- Add help.
- Support searching by URL.
- Remove earlier tag search functionality.
http://code.google.com/p/robotframework/source/detail?r=921d89c1b685

Modified:
 /src/robot/htmldata/rebot/model.js
 /src/robot/htmldata/rebot/report.css
 /src/robot/htmldata/rebot/report.html

=======================================
--- /src/robot/htmldata/rebot/model.js  Tue Feb  4 14:19:36 2014 UTC
+++ /src/robot/htmldata/rebot/model.js  Wed Feb  5 13:17:55 2014 UTC
@@ -23,6 +23,17 @@
                 tests = tests.concat(suites[i].searchTests(predicate));
             return tests.concat(util.filter(this.tests(), predicate));
         };
+        suite.searchTestsInSuite = function (pattern, matcher) {
+            if (!matcher)
+                matcher = util.Matcher(pattern);
+            if (matcher.matchesAny([suite.fullName, suite.name]))
+                return suite.allTests();
+            var tests = [];
+            var suites = this.suites();
+            for (var i in suites)
+ tests = tests.concat(suites[i].searchTestsInSuite(pattern, matcher));
+            return tests;
+        }
         suite.searchTestsByTag = function (tag) {
             return suite.searchTests(function (test) {
                 if (tag.combined)
@@ -119,6 +130,9 @@
         test.isCritical = data.isCritical;
         test.tags = data.tags;
         test.message = data.message;
+        test.matchesTagPattern = function (pattern) {
+            return containsTagPattern(test.tags, pattern);
+        }
         return test;
     }

=======================================
--- /src/robot/htmldata/rebot/report.css        Fri Jan 31 15:36:07 2014 UTC
+++ /src/robot/htmldata/rebot/report.css        Wed Feb  5 13:17:55 2014 UTC
@@ -42,6 +42,9 @@
 #search td, #search th {
     padding: 0 0.4em 0.4em 0.4em;
 }
+#search-suite, #search-test, #search-include, #search-exclude {
+    width: 20em;
+}
 #search a:hover {
     text-decoration: none;
 }
=======================================
--- /src/robot/htmldata/rebot/report.html       Fri Jan 31 15:23:55 2014 UTC
+++ /src/robot/htmldata/rebot/report.html       Wed Feb  5 13:17:55 2014 UTC
@@ -115,6 +115,7 @@
     var action = {'totals': showTotalSelector,
                   'tags':   showTagSelector,
                   'suites': showSuiteSelector,
+                  'search': showSearchSelector,
                   'total':  totalDetailSelected,
                   'tag':    tagDetailSelected,
                   'suite':  suiteDetailSelected}[key];
@@ -136,6 +137,11 @@
     renderSuiteSelector();
     scrollToSelector('suites');
 }
+
+function showSearchSelector() {
+    renderSearchSelector();
+    scrollToSelector('search');
+}

 function totalDetailSelected(name) {
     if (!name) return;
@@ -196,9 +202,7 @@
     tag.totalTime = calculateTotalTime(tests);
     if (tag.info == 'search') {
         tag.total = tests.length;
-        tag.pass = util.filter(tests, function (test) {
-            return test.status == 'PASS';
-        }).length;
+        tag.pass = calculatePassed(tests);
         tag.fail = tag.total - tag.pass;
     }
     $.tmpl('tagOrTotalDetailsTemplate', tag).appendTo('#details-header');
@@ -229,6 +233,49 @@
         updatePrintSelector(suite.fullName);
     });
 }
+
+function searchExecuted(suite, test, include, exclude) {
+    if (!(suite || test || include || exclude))
+        return;
+    renderSearchSelector(suite, test, include, exclude);
+    renderSearchDetails(suite, test, include, exclude);
+ scrollToSelector('search_' + suite + '::' + test + '::' + include + '::' + exclude);
+}
+
+function renderSearchSelector(suite, test, include, exclude) {
+    var args = {linkTarget: (suite || test || include || exclude) ?
+ ('search_' + suite + '::' + test + '::' + include + '::' + exclude) :
+                            'search',
+                searchTabStatus: 'detail-tab-selected'};
+ var search = {suite: suite, test: test, include: include, exclude: exclude};
+    renderSelector(args, 'searchSelectorTemplate', search);
+}
+
+function renderSearchDetails(suite, test, include, exclude) {
+    var tests = searchTests(suite, test, include, exclude);
+    var passed = calculatePassed(tests);
+    var stats = {total: tests.length,
+                 pass: passed,
+                 fail: tests.length - passed,
+                 totalTime: calculateTotalTime(tests)};
+    $.tmpl('tagOrTotalDetailsTemplate', stats).appendTo('#details-header');
+    drawTestDetailsTable(tests, true);
+}
+
+function searchTests(suitePattern, testPattern, includePattern, excludePattern) {
+    var tests;
+    if (suitePattern)
+        tests = window.testdata.suite().searchTestsInSuite(suitePattern);
+    else
+        tests = window.testdata.suite().allTests();
+    return util.filter(tests, function (test) {
+        if (testPattern && !util.Matcher(testPattern).matches(test.name))
+            return false;
+        if (includePattern && !test.matchesTagPattern(includePattern))
+            return false;
+        return !(excludePattern && test.matchesTagPattern(excludePattern));
+    });
+}

 function scrollToSelector(anchor) {
     $('#test-details-container').css('min-height', $(window).height());
@@ -283,6 +330,13 @@
         total += tests[i].times.elapsedMillis;
     return util.formatElapsed(total);
 }
+
+function calculatePassed(tests) {
+    var passed = util.filter(tests, function (test) {
+        return test.status == 'PASS';
+    });
+    return passed.length;
+}

 function renderTestDetails(sortByStatus, target) {
     if (!window.elementsToRender.length)
@@ -446,6 +500,9 @@
     <li class="${suiteTabStatus} detail-tab">
       <a href="#suites" onclick="renderSuiteSelector()">Suites</a>
     </li>
+    <li class="${searchTabStatus} detail-tab">
+      <a href="#search" onclick="renderSearchSelector()">Search</a>
+    </li>
   </ul>
 </script>

@@ -576,6 +633,55 @@
   </table>
 </script>

+<script  type="text/x-jquery-tmpl" id="searchSelectorTemplate">
+  <form>
+    <table class="details" id="details-header">
+      <tr>
+        <th><label for="search-suite">Suite:</label></th>
+        <td>
+          <input id="search-suite" type="text" value="{{html suite}}">
+        </td>
+      </tr>
+      <tr>
+        <th><label for="search-test">Test:</label></th>
+        <td>
+          <input id="search-test" type="text" value="{{html test}}">
+        </td>
+      </tr>
+      <tr>
+        <th><label for="search-include">Include:</label></th>
+        <td>
+          <input id="search-include" type="text" value="{{html include}}">
+        </td>
+      </tr>
+      <tr>
+        <th><label for="search-exclude">Exclude:</label></th>
+        <td>
+          <input id="search-exclude" type="text" value="{{html exclude}}">
+        </td>
+      </tr>
+      <tr>
+        <th></th>
+        <td>
+          <input type="submit" value="Search"
+ onclick="searchExecuted(util.escape($('#search-suite').val()), + util.escape($('#search-test').val()), + util.escape($('#search-include').val()), + util.escape($('#search-exclude').val()));
+                          return false">
+          <input type="button" value="Clear"
+                 onclick="$('#search-suite').val('');
+                          $('#search-test').val('');
+                          $('#search-include').val('');
+                          $('#search-exclude').val('')">
+          <a href="javascript:void(0)" onclick="$('#search-help').toggle()"
+             title="Toggle search pattern help.">Help</a>
+        </td>
+      </tr>
+    </table>
+  </form>
+</script>
+
 <script type="text/x-jquery-tmpl" id="tagOrTotalDetailsTemplate">
   <tr>
     <th>Status:</th>

--

--- You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to