Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
1.9k views
by The go-to Tester (222 points)

I am using grunt-loop-mocha to execute tests for selenium webdriver. I am getting below exception:

  1) 0001_Int_@@@@_Wrapper-Final "before all" hook:
     Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.
      at Timeout.<anonymous> (C:\Users\@@@@\Documents\oa-automation-suite\oa
-automation-suite\node_modules\mocha\lib\runnable.js:226:19)

Given below is my grunt file:


module.exports = function(grunt) {
  grunt.initConfig({
        loopmocha: {
            src: ["./tests/**/*-specs.js"],
            options: {
                mocha: {
                    reporter : 'spec'
                },
                iterations: [
                    {
                        "description": "Executing tests on Chrome",
                        "DESIRED": '{"browserName": "chrome","os":"Windows","os_version":"7","browser_version":"54"}'
                    },
                    {
                        "description": "Executing tests on Firefox",
                        "DESIRED": '{"browserName": "firefox","os":"Windows","os_version":"7","browser_version":"54"}'
                    }
                ]
            }
        }
    });
    grunt.loadNpmTasks('grunt-loop-mocha');
	grunt.registerTask('test', 'loopmocha');
};

 

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)

You need to define timeout time for mocha:

                options: {
                    mocha: {
                        reporter : 'spec',
                        timeout : 30000
                    },

It should resolve your issue.

If you  do not want to specify  timeout time in your grunt file, you can even pass argument with your command as

grunt test --timeout <timeout_time_here>

e.g.

grunt test --timeout 3000

 


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...