diff --git a/src/client/components/CompanyLocalHeader/index.jsx b/src/client/components/CompanyLocalHeader/index.jsx index 1b19a231cc6..d8072b6b438 100644 --- a/src/client/components/CompanyLocalHeader/index.jsx +++ b/src/client/components/CompanyLocalHeader/index.jsx @@ -119,9 +119,27 @@ const hasAllocatedLeadIta = (company) => const hasManagedAccountDetails = (company) => company.oneListGroupTier && hasAllocatedLeadIta(company) +const DATA_HUB_HAS_MOVED_LINK = + 'https://data-services-help.trade.gov.uk/data-hub/updates/announcements/export-wins-has-moved-to-data-hub/' + +const DATA_HUB_HAS_MOVED_MESSAGE = ( + <> + Historic export wins have now moved to Data Hub,{' '} + + see the export wins announcement + + . + +) + const CompanyLocalHeader = ({ breadcrumbs, - flashMessages, + flashMessages = [], company, csrfToken, }) => @@ -133,7 +151,11 @@ const CompanyLocalHeader = ({ company.id, company.name )} - flashMessages={flashMessages} + flashMessages={ + breadcrumbs[0]?.text === 'Exports' + ? [[DATA_HUB_HAS_MOVED_MESSAGE, ...flashMessages]] + : flashMessages + } > diff --git a/test/functional/cypress/specs/companies/export-wins-moved-spec.js b/test/functional/cypress/specs/companies/export-wins-moved-spec.js new file mode 100644 index 00000000000..7847193f398 --- /dev/null +++ b/test/functional/cypress/specs/companies/export-wins-moved-spec.js @@ -0,0 +1,45 @@ +const { company } = require('../../fixtures') +const urls = require('../../../../../src/lib/urls') + +describe('Export wins moved banner', () => { + it('There should be a banner informing about export wins moving to Data Hub on the company page', () => { + cy.visit(urls.companies.exports.index(company.dnbCorp.id)) + + cy.get('[data-test="status-message"') + .should( + 'have.text', + 'Historic export wins have now moved to Data Hub, see the export wins announcement.' + ) + .within(() => { + cy.contains('a', 'see the export wins announcement').should( + 'have.attr', + 'href', + 'https://data-services-help.trade.gov.uk/data-hub/updates/announcements/export-wins-has-moved-to-data-hub/' + ) + }) + }) + + describe("There should't be a banner in the other tabs", () => { + ;[ + 'overview', + 'activity', + 'business-details', + 'contacts', + 'account-management', + 'investments/projects', + 'orders', + ].forEach((slug) => + it(slug, () => { + cy.visit(`/companies/${company.dnbCorp.id}/${slug}`) + + // We need to wait for company name appear... + cy.contains(company.dnbCorp.name) + + // ...so that this waits for whent the data has been loaded and rendered + cy.contains('Historic export wins have now moved to Data Hub').should( + 'not.exist' + ) + }) + ) + }) +})