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

Modal is incompatible with Protractor #2289

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hazeledmands
Copy link

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
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
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
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

Are there any workarounds for this?

@icfantv
Copy link
Contributor

icfantv commented Jan 19, 2016

@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
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
Copy link
Contributor

icfantv commented Jan 19, 2016

Ok, apologies.

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

thorn0 commented Oct 13, 2016

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
Copy link

ahmehri commented Mar 3, 2017

@chrisirhc did this issue have been resolved?

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

Successfully merging this pull request may close these issues.

8 participants