Skip to content

Commit

Permalink
convert the queryTest e2e test to cypress
Browse files Browse the repository at this point in the history
  • Loading branch information
sbelsk committed Jan 10, 2024
1 parent 4897cc7 commit 65071cc
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 51 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/cdash/tests/js/e2e_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
49 changes: 0 additions & 49 deletions app/cdash/tests/js/e2e_tests/queryTests.js

This file was deleted.

50 changes: 50 additions & 0 deletions tests/cypress/e2e/query-tests.cy.js
Original file line number Diff line number Diff line change
@@ -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', 4);
});


it('filters correctly by build time', () => {
filter_test('buildstarttime', '83', 'yesterday', 5);
});

it('filters correctly by details', () => {
filter_test('details', '61', 'Completed', 5);
});

it('filters correctly by group', () => {
filter_test('groupname', '61', 'Experimental', 5);
filter_test('groupname', '62', 'Experimental', 0);
});

it('filters correctly by site', () => {
filter_test('site', '61', 'CDashTestingSite', 5);
});

it('filters correctly by time', () => {
// count all tests that took 0s to run
filter_test('time', '41', '0', 5);

// 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);
});
});

0 comments on commit 65071cc

Please sign in to comment.