Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Feature Request: Testability API changes #15585

Closed
@heathkit

Description

@heathkit

What is the current behavior?

Protractor synchronizes with Angular applications by using the whenStable() method of the Testability API to be notified when there are no more asynchronous tasks pending. This works for most cases, however there are situations in which whenStable() will not return in a reasonable amount of time, yet the application is stable enough to be tested. These include applications which:

  • have polling behavior in a $timeout callback (they should be using $interval, but this is still a * consistent problem)
  • make frequent $http calls for analytics or tracking that are unrelated to the UI.
  • have long-running $timeout calls, the result of which will not affect the UI

In these situations, users get a confusing timeout error from Protractor. We'd like to add some features to the testability API that will give users the chance to tune it for their application and get better synchronization behavior from Protractor.

Protractor also tries to provide debugging information about pending $timeout and $http tasks in the event of timeouts. The way we currently do this is complicated and not very reliable, and it would be great if we could just get this information from the Testability API directly.

These issues have previously been discussed in #14118 and the longstanding angular/protractor#169.

What is the expected behavior?

Ignore $timeout tasks with invokeApply=true

Since calling $timeout with invokeApply set won't cause a digest cycle, there's no need to wait for these tasks to finish as they won't mutate the page when they finish. This would be a breaking change for e2e tests, which were previously waiting on these timeout tasks.

ignoreHttpDomains

Add an option to the testability service (could just be a method to call) to whitelist certain domains (or url patterns). When making requests, $http would query the testability service and not increment the outstanding request count for whitelisted URLs.

Timeout Reporting

It would be helpful if we could pass a timeout and an error handler to whenStable(). If waiting for stability times out, the error handler would be called with a list of tasks that were pending (or at least a count).

Fine-grained deferred tracking

It would be nice to have an alternative to whenStable() that invokes a listener when the set of deferred tasks changes. That would give us total flexibility to decide which asynchronous tasks we need to wait for. It would be helpful to know how many tasks are pending and have some kind of detailed information about the task.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions