-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(cdk-experimental/testing): Adds a HarnessPredicate
class
#16319
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
Conversation
src/cdk-experimental/testing/protractor/protractor-harness-environment.ts
Show resolved
Hide resolved
src/cdk-experimental/testing/tests/harnesses/sub-component-harness.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
export class SubComponentHarness extends ComponentHarness { | ||
static readonly hostSelector = 'test-sub'; | ||
|
||
static with(options: {title?: string | RegExp, itemCount?: number} = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add an interface for supporting this with
pattern to more formally codify it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this pattern and I think that Harness authors should follow it, but the actual options may differ based on the particular harness being implemented, and some harnesses might not even need a with
method.
Maybe we can just say its a recommended convention and do it in all of our component harnesses where it makes sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…lar#16319) This enables users of harness authors to provide an API for querying harnesses based on arbitrary state as given by predicate functions.
This enables users of harness authors to provide an API for querying harnesses based on arbitrary state as given by predicate functions.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The
HarnessPredicate
class can be used to more easily search for component instances for aComponentHarness
that meet certain criteria (e.g. get aMatButtonHarness
with specific button text).