bbc / simorgh

The BBC's Open Source Web Application. Contributions welcome! Used on some of our biggest websites, e.g.
https://www.bbc.com/thai
Other
1.39k stars 219 forks source link

WSTEAM1-1166: Adds integration tests for UGC send page #11769

Closed Isabella-Mitchell closed 1 month ago

Isabella-Mitchell commented 1 month ago

Resolves JIRA WSTEAM1-1166 - Write out integration test

Overall changes

Adds integration tests for UCG send page

Code changes

Testing

  1. Check tests pass
  2. Check tests are sufficient

Helpful Links

Add Links to useful resources related to this PR if applicable.

Coding Standards

Repository use guidelines

Isabella-Mitchell commented 1 month ago

Should we be testing submission interaction here? Like when a user presses the submit button, checking to see if a request is made to the endpoint? Always get confused what the difference is between our integration and unit tests

Looking in to this. Definitely can add a test that mocks filling in the form and clicks submit. One concern is that if fields change in the test asset then the test could be flakey. I suppose the fix for this would be getting a test asset made which we know won't change.

EDIT: I couldn't work out how to test submitting form successfully. I was able to mock clicking the submit button, but this wouldn't cause validation or submission. I think this a limitation of integration tests, though I'm certainly far from an expert. 🙈