Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Export Wins functional tests #6610

Merged
merged 2 commits into from
Mar 15, 2024
Merged

Conversation

paulgain
Copy link
Contributor

@paulgain paulgain commented Mar 14, 2024

Description of change

This refactors the Export Wins functional tests. It breaks out the unwieldy add-export-win-spec.js file (~1300 lines) into the following 5 lightweight files that do not need to be reviewed as no changes have occurred:

  1. officer-details=spec.js
  2. credit-for-this-win-spec.js
  3. customer-details-spec.js
  4. win-details-spec.js
  5. support-provided-spec.js
  6. constants.js

However, reviews are required on the following files:

  1. add-export-win-from-export-project.js - leverages the new utility methods for filling out a form.
  2. add-export-win.js (Shrunk from ~1300 lines to 372 lines) leverages the new utility methods for filling out a form.
  3. utils.js - essentially utilty functions that make it easy to fill out the fields on a given step, this is going to be extremely handy when we come to test the Export Wins editing functionality.
  4. src/client/utils/date.js - checkout the getRandomDateInRange function.

For example, to fill out the first 3 form steps of an Export Win you would:

fillOfficerDetails({
  leadOfficer: 'David',
  teamType: 'Investment (ITFG or IG)',
  hqTeam: 'DIT Education',
})

clickContinueAndAssertUrl(creditForThisWinStep)

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

clickContinueAndAssertUrl(customerDetailsStep)

fillCustomerDetails({
  contact: 'Joseph Barker',
  location: 'Scotland',
  potential: 'The company is a Medium Sized Business',
  experience: 'Never exported',
})

// ...and so on!

Going forward, if you just wanted to edit the location on the customer details step you would:

fillCustomerDetails({
  location: 'Scotland',
})

There are no visual changes.

Checklist

  • Has the branch been rebased to main?
  • Automated tests (Any of the following when applicable: Unit, Functional or End-to-End)
  • Manual compatibility testing (Browsers: Chrome, Firefox, Edge, Safari)

@paulgain paulgain requested a review from a team as a code owner March 14, 2024 13:30
Copy link

cypress bot commented Mar 14, 2024

Passing run #51916 ↗︎

0 24 0 0 Flakiness 0

Details:

PR refinements
Project: data-hub-frontend Commit: b47a70f791
Status: Passed Duration: 02:07 💡
Started: Mar 15, 2024 12:45 PM Ended: Mar 15, 2024 12:48 PM

Review all test suite changes for PR #6610 ↗︎

@paulgain paulgain changed the title Refactor export win functional tests Refactor Export Wins functional tests Mar 14, 2024
Copy link
Contributor

@peterhudec peterhudec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a couple of suggestions.

@paulgain paulgain force-pushed the refactor/functional-tests branch from 36e7c9f to d7016bc Compare March 15, 2024 12:39
@paulgain paulgain merged commit ea965f3 into main Mar 15, 2024
16 checks passed
@paulgain paulgain deleted the refactor/functional-tests branch March 15, 2024 14:01
chopkinsmade pushed a commit that referenced this pull request Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants