parent
ffbdcd2b9c
commit
4dcea96b6d
25
gulpfile.js
25
gulpfile.js
|
@ -89,6 +89,8 @@ var _exampleProtractorBoilerplateFiles = [
|
||||||
'tsconfig.json'
|
'tsconfig.json'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
var _exampleConfigFilename = 'example-config.json';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run Protractor End-to-End Specs for Doc Samples
|
* Run Protractor End-to-End Specs for Doc Samples
|
||||||
* Alias for 'run-e2e-tests'
|
* Alias for 'run-e2e-tests'
|
||||||
|
@ -221,18 +223,19 @@ function findAndRunE2eTests(filter, outputFile) {
|
||||||
// fileName; then shut down the example. All protractor output is appended
|
// fileName; then shut down the example. All protractor output is appended
|
||||||
// to the outputFile.
|
// to the outputFile.
|
||||||
function runE2eTsTests(appDir, outputFile) {
|
function runE2eTsTests(appDir, outputFile) {
|
||||||
// spawn tasks to start the app
|
// Grab protractor configuration or defaults to systemjs config.
|
||||||
var appBuildSpawnInfo;
|
try {
|
||||||
var appRunSpawnInfo;
|
var exampleConfig = fs.readJsonSync(`${appDir}/${_exampleConfigFilename}`);
|
||||||
|
} catch (e) {
|
||||||
if (fs.existsSync(path.join(appDir, 'angular-cli.json'))) {
|
exampleConfig = {
|
||||||
appBuildSpawnInfo = spawnExt('npm', ['run', 'build:cli'], { cwd: appDir });
|
build: 'tsc',
|
||||||
appRunSpawnInfo = spawnExt('npm', ['run', 'http-server:cli', '--', '-s'], { cwd: appDir });
|
run: 'http-server:e2e'
|
||||||
} else {
|
};
|
||||||
appBuildSpawnInfo = spawnExt('npm',['run','tsc'], { cwd: appDir });
|
|
||||||
appRunSpawnInfo = spawnExt('npm',['run','http-server:e2e', '--', '-s' ], { cwd: appDir });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var appBuildSpawnInfo = spawnExt('npm', ['run', exampleConfig.build], { cwd: appDir });
|
||||||
|
var appRunSpawnInfo = spawnExt('npm', ['run', exampleConfig.run, '--', '-s'], { cwd: appDir });
|
||||||
|
|
||||||
return runProtractor(appBuildSpawnInfo.promise, appDir, appRunSpawnInfo, outputFile);
|
return runProtractor(appBuildSpawnInfo.promise, appDir, appRunSpawnInfo, outputFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -841,7 +844,7 @@ function getTypingsPaths(basePath) {
|
||||||
|
|
||||||
function getExamplePaths(basePath, includeBase) {
|
function getExamplePaths(basePath, includeBase) {
|
||||||
// includeBase defaults to false
|
// includeBase defaults to false
|
||||||
return getPaths(basePath, "example-config.json", includeBase)
|
return getPaths(basePath, _exampleConfigFilename, includeBase)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDartExampleWebPaths(basePath) {
|
function getDartExampleWebPaths(basePath) {
|
||||||
|
|
|
@ -36,3 +36,4 @@ Thumbs.db
|
||||||
!config/karma.conf.js
|
!config/karma.conf.js
|
||||||
!config/protractor.conf.js
|
!config/protractor.conf.js
|
||||||
!src/typings.d.ts
|
!src/typings.d.ts
|
||||||
|
!src/tsconfig.json
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"build": "build:cli",
|
||||||
|
"run": "http-server:cli"
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"compileOnSave": false,
|
||||||
|
"compilerOptions": {
|
||||||
|
"declaration": false,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"module": "commonjs",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"noEmitOnError": true,
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"outDir": "../dist/",
|
||||||
|
"rootDir": ".",
|
||||||
|
"sourceMap": true,
|
||||||
|
"target": "es5",
|
||||||
|
"inlineSources": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"files": [
|
||||||
|
"main.ts",
|
||||||
|
"typings.d.ts"
|
||||||
|
]
|
||||||
|
}
|
|
@ -18,7 +18,7 @@
|
||||||
"webdriver:update": "webdriver-manager update",
|
"webdriver:update": "webdriver-manager update",
|
||||||
"start:webpack": "webpack-dev-server --inline --progress --port 8080",
|
"start:webpack": "webpack-dev-server --inline --progress --port 8080",
|
||||||
"test:webpack": "karma start karma.webpack.conf.js",
|
"test:webpack": "karma start karma.webpack.conf.js",
|
||||||
"build:webpack": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail",
|
"build:webpack": "rimraf dist && webpack --config config/webpack.prod.js --bail",
|
||||||
"build:cli": "ng build"
|
"build:cli": "ng build"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
/// <reference path="../_protractor/e2e.d.ts" />
|
||||||
|
describe('QuickStart E2E Tests', function () {
|
||||||
|
|
||||||
|
let expectedMsg = 'Hello from Angular 2 App with Webpack';
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
browser.get('');
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should display: ${expectedMsg}`, function () {
|
||||||
|
expect(element(by.css('h1')).getText()).toEqual(expectedMsg);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display an image', function () {
|
||||||
|
expect(element(by.css('img')).isPresent()).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"build": "build:webpack",
|
||||||
|
"run": "http-server:cli"
|
||||||
|
}
|
Loading…
Reference in New Issue