Skip to content

Commit

Permalink
Merge pull request #6630 from uktrade/fix/export-wins-sandbox-endpoints
Browse files Browse the repository at this point in the history
Add Export Wins metadata endpoints to sandbox.
  • Loading branch information
paulgain authored Mar 20, 2024
2 parents 55f2b3b + 93f583d commit ab1993e
Show file tree
Hide file tree
Showing 12 changed files with 12,034 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,6 @@ describe('Adding an export win from an export project', () => {
cy.intercept('GET', '/api-proxy/v4/export-win/*', exportWin).as(
'apiGetExportWin'
)
cy.intercept('GET', '/api-proxy/v4/metadata/hq-team-region-or-post?*', [
{ name: 'DIT Education' },
{ name: 'Healthcare UK' },
])
cy.intercept('GET', `/api-proxy/v4/contact?company_id=${company.id}`, {
results: [
contactFaker({
Expand All @@ -221,17 +217,6 @@ describe('Adding an export win from an export project', () => {
}),
],
})
cy.intercept('GET', '/api-proxy/v4/metadata/hvc', [
{ name: 'Australia Consumer Goods & Retail: E004' },
])
cy.intercept('GET', '/api-proxy/v4/metadata/support-type', [
{
name: 'Market entry advice and support – DIT/FCO in UK',
},
])
cy.intercept('GET', '/api-proxy/v4/metadata/associated-programme', [
{ name: 'Afterburner' },
])
})

it(
Expand All @@ -243,7 +228,7 @@ describe('Adding an export win from an export project', () => {
fillOfficerDetails({
leadOfficer: null, // pre-populated from the export project
teamType: 'Investment (ITFG or IG)',
hqTeam: 'DIT Education',
hqTeam: 'ITFG - E-Business Projects Team',
teamMembers: null, // pre-populated from the export project
})

Expand All @@ -252,7 +237,7 @@ describe('Adding an export win from an export project', () => {
fillCreditForThisWin({
contributingOfficer: 'John',
teamType: 'Trade (TD or ST)',
hqTeam: 'Healthcare UK',
hqTeam: 'TD - Events - Education',
})

clickContinueAndAssertUrl(customerDetailsStep)
Expand Down
43 changes: 11 additions & 32 deletions test/functional/cypress/specs/export-win/add-export-win-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,33 +61,12 @@ describe('Adding an export win', () => {
}),
],
})

cy.intercept('/api-proxy/adviser/?*', {
results: [
{ id: '100', name: 'David Meyer' },
{ id: '101', name: 'John Smith' },
],
})
cy.intercept('GET', '/api-proxy/v4/metadata/team-type', [
{ id: '200', name: 'Investment (ITFG or IG)' },
{ id: '201', name: 'Trade (TD or ST)' },
])
cy.intercept('GET', '/api-proxy/v4/metadata/hq-team-region-or-post?*', [
{ id: '300', name: 'DIT Education' },
{ id: '301', name: 'Healthcare UK' },
])
cy.intercept('GET', '/api-proxy/v4/metadata/hvc', [
{ id: '400', name: 'Australia Consumer Goods & Retail: E004' },
])
cy.intercept('GET', '/api-proxy/v4/metadata/support-type', [
{
id: '500',
name: 'Market entry advice and support – DIT/FCO in UK',
},
])
cy.intercept('GET', '/api-proxy/v4/metadata/associated-programme', [
{ id: '600', name: 'Afterburner' },
])
cy.intercept('POST', '/api-proxy/v4/export-win', {
statusCode: 201,
}).as('apiPostExportWin')
Expand Down Expand Up @@ -129,15 +108,15 @@ describe('Adding an export win', () => {
fillOfficerDetails({
leadOfficer: 'David',
teamType: 'Investment (ITFG or IG)',
hqTeam: 'DIT Education',
hqTeam: 'ITFG - E-Business Projects Team',
})

clickContinueAndAssertUrl(creditForThisWinStep)

fillCreditForThisWin({
contributingOfficer: 'John',
teamType: 'Trade (TD or ST)',
hqTeam: 'Healthcare UK',
hqTeam: 'TD - Events - Education',
})

clickContinueAndAssertUrl(customerDetailsStep)
Expand Down Expand Up @@ -200,7 +179,7 @@ describe('Adding an export win', () => {
content: {
'Lead officer name': 'David Meyer',
'Team type': 'Investment (ITFG or IG)',
'HQ Team, region or post': 'DIT Education',
'HQ Team, region or post': 'ITFG - E-Business Projects Team',
'Team members (optional)': 'Not set',
},
})
Expand All @@ -214,7 +193,7 @@ describe('Adding an export win', () => {
content: {
'Did any other teams help with this win?':
'YesContributing teams and advisersContributing officer: John SmithTeam ' +
'type: Trade (TD or ST)HQ team, region or post: Healthcare UK',
'type: Trade (TD or ST)HQ team, region or post: TD - Events - Education',
},
})
})
Expand Down Expand Up @@ -286,14 +265,14 @@ describe('Adding an export win', () => {
cy.wait('@apiPostExportWin').then(({ request }) => {
expect(omit(request.body, '_csrf')).to.deep.equal({
lead_officer: '100',
team_type: '42bdaf2e-ae19-4589-9840-5dbb67b50add',
hq_team: '300',
team_type: '42bdaf2e-ae19-4589-9840-5dbb67b50add', // Investment (ITFG or IG)
hq_team: '1e5aec69-c581-4356-b0ca-1f710d3d077d', // ITFG - E-Business Projects Team
team_members: [],
advisers: [
{
adviser: '101',
hq_team: '301',
team_type: '201',
team_type: 'a4839e09-e30e-492c-93b5-8ab2ef90b891', // Trade (TD or ST)
hq_team: '2f883a06-5811-4668-878f-92a1e3de548d', // TD - Events - Education
},
],
company_contacts: ['000'],
Expand Down Expand Up @@ -323,9 +302,9 @@ describe('Adding an export win', () => {
goods_vs_services: '456e951d-a633-4f21-afde-d41381407efe',
name_of_export: 'Biscuits',
sector: 'af959812-6095-e211-a939-e4115bead28a',
hvc: '400',
type_of_support: ['500'],
associated_programme: ['600'],
hvc: '0240d283-ec44-4f33-b501-e2bf14e337b5', // Australia Consumer Goods & Retail: E004
type_of_support: ['5560d2ee-b75b-48b0-b6ca-36d43653be61'], // Market entry advice and support – DIT/FCO in UK
associated_programme: ['b6f5c31a-aa45-4ae0-89bd-2eb3ab943f76'], // Afterburner
is_personally_confirmed: true,
is_line_manager_confirmed: true,
total_expected_export_value: 5000000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@ import { clickContinueButton } from '../../support/actions'
describe('Credit for this win', () => {
const { creditForThisWin } = formFields

beforeEach(() => {
cy.intercept('GET', '/api-proxy/v4/metadata/hq-team-region-or-post?*', [
{ name: 'DIT Education' },
{ name: 'Healthcare UK' },
])
cy.visit(creditForThisWinStep)
})
beforeEach(() => cy.visit(creditForThisWinStep))

it('should render a step heading', () => {
cy.get(creditForThisWin.heading).should('have.text', 'Credit for this win')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ import {
describe('Officer details', () => {
const { officerDetails } = formFields

beforeEach(() => {
cy.intercept('GET', '/api-proxy/v4/metadata/hq-team-region-or-post?*', [
{ name: 'DIT Education' },
{ name: 'Healthcare UK' },
])
cy.visit(officerDetailsStep)
})
beforeEach(() => cy.visit(officerDetailsStep))

it('should render an officer details heading', () => {
cy.get(officerDetails.heading).should('have.text', 'Officer details')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,7 @@ import {
describe('Support provided', () => {
const { supportProvided } = formFields

beforeEach(() => {
cy.intercept('GET', '/api-proxy/v4/metadata/associated-programme', [
{ name: 'Afterburner' },
])
cy.intercept('GET', '/api-proxy/v4/metadata/support-type', [
{ name: 'Market entry advice and support – DIT/FCO in UK' },
])
cy.intercept('GET', '/api-proxy/v4/metadata/hvc', [
{ name: 'Australia Consumer Goods & Retail: E004' },
])
cy.visit(supportProvidedStep)
})
beforeEach(() => cy.visit(supportProvidedStep))

it('should render a step heading', () => {
cy.get(supportProvided.heading).should('have.text', 'Support given')
Expand Down
Loading

0 comments on commit ab1993e

Please sign in to comment.