mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 06:53:03 +00:00
Replace Protrator e2e tests with Cypress. Move all existing tests to Cypress & add basic Deque Axe integration.
This commit is contained in:
49
cypress/integration/search-navbar.spec.ts
Normal file
49
cypress/integration/search-navbar.spec.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
const page = {
|
||||
fillOutQueryInNavBar(query) {
|
||||
// Click the magnifying glass
|
||||
cy.get('.navbar-container #search-navbar-container form a').click();
|
||||
// Fill out a query and click Enter
|
||||
cy.get('.navbar-container #search-navbar-container form input[name = "query"]').type(query);
|
||||
},
|
||||
submitQueryByPressingEnter() {
|
||||
cy.get('.navbar-container #search-navbar-container form input[name = "query"]').type('{enter}');
|
||||
},
|
||||
submitQueryByPressingIcon() {
|
||||
cy.get('.navbar-container #search-navbar-container form .submit-icon').click();
|
||||
}
|
||||
};
|
||||
|
||||
describe('Search from Navigation Bar', () => {
|
||||
// NOTE: these tests currently assume this query will return results!
|
||||
const query = 'test';
|
||||
|
||||
it('should go to search page with correct query if submitted (from home)', () => {
|
||||
cy.visit('/');
|
||||
page.fillOutQueryInNavBar(query);
|
||||
page.submitQueryByPressingEnter();
|
||||
// New URL should include query param
|
||||
cy.url().should('include', 'query=' + query);
|
||||
// At least one search result should be displayed
|
||||
cy.get('ds-item-search-result-list-element').should('be.visible');
|
||||
});
|
||||
|
||||
it('should go to search page with correct query if submitted (from search)', () => {
|
||||
cy.visit('/search');
|
||||
page.fillOutQueryInNavBar(query);
|
||||
page.submitQueryByPressingEnter();
|
||||
// New URL should include query param
|
||||
cy.url().should('include', 'query=' + query);
|
||||
// At least one search result should be displayed
|
||||
cy.get('ds-item-search-result-list-element').should('be.visible');
|
||||
});
|
||||
|
||||
it('should allow user to also submit query by clicking icon', () => {
|
||||
cy.visit('/');
|
||||
page.fillOutQueryInNavBar(query);
|
||||
page.submitQueryByPressingIcon();
|
||||
// New URL should include query param
|
||||
cy.url().should('include', 'query=' + query);
|
||||
// At least one search result should be displayed
|
||||
cy.get('ds-item-search-result-list-element').should('be.visible');
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user