diff --git a/tests/windmill/js/facets.js b/tests/windmill/js/facets.js index f22a8fd40..6c0d85e34 100644 --- a/tests/windmill/js/facets.js +++ b/tests/windmill/js/facets.js @@ -7,30 +7,53 @@ var test_facets = new function() { assert("gw_row_count", "7413" ) ]; - // create text facet from 1st word of Short Description - this.test_facet_creation = [ + // create text facet from 1st word of Short Description column + this.test_create_text_facet = [ action('click', { jquery: '(".column-header-layout tr:contains(\'Shrt_Desc\') .column-header-menu")[0]' } ), action('mouseOver', { jquery: '("td:contains(\'Facet\')")[0]' } ), action("gw_wait4menuitem", { name: 'Custom Text Facet' } ), action("click", { jquery: '(".menu-item:contains(\'Custom Text Facet\')")[0]' } ), action("type", { jquery: '(".expression-preview-code")[0]', text: "value.split(',')[0]" } ), action("waits.forElement", { jquery: '("td:contains(\'value.split\')")[0]' } ), - action("click", { jquery: '("button:contains(\'OK\')")[0]' } ) - ]; - - // test created facet - this.test_created_facet = [ - action("waits.forElement", { jquery: '(".ui-button-text:contains(\'count\')")[0]' } ), + action("click", { jquery: '("button:contains(\'OK\')")[0]' } ), + action("gw_wait4ajaxend"), //doesn't help yet, since ajax_in_progress isn't yet reliable + action("waits.forElement", { jquery: '("a.facet-choice-label")[0]' } ), assert("gw_expected_top_value","ABALONE") ]; - + // sort the facet by count and test the result - this.test_sorted_facet = [ + this.test_sort_text_facet = [ action("click", { jquery: '(".ui-button-text:contains(\'count\')")[0]' } ), - action("waits.forElement", { jquery: '(".ui-state-active .ui-button-text:contains(\'count\')")[0]' } ), + action("waits.forElement", { jquery: '(".ui-state-active .ui-button-text:contains(\'count\')")[0]' } ), //wait til count is the active sort assert("gw_expected_top_value","BEEF") ]; - + + // filter down to BEEF + this.test_fitler_text_facet = [ + action("click", { jquery: '("a.facet-choice-label")[0]' } )//, + //TODO: gw_row_count fails with 'undefined' + //assert("gw_row_count", "457") + ]; + + // create numeric filter from Water column + this.test_create_numeric_facet = [ + action("click", { jquery: '(".column-header-layout tr:contains(\'Water\') .column-header-menu")[0]' } ), + action('mouseOver', { jquery: '("td:contains(\'Facet\')")[0]' } ), + action("gw_wait4menuitem", { name: 'Numeric Facet' } ), + action("click", { jquery: '(".menu-item:contains(\'Numeric Facet\')")[0]' } )//, + //TODO: (How) can I run a JSUnit assert w/in an object? + //function () { jum.assertTrue( $(".facet-panel span:contains(\'Water\')").length ); } + ]; + +/* + // filter out BEEF with lower water content + this.test_filter_numeric_facet = [ + //TODO: dragDropElem fails with 'undefined'. Maybe because of two params? + //action("dragDropElem", { jquery: '((".slider-widget-draggable.left"))[0]', pixels: '150, 0' } )//, + assert("gw_row_count", "153") + ]; +*/ + }; diff --git a/tests/windmill/js/initialize.js b/tests/windmill/js/initialize.js index 8a1d36bae..a3ee2d214 100644 --- a/tests/windmill/js/initialize.js +++ b/tests/windmill/js/initialize.js @@ -3,7 +3,8 @@ var actions = windmill.jsTest.actions; -function action(what,params) { +function action(what,params) { +params = params || {}; return { method : what, params : params @@ -32,10 +33,13 @@ function assert(what,params) { } asserts.gw_row_count = function (count) { + action("waits.forElement", { jquery: '(".viewPanel-summary-row-count")[0]' } ); asserts.assertText( { jquery: '(".viewPanel-summary-row-count")[0]', validator: count } ); }; asserts.gw_expected_top_value = function (expected_value) { + // action("waits.forElement", { jquery: '("a.facet-choice-label")[0]' } ); // doesn't work bc waits can't go inside functions + //TODO: is there a way to make the assert wait first, rather than putting this before each call of the assert?, asserts.assertEquals(expected_value, $.trim($("a.facet-choice-label")[0].text)); };