diff --git a/src/client/components/CompanyLocalHeader/index.jsx b/src/client/components/CompanyLocalHeader/index.jsx index 529acd43972..46a84eebbe7 100644 --- a/src/client/components/CompanyLocalHeader/index.jsx +++ b/src/client/components/CompanyLocalHeader/index.jsx @@ -124,6 +124,7 @@ const CompanyLocalHeader = ({ flashMessages, company, csrfToken, + hasExportWinFeatureGroup, }) => company && ( <> @@ -188,6 +189,18 @@ const CompanyLocalHeader = ({ > Add export project + {hasExportWinFeatureGroup && ( + + )} diff --git a/src/client/components/CompanyLocalHeader/state.js b/src/client/components/CompanyLocalHeader/state.js index f81a4dea510..a7b488639e5 100644 --- a/src/client/components/CompanyLocalHeader/state.js +++ b/src/client/components/CompanyLocalHeader/state.js @@ -4,4 +4,5 @@ export const state2props = (state) => state[ID] export const companyState2Props = (state) => ({ csrfToken: state.csrfToken, + hasExportWinFeatureGroup: state.activeFeatureGroups?.includes('export-wins'), }) diff --git a/test/functional/cypress/specs/export-win/user-feature-group-spec.js b/test/functional/cypress/specs/export-win/user-feature-group-spec.js new file mode 100644 index 00000000000..38ffeee56f3 --- /dev/null +++ b/test/functional/cypress/specs/export-win/user-feature-group-spec.js @@ -0,0 +1,16 @@ +const company = '/companies/00009ae3-1912-e411-8a2b-e4115bead28a/overview' + +describe('Export win user feature groups', () => { + context('Company page"', () => { + it('should render the "Add export win" button', () => { + cy.setUserFeatureGroups(['export-wins']) + cy.visit(company) + cy.get('[data-test="header-add-export-win"]').should('exist') + }) + it('should hide the "Add export win" button', () => { + cy.setUserFeatureGroups([]) + cy.visit(company) + cy.get('[data-test="header-add-export-win"]').should('not.exist') + }) + }) +})