angular / protractor

E2E test framework for Angular apps
http://www.protractortest.org
MIT License
8.75k stars 2.31k forks source link

Synchronization not work with ngrx/store or ionic or ngx-bootstrap modal #4867

Open EugeneSnihovsky opened 6 years ago

EugeneSnihovsky commented 6 years ago

Hello everyone!

I have following error:

Timed out waiting for asynchronous Angular tasks to finish after 31 seconds. This may be because the current page is not an Angular application. Please see the FAQ for more details: https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular

This error happens when:

  1. I use angular for web with ngrx/store. Tests failed right aftrer beginning, after browser.get(url) action done

  2. I use angular for mobile with ionic. Tests failed on each navigation action (with ionic NavController)

  3. I use angular for web with ng-bootstrap/modal. Test fails right after I open modal (when modal instance is opened - it return promise, which resolved only after modal is closed)

No one of this bug can be fixed with browser.waitForAngularEnabled(false) locally before action. When I return browser.waitForAngularEnabled(true) after buggy navigation/modal - tests immediately freezes with same error.

Only thing that help is turn off synchronization globally with hook

'use strict';

import { browser } from 'protractor';
import { defineSupportCode, Hooks, HookScenarioResult, CallbackStepDefinition } from 'cucumber';

/**
 * Defines logic that fired before each scenario
 */
defineSupportCode(({ Before }: Hooks): void => {

    /**
     * Disables wait for angular protractor logic
     * @param {HookScenarioResult} scenario Information about current scenario
     * @param {CallbackStepDefinition} callback Callback for hook definition
     */
    Before((scenario: HookScenarioResult, done: CallbackStepDefinition) => {
        browser.waitForAngularEnabled(false)
            .then(() => done(), done);
    });

});

But after this all my programmers life turns into a nightmare. Is there a some workaround or possibility, that this will be fixed?


shamshiranees commented 5 years ago

same issue