Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert the viewTest e2e test to cypress #1955

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public/js/bulletchart.js
app/cdash/tests/js/pages/login.page.js
app/cdash/tests/js/pages/catchConsoleErrors.page.js
app/cdash/tests/js/e2e_tests/viewTestPagination.js
app/cdash/tests/js/e2e_tests/viewTest.js
app/cdash/tests/js/e2e_tests/viewSubProjects.js
app/cdash/tests/js/e2e_tests/subprojectGroupOrder.js
app/cdash/tests/js/e2e_tests/sort_index.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 @@ -22,7 +22,7 @@ add_cypress_e2e_test(sub-project-dependencies)
add_cypress_e2e_test(manage-build-group)
add_cypress_e2e_test(manage-sub-project)
add_cypress_e2e_test(view-build-error)
add_protractor_test(viewTest)
add_cypress_e2e_test(view-test)
add_protractor_test(sort_index)
add_cypress_e2e_test(expected-build)
add_protractor_test(remove_build)
Expand Down
60 changes: 0 additions & 60 deletions app/cdash/tests/js/e2e_tests/viewTest.js

This file was deleted.

48 changes: 48 additions & 0 deletions tests/cypress/e2e/view-test.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
describe('viewTest', () => {

it('shows the test we expect', () => {
cy.visit('viewTest.php?buildid=1');
cy.get('#viewTestTable').find('tbody').contains('tr', 'kwsys.testHashSTL').should('exist');
});


it('shows link to queryTests.php', () => {
cy.visit('viewTest.php?buildid=1');

const default_filters = 'queryTests.php?project=TestCompressionExample&date=2009-12-18&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);
});


it('accounts for missing tests', () => {
// go to the viewTest page corresponding to build with name 'Win32-MSVC2009'
cy.visit('index.php?project=EmailProjectExample&date=2009-02-26');
cy.get('tbody').contains('a', 'Win32-MSVC2009').invoke('attr', 'href').then(build_url => {
const buildid = build_url.match(/build\/([0-9]+)/)[1];
cy.visit(`viewTest.php?buildid=${buildid}`);
});

// verify that summary table displays tests as missing
function verify_missing_row(test_name) {
cy.get('#viewTestTable').contains('tr', test_name).as('missing_test_row');
cy.get('@missing_test_row').find('td').eq(0).should('contain', test_name);
cy.get('@missing_test_row').find('td').eq(1).should('contain', 'Missing');
}
verify_missing_row('Parser1Test1');
verify_missing_row('DashboardSendTest');
verify_missing_row('SystemInfoTest');

// check stats above the table
function get_whitespace_regex(input_str) {
const ws = '\\s+'; // matches any whitespace
return new RegExp(ws + input_str.split(/\s+/).join(ws) + ws);
}
// TODO: (sbelsk) we have to do this hack to comapre the text
// because it's bound in angular and cypress can't get it easily.
// once this gets redone in Vue, we should simply do:
// cy.get('h3#test-totals-indicator').should('contain', '2 passed, 3 failed, 0 not run, 3 missing.');
const expected_regex = get_whitespace_regex('2 passed, 3 failed, 0 not run, 3 missing.');
cy.get('h3#test-totals-indicator').invoke('text').should('match', expected_regex);
});

});