Protractor ,Jasmine timeout issue

后端 未结 6 1698
情书的邮戳
情书的邮戳 2021-02-10 02:10

I\'m doing e2e-testing with Protractor and Jasmine. Our application is in Angular.

I have written given getPageTimeout: 500000, allScriptsTimeout: 600

相关标签:
6条回答
  • 2021-02-10 02:47

    For people running in this issue only when using Internet Explorer as test browser try to force a new clean session every test:

    protractor-conf.js

    {"browserName": "internet explorer",
        "ie.forceCreateProcessApi": true,
        "ie.browserCommandLineSwitches": "-private",
        "ie.ensureCleanSession": "true",
        "seleniumAddress": 'http://10.0.1.XXX:4444/wd/hub'
    }
    

    Ensure that TabProcGrowth" = dword: 00000000 in Path HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main is set.

    0 讨论(0)
  • 2021-02-10 02:55

    Angular is never becoming ready in your app. The only reason why you're seeing jasmine timeout instead of protractor timeouts is because you increased your protractor timeout limit to be higher than your jasmine timeout limit. This is likely a problem with the app polling indefinitely, rather than a problem with how you're writing your test.

    From https://github.com/angular/protractor/blob/master/docs/timeouts.md:

    "Before performing any action, Protractor asks Angular to wait until the page is synchronized. This means that all timeouts and http requests are finished. If your application continuously polls $timeout or $http, it will never be registered as completely loaded. You should use the $interval service (interval.js) for anything that polls continuously (introduced in Angular 1.2rc3)."

    0 讨论(0)
  • 2021-02-10 03:00

    Try this:

    describe('Something', function()
    {
    
      it('should do something', function() {
      },500000);
    
    },500000);
    
    0 讨论(0)
  • 2021-02-10 03:01

    Try adding below code, jasmine default time 5 sec. The below code will wait for all test cases to complete it task & working fine for me. jasmine.getEnv().defaultTimeoutInterval =15000;

    onPrepare: function(){
    jasmine.getEnv().defaultTimeoutInterval =your time to set in milli second;
    }
    
    0 讨论(0)
  • 2021-02-10 03:08

    Try adding below timeoutinterval in config file

      jasmineNodeOpts: {
        defaultTimeoutInterval: 360000
      }
    
    0 讨论(0)
  • 2021-02-10 03:09

    Set in your config file eg:

    exports.config = {
       seleniumAddress: 'http://localhost:4444/wd/hub',
       suites: require('./Suites.js'),
    
       capabilities: {
          browserName: 'chrome'
       },
    
       jasmineNodeOpts: {
         showColors: true,
         defaultTimeoutInterval: 360000
       },
    
       allScriptsTimeout: 360000, 
    };
    
    0 讨论(0)
提交回复
热议问题