2010-05-06 03:05:48 +02:00
|
|
|
var test_facets = new function() {
|
|
|
|
|
2011-10-07 21:25:15 +02:00
|
|
|
// TODO: if I'm in a project, go back to main page (useful when working on this test)
|
2010-05-11 02:45:05 +02:00
|
|
|
//if () {
|
2011-10-07 21:25:15 +02:00
|
|
|
//go back
|
2010-05-11 02:45:05 +02:00
|
|
|
//};
|
2011-10-07 21:25:15 +02:00
|
|
|
|
2010-05-11 19:17:34 +02:00
|
|
|
// test opening Food project
|
|
|
|
test = newTest();
|
2012-01-27 17:26:42 +01:00
|
|
|
assert (test, "assertText", { id:"slogan", validator: "A power tool for working with messy data." });
|
2010-05-11 19:17:34 +02:00
|
|
|
this.test_home_page = test;
|
|
|
|
|
|
|
|
// make sure the dataset was loaded properly
|
|
|
|
test = newTest();
|
|
|
|
action (test, "click", { link: "Food" });
|
|
|
|
wait (test, "forPageLoad", { timeout: "20000" });
|
2012-01-27 17:26:42 +01:00
|
|
|
assert (test, "assertTest", {xpath: "//div[@id='summary-bar']/span",validator: "7413 rows"});
|
2010-05-11 19:17:34 +02:00
|
|
|
this.test_open_project = test;
|
2010-05-06 03:05:48 +02:00
|
|
|
|
2010-05-08 03:06:36 +02:00
|
|
|
// create text facet from 1st word of Short Description column
|
2010-05-11 19:17:34 +02:00
|
|
|
test = newTest();
|
|
|
|
action (test, 'click', { jquery: '(".column-header-layout tr:contains(\'Shrt_Desc\') .column-header-menu")[0]' });
|
|
|
|
action (test, 'mouseOver', { jquery: '("td:contains(\'Facet\')")[0]' });
|
|
|
|
wait (test, "forMenuItem", { name: 'Custom Text Facet' });
|
|
|
|
action (test, "click", { jquery: '(".menu-item:contains(\'Custom Text Facet\')")[0]' });
|
|
|
|
action (test, "type", { jquery: '(".expression-preview-code")[0]', text: "value.split(',')[0]" });
|
|
|
|
wait (test, "forElement", { jquery: '("td:contains(\'value.split\')")[0]' });
|
|
|
|
action (test, "click", { jquery: '("button:contains(\'OK\')")[0]' });
|
|
|
|
wait (test, "forAjaxEnd");
|
|
|
|
assert (test, "expectedTopFacetValue", "ABALONE");
|
|
|
|
this.test_facet = test;
|
2010-05-08 03:06:36 +02:00
|
|
|
|
2010-05-06 03:05:48 +02:00
|
|
|
// sort the facet by count and test the result
|
2010-05-11 19:17:34 +02:00
|
|
|
test = newTest();
|
|
|
|
action (test, "click", { jquery: '(".ui-button-text:contains(\'count\')")[0]' });
|
|
|
|
wait (test, "forElement", { jquery: '(".ui-state-active .ui-button-text:contains(\'count\')")[0]' }); // wait til count is the active sort
|
|
|
|
assert (test, "expectedTopFacetValue", "BEEF");
|
|
|
|
this.test_sort_text_facet = test;
|
2010-05-08 03:06:36 +02:00
|
|
|
|
|
|
|
// filter down to BEEF
|
2010-05-11 19:17:34 +02:00
|
|
|
test = newTest();
|
|
|
|
action (test, "click", { jquery: '("a.facet-choice-label")[0]' });
|
|
|
|
assert (test, "rowCount", "457");
|
|
|
|
this.test_fitler_text_facet = test;
|
2010-05-08 03:06:36 +02:00
|
|
|
|
|
|
|
// create numeric filter from Water column
|
2010-05-11 19:17:34 +02:00
|
|
|
test = newTest();
|
|
|
|
action (test, "click", { jquery: '(".column-header-layout tr:contains(\'Water\') .column-header-menu")[0]' });
|
|
|
|
action (test, "mouseOver", { jquery: '("td:contains(\'Facet\')")[0]' });
|
|
|
|
wait (test, "forMenuItem", { name: 'Numeric Facet' });
|
|
|
|
action (test, "click", { jquery: '(".menu-item:contains(\'Numeric Facet\')")[0]' });
|
2010-05-31 19:56:07 +02:00
|
|
|
wait (test, "forAjaxEnd");
|
|
|
|
assert (test, function() {
|
|
|
|
jum.assertTrue($(".facet-panel span:contains('Water')").length > 0);
|
|
|
|
});
|
2010-05-11 19:17:34 +02:00
|
|
|
this.test_create_numeric_facet = test;
|
2010-05-08 03:06:36 +02:00
|
|
|
|
|
|
|
// filter out BEEF with lower water content
|
2010-05-11 19:17:34 +02:00
|
|
|
test = newTest();
|
|
|
|
wait (test, "forAjaxEnd");
|
|
|
|
wait (test, "forElement", { jquery: '((".slider-widget-draggable.left"))[0]' }),
|
|
|
|
action (test, "dragDropElem", { jquery: '((".slider-widget-draggable.left"))[0]', pixels: '150, 0' });
|
2010-05-31 19:56:07 +02:00
|
|
|
wait (test, "forAjaxEnd"); // <--- FIXME for some reason the range faceting doesn't seem to be triggering that
|
2010-05-11 19:17:34 +02:00
|
|
|
//assert (test, "rowCount", "153");
|
|
|
|
this.test_filter_numeric_facet = test;
|
|
|
|
|
2010-05-06 03:05:48 +02:00
|
|
|
};
|