thefrontside / thefrontside/interactors
Invariant Assertions
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 36
- Forks
- 2
- Avg merge
- 4m
- Merged PRs (30d)
- 2
Description
By far, Most of the time you want to make sure that an assertion is eventually true over the timeout period. In other words, it can fail any number of time up until the timeout, but the moment it passes, the entire assertion is considered to pass.
convergent assertion profile
|--- timeout ------|
(pass) F -> F -> F -> T
(pass) F-> T
(pass) T
(fail) F -> F -> F -> F -> F
However, we have encountered some cases where you want to assert some invariant is true over the course of time. For example, that a button remains enabled and visible. There is no way to do this currently with interactors.
The feature request is to add assertion methods to ensure that something is true and remains true for a certain period.
invariant assertion profile
This is the boolean inverse of the convergent assertion profile.
|--- timeout ------|
(fail) T -> T -> T -> F
(fail) T-> F
(fail) F
(pass) T -> T -> T -> T -> T
Two proposals
new assertion methods
Corresponding to each assertion method there is an equivalent "invariant" method which has the invariant assertion profile:
| Flavor | Convergent | Invariant |
|---|---|---|
| identity | is() |
remains() |
| possesion | has() |
retains() |
so to use the button as an example:
await Button("Sign In").remains({ visible: true });
await Button("Sign In").retains({ visibility: true });
assertion modifier
Another possibility is just add a "modifier" to assertions to make them invariant:
await Button("Sign In").is({ visible: true }).continously()
That seems to be simple, and would also be easier to bolt on to things like exists() and absent()
Context
Here is an example of an invariant assertion in the wild that cannot be migrated to interactors https://github.com/folio-org/stripes-core/blob/dc3bd495e00c69737bc145f36c9a2780ed31ba7e/test/bigtest/tests/login-test.js#L80-L82
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing assertion API and the linked stripes-core login-test.js example, then compare the proposed invariant methods with the assertion modifier approach. The issue names no repository files or tests; done requires an agreed API and invariant behavior covering the described pass and fail profiles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100