When clicking a button, the elements within this div receive number values. If a specific pattern is reached in the text of these elements, the test should be ended.
For instance, if there are 5 elements under the "someelement" div and three of them contain the number 5, it should output "you win". Similarly, if four elements have the number 2, it should display "you win2". The validation process should loop through all possible options. How can I create a loop to handle this?
I have managed to count the numbers in the elements easily, but now I need to find a way to continue the test until one of the expected conditions is met.
var els = element.all(by.cssContainingText('.thediv', '5'));
expect(els.count()).toBe(3);
var els2 = element.all(by.cssContainingText('.thediv', '4'));
expect(els.count()).toBe(2);