-
-
Notifications
You must be signed in to change notification settings - Fork 259
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
Adding _registerHook
/ _runHooks
functionality allow adding work start/end of test helpers
#878
Conversation
771e78e
to
8db15fe
Compare
addon-test-support/@ember/test-helpers/-internal/helper-hooks.ts
Outdated
Show resolved
Hide resolved
addon-test-support/@ember/test-helpers/-internal/helper-hooks.ts
Outdated
Show resolved
Hide resolved
addon-test-support/@ember/test-helpers/-internal/helper-hooks.ts
Outdated
Show resolved
Hide resolved
addon-test-support/@ember/test-helpers/-internal/helper-hooks.ts
Outdated
Show resolved
Hide resolved
addon-test-support/@ember/test-helpers/-internal/helper-hooks.ts
Outdated
Show resolved
Hide resolved
addon-test-support/@ember/test-helpers/-internal/helper-hooks.ts
Outdated
Show resolved
Hide resolved
addon-test-support/@ember/test-helpers/-internal/helper-hooks.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Robert Jackson <[email protected]>
Co-authored-by: Robert Jackson <[email protected]>
Co-authored-by: Robert Jackson <[email protected]>
addon-test-support/@ember/test-helpers/-internal/helper-hooks.ts
Outdated
Show resolved
Hide resolved
addon-test-support/@ember/test-helpers/-internal/helper-hooks.ts
Outdated
Show resolved
Hide resolved
_registerHook
/ _runHooks
functionality allow adding work start/end of test helpers
This would be a very handy thing to have for our accessibility testing also (we're hoping to contribute some back to ember-a11y-testing but still learning a lot). Is there a path to this become a stable exported api? (I noticed the words "internal" and also exports with underscores so I assume I shouldn't use them, but I would love to be wrong) |
@fivetanley this is actually precisely one of the use cases we're looking to support! The plan is definitely to have this be a publicly, supported API. We typically iterate on this type of API actively before we publish it for general consumption, as that helps validate our assumptions about the functionality. Please let us know if there's anything you need from these APIs that we're missing. |
@fivetanley this is a late follow-up, but not sure you've seen https://github.com/ember-a11y/ember-a11y-testing/blob/master/addon-test-support/setup-global-a11y-hooks.ts#L20, which is where this is used in |
Description
Adds new hooks API, allowing external code to be 'hooked' into test helpers. This adds extensibility points that will allow consumers to define additional, custom behaviors to happen at specific points in the test invocation.
A good example of where this could be used is for accessibility testing - hooking into the
visit:end
to run audits without requiring audits be explicitly written into tests themselves.Details
Adds the following public API:
This allows registering a hook for a specific helper. Hooks can be registered to run at the
start
of the function, or theend
.Example:
Registering a
fillIn
hook to be run at the start of the visit invocation:This also incorporates the previous
log
addition, which logs DOM elements, to use the new hooks API.