diff --git a/.eslintignore b/.eslintignore index 2a7629033e..9da77b906a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -79,7 +79,6 @@ app/cdash/tests/js/e2e_tests/viewBuildError.js app/cdash/tests/js/e2e_tests/subprojectGroupOrder.js app/cdash/tests/js/e2e_tests/sort_index.js app/cdash/tests/js/e2e_tests/remove_build.js -app/cdash/tests/js/e2e_tests/queryTests.js app/cdash/tests/js/e2e_tests/multiSort.js app/cdash/tests/js/e2e_tests/manageSubProject.js app/cdash/tests/js/e2e_tests/manageBuildGroup.js diff --git a/app/cdash/tests/js/e2e_tests/CMakeLists.txt b/app/cdash/tests/js/e2e_tests/CMakeLists.txt index e08e0c0e85..937772b1f1 100644 --- a/app/cdash/tests/js/e2e_tests/CMakeLists.txt +++ b/app/cdash/tests/js/e2e_tests/CMakeLists.txt @@ -28,7 +28,7 @@ add_cypress_e2e_test(expected-build) add_protractor_test(remove_build) add_protractor_test(viewSubProjects) add_cypress_e2e_test(test-summary) -add_protractor_test(queryTests) +add_cypress_e2e_test(query-tests) add_cypress_e2e_test(filter-labels) add_protractor_test(viewTestPagination) add_protractor_test(done_build) diff --git a/app/cdash/tests/js/e2e_tests/queryTests.js b/app/cdash/tests/js/e2e_tests/queryTests.js deleted file mode 100644 index f370c5e3c8..0000000000 --- a/app/cdash/tests/js/e2e_tests/queryTests.js +++ /dev/null @@ -1,49 +0,0 @@ -require('../pages/catchConsoleErrors.page.js'); -describe("queryTests", function() { - function filter_test(field, compare, value, num_builds) { - // Load the filtered page. - browser.get('queryTests.php?project=InsightExample&filtercount=1&showfilters=1&field1=' + field + '&compare1=' + compare + '&value1=' + value); - - // Make sure the expected number of rows are displayed. - expect(element.all(by.repeater('build in pagination.filteredBuilds')).count()).toBe(num_builds); - } - - it("filter on build name", function() { - filter_test("buildname", "63", "simple", 3); - }); - - - it("filter on build time", function() { - filter_test("buildstarttime", "83", "yesterday", 4); - }); - - it("filter on details", function() { - filter_test("details", "61", "Completed", 4); - }); - - it("filter on group", function() { - filter_test("groupname", "61", "Experimental", 4); - filter_test("groupname", "62", "Experimental", 0); - }); - - it("filter on site", function() { - filter_test("site", "61", "CDashTestingSite", 4); - }); - - it("filter on time", function() { - // This test should not count on all tests taking 0s - // It should open the page with the time filter set to == 0 - // then make sure that all tests on the page have times - // of 0s. - // filter_test("time", "41", "0", 5); - }); - - it("check default filters", function() { - browser.get('index.php?project=InsightExample'); - browser.actions().mouseMove(element(by.linkText('Dashboard'))).perform(); - var link = element(by.linkText('Tests Query')); - expect(link.getAttribute('href')).toContain('queryTests.php?project=InsightExample'); - expect(link.getAttribute('href')).toContain('&filtercount=1&showfilters=1&field1=status&compare1=62&value1=Passed'); - }); - -}); diff --git a/tests/cypress/e2e/query-tests.cy.js b/tests/cypress/e2e/query-tests.cy.js new file mode 100644 index 0000000000..553b9a0ef3 --- /dev/null +++ b/tests/cypress/e2e/query-tests.cy.js @@ -0,0 +1,50 @@ +describe('query tests', () => { + function filter_test(field, compare, value, num_builds) { + // load the filtered page + const filter_url = `queryTests.php?project=InsightExample&filtercount=1&field1=${field}&compare1=${compare}&value1=${value}`; + cy.visit(filter_url); + + // make sure the expected number of rows are displayed + cy.get('#numtests').should('contain', `Query Tests: ${num_builds} matches`); + cy.get('#queryTestsTable').find('tbody').find('tr').should('have.length', num_builds); + } + + it('filters correctly by build name', () => { + filter_test('buildname', '63', 'simple', 3); + }); + + + it('filters correctly by build time', () => { + filter_test('buildstarttime', '83', 'yesterday', 4); + }); + + it('filters correctly by details', () => { + filter_test('details', '61', 'Completed', 4); + }); + + it('filters correctly by group', () => { + filter_test('groupname', '61', 'Experimental', 4); + filter_test('groupname', '62', 'Experimental', 0); + }); + + it('filters correctly by site', () => { + filter_test('site', '61', 'CDashTestingSite', 4); + }); + + it('filters correctly by time', () => { + // count all tests that took 0s to run + filter_test('time', '41', '0', 4); + + // make sure all filtered tests actually have 'Time' equal to zero + cy.get('#queryTestsTable').find('tbody').find('tr').each(row => { + cy.wrap(row).find('td').eq(4).should('contain', '0s'); + }); + }); + + it('displays the right default filters', () => { + cy.visit('index.php?project=InsightExample'); + const today_str = new Date().toISOString().slice(0, 10); + const default_filters = `queryTests.php?project=InsightExample&date=${today_str}&filtercount=1&showfilters=1&field1=status&compare1=62&value1=Passed`; + cy.get('#navigation').find('a').contains('Tests Query').should('have.attr', 'href').and('contains', default_filters); + }); +});