2

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

Errol Green
  • 1,367
  • 5
  • 19
  • 32
  • 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 May 14 '16 at 03:07
  • @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 May 16 '16 at 14:34
  • @alecxe updated my question. – Errol Green May 16 '16 at 15:57

1 Answers1

2

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);
    
Emna Ayadi
  • 2,430
  • 8
  • 37
  • 77
  • Tried the specified solution, however I am still getting the same results. I don't believe we would even need to add timeouts for these specs as they are empty. – Errol Green May 16 '16 at 14:46
  • Check the answers for my question about time out may be that can help you! http://stackoverflow.com/questions/37070680/timed-out-waiting-for-asynchronous-script-result-while-executing-protractor-scri – Emna Ayadi May 16 '16 at 14:53
  • Updated my question, added an Error Gist and my protractor config. Could you have a look please. I took a look at your question, and made some changes to my config, however no luck.. – Errol Green May 16 '16 at 15:56
  • 1
    use framework : jasmine2 as you are using Jasmine2HtmlReporter, have you tried the test without Jasmine2HtmlReporter, may be it tooks a lot of time, try to eliminate Jasmine2HtmlReporter? – Emna Ayadi May 16 '16 at 16:13
  • 1
    I've tried using jasmine2 and produces the same result. I will try and elimate Jasmine2HtmlReporter – Errol Green May 16 '16 at 16:26
  • 1
    That was it. Thank you very much, I guess it was screwing with the proxy commands. I may need to update that module. Could you update your answer and I will mark correct. – Errol Green May 16 '16 at 16:36