Mastering Protractor's end-to-end control flow and managing time outs

When testing an angular app using protractor, I encountered a strange issue recently. Every now and then, or since a recent update, protractor seems to stall or slow down significantly.

After investigating the problem, I discovered that a simple someElement.getText().then(...) call is taking an unusually long time to resolve; the .then(...) part never gets executed. Adding a allScriptTimeOut: 500 000 delay allows the promise to eventually resolve after about 6 minutes (which is very inconvenient!).

While waiting with allScriptTimeOut: 500 000 does work eventually, it takes too long.

An alternative solution to this slowdown is to instruct protractor to ignore Angular's promises and asynchronous tasks and proceed without waiting for them by setting

browser.ignoreSynchronization = true;

However, setting this boolean to true causes issues as it treats the entire angular app as non-angular and disregards all Angular processes. Additionally, our app is not entirely angular; some pages are non-angular. Here lies my question:

Is there a way to access the controlflow queue and monitor if any enqueued action is taking longer than 11 seconds? If so, can we set

browser.ignoreSynchronization = true
? A hypothetical code snippet would look like this:

protractor.controlflow(function(delay){
  if(delay > 11 sec){
    browser.ignoreSynchronization = true;
  }else{
    browser.ignoreSynchronization = false;
  }
});

The syntax may not be correct, but the concept is what matters most to me;

Thank you again for understanding my dilemma.

UPDATES:

Upon further inspection, Protractor can click on most buttons successfully, except for one at the bottom of the screen. Even though I scrolled to bring the button into view before clicking, it still took 6 minutes to register the click.

Why is there such a significant delay in successfully clicking on that particular button?

Answer №1

Regarding the inquiry about modifying ignoreSynchronization in a test, as of now (up to protractor 3.3.0), it is not feasible due to the absence of the variable within the control flow when using the built-in waitForAngular function (browser.ts:399). Unless this functionality is included in a future update, incorporating such a change would result in a disruptive alteration from the current functionality.

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

Divide and conquer - meteorjs

I am currently utilizing the most recent version of Meteor. Meteor is designed to keep everything within the same directory structure, like this: MeteorProject -- .meteor -- client -- imports -- server -- test -- node_modules -- packa ...

Error with Google Maps Display

My goal is to achieve two things with the code snippet below: If the geocode process is unsuccessful, I want to prevent the map from being displayed (currently, I've only hidden the error message). If the geocode process is successful, I only want t ...

Exploring through a table using JavaScript

I am struggling to search a table within my HTML for a specific term. The code I have works to an extent, but it does not account for alternatives such as searching for "what is that" when I type in "What is that". Additionally, I need the script to ignor ...

Learn how to effortlessly integrate and utilize a bpmn file in a Vue component by leveraging the raw-loader

As a newcomer to bpmn-js, I am facing the challenge of importing and utilizing a .bpmn file within a vue.js component (BPMNViewer.vue). Despite my efforts in researching, I could only find recommendations to use the raw-loader. Consequently, I am currently ...

Fade out effect in jQuery upon reloading the page

Is there anyone who can assist me with this issue? The following script snippet allows a user to delete records from a table connected to a mySQL database. <script type="text/javascript> $(document).ready(function(){ $('form.delete ...

The compiler option 'esnext.array' does not provide support for utilizing the Array.prototype.flat() method

I'm facing an issue with getting my Angular 2 app to compile while using experimental JavaScript array features like the flat() method. To enable these features, I added the esnext.array option in the tsconfig.json file, so the lib section now includ ...

the concept of peerDependencies plays a crucial role in the npm

Trying to set up my own Angular seed with Angular and Angular Material included. However, running npm install from package.json results in the following error: "peerDependencies": { "angular": "@>=1.3 <1.6", "angular-animate": "^@>=1.3 &l ...

Executing a long job in PHP (Laravel) while simultaneously making an AJAX call

Looking to create a real-time progressing bar? I attempted to incorporate this example into my Laravel project but seem to have missed a step. Here is my HTML and JavaScript code: <div style="border:1px solid black;width:500px;height:80px"> &l ...

Capture the response from an AJAX request and store it in a JavaScript variable

I've been struggling to find a solution for this issue for quite some time now without any success. Here's what I'm trying to accomplish: I need to retrieve an array from my PHP file so that I can utilize it in my JavaScript code. Example. ...

Disappearing Cloned Form Fields in jQuery

Hey there! I'm trying to duplicate a section of a form using the code below. But for some reason, the copied fields are only visible for a split-second before they disappear. Can anyone spot any errors that might be causing this strange behavior? jQu ...

Array of Objects Returned by Mongoose

Need help understanding an issue. I'm facing a problem where my API is returning the whole object as an array for one route, even though the schema is identical to another route that returns the object correctly. The only difference I can see is tha ...

"Although both jQuery and PHP are capable of setting the element attribute, it is only PHP that functions successfully

I have been trying to set an element attribute to adjust the range of a slider. Initially, I used ajax to fetch data from a php file and assign it to the attribute. The slider looked good with the value but unfortunately, it wasn't functioning as expe ...

Activating two buttons in jquery will trigger this action

I am currently working on developing a filter button that will perform different actions based on which buttons are pressed. Pressing button1 will trigger one action, while pressing button2 will trigger another action. If button1 is pressed first, followe ...

Is there a way to cycle through an array with each click?

I am currently working on implementing a slider feature that enables users to navigate through different pieces of information by clicking on arrows. However, I have encountered an issue where one arrow works correctly (forward), but the other arrow does n ...

Launch in a new window using JavaScript

Check out my interactive map here. Currently, when I click on different sections of the map, the target page opens in the same window. However, I would like it to open in a new window instead. <iframe src="http://bluewingholidays.com/map/map.html ...

Encountered an issue while trying to read properties of undefined (specifically 'meta') within a Vue 3 single-spa application

I've been working on a micro-frontend project, utilizing vue 3 and single-spa 5.9.3. Recently, I attempted to update one of the npm packages for a Micro-frontend to the latest release. The build process went smoothly, but it resulted in the following ...

What is causing the Access-Control-Allow-Origin error when using axios?

I have a simple axios code snippet: axios.get(GEO_IP) .then(res => res) .catch(err => err); In addition, I have configured some default settings for axios: axios.defaults.headers["content-type"] = "application/json"; axios.defaults.headers.common. ...

The Powerful Duo: JavaScript and Regex

Having some issues with the code snippet below, I know there's an error in my code but I can't seem to figure out what it is (tried enclosing the code in quotes but that didn't work...) var Regex = require('regex') var regex = new ...

Decoding GeoJSON: Extracting a feature from an array

I am currently working on a map project where I am drawing polygons with properties pulled from a JSON file. Each polygon is colored based on feature values in the JSON file. Here's an example of a feature in the JSON file: { "type": "Feature", " ...

The rollup-plugin-typescript is unable to identify the 'lib' option within the 'compilerOptions'

Currently, I'm following a tutorial on how to create an npm package. The tutorial can be found here. Here is the content of my tsconfig.json file: { "compilerOptions": { "target": "es5", "module": "es2015", "sourceMap": tr ...