From a42c60ead7070f44a4697659a7e910a6da59504a Mon Sep 17 00:00:00 2001 From: Florian Giroud <6267288+fgiroud@users.noreply.github.com> Date: Mon, 9 Aug 2021 09:32:00 +0200 Subject: [PATCH] Code cleanup, removed old frontend tests, #3552 (#4093) --- main/tests/client/src/facets.js | 67 --------------------- main/tests/client/src/initialize.js | 91 ----------------------------- 2 files changed, 158 deletions(-) delete mode 100644 main/tests/client/src/facets.js delete mode 100644 main/tests/client/src/initialize.js diff --git a/main/tests/client/src/facets.js b/main/tests/client/src/facets.js deleted file mode 100644 index 2a0c47773..000000000 --- a/main/tests/client/src/facets.js +++ /dev/null @@ -1,67 +0,0 @@ -var test_facets = new function() { - - // TODO: if I'm in a project, go back to main page (useful when working on this test) - //if () { - //go back - //}; - - // test opening Food project - test = newTest(); - assert (test, "assertText", { id:"slogan", validator: "A power tool for working with messy data." }); - this.test_home_page = test; - - // make sure the dataset was loaded properly - test = newTest(); - action (test, "click", { link: "Food" }); - wait (test, "forPageLoad", { timeout: "20000" }); - assert (test, "assertText", {xpath: "//div[@id='summary-bar']/span",validator: "7413 rows"}); - this.test_open_project = test; - - // create text facet from 1st word of Short Description column - 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; - - // sort the facet by count and test the result - 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; - - // filter down to BEEF - test = newTest(); - action (test, "click", { jquery: '("a.facet-choice-label")[0]' }); - assert (test, "rowCount", "457"); - this.test_fitler_text_facet = test; - - // create numeric filter from Water column - 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]' }); - wait (test, "forAjaxEnd"); - assert (test, function() { - jum.assertTrue($(".facet-panel span:contains('Water')").length > 0); - }); - this.test_create_numeric_facet = test; - - // filter out BEEF with lower water content - 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' }); - wait (test, "forAjaxEnd"); // <--- FIXME for some reason the range faceting doesn't seem to be triggering that - //assert (test, "rowCount", "153"); - this.test_filter_numeric_facet = test; - -}; diff --git a/main/tests/client/src/initialize.js b/main/tests/client/src/initialize.js deleted file mode 100644 index df909e615..000000000 --- a/main/tests/client/src/initialize.js +++ /dev/null @@ -1,91 +0,0 @@ - -var test = []; - -function newTest() { - return []; -} - -windmill.macros = {}; - -// ---------------------- actions extensions ---------------------------- - -function action(test, what, params) { - if (typeof what == "function") { - test.push(what); - } else if (what in windmill.macros.actions) { - windmill.macros.actions[what](params); - } else { - test.push({ - method: what, - params: params - }); - } -} - -windmill.macros.actions = {}; - -windmill.macros.actions.clickColumnHeader = function (test,params) { - action(test,"click", { jquery: '(".column-header-layout tr:contains("' + params.column_name + '") .column-header-menu")[0]'} ); -}; - -// ---------------------- wait extensions ------------------------------- - -function wait(test, what, params) { - if (typeof what == "function") { - test.push(what); - } else if (what in windmill.macros.waits) { - windmill.macros.waits[what](test,params); - } else { - test.push({ - method: "waits." + what, - params: params - }); - } -} - -windmill.macros.waits = {}; - -windmill.macros.waits.forAjaxEnd = function (test) { - wait(test,"forElement", { jquery: '("body[ajax_in_progress=\'false\']")[0]' } ); -}; - -windmill.macros.waits.forMenuItem = function (test,params) { - wait(test,"forElement", { jquery: '(".menu-item:contains(\'' + params.name + '\')")[0]' } ); -}; - -// ---------------------- asserts extensions ---------------------------- - -function assert(test, what, params) { - if (typeof what == "function") { - test.push(what); - } else if (what in windmill.macros.asserts) { - windmill.macros.asserts[what](test,params); - } else { - test.push({ - method: "asserts." + what, - params: params - }); - } -} - -windmill.macros.asserts = {}; - -windmill.macros.asserts.rowCount = function (test, count) { - wait(test,"forElement", { jquery: '(".viewPanel-summary-row-count")[0]' } ); - assert(test,"assertText", { jquery: '(".viewPanel-summary-row-count")[0]', validator: count } ); -}; - -windmill.macros.asserts.expectedTopFacetValue = function (test, expected_value) { - wait(test, "forElement", { jquery: '("a.facet-choice-label")[0]' } ); - assert(test, function() { - jum.assertEquals(expected_value, $.trim($("a.facet-choice-label")[0].text)); - }); -}; - -// ----------------------- register tests --------------------------- - -windmill.jsTest.register([ - "test_facets" -]); - -windmill.jsTest.require("facets.js");