diff --git a/.npmignore b/.npmignore index 6889a17be..9cfdf4723 100644 --- a/.npmignore +++ b/.npmignore @@ -22,6 +22,9 @@ spec/ stress/ testapp/ website/ +exampleTypescript/*.js +exampleTypescript/node_modules/ +exampleTypescript/tmp/ # Development files diff --git a/gulpfile.js b/gulpfile.js index c8cf6e0ae..b1e7b5578 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -94,6 +94,9 @@ gulp.task('tsc', function(done) { runSpawn(done, 'node', ['node_modules/typescript/bin/tsc']); }); +gulp.task('tsc:spec', function(done) { + runSpawn(done, 'node', ['node_modules/typescript/bin/tsc', '-p', 'ts_spec_config.json']); +}); gulp.task('prepublish', function(done) { runSequence('checkVersion', 'jshint', 'tsc', 'built:copy', done); @@ -101,7 +104,7 @@ gulp.task('prepublish', function(done) { gulp.task('pretest', function(done) { runSequence('checkVersion', - ['webdriver:update', 'jshint', 'tslint', 'format'], 'tsc', 'built:copy', done); + ['webdriver:update', 'jshint', 'tslint', 'format'], 'tsc', 'built:copy', 'tsc:spec', done); }); gulp.task('default',['prepublish']); diff --git a/scripts/test.js b/scripts/test.js index b2f8421cd..cac0c7be4 100755 --- a/scripts/test.js +++ b/scripts/test.js @@ -38,6 +38,9 @@ var passingTests = [ 'node built/cli.js spec/noGlobalsConf.js', 'node built/cli.js spec/angular2Conf.js', 'node built/cli.js spec/hybridConf.js', + 'node built/cli.js spec/built/noCFBasicConf.js', + 'node built/cli.js spec/built/noCFBasicConf.js --useBlockingProxy', + 'node built/cli.js spec/built/noCFPluginConf.js', 'node scripts/driverProviderAttachSession.js', 'node scripts/errorTest.js', // Interactive Element Explorer tasks diff --git a/spec/install/noCF/plugin_spec.ts b/spec/install/noCF/plugin_spec.ts deleted file mode 100644 index 8f15bcc7a..000000000 --- a/spec/install/noCF/plugin_spec.ts +++ /dev/null @@ -1,8 +0,0 @@ -import {browser, protractor} from 'protractor'; - -describe('category', function() { - it('name', async function() { - await browser.get('index.html'); - await expect((protractor as any).ON_PAGE_LOAD).toBe(true); - }); -}); diff --git a/spec/install/test.js b/spec/install/test.js index f0e56b5a8..8e182e79a 100644 --- a/spec/install/test.js +++ b/spec/install/test.js @@ -62,5 +62,3 @@ install(); tsc(); test('tmp/conf.js'); test('tmp/typescript_conf.js'); -test('tmp/noCFSmokeConf.js'); -test('tmp/noCFPluginConf.js'); diff --git a/spec/install/noCF/smoke_spec.ts b/spec/ts/basic/element_spec.ts similarity index 92% rename from spec/install/noCF/smoke_spec.ts rename to spec/ts/basic/element_spec.ts index 9a218893b..18ca6a7da 100644 --- a/spec/install/noCF/smoke_spec.ts +++ b/spec/ts/basic/element_spec.ts @@ -1,22 +1,7 @@ // Based off of spec/basic/elements_spec.js import * as q from 'q'; -import {$, $$, browser, by, By, element, ElementArrayFinder, ElementFinder, ExpectedConditions, promise as ppromise, WebElement} from 'protractor'; - -describe('verify control flow is off', function() { - it('should have set webdriver.promise.USE_PROMISE_MANAGER', () => { - expect((ppromise as any).USE_PROMISE_MANAGER).toBe(false); - }); - - it('should not wait on one command before starting another', async function() { - // Wait forever - browser.controlFlow().wait( - (browser.controlFlow() as any).promise((): void => undefined) as ppromise.Promise); - - // then return - await browser.controlFlow().execute(() => ppromise.when(null)); - }); -}); +import {$, $$, browser, by, By, element, ElementArrayFinder, ElementFinder, ExpectedConditions, promise as ppromise, WebElement} from '../../..'; describe('ElementFinder', function() { it('should return the same result as browser.findElement', async function() { diff --git a/spec/ts/basic/is_disabled_spec.ts b/spec/ts/basic/is_disabled_spec.ts new file mode 100644 index 000000000..0ccc20ff8 --- /dev/null +++ b/spec/ts/basic/is_disabled_spec.ts @@ -0,0 +1,16 @@ +import {browser, promise as ppromise} from '../../..'; + +describe('verify control flow is off', function() { + it('should have set webdriver.promise.USE_PROMISE_MANAGER', () => { + expect((ppromise as any).USE_PROMISE_MANAGER).toBe(false); + }); + + it('should not wait on one command before starting another', async function() { + // Wait forever + browser.controlFlow().wait( + (browser.controlFlow() as any).promise((): void => undefined) as ppromise.Promise); + + // then return + await browser.controlFlow().execute(() => ppromise.when(null)); + }); +}); diff --git a/spec/install/noCFSmokeConf.ts b/spec/ts/noCFBasicConf.ts similarity index 78% rename from spec/install/noCFSmokeConf.ts rename to spec/ts/noCFBasicConf.ts index 0e5cf1942..e7c248894 100644 --- a/spec/install/noCFSmokeConf.ts +++ b/spec/ts/noCFBasicConf.ts @@ -1,5 +1,5 @@ import {Config} from '../..'; -const env = require('../../environment'); +const env = require('../environment.js'); export let config: Config = { seleniumAddress: env.seleniumAddress, @@ -7,7 +7,7 @@ export let config: Config = { framework: 'jasmine', specs: [ - 'noCF/smoke_spec.js' + 'basic/*_spec.js' ], capabilities: env.capabilities, diff --git a/spec/install/noCFPluginConf.ts b/spec/ts/noCFPluginConf.ts similarity index 79% rename from spec/install/noCFPluginConf.ts rename to spec/ts/noCFPluginConf.ts index 42bbfda96..fac32bf7a 100644 --- a/spec/install/noCFPluginConf.ts +++ b/spec/ts/noCFPluginConf.ts @@ -1,7 +1,7 @@ import * as q from 'q'; -import {Config, protractor} from 'protractor'; +import {Config, protractor} from '../..'; import {promise as wdpromise} from 'selenium-webdriver'; -const env = require('../../environment'); +const env = require('../environment.js'); export let config: Config = { seleniumAddress: env.seleniumAddress, @@ -9,13 +9,15 @@ export let config: Config = { framework: 'jasmine', specs: [ - 'noCF/plugin_spec.js' + 'plugin/plugin_spec.js' ], capabilities: env.capabilities, baseUrl: env.baseUrl + '/ng1/', + SELENIUM_PROMISE_MANAGER: false, + plugins: [{ inline: { onPageLoad: function() { @@ -25,7 +27,5 @@ export let config: Config = { }); } } - }], - - SELENIUM_PROMISE_MANAGER: false + }] }; diff --git a/spec/ts/plugin/plugin_spec.ts b/spec/ts/plugin/plugin_spec.ts new file mode 100644 index 000000000..2ee4cc2b5 --- /dev/null +++ b/spec/ts/plugin/plugin_spec.ts @@ -0,0 +1,8 @@ +import {browser, protractor} from '../../..'; + +describe('plugins', function() { + it('should have run the onPageLoad hook', async function() { + await browser.get('index.html'); + await expect((protractor as any).ON_PAGE_LOAD).toBe(true); + }); +}); diff --git a/spec/tsconfig.json b/ts_spec_config.json similarity index 55% rename from spec/tsconfig.json rename to ts_spec_config.json index eb8af8c8e..22227ea50 100644 --- a/spec/tsconfig.json +++ b/ts_spec_config.json @@ -7,15 +7,9 @@ "declaration": true, "removeComments": false, "noImplicitAny": true, - "outDir": "built", - "types": [ - "jasmine", "jasminewd2", "node", - "chalk", "glob", "minimatch", - "minimist", "optimist", "q", - "selenium-webdriver" - ] + "outDir": "spec/built" }, "include": [ - "ts" + "spec/ts/**/*" ] } diff --git a/tsconfig.json b/tsconfig.json index 4cc9124c4..0ac13f1d3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,6 +16,6 @@ "website", "scripts", "exampleTypescript", - "spec/install" + "spec/**/*" ] }