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

Commit dc361ce

Browse files
committed
chore(tests): Reorganize typesript tests
* 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`
1 parent c1df958 commit dc361ce

12 files changed

+46
-44
lines changed

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ spec/
2222
stress/
2323
testapp/
2424
website/
25+
exampleTypescript/*.js
26+
exampleTypescript/node_modules/
27+
exampleTypescript/tmp/
2528

2629
# Development files
2730

gulpfile.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,17 @@ gulp.task('tsc', function(done) {
9494
runSpawn(done, 'node', ['node_modules/typescript/bin/tsc']);
9595
});
9696

97+
gulp.task('tsc:spec', function(done) {
98+
runSpawn(done, 'node', ['node_modules/typescript/bin/tsc', '-p', 'ts_spec_config.json']);
99+
});
97100

98101
gulp.task('prepublish', function(done) {
99102
runSequence('checkVersion', 'jshint', 'tsc', 'built:copy', done);
100103
});
101104

102105
gulp.task('pretest', function(done) {
103106
runSequence('checkVersion',
104-
['webdriver:update', 'jshint', 'tslint', 'format'], 'tsc', 'built:copy', done);
107+
['webdriver:update', 'jshint', 'tslint', 'format'], 'tsc', 'built:copy', 'tsc:spec', done);
105108
});
106109

107110
gulp.task('default',['prepublish']);

scripts/test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ var passingTests = [
3838
'node built/cli.js spec/noGlobalsConf.js',
3939
'node built/cli.js spec/angular2Conf.js',
4040
'node built/cli.js spec/hybridConf.js',
41+
'node built/cli.js spec/built/noCFBasicConf.js',
42+
'node built/cli.js spec/built/noCFBasicConf.js --useBlockingProxy',
43+
'node built/cli.js spec/built/noCFPluginConf.js',
4144
'node scripts/driverProviderAttachSession.js',
4245
'node scripts/errorTest.js',
4346
// Interactive Element Explorer tasks

spec/install/noCF/plugin_spec.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

spec/install/test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,3 @@ install();
6262
tsc();
6363
test('tmp/conf.js');
6464
test('tmp/typescript_conf.js');
65-
test('tmp/noCFSmokeConf.js');
66-
test('tmp/noCFPluginConf.js');

spec/install/noCF/smoke_spec.ts renamed to spec/ts/basic/element_spec.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,7 @@
11
// Based off of spec/basic/elements_spec.js
22
import * as q from 'q';
33

4-
import {$, $$, browser, by, By, element, ElementArrayFinder, ElementFinder, ExpectedConditions, promise as ppromise, WebElement} from 'protractor';
5-
6-
describe('verify control flow is off', function() {
7-
it('should have set webdriver.promise.USE_PROMISE_MANAGER', () => {
8-
expect((ppromise as any).USE_PROMISE_MANAGER).toBe(false);
9-
});
10-
11-
it('should not wait on one command before starting another', async function() {
12-
// Wait forever
13-
browser.controlFlow().wait(
14-
(browser.controlFlow() as any).promise((): void => undefined) as ppromise.Promise<void>);
15-
16-
// then return
17-
await browser.controlFlow().execute(() => ppromise.when(null));
18-
});
19-
});
4+
import {$, $$, browser, by, By, element, ElementArrayFinder, ElementFinder, ExpectedConditions, promise as ppromise, WebElement} from '../../..';
205

216
describe('ElementFinder', function() {
227
it('should return the same result as browser.findElement', async function() {

spec/ts/basic/is_disabled_spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import {browser, promise as ppromise} from '../../..';
2+
3+
describe('verify control flow is off', function() {
4+
it('should have set webdriver.promise.USE_PROMISE_MANAGER', () => {
5+
expect((ppromise as any).USE_PROMISE_MANAGER).toBe(false);
6+
});
7+
8+
it('should not wait on one command before starting another', async function() {
9+
// Wait forever
10+
browser.controlFlow().wait(
11+
(browser.controlFlow() as any).promise((): void => undefined) as ppromise.Promise<void>);
12+
13+
// then return
14+
await browser.controlFlow().execute(() => ppromise.when(null));
15+
});
16+
});

spec/install/noCFSmokeConf.ts renamed to spec/ts/noCFBasicConf.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {Config} from '../..';
2-
const env = require('../../environment');
2+
const env = require('../environment.js');
33

44
export let config: Config = {
55
seleniumAddress: env.seleniumAddress,
66

77
framework: 'jasmine',
88

99
specs: [
10-
'noCF/smoke_spec.js'
10+
'basic/*_spec.js'
1111
],
1212

1313
capabilities: env.capabilities,
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
import * as q from 'q';
2-
import {Config, protractor} from 'protractor';
2+
import {Config, protractor} from '../..';
33
import {promise as wdpromise} from 'selenium-webdriver';
4-
const env = require('../../environment');
4+
const env = require('../environment.js');
55

66
export let config: Config = {
77
seleniumAddress: env.seleniumAddress,
88

99
framework: 'jasmine',
1010

1111
specs: [
12-
'noCF/plugin_spec.js'
12+
'plugin/plugin_spec.js'
1313
],
1414

1515
capabilities: env.capabilities,
1616

1717
baseUrl: env.baseUrl + '/ng1/',
1818

19+
SELENIUM_PROMISE_MANAGER: false,
20+
1921
plugins: [{
2022
inline: {
2123
onPageLoad: function() {
@@ -25,7 +27,5 @@ export let config: Config = {
2527
});
2628
}
2729
}
28-
}],
29-
30-
SELENIUM_PROMISE_MANAGER: false
30+
}]
3131
};

spec/ts/plugin/plugin_spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {browser, protractor} from '../../..';
2+
3+
describe('plugins', function() {
4+
it('should have run the onPageLoad hook', async function() {
5+
await browser.get('index.html');
6+
await expect((protractor as any).ON_PAGE_LOAD).toBe(true);
7+
});
8+
});

spec/tsconfig.json renamed to ts_spec_config.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,9 @@
77
"declaration": true,
88
"removeComments": false,
99
"noImplicitAny": true,
10-
"outDir": "built",
11-
"types": [
12-
"jasmine", "jasminewd2", "node",
13-
"chalk", "glob", "minimatch",
14-
"minimist", "optimist", "q",
15-
"selenium-webdriver"
16-
]
10+
"outDir": "spec/built"
1711
},
1812
"include": [
19-
"ts"
13+
"spec/ts/**/*"
2014
]
2115
}

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
"website",
1717
"scripts",
1818
"exampleTypescript",
19-
"spec/install"
19+
"spec/**/*"
2020
]
2121
}

0 commit comments

Comments
 (0)