Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
chore(tests): Reorganize typesript tests
Browse files Browse the repository at this point in the history
* Moved our `/spec/install/noCF/` tests back to `/spec/ts` and restored
  `ts_spec_config.json`.
  * It turns out that typescript@~2.0.0 does support `-p config_file.json`.
    The thing it doesn't support is pointing `include` to a folder.  So rather
    than moving everything in #4062, we just needed to use globs.
* Split `smokeSpec.ts` into `is_disabled_spec.ts` and `element_spec.ts`.
* Renamed `noCFSmokeConf.ts` to `noCFBasicConf.ts` so it is more clearly
  analogous to `basicConf.js`.
* Added test using blocking proxy for `noCFBasicConf.ts`.

Also added generated `exampleTypescript/` files to `.npmignore`
  • Loading branch information
sjelin committed Feb 8, 2017
1 parent c1df958 commit dc361ce
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 44 deletions.
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ spec/
stress/
testapp/
website/
exampleTypescript/*.js
exampleTypescript/node_modules/
exampleTypescript/tmp/

# Development files

Expand Down
5 changes: 4 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,17 @@ 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);
});

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']);
3 changes: 3 additions & 0 deletions scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions spec/install/noCF/plugin_spec.ts

This file was deleted.

2 changes: 0 additions & 2 deletions spec/install/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,3 @@ install();
tsc();
test('tmp/conf.js');
test('tmp/typescript_conf.js');
test('tmp/noCFSmokeConf.js');
test('tmp/noCFPluginConf.js');
Original file line number Diff line number Diff line change
@@ -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<void>);

// 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() {
Expand Down
16 changes: 16 additions & 0 deletions spec/ts/basic/is_disabled_spec.ts
Original file line number Diff line number Diff line change
@@ -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<void>);

// then return
await browser.controlFlow().execute(() => ppromise.when(null));
});
});
4 changes: 2 additions & 2 deletions spec/install/noCFSmokeConf.ts → spec/ts/noCFBasicConf.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {Config} from '../..';
const env = require('../../environment');
const env = require('../environment.js');

export let config: Config = {
seleniumAddress: env.seleniumAddress,

framework: 'jasmine',

specs: [
'noCF/smoke_spec.js'
'basic/*_spec.js'
],

capabilities: env.capabilities,
Expand Down
12 changes: 6 additions & 6 deletions spec/install/noCFPluginConf.ts → spec/ts/noCFPluginConf.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
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,

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() {
Expand All @@ -25,7 +27,5 @@ export let config: Config = {
});
}
}
}],

SELENIUM_PROMISE_MANAGER: false
}]
};
8 changes: 8 additions & 0 deletions spec/ts/plugin/plugin_spec.ts
Original file line number Diff line number Diff line change
@@ -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);
});
});
10 changes: 2 additions & 8 deletions spec/tsconfig.json → ts_spec_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*"
]
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"website",
"scripts",
"exampleTypescript",
"spec/install"
"spec/**/*"
]
}

0 comments on commit dc361ce

Please sign in to comment.