0
votes

I'm using Protractor on Selenium, MacOS and Chrome. I'm trying to run the same test using an array of elements to provide the test data:

As I read here: Looping on a protractor test with parameters

I was trying that solution but when I run it, my test is not even found:

 for(var i = 0; casos.length; i++){

            (function(cotizacion){
                it('obtener $1,230.00 de la cotizacion', function(){
                    browser.get('https://mifel-danielarias.c9users.io');
                    login(user,pass);
                    fillVidaCotizadorForm(formData);
                    //browser.sleep(5000);
                    var primaTotal = element(by.binding('vida.primaTotal'));
                    browser.wait(EC.visibilityOf(primaTotal),4000);
                    expect(primaTotal.getText()).toBe(cotizacion);
                });
            })(casos[i].Fallecimiento);
        }

Output message:

> [14:13:01] I/hosted - Using the selenium server at
> http://localhost:4444/wd/hub [14:13:01] I/launcher - Running 1
> instances of WebDriver Started
> 
> 
> No specs found Finished in 0.003 seconds

This loop is inside my describe function and if I run the test normally without any loop, it runs flawlessly.

1
What does your Protractor config look like? - cnishina
You should not use the it block inside any loop. - Sudharsan Selvaraj
If you are looking for Data Driven Approach. You can find the way to do it. stackoverflow.com/questions/38221397/… - Optimworks
@SureshSalloju Thank you! That's exactly what I was looking for. - Fcojavmelo
@Pakitorocker Ur welcome - Optimworks

1 Answers

0
votes

As @OptimWorks mentioned in his comment, Data Driven Approach was exactly what I was looking for, and this question provided several good answers.