class
final
The Testability service provides testing hooks that can be accessed from the browser.
class Testability implements PublicTestability { increasePendingRequestCount(): number decreasePendingRequestCount(): number isStable(): boolean whenStable(doneCb: Function, timeout?: number, updateCb?: Function): void getPendingRequestCount(): number findProviders(using: any, provider: string, exactMatch: boolean): any[] }
Angular applications bootstrapped using an NgModule (via @NgModule.bootstrap
field) will also instantiate Testability by default (in both development and production modes).
For applications bootstrapped using the bootstrapApplication
function, Testability is not included by default. You can include it into your applications by getting the list of necessary providers using the provideProtractorTestingSupport()
function and adding them into the options.providers
array. Example:
import {provideProtractorTestingSupport} from '@angular/platform-browser'; await bootstrapApplication(RootComponent, providers: [provideProtractorTestingSupport()]);
increasePendingRequestCount() Deprecated |
---|
Increases the number of pending request |
|
decreasePendingRequestCount() Deprecated |
---|
Decreases the number of pending request |
|
isStable() |
---|
Whether an associated application is stable |
|
whenStable() | |||||||||
---|---|---|---|---|---|---|---|---|---|
Wait for the application to be stable with a timeout. If the timeout is reached before that happens, the callback receives a list of the macro tasks that were pending, otherwise null. | |||||||||
|
doneCb | Function | The callback to invoke when Angular is stable or the timeout expires whichever comes first. |
timeout | number | Optional. The maximum time to wait for Angular to become stable. If not specified, whenStable() will wait forever. Optional. Default is |
updateCb | Function | Optional. If specified, this callback will be invoked whenever the set of pending macrotasks changes. If this callback returns true doneCb will not be invoked and no further updates will be issued. Optional. Default is |
void
getPendingRequestCount() Deprecated |
---|
Get the number of pending requests |
|
findProviders() | |||||||||
---|---|---|---|---|---|---|---|---|---|
Find providers by name | |||||||||
|
using | any | The root element to search from |
provider | string | The name of binding variable |
exactMatch | boolean | Whether using exactMatch |
any[]
© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/core/Testability