Testability
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[]
}
Description
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()]);
Methods
increasePendingRequestCount() |
---|
Increases the number of pending request |
Deprecated pending requests are now tracked with zones. ParametersThere are no parameters. Returns
|
decreasePendingRequestCount() |
---|
Decreases the number of pending request |
Deprecated pending requests are now tracked with zones ParametersThere are no parameters. Returns
|
isStable() |
---|
Whether an associated application is stable |
ParametersThere are no parameters. Returns
|
getPendingRequestCount() |
---|
Get the number of pending requests |
Deprecated pending requests are now tracked with zones ParametersThere are no parameters. Returns
|
findProviders() |
---|
Find providers by name |