Added additional facet tests. Work in progress commented out as TODO
git-svn-id: http://google-refine.googlecode.com/svn/trunk@621 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
125039047e
commit
f7151cdbaa
@ -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")
|
||||
];
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -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));
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user