mercredi 13 juin 2018

var is not defined in angular testing

I am tetsing an angular app in protrator and do not understand why this happens.

I have this test:

beforeEach(function() {
  
        browser.get('http://localhost:8080/#/');

...

        //name
        let name = element(by.css("*[id='field_nombre']"));
    
       }
       
        it('Scenario 1', function () {
        name.click();
        ....
It says name is not defined.

I do this:

 beforeEach(function() {
      
            browser.get('http://localhost:8080/#/');

    ...

        
           }
           
            it('Scenario 1', function () {
             //name
            let name = element(by.css("*[id='field_nombre']"));
            name.click();
            ....

And the test works. Is there any reason why it doesnt recognises teh vars initialisec inside beforeeach??

Aucun commentaire:

Enregistrer un commentaire