diff --git a/frontend/eda/access/credential-types/CredentialTypes.cy.tsx b/frontend/eda/access/credential-types/CredentialTypes.cy.tsx index 43f52ffa3d..d589e326dc 100644 --- a/frontend/eda/access/credential-types/CredentialTypes.cy.tsx +++ b/frontend/eda/access/credential-types/CredentialTypes.cy.tsx @@ -1,5 +1,6 @@ import { edaAPI } from '../../common/eda-utils'; import { CredentialTypes } from './CredentialTypes'; +import { Projects } from '../../projects/Projects'; describe('CredentialTypes.cy.ts', () => { beforeEach(() => { @@ -289,3 +290,53 @@ describe('CredentialTypes.cy.ts', () => { cy.contains('th', 'Name'); }); }); + +describe('Empty list without POST permission', () => { + beforeEach(() => { + cy.intercept( + { + method: 'GET', + url: edaAPI`/credential-types/*`, + }, + { + fixture: 'emptyList.json', + } + ).as('emptyList'); + }); + it('Empty state is displayed correctly', () => { + cy.mount(); + cy.contains(/^You do not have permission to create a credential type.$/); + cy.contains( + /^Please contact your organization administrator if there is an issue with your access.$/ + ); + }); +}); + +describe('Empty list with POST permission', () => { + beforeEach(() => { + cy.intercept( + { + method: 'OPTIONS', + url: edaAPI`/credential-types/`, + }, + { + fixture: 'edaCredentialTypesOptions.json', + } + ).as('getOptions'); + cy.intercept( + { + method: 'GET', + url: edaAPI`/credential-types/*`, + }, + { + fixture: 'emptyList.json', + } + ).as('emptyList'); + }); + it('Empty state is displayed correctly', () => { + cy.mount(); + cy.contains(/^There are currently no credential types created for your organization.$/); + cy.contains(/^Please create a credential type by using the button below.$/); + cy.contains('button', /^Create credential type$/).should('be.visible'); + }); +}); diff --git a/frontend/eda/access/credentials/Credentials.cy.tsx b/frontend/eda/access/credentials/Credentials.cy.tsx index f46b6f63af..419b0f6d7c 100644 --- a/frontend/eda/access/credentials/Credentials.cy.tsx +++ b/frontend/eda/access/credentials/Credentials.cy.tsx @@ -193,7 +193,7 @@ describe('Credentials.cy.ts', () => { }); }); -describe('Empty list', () => { +describe('Empty list without POST permission', () => { beforeEach(() => { cy.intercept( { @@ -205,6 +205,36 @@ describe('Empty list', () => { } ).as('emptyList'); }); + it('Empty state is displayed correctly', () => { + cy.mount(); + cy.contains(/^You do not have permission to create a credential.$/); + cy.contains( + /^Please contact your organization administrator if there is an issue with your access.$/ + ); + }); +}); + +describe('Empty list with POST permission', () => { + beforeEach(() => { + cy.intercept( + { + method: 'OPTIONS', + url: edaAPI`/eda-credentials/`, + }, + { + fixture: 'edaCredentialsOptions.json', + } + ).as('getOptions'); + cy.intercept( + { + method: 'GET', + url: edaAPI`/eda-credentials/*`, + }, + { + fixture: 'emptyList.json', + } + ).as('emptyList'); + }); it('Empty state is displayed correctly', () => { cy.mount(); cy.contains(/^There are currently no credentials created for your organization.$/); diff --git a/frontend/eda/decision-environments/DecisionEnvironments.cy.tsx b/frontend/eda/decision-environments/DecisionEnvironments.cy.tsx index 365f8777f8..034e461184 100644 --- a/frontend/eda/decision-environments/DecisionEnvironments.cy.tsx +++ b/frontend/eda/decision-environments/DecisionEnvironments.cy.tsx @@ -168,12 +168,42 @@ describe('DecisionEnvironments.cy.ts', () => { }); }); -describe('Empty list', () => { +describe('Empty list without POST permission', () => { beforeEach(() => { cy.intercept( { method: 'GET', - url: '/api/eda/v1/decision-environments/*', + url: edaAPI`/decision-environments/*`, + }, + { + fixture: 'emptyList.json', + } + ).as('emptyList'); + }); + it('Empty state is displayed correctly', () => { + cy.mount(); + cy.contains(/^You do not have permission to create a decision environment.$/); + cy.contains( + /^Please contact your organization administrator if there is an issue with your access.$/ + ); + }); +}); + +describe('Empty list with POST permission', () => { + beforeEach(() => { + cy.intercept( + { + method: 'OPTIONS', + url: edaAPI`/decision-environments/`, + }, + { + fixture: 'edaDecisionEnvironmentsOptions.json', + } + ).as('getOptions'); + cy.intercept( + { + method: 'GET', + url: edaAPI`/decision-environments/*`, }, { fixture: 'emptyList.json', diff --git a/frontend/eda/decision-environments/DecisionEnvironments.tsx b/frontend/eda/decision-environments/DecisionEnvironments.tsx index 261355840c..27c2ea69a7 100644 --- a/frontend/eda/decision-environments/DecisionEnvironments.tsx +++ b/frontend/eda/decision-environments/DecisionEnvironments.tsx @@ -44,7 +44,7 @@ export function DecisionEnvironments() { emptyStateTitle={ canCreateDE ? t('There are currently no decision environments created for your organization.') - : t('You do not have permission to create a decision environment') + : t('You do not have permission to create a decision environment.') } emptyStateDescription={ canCreateDE diff --git a/frontend/eda/rulebook-activations/RulebookActivations.cy.tsx b/frontend/eda/rulebook-activations/RulebookActivations.cy.tsx index e7ec5f011c..221973909e 100644 --- a/frontend/eda/rulebook-activations/RulebookActivations.cy.tsx +++ b/frontend/eda/rulebook-activations/RulebookActivations.cy.tsx @@ -175,7 +175,7 @@ describe('RulebookActivations.cy.ts', () => { }); }); -describe('Empty list', () => { +describe('Empty list without POST permission', () => { beforeEach(() => { cy.intercept( { @@ -187,6 +187,36 @@ describe('Empty list', () => { } ).as('emptyList'); }); + it('Empty state is displayed correctly', () => { + cy.mount(); + cy.contains(/^You do not have permission to create a rulebook activation.$/); + cy.contains( + /^Please contact your organization administrator if there is an issue with your access.$/ + ); + }); +}); + +describe('Empty list with POST permission', () => { + beforeEach(() => { + cy.intercept( + { + method: 'OPTIONS', + url: edaAPI`/activations/`, + }, + { + fixture: 'edaActivationsOptions.json', + } + ).as('getOptions'); + cy.intercept( + { + method: 'GET', + url: edaAPI`/activations/*`, + }, + { + fixture: 'emptyList.json', + } + ).as('emptyList'); + }); it('Empty state is displayed correctly', () => { cy.mount(); cy.contains(/^There are currently no rulebook activations created for your organization.$/);