Skip to content

Commit

Permalink
Convert banner test to Cypress (#1898)
Browse files Browse the repository at this point in the history
This PR is simply a one-to-one conversion of the banner management test
from our legacy UI testing infrastructure to Cypress.
  • Loading branch information
williamjallen committed Dec 29, 2023
1 parent 0ee31d1 commit 166a06b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 74 deletions.
2 changes: 1 addition & 1 deletion app/cdash/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ add_php_test(committerinfo)
add_php_test(edituser)
add_php_test(image)
add_php_test(displayimage)
add_php_test(managebanner)
add_cypress_test(banner)
add_php_test(manageprojectroles)
add_php_test(manageusers)
add_php_test(projectindb)
Expand Down
58 changes: 0 additions & 58 deletions app/cdash/tests/test_managebanner.php

This file was deleted.

15 changes: 0 additions & 15 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -24931,21 +24931,6 @@ parameters:
count: 1
path: app/cdash/tests/test_lotsofsubprojects.php

-
message: "#^Call to deprecated method pass\\(\\) of class SimpleTestCase\\.$#"
count: 1
path: app/cdash/tests/test_managebanner.php

-
message: "#^Call to method WebTestCase\\:\\:setFieldByName\\(\\) with incorrect case\\: SetFieldByName$#"
count: 2
path: app/cdash/tests/test_managebanner.php

-
message: "#^Method ManageBannerTestCase\\:\\:testManageBannerTest\\(\\) has no return type specified\\.$#"
count: 1
path: app/cdash/tests/test_managebanner.php

-
message: """
#^Call to deprecated method getPdo\\(\\) of class CDash\\\\Database\\:
Expand Down
26 changes: 26 additions & 0 deletions tests/cypress/e2e/banner.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
describe('User profile page', () => {
it('is protected by login', () => {
cy.visit('/manageBanner.php');
cy.url().should('eq', `${Cypress.config().baseUrl}/login`);
});

it('Can change banner', () => {
cy.visit('/index.php?project=InsightExample');
cy.get('[name=banner]').should('not.exist');

cy.login();
cy.visit('/manageBanner.php');
cy.get('[name=message]').clear().type('this is a new banner');
cy.get('[name=updateMessage]').click();

cy.visit('/index.php?project=InsightExample');
cy.get('[name=banner]').should('contain.text', 'this is a new banner');

cy.visit('/manageBanner.php');
cy.get('[name=message]').clear();
cy.get('[name=updateMessage]').click();

cy.visit('/index.php?project=InsightExample');
cy.get('[name=banner]').should('not.exist');
});
});

0 comments on commit 166a06b

Please sign in to comment.