Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
13
rated 0 times [  20] [ 7]  / answers: 1 / hits: 18776  / 10 Years ago, thu, february 20, 2014, 12:00:00

I would like to test a filtering function in my angularJS app.
In fact when I click on the filter the number of search results displayed on the page should decrease
Here is is my code so far :



    element(by.id('foundNumber')).getText().then (function(text){console.log(text); })
element(by.repeater('term in facets.uproctype').row(0)).click ()
element(by.id('foundNumber')).getText().then (function(text){console.log(text); })


And here is my console log :



Using the selenium server at http://localhost:4444/wd/hub
6209
6195
....


I don't know how can I compare theses two values in an expect line as I can't use them inside their function.
Any help?



Thanks
Zied


More From » angularjs

 Answers
25

I believe you would have to nest your then functions to ensure the original value is available.



element(by.id('foundNumber')).getText().then( function(original_text) {

element(by.repeater('term in facets.uproctype').row(0)).click ();

element(by.id('foundNumber')).getText().then( function(new_text){
expect(original_text).not.toBe(new_text);
});

});


This link also might be helpful.
https://code.google.com/p/selenium/wiki/WebDriverJs#Control_Flows


[#72417] Tuesday, February 18, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
haleeg

Total Points: 703
Total Questions: 100
Total Answers: 98

Location: Dominica
Member since Sat, Nov 5, 2022
2 Years ago
;