2
votes

I'm receiving very strange test spec behavior when trying to run my jasmine specs with protractor.

I have two empty specs that both should pass, however my first spec passes then all proceeding specs fail. I believe this may have something to do with the version levels, as when I did an update it caused my jasmine test cases to break.

  • Protractor 3.3.0
  • Jasmine 2.4.1

Test specs

 it('test spec 1', function () {

 });

 it('test spec 2', function () {

 });

Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.

'use strict';
exports.config = {

    seleniumAddress: 'http://127.0.0.1:4723/wd/hub',
    baseUrl: 'http://10.0.2.2:' + (process.env.HTTP_PORT || '8000'),
    specs: [
        './e2e-test.js'

    ],
    framework: 'jasmine',
    jasmineNodeOpts: {
        showColors: true,
        isVerbose: true,
        defaultTimeoutInterval: 30000,
        print: function() {}
    },
    capabilities: {
        deviceName:"Samsung S7",
        platformName: 'Android',
        'appium-version': '1.4.16',
        platformVersion:'23',
        app: 'C:/Users/egreen/Desktop/Android/foo/platforms/android/build/outputs/apk/android-debug.apk',
        browserName:'',
        udid:'988627534e4c383848',
        autoWebview: true

    },

    // A callback function called when tests are started
    onPrepare: function () {

        var wd = require('wd'),
            protractor = require('protractor'),
            wdBridge = require('wd-bridge')(protractor, wd);
        wdBridge.initFromProtractor(exports.config);
        require('jasmine-reporters');
        var fs = require('fs'),
            d = new Date(),
            date = [
                d.getFullYear(),
                ('0' + (d.getMonth() + 1)).slice(-2),
                ('0' + d.getDate()).slice(-2)
            ].join('-'),
            time = [
                ('0'+d.getHours()).slice(-2),
                (('0'+d.getMinutes()).slice(-2)),
                ('0'+d.getSeconds()).slice(-2)
            ].join('');


        var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
        jasmine.getEnv().addReporter(
            new Jasmine2HtmlReporter({
                savePath: 'target/reports/mobile-app/'+date+'/'+time+'/',
                screenshotsFolder: 'images'
            })
        );
        var SpecReporter = require('jasmine-spec-reporter');
        jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));

    },
};

Error gist

1
Are you sure this is happening in this particular test? Could you provide the complete contents of the file and your protractor config? Thanks!alecxe
@alecxe Yes, I'm certain this is happening in these tests. Its very strange behavior. I should also add that I am using Appium. So it may also be an issue with that framework. I will add the contents of my config shortly.Errol Green
@alecxe updated my question.Errol Green

1 Answers

2
votes

Updated :

  • Try to eliminate Jasmine2HtmlReporter.

  • Try to add :

      describe("long asynchronous specs", function() {
        beforeEach(function(done) {
          done();
        }, 10000);
       // Your code here 
    
       afterEach(function(done) {
          done();
        }, 10000);
      }
    

    You can also have a look into : Jasmine Asynchronous Support

  • Or try to add time out here :

     it('test spec 1', function () {
    
     },1000);
    
     it('test spec 2', function () {
    
     },1000);