Protractor patiently pauses for ignore synchronization, comparing the browser's implicitTimeout to the browser.wait timeout

Whenever a button is clicked in my application, it triggers a $timeout and requires me to work with ignoreSynchronization set to true. However, I have noticed some interesting behavior during the waiting process for elements to be added to the page:

Surprisingly, the wait timeout specified in browser.wait(element, timeout, error message) does not have any effect at all. The only timeout that actually matters is the implicitTimeout set on the browser. Moreover, the ENTIRE implicit timeout is utilized, even if the element is found before the timeout ends. This results in tests always running slowly, utilizing the maximum time given.

describe('Cool Page', () =>{
  beforeEach(function(){
    browser.ignoreSynchronization = true;
    return browser.sleep(250);
  });

  afterEach(function(){
    browser.ignoreSynchronization = false;
    return browser.sleep(250);
  });

  it('can open menu with timeout', function(){
    // No timeout at this point
    coolPage.wait.ellipsesIcons().then(() =>{
       // Clicking the ellipses icons kicks off a $timeout of 100 seconds
       coolPage.ellipsesIcons.click().then(() =>{
          coolPage.wait.dropdownOptions().then(() => {
             expect(coolPage.dropdownOptions.getText()).toContain('Option 1');
          });
       });
    });
  });
})

.

  export = new CoolPage;
  class CoolPageextends PageObject {
    private elements;

    constructor(){
        super();
        ... // Lots of other stuff
        this.initWait();
    }

    ... // Initializing elements and other things

    private initWait() {
      this.wait = {
        ellipsesIcons: () => {
          // Timeout of 5 seconds will be used - regardless of isPresent resolving as true or false, the entire 5 seconds will be used
          browser.manage().timeouts().implicitlyWait(5000);
          // The 2 milliseconds passed in here does nothing at all
          browser.wait(element(by.css('.fa-ellipses-h')).isPresent(), 2, 'Ellipses Icon(...) was not present in time');
          // Must reset implicit wait back to the original 25 seconds it was set too in the conf
          browser.manage().timeouts().implicitlyWait(25000);
          return browser.sleep(150);
        },
        dropdownOptions: () => {
          // This two seconds wait WILL be used
          browser.manage().timeouts().implicitlyWait(2000);
          // This five second wait WILL NOT be used
          browser.wait(element(by.css('[name="change-status"]')).isPresent(), 5000, 'Options actions menu item was not present in time');
          browser.manage().timeouts().implicitlyWait(25000);
          return browser.sleep(150);
        },
      }
    }

Interestingly, the timeouts passed in through browser.wait have no impact here. This raises the following questions:

  • What is the actual purpose of the browser.wait timeout?
  • When and why is the implicit wait used? I thought it was solely for waiting for pages to load.
  • Is there any method to pass in a timeout that will be utilized effectively?
  • If not, is there a way for the wait to exit as soon as the condition is met, rather than running the entire timeout?

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The loading indicator fails to show up when users navigate between pages that have already been loaded in NextJS and ReactJS

What do I need: I am seeking a way to show a loading indicator whenever a user switches between pages on my website. After discovering an effective example at https://github.com/zeit/next.js/tree/canary/examples/with-loading, I implemented a similar appro ...

Vue's innate lifecycle hook

I am looking for a way to automatically run a specific function as a beforeMount hook in every component of my Vue project without having to declare it individually. Essentially, I want a default behavior where if the hook is not explicitly stated in a com ...

Challenges with cross domain iframes

I am trying to find a way to send a message from an iframe to the parent page at regular intervals, for example: Iframe Domain = www.abc.com Parent Domain = www.xyz.com I have looked into the following resources: Cross domain iframe issue If anyone ha ...

Angular UI Bootstrap Typeahead - Apply a class when the element is added to the document body

In my current project, I am utilizing angular bootstrap typeahead with multiple instances. Some of these instances are directly appended to the body using the "typeahead-append-to-body" option. Now, I have a specific instance where I need to customize the ...

Modifying an item within an array of Mongoose models

I am working with a model schema that looks like this: { _id: foo cart: { items: [ { id: number name: string, } ] } } My goal is to locate the document by its id and then modify the name value of the object in ...

"Enjoying a table header that scrolls freely with autoscroll feature

Resolved - http://jsfiddle.net/CrSpu/11704/ I'm facing an issue with a table that has autoscroll functionality. I am looking to freeze the header of the table when automatic scrolling occurs, or you can test it out using my code pen. I'm uncer ...

loop through the links using their unique identifiers

Here is my current code in Jade/Pug: #pm_language.dropdown(aria-haspopup='true', aria-expanded='false') button#langbutton.btn.btn-primary.dropdown-toggle(type='button', data-toggle='dropdown') Lang [RU] ...

Displaying JSON data dynamically by iterating through it in a loop

While working with JSON data in a loop, I noticed that the code quality does not meet my expectations. I have a feeling that I might be missing something in my approach. $(function(){ $.getJSON('data.json', function(data){ let content ...

Suggestions for improving the smoothness of the Bootstrap toggle hide/show feature

Recently completed my bootstrap toggle hide/show feature and everything seems to be functioning correctly, except for the transition between the different contents. The borders appear jagged and not smooth when activating the toggle. I suspect there may b ...

Node.js Express API returns an error status with an empty array response in a RestFul manner

Currently, I am in the process of developing a RestFull API using Node.JS to validate if a specific license plate is registered in my database (which happens to be MySQL). The endpoint that I have set up for this task is as follows: http://localhost:3009/_ ...

Retrieving the browser version with Selenium WebDriver and Ruby

Is there a way to retrieve the browser version using Ruby without having to make a system call? Look at my Ruby script below. #!/usr/bin/env ruby require "selenium-webdriver" # Using Marionette with the Ruby bindings for Selenium caps = Selenium::WebDr ...

Sending the parameter with the URL and receiving the response in return

Can the result be retrieved by calling a URL and sending specific parameters with it? For instance, if I pass two numbers along with the URL, can I receive the sum in return? The addition operation is carried out on the page being called upon. ...

Interested in learning how to filter nested tables?

After successfully integrating a filter code snippet, I encountered an issue with the filter not recognizing data tables that can only be inserted as nested tables. Due to my limited knowledge of JavaScript/CSS, I'm unsure if this problem can be resol ...

Customizing buttons on Dialogs in JavaScript to have dynamic names

There is something on my website that resembles this: $("#id").html(msg2show).dialog({ //Other attributes buttons: { "Yes": function() {//Code}, "No": function() {//Code} } ...

Let's explore further - delving into JSON & array manipulation using the foreach loop in Pure JavaScript

Although I have some experience with Java Script, I still consider myself a beginner in certain areas, particularly when it comes to accessing JSON objects and arrays. I've tried various syntax and options for accessing arrays using [], but so far, I ...

Clicking on the image "Nav" will load the div into the designated target and set its display to none. The div will

Can someone help me with loading a div into a target from an onclick using image navigation? I also need to hide the inactive divs, ensuring that only the 1st div is initially loaded when the page loads. I've tried searching for a solution but haven&a ...

Do we really need TypeScript project references when transpiling with Babel in an Electron project using Webpack?

Currently, I am in the process of setting up my project configuration and have not encountered any errors so far. However, based on my understanding of the Typescript documentation... It appears that Project references are not essential when using babel-l ...

How should you correctly display the outcome of a mathematical function on a data property in a v-for loop in VueJS?

Recently, I've been developing a dice roller using Vue for a game project. The approach involves looping through different types of dice with v-for to create buttons and display the result in an associated div element. However, despite correct console ...

What method is most effective for transferring arrays from C# to Javascript in a simple and straightforward manner?

Although there may be similar questions here, none of them are asking the exact same thing as mine. For my ASP.NET MVC4 project, I have decided to use aspx as my view engine. Within my views, I have integrated a JavaScript code that takes a table of value ...

jQuery tooltip anchored to the left side of the screen, ignoring all attempts to adjust its position

I have a jQuery tooltip that is supposed to hover over the table header, but it is displaying on the far left side of my screen with no formatting - just black text. I have attempted to use the placement and position jQuery attributes, but they do not seem ...