-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Abstract locatorFor logic #4
Comments
Hi @srlee309, really appreciate your feedback, thank you! That's something we were thinking about. I really like how you abstracted the |
Hi @srlee309, thank you for your suggestion. This would look something like: export class TitleHarness extends ComponentHarness {
...
static with(
options: BaseHarnessFilters
): HarnessPredicate<TitleHarness> {
return new HarnessPredicate(TitleHarness, options);
}
}
...
getHarness(TitleHarness.with({ selector: '...' }) I totally agree that the The goal of this library is to provide a way of using existing harnesses with Cypress, but we are planning to release another library (in this repo) that will make harness writing easier. I will close this issue and add a reference to it in a new issue about harness abstraction in general. |
I just opened the issue. @srlee309 if you have any suggestions & ideas, we'd be glad to hear them 😊 |
I have two related suggestions:
Allow the harness creation to be done with a selector object
It is often the case that you want to select not just a component, but a particular instance of that component. Some examples are:
It would be useful if the harness creation allowed passing an object like the below.
Abstract verbose test harness logic
The testing harness by default needs properties for the locatorFor etc. We can abstract some of this. Ideally part of that would be creating functions to take a SelectorOptions object and do all the locatorFor logic that is required. A quick draft of something it might look like is:
See the below test harness to see how it is used.
https://github.com/srlee309/component-commands-example/blob/master/libs/example/form/.cypress/src/support/component-test-harness.ts
The text was updated successfully, but these errors were encountered: