From 35135629a403c5fba83d612fd6f084ec25646633 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Mon, 9 Sep 2024 16:21:24 -0500 Subject: [PATCH] Test stability fixes. Ensure Item Edit tests wait on tabs to load by testing if tab is active. Fix small bug in login-modal test. --- cypress/e2e/item-edit.cy.ts | 24 ++++++++++++++++++++++++ cypress/e2e/login-modal.cy.ts | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/item-edit.cy.ts b/cypress/e2e/item-edit.cy.ts index 60e1b924eed..604aab9d042 100644 --- a/cypress/e2e/item-edit.cy.ts +++ b/cypress/e2e/item-edit.cy.ts @@ -15,6 +15,9 @@ describe('Edit Item > Edit Metadata tab', () => { it('should pass accessibility tests', () => { cy.get('a[data-test="metadata"]').click(); + // Our selected tab should be active + cy.get('a[data-test="metadata"]').should('have.class', 'active'); + // tag must be loaded cy.get('ds-edit-item-page').should('be.visible'); @@ -33,6 +36,9 @@ describe('Edit Item > Status tab', () => { it('should pass accessibility tests', () => { cy.get('a[data-test="status"]').click(); + // Our selected tab should be active + cy.get('a[data-test="status"]').should('have.class', 'active'); + // tag must be loaded cy.get('ds-item-status').should('be.visible'); @@ -46,6 +52,9 @@ describe('Edit Item > Bitstreams tab', () => { it('should pass accessibility tests', () => { cy.get('a[data-test="bitstreams"]').click(); + // Our selected tab should be active + cy.get('a[data-test="bitstreams"]').should('have.class', 'active'); + // tag must be loaded cy.get('ds-item-bitstreams').should('be.visible'); @@ -70,6 +79,9 @@ describe('Edit Item > Curate tab', () => { it('should pass accessibility tests', () => { cy.get('a[data-test="curate"]').click(); + // Our selected tab should be active + cy.get('a[data-test="curate"]').should('have.class', 'active'); + // tag must be loaded cy.get('ds-item-curate').should('be.visible'); @@ -83,6 +95,9 @@ describe('Edit Item > Relationships tab', () => { it('should pass accessibility tests', () => { cy.get('a[data-test="relationships"]').click(); + // Our selected tab should be active + cy.get('a[data-test="relationships"]').should('have.class', 'active'); + // tag must be loaded cy.get('ds-item-relationships').should('be.visible'); @@ -96,6 +111,9 @@ describe('Edit Item > Version History tab', () => { it('should pass accessibility tests', () => { cy.get('a[data-test="versionhistory"]').click(); + // Our selected tab should be active + cy.get('a[data-test="versionhistory"]').should('have.class', 'active'); + // tag must be loaded cy.get('ds-item-version-history').should('be.visible'); @@ -109,6 +127,9 @@ describe('Edit Item > Access Control tab', () => { it('should pass accessibility tests', () => { cy.get('a[data-test="access-control"]').click(); + // Our selected tab should be active + cy.get('a[data-test="access-control"]').should('have.class', 'active'); + // tag must be loaded cy.get('ds-item-access-control').should('be.visible'); @@ -122,6 +143,9 @@ describe('Edit Item > Collection Mapper tab', () => { it('should pass accessibility tests', () => { cy.get('a[data-test="mapper"]').click(); + // Our selected tab should be active + cy.get('a[data-test="mapper"]').should('have.class', 'active'); + // tag must be loaded cy.get('ds-item-collection-mapper').should('be.visible'); diff --git a/cypress/e2e/login-modal.cy.ts b/cypress/e2e/login-modal.cy.ts index 3fe46586024..1d72306accd 100644 --- a/cypress/e2e/login-modal.cy.ts +++ b/cypress/e2e/login-modal.cy.ts @@ -67,7 +67,7 @@ describe('Login Modal', () => { // Login, and the tag should no longer exist page.submitLoginAndPasswordByPressingEnter(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); - cy.get('.form-login').should('not.exist'); + cy.get('ds-log-in').should('not.exist'); // Verify we are still on homepage cy.url().should('include', '/home');