Skip to content

Testability.whenStable does not work for chained http calls #20921

@lyml

Description

@lyml

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

When chaining http calls the testability.whenStable callback is run after the first http call is made

Expected behavior

The when stable callback should be run after the entire chain of http calls is completed

Minimal reproduction of the problem with instructions

I have produced a repository from a clean ng new where the e2e tests demonstrates this funcionality.

https://github.com/lyml/chained-http

See also:

angular/protractor#4582

Where the problem is discussed in more detail.

What is the motivation / use case for changing the behavior?

Testabilitys whenStable is, as far as I can tell, only there to make test frameworks like protractor capable of determining when there are no more background tasks. This works properly for single http calls and chained setTimeout calls however for specifically http calls that trigger a new http call it incorrectly marks the testabity as stable.

Environment


yarn run v1.3.2
$ ng -v

Angular CLI: 1.6.0
Node: 8.9.3
OS: linux x64
Angular: 5.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.0
@angular-devkit/build-optimizer: 0.0.35
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.41
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0
@schematics/angular: 0.1.10
@schematics/schematics: 0.0.10
typescript: 2.4.2
webpack: 3.10.0

Browser:
- [x] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [x] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX

The issue is also confirmed in Angular 4.4.6

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions