SuffolkLITLab / docassemble-MAVirtualCourt

Project which currently holds code for the Doc Assembly Line project, including dependencies for actual interviews.
Other
7 stars 5 forks source link

Testing: Where do helper functions belong? #614

Closed plocket closed 3 years ago

plocket commented 4 years ago

I'm not sure these functions belong in scope. This file is just to make sure that the page and browser variables can be shared across the various test helper functions. These look like helper functions for the tests, and so they would fit into tests/features/support/steps.js or another file entirely.

_Originally posted by @niharikasingh in https://github.com/SuffolkLITLab/docassemble-MAVirtualCourt/pull/597#discussion_r482635122_

Response: Functions that are just in tests/features/support/steps.js are not accessible to the actual steps. I don't think they keep that context somehow. At least, it didn't work when I tried it, but maybe I did something wrong. For that reason, I had suspected it wouldn't work in other files, though I didn't try.

I think I also saw some examples out there that used scope for this kind of thing, but maybe they were bad examples. We can make this a research issue. If there's an established practice out there, I'm interested in learning more about it.

plocket commented 4 years ago

To add: I had taken the examples to indicate that scope was a kind of shared namespace for the tests and was using it as such.