diff --git a/scripts/test.js b/scripts/test.js index 643b5082c..8e87c5cf4 100755 --- a/scripts/test.js +++ b/scripts/test.js @@ -16,7 +16,7 @@ var passingTests = [ 'node built/cli.js spec/onPrepareFileConf.js', 'node built/cli.js spec/onPreparePromiseConf.js', 'node built/cli.js spec/onPreparePromiseFileConf.js', - // 'node built/cli.js spec/mochaConf.js', + 'node built/cli.js spec/mochaConf.js', 'node built/cli.js spec/withLoginConf.js', 'node built/cli.js spec/suitesConf.js --suite okmany', 'node built/cli.js spec/suitesConf.js --suite okspec', diff --git a/spec/mocha/lib_spec.js b/spec/mocha/lib_spec.js index 9b2f0d056..e469f8d9e 100644 --- a/spec/mocha/lib_spec.js +++ b/spec/mocha/lib_spec.js @@ -1,26 +1,26 @@ // Use the external Chai As Promised to deal with resolving promises in // expectations. -var chai = require('chai'); -var chaiAsPromised = require('chai-as-promised'); +const chai = require('chai'); +const chaiAsPromised = require('chai-as-promised'); chai.use(chaiAsPromised); -var expect = chai.expect; +const expect = chai.expect; // Chai's expect().to.exist style makes default jshint unhappy. // jshint expr:true -describe('no protractor at all', function() { - it('should still do normal tests', function() { +describe('no protractor at all', () => { + it('should still do normal tests', () => { expect(true).to.equal(true); }); }); -describe('protractor library', function() { - it.skip('should be able to skip tests', function() { +describe('protractor library', () => { + it.skip('should be able to skip tests', () => { expect(true).to.equal(false); }); - it('should expose the correct global variables', function() { + it('should expose the correct global variables', () => { expect(protractor).to.exist; expect(browser).to.exist; expect(by).to.exist; @@ -28,22 +28,26 @@ describe('protractor library', function() { expect($).to.exist; }); - it('should wrap webdriver', function() { + it('should wrap webdriver', async function() { // Mocha will report the spec as slow if it goes over this time in ms. this.slow(6000); - browser.get('index.html'); + + await browser.get('index.html'); expect(browser.getTitle()).to.eventually.equal('My AngularJS App'); }); - describe('with async tests', function() { - var finished = false; + describe('with async tests', () => { + let finished = false; - it('should wait for async operations to finish', function() { - browser.get('index.html').then(function() { finished = true; }); + it('should wait for async operations to finish', async() => { + await browser.get('index.html'); + finished = true; }); - after('verify mocha waited', function() { - if(!finished) { throw new Error('Mocha did not wait for async!'); } + after('verify mocha waited', () => { + if(!finished) { + throw new Error('Mocha did not wait for async!'); + } }); }); }); diff --git a/spec/mochaConf.js b/spec/mochaConf.js index 2bd6c74f7..0327e2a77 100644 --- a/spec/mochaConf.js +++ b/spec/mochaConf.js @@ -3,6 +3,7 @@ var env = require('./environment.js'); // A small suite to make sure the mocha framework works. exports.config = { seleniumAddress: env.seleniumAddress, + SELENIUM_PROMISE_MANAGER: false, framework: 'mocha',