2
votes

I posted an issue because I thought it was a bug with something to do with Jasmine.

Here is link: https://github.com/angular/protractor/issues/3130#event-628418439

I try to run a simple request to the server. The server reply and angular shows the message but the test freezes and i get the error below.

I am new in e2e (testing in general). Am I doing something wrong or it is a bug.

protractor protractor-e2e.js 
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.0.115:54697/wd/hub
Started
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
F

Failures:
1) Registration view should ask for a proper email "The email must be a valid email address."
  Message:
    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
  Stack:
    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
        at tryOnTimeout (timers.js:224:11)
        at Timer.listOnTimeout (timers.js:198:5)

Ran 1 of 9 specs
1 spec, 1 failure
Finished in 27.718 seconds
Shutting down selenium standalone server.
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #01 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1

```

protractor --version Version 3.2.2

==UPDATE : complete test ==

'use strict';

var fulanito = {
    name: 'Fulano',
    last_name: 'De Tal',
    email: '[email protected]',
    password: 'lacontraseñadefulanito',
};

describe('Registration view', function() {

    beforeEach(function() {
        browser.get('#/account/register');
        browser.manage().logs().get('browser').then(function(browserLog) {
            console.log('log: ' + require('util').inspect(browserLog));
        });
    });

    fit('should aske for a proper email "The email must be a valid email address."', function function_name(argument) {
        var inputname = element(by.model('userData.name')).sendKeys(fulanito.name);
        var inputname = element(by.model('userData.last_name')).sendKeys(fulanito.last_name);
        var inputemail = element(by.model('userData.email')).sendKeys('fulanito@ara');
        var inputpassword = element(by.model('userData.password')).sendKeys(fulanito.password);
        var inputpassword_confirmation = element(by.model('userData.password_confirmation')).sendKeys(fulanito.password);

});

  it('should see "Registro"', function() {
        expect(element(by.css('h1')).getText()).toContain('Registro');
    });

My config file

   exports.config = {
    allScriptsTimeout: 99999, 
    // The address of a running selenium server.
    //seleniumAddress: 'http://localhost:4444/wd/hub',
    // Capabilities to be passed to the webdriver instance.
    capabilities: {
        'browserName': 'chrome'
    },
     onPrepare: function() {
        // you can also add properties to globals here
        global.host= 'http://localhost:9000/';
    },
    keepAlive: true, //intesive testing
    baseUrl: 'http://localhost:9000',
    //Stand alone: 9001 
    //baseUrl: 'http://localhost:9001',
    framework: 'jasmine',
    // Spec patterns are relative to the current working directly when
    // protractor is called.
    //specs: ['test/e2e/*.js'],
    specs: ['test/e2e/register-spec.js'],
    // Options to be passed to Jasmine-node.
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 25000, 
        isVerbose: true,
        includeStackTrace: true
    }
   };

I can see the message but Protractor Waits! until jasmine error

2
Also, please post the complete test spec (from line 1 to the last line, as is).alecxe
I remove keepAlive, but same resultshugomosh

2 Answers

1
votes

It turns out that there is an error in my code and possible a bug.

  fit('should aske for a proper email "The email must be a valid email address."', function function_name(argument) {
        var inputname = element(by.model('userData.name')).sendKeys(fulanito.name);
        var inputname = element(by.model('userData.last_name')).sendKeys(fulanito.last_name);
        var inputemail = element(by.model('userData.email')).sendKeys('fulanito@ara');
        var inputpassword = element(by.model('userData.password')).sendKeys(fulanito.password);
        var inputpassword_confirmation = element(by.model('userData.password_confirmation')).sendKeys(fulanito.password);

});

The stupid error is that I used the autocomplete for function: function function_name(argument) {} and that causes the error. So one must put : function () {} without the argument. : |

0
votes

Just to clarify, this argument is designed to be a done function/callback. If you specify it, you have to call it manually when the test is finished. If you don't call it, the test would freeze until a jasmine global timeout is reached. This is exactly what is happening in this case.