SuffolkLITLab / ALKiln

Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.
https://assemblyline.suffolklitlab.org/docs/alkiln/intro
MIT License
14 stars 4 forks source link

Cleanup Task to Delete incomplete Interviews #831

Closed michaelhofrichter closed 2 weeks ago

michaelhofrichter commented 7 months ago

A cleanup task should be to delete any incomplete interviews for the testing user. There are a couple of different API endpoints that might be useful here:

plocket commented 7 months ago

Closed wrong issue, sorry

plocket commented 7 months ago

Brainstorming:

This may have an MVP and future improvements. For example, one complication is that one interview could open another interview.

Is it possible to use the API to give every session a tag so that we can just use the tag to delete all of the user's interviews at once? Maybe using the Project name as the tag? We probably need API access to session_tags(), which I think we'd have to write ourselves. Running as an admin can get any interview, not just the current user's interview, but we can't count on that permission level.

Note: We need to use the auth of the user running the interview, not the auth of the author's API key - sometimes authors "log in" as a different user to test different functionality. I think being in an interview and making a request without a different API key would work (never needed to try it), but can we count on being present in an interview at the time we need to delete it? The user could have navigated away from the interview.

We could change how we navigate to an interview so that each "I start the interview" (or similar) Step opens a new window/tab. When we close up a Scenario, we would delete the interview associated with that window/tab before closing it.

plocket commented 4 weeks ago

Given:

Then:

Note: We are deleting the interview with API keys. Deleting robotically is slow (introducing more incidental flake) and will run into complications because at some point folks are going to log in as different users in the same test, or use some other complex behavior, and that will be much harder to account for. This is a nice-to-have, not a critical feature. We don't want to make it burdensome if we can reasonably avoid it.

Additional work our authors will have to do:

Example of an author creating (and getting back) a new API key for a user:

curl -X POST \
  https://apps-dev.suffolklitlab.org/api/user/123/api \
  -H 'Content-Type: application/json' \
  -d '{
    "key": "yourAdminAPIKeyWhateverItIs",
    "method": "none"
  }'

This can be done for absolutely any user account.

Further things to consider:

Warnings to add to the report:

New tests to write:

API tests, no warnings

API with warnings

Non-API warnings