phlask-map icon indicating copy to clipboard operation
phlask-map copied to clipboard

Add Cypress Tests for Suggestion Submission Flow

Open marcbachan opened this issue 4 months ago • 2 comments

Description

End-to-end tests confirming user can open form, fill it, and submit successfully.

NOTE: If working on this before #648 and #649 are completed, it is acceptable that the test will not pass. It will still help us do quick validation once they are completed by targeting the newly created resources.

  1. Add a Cypress test that performs the following actions in cypress/e2e/desktop/suggestion.cy.js
    1. Clicks on any tap on the page
    2. Clicks on the "Edit" button on the modal that appears
    3. Fills out the form, making sure to fill out all pages of the form (See: https://github.com/phlask/phlask-map/blob/develop/cypress/e2e/desktop/crowdsourcing.cy.js for a reference implementation of that)
    4. Does NOT click the "Submit" button (to avoid adding junk data to our database)
  2. If necessary, add data-cy attributes to resources in order to allow Cypress to target them for clicking/writing/etc.
    • For an example of how to target elements, see the the should successfully submit a water site for testing test in the cypress/e2e/desktop/crowdsourcing.cy.js file.
    • For an example of how components are updated to support the example above, see line 27 of the src/components/AddResourceModal/ChooseResource.jsx file.
  3. When opening a Pull Request for this story, make sure to include a video recording of the completed test to help reviewers.
    • When you run tests locally, a video of the test should automatically be recorded in the cypress/videos folder.

Complexity

~100 LOC test file; integration + mock API

marcbachan avatar Oct 08 '25 23:10 marcbachan

In thinking about this more, we could implement this as a test that expects the form to be working based on the design to be defined in this ticket.

gcardonag avatar Oct 21 '25 23:10 gcardonag

Since #649 was closed, this will get worked on when #674 is completed.

RaulBSanchez avatar Nov 18 '25 18:11 RaulBSanchez

Discussed with @marcbachan offline we're going to create a new database for the suggested edits. #674 will be edited to write the changes to the correct table, once thats closer to approval we'll work on this.

RaulBSanchez avatar Dec 07 '25 15:12 RaulBSanchez