Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Modal is incompatible with Protractor - #2289

Open
hazeledmands wants to merge 1 commit into
angular-ui:masterfrom
goodeggs:notify_when_no_outstanding_requests
Open

Modal is incompatible with Protractor#2289
hazeledmands wants to merge 1 commit into
angular-ui:masterfrom
goodeggs:notify_when_no_outstanding_requests

Conversation

@hazeledmands

Copy link
Copy Markdown

Protractor uses Angular's $browser.notifyWhenNoOutstandingRequests to determine when it's okay to continue sending commands via webdriver.

Right now, when Protractor does an action that results in a modal being shown, notifyWhenNoOutstandingRequests gets called immediately, often before the modal is done displaying, resulting in flakey specs.

This commit contains a failing test simulating this behavior.

Protractor uses Angular's $browser.notifyWhenNoOutstandingRequests
(https://github.com/angular/protractor/blob/f23565d5db4fbb102cfec8311ce9dfaee52e9113/lib/clientsidescripts.js#L28)
to determine when it's okay to continue sending commands via webdriver.

Right now, when Protractor does an action that results in a modal being
shown, notifyWhenNoOutstandingRequests gets called immediately, often
before the modal is done displaying, resulting in flakey specs.

This commit contains a failing test simulating this behavior.
@chrisirhc

Copy link
Copy Markdown
Contributor

This might be related to ui-bootstrap not relying on ngAnimate right now.
Note to self to take a look at this after rebasing #1772 .

@wesleycho

Copy link
Copy Markdown
Contributor

Can you take a look at this again @chrisirhc?

@wesleycho wesleycho added this to the 0.13.x milestone Apr 6, 2015
@wesleycho

Copy link
Copy Markdown
Contributor

This appears to still be an issue, likely because $modal is not completely relying on ngAnimate currently for opening the modal.

@wesleycho wesleycho modified the milestones: 0.14.3, 1.0.0 Oct 23, 2015
@wesleycho wesleycho removed this from the 1.0.0 milestone Jan 8, 2016
@wesleycho wesleycho modified the milestones: 1.0.1, 1.0.0, 1.0.2, 1.0.3, 1.0.4 Jan 8, 2016
@wesleycho wesleycho modified the milestones: Backlog, 1.1.0 Jan 17, 2016
@gjermundgaraba

Copy link
Copy Markdown

Are there any workarounds for this?

@icfantv

icfantv commented Jan 19, 2016

Copy link
Copy Markdown
Contributor

@bjaanes not to my knowledge. You may try reaching out to the StackOverflow community to cast a wider net. If you go that route, in order for people to want to help you, I would strongly encourage you to show you've done research and know exactly why the problem exists as well as creating a minimally working plunker that demonstrates the issue.

@wesleycho

Copy link
Copy Markdown
Contributor

@icfantv the test makes it obvious what the problem is - we just need to figure out what is going on that is causing it to fail. Incidentally, I did take another look at this in the past few days, but still am not sure what is causing the problem.

This is up for grabs for anyone to fix.

@icfantv

icfantv commented Jan 19, 2016

Copy link
Copy Markdown
Contributor

Ok, apologies.

@wesleycho wesleycho modified the milestone: Backlog Apr 5, 2016
@thorn0

thorn0 commented Oct 13, 2016

Copy link
Copy Markdown
Contributor

Have a look at the implementation of $browser.notifyWhenNoOutstandingRequests and you'll see why the test fails.

  self.notifyWhenNoOutstandingRequests = function(callback) {
    if (outstandingRequestCount === 0) {
      callback();
    } else {
      outstandingRequestCallbacks.push(callback);
    }
  };

If you call this function before starting an async operation (with $timeout or $http), the callback will be just executed immediately. Especially in unit tests where we have the mock $browser service, whose implementation of notifyWhenNoOutstandingRequests is even simpler:

  notifyWhenNoOutstandingRequests: function(fn) {
    fn();
  }

I haven't investigated the Protractor's side of this issue. Just saying that the test is invalid.

@ahmehri

ahmehri commented Mar 3, 2017

Copy link
Copy Markdown

@chrisirhc did this issue have been resolved?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.