diff --git a/cypress/integration/homepage.spec.ts b/cypress/integration/homepage.spec.ts index 7685c2c108..8fdf61dbf7 100644 --- a/cypress/integration/homepage.spec.ts +++ b/cypress/integration/homepage.spec.ts @@ -16,8 +16,8 @@ describe('Homepage', () => { it('should have a working search box', () => { const queryString = 'test'; - cy.get('[data-e2e="search-box"]').type(queryString); - cy.get('[data-e2e="search-button"]').click(); + cy.get('[data-test="search-box"]').type(queryString); + cy.get('[data-test="search-button"]').click(); cy.url().should('include', '/search'); cy.url().should('include', 'query=' + encodeURI(queryString)); }); diff --git a/cypress/integration/login-modal.spec.ts b/cypress/integration/login-modal.spec.ts index fbdbeba3e8..fece28b425 100644 --- a/cypress/integration/login-modal.spec.ts +++ b/cypress/integration/login-modal.spec.ts @@ -3,31 +3,31 @@ import { TEST_ADMIN_PASSWORD, TEST_ADMIN_USER, TEST_ENTITY_PUBLICATION } from 'c const page = { openLoginMenu() { // Click the "Log In" dropdown menu in header - cy.get('ds-themed-navbar [data-e2e="login-menu"]').click(); + cy.get('ds-themed-navbar [data-test="login-menu"]').click(); }, openUserMenu() { // Once logged in, click the User menu in header - cy.get('ds-themed-navbar [data-e2e="user-menu"]').click(); + cy.get('ds-themed-navbar [data-test="user-menu"]').click(); }, submitLoginAndPasswordByPressingButton(email, password) { // Enter email - cy.get('ds-themed-navbar [data-e2e="email"]').type(email); + cy.get('ds-themed-navbar [data-test="email"]').type(email); // Enter password - cy.get('ds-themed-navbar [data-e2e="password"]').type(password); + cy.get('ds-themed-navbar [data-test="password"]').type(password); // Click login button - cy.get('ds-themed-navbar [data-e2e="login-button"]').click(); + cy.get('ds-themed-navbar [data-test="login-button"]').click(); }, submitLoginAndPasswordByPressingEnter(email, password) { // In opened Login modal, fill out email & password, then click Enter - cy.get('ds-themed-navbar [data-e2e="email"]').type(email); - cy.get('ds-themed-navbar [data-e2e="password"]').type(password); - cy.get('ds-themed-navbar [data-e2e="password"]').type('{enter}'); + cy.get('ds-themed-navbar [data-test="email"]').type(email); + cy.get('ds-themed-navbar [data-test="password"]').type(password); + cy.get('ds-themed-navbar [data-test="password"]').type('{enter}'); }, submitLogoutByPressingButton() { // This is the POST command that will actually log us out cy.intercept('POST', '/server/api/authn/logout').as('logout'); // Click logout button - cy.get('ds-themed-navbar [data-e2e="logout-button"]').click(); + cy.get('ds-themed-navbar [data-test="logout-button"]').click(); // Wait until above POST command responds before continuing // (This ensures next action waits until logout completes) cy.wait('@logout'); @@ -102,10 +102,10 @@ describe('Login Modal', () => { page.openLoginMenu(); // Registration link should be visible - cy.get('ds-themed-navbar [data-e2e="register"]').should('be.visible'); + cy.get('ds-themed-navbar [data-test="register"]').should('be.visible'); // Click registration link & you should go to registration page - cy.get('ds-themed-navbar [data-e2e="register"]').click(); + cy.get('ds-themed-navbar [data-test="register"]').click(); cy.location('pathname').should('eq', '/register'); cy.get('ds-register-email').should('exist'); }); @@ -116,10 +116,10 @@ describe('Login Modal', () => { page.openLoginMenu(); // Forgot password link should be visible - cy.get('ds-themed-navbar [data-e2e="forgot"]').should('be.visible'); + cy.get('ds-themed-navbar [data-test="forgot"]').should('be.visible'); // Click link & you should go to Forgot Password page - cy.get('ds-themed-navbar [data-e2e="forgot"]').click(); + cy.get('ds-themed-navbar [data-test="forgot"]').click(); cy.location('pathname').should('eq', '/forgot'); cy.get('ds-forgot-email').should('exist'); }); diff --git a/cypress/integration/my-dspace.spec.ts b/cypress/integration/my-dspace.spec.ts index da78ff8da6..eb931adda7 100644 --- a/cypress/integration/my-dspace.spec.ts +++ b/cypress/integration/my-dspace.spec.ts @@ -11,7 +11,7 @@ describe('My DSpace page', () => { cy.get('ds-my-dspace-page').should('exist'); // At least one recent submission should be displayed - cy.get('[data-e2e="list-object"]').should('be.visible'); + cy.get('[data-test="list-object"]').should('be.visible'); // Click each filter toggle to open *every* filter // (As we want to scan filter section for accessibility issues as well) @@ -43,7 +43,7 @@ describe('My DSpace page', () => { cy.get('ds-my-dspace-page').should('exist'); // Click button in sidebar to display detailed view - cy.get('ds-search-sidebar [data-e2e="detail-view"]').click(); + cy.get('ds-search-sidebar [data-test="detail-view"]').click(); cy.get('ds-object-detail').should('exist'); @@ -109,8 +109,8 @@ describe('My DSpace page', () => { // This is the GET command that will actually run the search cy.intercept('GET', '/server/api/discover/search/objects*').as('search-results'); // On MyDSpace, find the submission we just created via its ID - cy.get('[data-e2e="search-box"]').type(id); - cy.get('[data-e2e="search-button"]').click(); + cy.get('[data-test="search-box"]').type(id); + cy.get('[data-test="search-button"]').click(); // Wait for search results to come back from the above GET command cy.wait('@search-results'); diff --git a/cypress/integration/search-navbar.spec.ts b/cypress/integration/search-navbar.spec.ts index 211b4836b1..babd9b9dfd 100644 --- a/cypress/integration/search-navbar.spec.ts +++ b/cypress/integration/search-navbar.spec.ts @@ -3,15 +3,15 @@ import { TEST_SEARCH_TERM } from 'cypress/support'; const page = { fillOutQueryInNavBar(query) { // Click the magnifying glass - cy.get('ds-themed-navbar [data-e2e="header-search-icon"]').click(); + cy.get('ds-themed-navbar [data-test="header-search-icon"]').click(); // Fill out a query in input that appears - cy.get('ds-themed-navbar [data-e2e="header-search-box"]').type(query); + cy.get('ds-themed-navbar [data-test="header-search-box"]').type(query); }, submitQueryByPressingEnter() { - cy.get('ds-themed-navbar [data-e2e="header-search-box"]').type('{enter}'); + cy.get('ds-themed-navbar [data-test="header-search-box"]').type('{enter}'); }, submitQueryByPressingIcon() { - cy.get('ds-themed-navbar [data-e2e="header-search-icon"]').click(); + cy.get('ds-themed-navbar [data-test="header-search-icon"]').click(); } }; @@ -31,7 +31,7 @@ describe('Search from Navigation Bar', () => { // Wait for search results to come back from the above GET command cy.wait('@search-results'); // At least one search result should be displayed - cy.get('[data-e2e="list-object"]').should('be.visible'); + cy.get('[data-test="list-object"]').should('be.visible'); }); it('should go to search page with correct query if submitted (from search)', () => { @@ -46,7 +46,7 @@ describe('Search from Navigation Bar', () => { // Wait for search results to come back from the above GET command cy.wait('@search-results'); // At least one search result should be displayed - cy.get('[data-e2e="list-object"]').should('be.visible'); + cy.get('[data-test="list-object"]').should('be.visible'); }); it('should allow user to also submit query by clicking icon', () => { @@ -61,6 +61,6 @@ describe('Search from Navigation Bar', () => { // Wait for search results to come back from the above GET command cy.wait('@search-results'); // At least one search result should be displayed - cy.get('[data-e2e="list-object"]').should('be.visible'); + cy.get('[data-test="list-object"]').should('be.visible'); }); }); diff --git a/cypress/integration/search-page.spec.ts b/cypress/integration/search-page.spec.ts index 981c9365aa..de279c7f2e 100644 --- a/cypress/integration/search-page.spec.ts +++ b/cypress/integration/search-page.spec.ts @@ -7,20 +7,20 @@ describe('Search Page', () => { const queryString = 'Another interesting query string'; cy.visit('/search'); // Type query in searchbox & click search button - cy.get('[data-e2e="search-box"]').type(queryString); - cy.get('[data-e2e="search-button"]').click(); + cy.get('[data-test="search-box"]').type(queryString); + cy.get('[data-test="search-button"]').click(); cy.url().should('include', 'query=' + encodeURI(queryString)); }); it('should load results and pass accessibility tests', () => { cy.visit('/search?query=' + TEST_SEARCH_TERM); - cy.get('[data-e2e="search-box"]').should('have.value', TEST_SEARCH_TERM); + cy.get('[data-test="search-box"]').should('have.value', TEST_SEARCH_TERM); // tag must be loaded cy.get('ds-search-page').should('exist'); // At least one search result should be displayed - cy.get('[data-e2e="list-object"]').should('be.visible'); + cy.get('[data-test="list-object"]').should('be.visible'); // Click each filter toggle to open *every* filter // (As we want to scan filter section for accessibility issues as well) @@ -48,13 +48,13 @@ describe('Search Page', () => { cy.visit('/search?query=' + TEST_SEARCH_TERM); // Click button in sidebar to display grid view - cy.get('ds-search-sidebar [data-e2e="grid-view"]').click(); + cy.get('ds-search-sidebar [data-test="grid-view"]').click(); // tag must be loaded cy.get('ds-search-page').should('exist'); // At least one grid object (card) should be displayed - cy.get('[data-e2e="grid-object"]').should('be.visible'); + cy.get('[data-test="grid-object"]').should('be.visible'); // Analyze for accessibility issues testA11y('ds-search-page', diff --git a/cypress/integration/submission.spec.ts b/cypress/integration/submission.spec.ts index 4c7758f8d6..c877479f44 100644 --- a/cypress/integration/submission.spec.ts +++ b/cypress/integration/submission.spec.ts @@ -78,8 +78,8 @@ describe('New Submission page', () => { // This is the GET command that will actually run the search cy.intercept('GET', '/server/api/discover/search/objects*').as('search-results'); // On MyDSpace, find the submission we just saved via its ID - cy.get('[data-e2e="search-box"]').type(id); - cy.get('[data-e2e="search-button"]').click(); + cy.get('[data-test="search-box"]').type(id); + cy.get('[data-test="search-button"]').click(); // Wait for search results to come back from the above GET command cy.wait('@search-results'); diff --git a/src/app/search-navbar/search-navbar.component.html b/src/app/search-navbar/search-navbar.component.html index 05b3d13b1b..c9a83b7117 100644 --- a/src/app/search-navbar/search-navbar.component.html +++ b/src/app/search-navbar/search-navbar.component.html @@ -3,8 +3,8 @@
- + class="d-inline-block bg-transparent position-absolute form-control dropdown-menu-right p-1" data-test="header-search-box"> +
diff --git a/src/app/shared/auth-nav-menu/auth-nav-menu.component.html b/src/app/shared/auth-nav-menu/auth-nav-menu.component.html index 3f06f9f42c..348c627e78 100644 --- a/src/app/shared/auth-nav-menu/auth-nav-menu.component.html +++ b/src/app/shared/auth-nav-menu/auth-nav-menu.component.html @@ -1,7 +1,7 @@