opengovsg/GoGovSG

Inserting test data for E2E tests

Opened this issue · 1 comments

Context

Our E2E Directory tests test for correctness of link search, sorted by popularity and recency. To create test data, we currently create links and programmatically retrieve them within the test itself.

This has the unintended side effect that a Directory test could fail for reasons outside of the Directory flow. This would also mean more maintenance work in the future, say if the link creation flow changes.

Technical brief

Investigate potential solutions for seeding data for our E2E tests, evaluate which is best and implement

Some potential solutions:

  • Running a script to seed the test db before our E2E hooks
  • API calls to seed the db before our E2E hooks
  • TestCafe (is there a way to seed the data via TestCafe)

More Details

From #1963

Populating links within the Directory tests couples the success of the Directory tests to the success of link creation and retrieval. This has the unintended side effect that a Directory test could fail for reasons outside of the Directory flow. This would also mean more maintenance work in the future, say if the link creation flow changes. One alternative to consider is, instead of adding links and retrieving them within the web console, to run a script to seed the database before running the tests. I think this isn't a high priority task since the functionality here is complete, so I will just open it as an issue for now.

tagging @KoalaTasha to leave some thought since she worked on the upstream feature previously