Tips for ensuring all elements in an ng-repeat are fully displayed

Property Page Panel:

this.IncList = element.all(by.repeater('list in $ctrl.all track by list.guid'));

Code snippet for waiting for List to appear:

exports.WaitUntilListDisplayed = function(){
    browser.wait(function(){
        Panel.IncList.isDisplayed();
    },10000);
};

When attempting to use the above function in my test to wait for all items in the list to be displayed, it consistently times out. Is there a better way to wait until all elements within ng-repeat are visible?

Answer №1

There is an issue with the wait function as it does not return anything, causing the condition to always be "falsy" and resulting in a timeout exception:

exports.WaitUntilListDisplayed = function(){
    browser.wait(function() {
        return Panel.List.isDisplayed();
    }, 10000);
};

It's important to note that the page object field mentioned is named IncList, but List is being used inside the expected condition.


Furthermore, you have the option to utilize the by.exactRepeater method and exclude the "track by" portion:

this.IncList = element.all(by.exactRepeater('list in $ctrl.all'));

Answer №2

To handle multiple elements returned by Panel.List, it is important to use a Promise to check for any false values within the array returned by the isDisplayed() function:

browser.wait(function(){
  return Panel.List.isDisplayed().then(results => results.indexOf(false) == -1);
}, 5000, "some elements are not visible");

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

Looking for an example of a Three.js AnimationClip

Trying to create simple keyframed animations in threeJS with an object3D for moving, rotating, and scaling? Check out this outdated example: . However, be warned that the animation rotation has switched to quaternion in threeJS. Struggling to find a strai ...

Continuously incorporating Ajax requests into a queue

I'm currently tackling a new feature at work and find myself at a crucial point. Despite being unfamiliar with Ajax, I am determined to set up a manual queue to handle the requests instead of relying on the browser. After some research and referring t ...

Deactivating the drag feature when setting the duration of a new event in FullCalendar

Hello there! I've integrated full calendar into my Angular project and I'm facing a challenge. I want to restrict users from defining the duration of an event by holding click on an empty schedule in the weekly calendar, where each date interval ...

Is the Angular index detection failing due to issues with the $$hasKeys property in indexOf()?

Scenario: role: { roleid=3, name="admin"} availableRoles: [ { roleid=3, name="admin", $$hashKey="object:222"}, { roleid=4, name="plain user", $$hashKey="object:223"} ] currentRoles: [ { roleid=3, name="admin"} ...

Having trouble parsing XML with JavaScript

I am currently attempting to parse an XML file using JavaScript for a school assignment, and I am required to use pure JavaScript without jQuery. I am able to retrieve one value successfully, but encountering issues with another. The problem lies within m ...

Tips for testing views in ember.js using unit tests

We are currently delving into the world of Ember.js. Our development process is completely test-driven, and we aim to apply the same methodology to Ember.js. Having prior experience in test-driven development with Backbone.js apps using Jasmine or Mocha/Ch ...

The containerElement is not compatible for routing when using a menuItem in React JS

Greetings, I am fairly new to working with React.js and I am currently exploring how to implement routing using material-ui MenuItem. However, I seem to be encountering some difficulties when trying to utilize the ContainerElement feature upon clicking on ...

Tips for effectively logging data retrieved through Ajax requests

When I have content loaded via Ajax with two divs and a list, my goal is to console.log which div I was typing on when clicking on a list item. However, the issue I'm facing is that I always get the first one I clicked until I refresh the page. Altho ...

Is it possible to strip double quotes from link title attributes by using expression data?

Trying to pass the link title attribute for "Tags". The Tag value should be an array and now attempting to remove double quotes from the link title attribute. Upon hovering, currently getting: - ["text", "text 1", "text 2"]. Expected format (Text Capita ...

Accessing plugin objects with a custom www/index.html location is not possible on PhoneGap 3.x, iOs6, and iOs7 with AngularJs

Is there a way to access the javascript plugin objects and set a custom location for www/index.html? By adding the following line in project_name/www/config.xml: <content src="app/index.html" /> A custom location for the www/index.html can be load ...

The pushPage function is malfunctioning in the Onsen monaca phonegap environment

JS app.controller('categoryController', function($scope,$http){ $http.get('http://xxxxxxxxxxxx.com/public/api/v1/category').success(function(response){ $scope.myCategory = response.data; }); $scope.showSubCategory ...

The method for storing a user's choice in my array and subsequently selecting an element at random

Seeking assistance in developing a program that can play an audio list at various durations. The plan is to have the duration for elements 4 through 8 based on user selection, with the program playing each element within that range during the initial round ...

Seamless Functionality with Selenium WebDriver

I am currently working on a Java code that involves Selenium WebDriver. Everything runs smoothly until the AddItems function is called. For some reason, it fails to continue from the Login function. I have attempted various approaches such as calling both ...

Element eradicated by mysterious force - what is the reason behind this destruction?

I encountered a peculiar issue while working on a JS game demo. For some reason, one of the functions is unexpectedly deleting the container element (even though I didn't intend for it to do so). This function usually creates another element inside th ...

How to troubleshoot an Ionic exception occurring during the execution of any Ionic command?

Whenever I attempt to run an ionic command, I keep encountering this error message: { Error at FatalException.Exception (C:\Users\crist\AppData\Roaming\npm\node_modules\ionic\node_modules\@ionic\cli-u ...

Navigating following an AJAX form submission

Currently, I am delving into a problem brought to my attention by a friend. My knowledge of AJAX and jQuery is not very strong. What I have gathered so far is that when this form is submitted, it goes to the current address set_var.cgi with an index of 94, ...

Display a loading spinner by utilizing a helper function with the React context API

I'm still learning about the React Context API and I've run into an issue. I'm trying to implement a loader that starts when I make an API call and stops once the call is complete. However, when I try to dispatch actions from a helper functi ...

Video playback behaving differently on Firefox and Chrome - Can anyone explain why?

I am encountering an issue with my banner video when trying to make it stretch at 100% of the width. It seems to work perfectly on Firefox, but not on Chrome. To see an example, visit . Despite using code snippets and attempting to address compatibility is ...

Transforming ASP.NET MVC IEnumerable view model into a JSON array of elements

My goal is to develop a dynamic calendar in ASP.NET MVC that pulls event data from a database to populate it. Right now, the calendar is set up to read a json array of objects, but I am facing an issue with converting my ViewModel data into a format that t ...

What is the best way to prevent executing a method in [queryParams] in Angular 7?

I'm currently working on incorporating the option for users to open a link in a new tab. I'm trying to avoid using the (click) method, so I've come up with the following logic to achieve this: <a [routerLink]="['/search/' + sea ...