build: switch example e2e tests to bazel (#28402)

* No longer builds the example e2e tests using "tsc". The examples are now built with Bazel and can therefore be built with Ivy by using the `--define=compile=aot` switch.
* No longer runs the example e2e tests using the protractor CLI. example e2e tests are executed with the Bazel protractor rule and can therefore run incrementally.

NOTE: Unit tests found within the examples are still running within the legacy jobs.

PR Close #28402
This commit is contained in:
Paul Gschwendtner
2019-01-28 19:21:10 -08:00
committed by Jason Aden
parent 12b8a6e351
commit ef78e33560
103 changed files with 898 additions and 416 deletions
+1 -4
View File
@@ -397,7 +397,6 @@ jobs:
- *define_env_vars
- *yarn_install
- run: yarn tsc -p packages
- run: yarn tsc -p packages/examples
- run: yarn tsc -p modules
- run: yarn karma start ./karma-js.conf.js --single-run --browsers=ChromeNoSandbox
@@ -424,7 +423,6 @@ jobs:
command: ./scripts/saucelabs/start-tunnel.sh
background: true
- run: yarn tsc -p packages
- run: yarn tsc -p packages/examples
- run: yarn tsc -p modules
# Waits for the Saucelabs tunnel to be ready. This ensures that we don't run tests
# too early without Saucelabs not being ready.
@@ -452,10 +450,9 @@ jobs:
- run: ./scripts/build-e2e-tests.sh --use-existing-packages-dist
- run:
name: Starting servers for e2e tests
command: yarn gulp serve serve-examples
command: yarn gulp serve
background: true
- run: NODE_PATH=$NODE_PATH:./dist/all yarn protractor ./protractor-e2e.conf.js --bundles=true
- run: NODE_PATH=$NODE_PATH:./dist/all yarn protractor ./protractor-examples-e2e.conf.js --bundles=true
- run: NODE_PATH=$NODE_PATH:./dist/all yarn protractor ./protractor-perf.conf.js --bundles=true --dryrun
legacy-misc-tests:
-1
View File
@@ -39,7 +39,6 @@ gulp.task('source-map-test', loadTask('source-map-test'));
gulp.task('tools:build', loadTask('tools-build'));
gulp.task('check-cycle', loadTask('check-cycle'));
gulp.task('serve', loadTask('serve', 'default'));
gulp.task('serve-examples', loadTask('serve', 'examples'));
gulp.task('changelog', loadTask('changelog'));
gulp.task('check-env', () => {/* this is a noop because the env test ran already above */});
gulp.task('cldr:extract', loadTask('cldr', 'extract'));
+2 -2
View File
@@ -38,12 +38,14 @@
"@bazel/karma": "~0.22.1",
"@bazel/typescript": "~0.22.1",
"@schematics/angular": "^7.0.4",
"@types/angular": "^1.6.47",
"@types/chokidar": "1.7.3",
"@types/convert-source-map": "^1.5.1",
"@types/diff": "^3.2.2",
"@types/fs-extra": "4.0.2",
"@types/hammerjs": "2.0.35",
"@types/jasmine": "^2.8.8",
"@types/jasminewd2": "^2.0.6",
"@types/mock-fs": "^3.6.30",
"@types/node": "^10.9.4",
"@types/selenium-webdriver": "3.0.7",
@@ -98,9 +100,7 @@
"@bazel/bazel": "~0.22.0",
"@bazel/buildifier": "^0.19.2",
"@bazel/ibazel": "~0.9.0",
"@types/angular": "^1.6.47",
"@types/base64-js": "1.2.5",
"@types/jasminewd2": "^2.0.4",
"@types/minimist": "^1.2.0",
"@types/systemjs": "0.19.32",
"browserstacktunnel-wrapper": "2.0.1",
+4
View File
@@ -0,0 +1,4 @@
exports_files([
"index.html",
"tsconfig-e2e.json",
])
+6 -19
View File
@@ -7,28 +7,15 @@ behavior) just like an Angular application developer would write.
# Running the examples
```
# # execute the following command only when framework code changes
./build.sh
# Serving individual examples (e.g. common)
yarn bazel run //packages/examples/common:devserver
# run when test change
./packages/examples/build.sh
# start server
$(npm bin)/gulp serve-examples
# "core" examples
yarn bazel run //packages/examples/core:devserver
```
navigate to [http://localhost:8001](http://localhost:8001)
# Running the tests
```
# run only when framework code changes
./build.sh
# run to compile tests and run them
./packages/examples/test.sh
```
NOTE: sometimes the http server does not exit properly and it retains the `8001` port.
in such a case you can use `lsof -i:8001` to see which process it is and then use `kill`
to remove it. (Or in single command: `lsof -i:8001 -t | xargs kill`)
yarn bazel test //packages/examples/...
```
-21
View File
@@ -1,21 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
(function(global: any) {
writeScriptTag('/vendor/zone.js');
writeScriptTag('/vendor/task-tracking.js');
writeScriptTag('/vendor/system.js');
writeScriptTag('/vendor/Reflect.js');
writeScriptTag('/_common/system-config.js');
if (location.pathname.indexOf('/upgrade/') != -1) {
writeScriptTag('/vendor/angular.js');
}
function writeScriptTag(scriptUrl: string, onload: string = '') {
document.write('<script src="' + scriptUrl + '" onload="' + onload + '"></script>');
}
}(window));
-26
View File
@@ -1,26 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/* tslint:disable:no-console */
import * as webdriver from 'selenium-webdriver';
declare var browser: any;
declare var expect: any;
// TODO (juliemr): remove this method once this becomes a protractor plugin
export function verifyNoBrowserErrors() {
browser.manage().logs().get('browser').then(function(browserLog: any[]) {
const errors: any[] = [];
browserLog.filter(logEntry => {
const msg = logEntry.message;
console.log('>> ' + msg);
if (logEntry.level.value >= webdriver.logging.Level.INFO.value) {
errors.push(msg);
}
});
expect(errors).toEqual([]);
});
}
-16
View File
@@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon" />
<script type="text/javascript" src="bootstrap.js"></script>
<script type="text/javascript">
System.import('main-dynamic').catch(console.error.bind(console));
</script>
</head>
<body>
<example-app>
loading...
</example-app>
</body>
</html>
-19
View File
@@ -1,19 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/*
DO NOT DELETE THIS FILE
=======================
The purpose of this file is to allow `main-dynamic.ts` to be tsc-compiled
BEFORE it is copied over to each of the associated example directories
within `dist/examples`.
*/
export class AppModule {};
@@ -1,36 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
System.config({
defaultJSExtensions: true,
map: {
'@angular/common': '/vendor/@angular/common/bundles/common.umd.js',
'@angular/compiler': '/vendor/@angular/compiler/bundles/compiler.umd.js',
'@angular/animations': '/vendor/@angular/animations/bundles/animations.umd.js',
'@angular/animations/browser': '/vendor/@angular/animations/bundles/animations-browser.umd.js',
'@angular/platform-browser/animations':
'/vendor/@angular/platform-browser/bundles/platform-browser-animations.umd.js',
'@angular/core': '/vendor/@angular/core/bundles/core.umd.js',
'@angular/forms': '/vendor/@angular/forms/bundles/forms.umd.js',
'@angular/http': '/vendor/@angular/forms/bundles/http.umd.js',
'@angular/platform-browser':
'/vendor/@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic':
'/vendor/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/router': '/vendor/@angular/router/bundles/router.umd.js',
'@angular/upgrade': '/vendor/@angular/upgrade/bundles/upgrade.umd.js',
'@angular/upgrade/static': '/vendor/@angular/upgrade/bundles/upgrade-static.umd.js',
'rxjs': '/vendor/rxjs'
},
packages: {
'rxjs/ajax': {main: 'index.js', defaultExtension: 'js'},
'rxjs/operators': {main: 'index.js', defaultExtension: 'js'},
'rxjs/testing': {main: 'index.js', defaultExtension: 'js'},
'rxjs/websocket': {main: 'index.js', defaultExtension: 'js'},
'rxjs': {main: 'index.js', defaultExtension: 'js'},
},
});
-44
View File
@@ -1,44 +0,0 @@
#!/usr/bin/env bash
set -u -e -o pipefail
#
# This script is used to compile and copy the contents for each of
# example directories over to the dist/examples directory so that they
# can be tested with karma and protractor. The `gulp serve-examples` command
# can be used to run each of the examples in isolation via http as well.
#
(
cd `dirname $0`
DIST="../../dist/examples";
rm -rf -- $DIST
$(npm bin)/tsc -p ./tsconfig-build.json --importHelpers false
mkdir $DIST/vendor/
ln -s ../../../dist/packages-dist/ $DIST/vendor/@angular
for FILE in \
../../../node_modules/angular/angular.js \
../../../node_modules/zone.js/dist/zone.js \
../../../node_modules/zone.js/dist/task-tracking.js \
../../../node_modules/systemjs/dist/system.js \
../../../node_modules/reflect-metadata/Reflect.js \
../../../node_modules/rxjs
do
ln -s $FILE $DIST/vendor/`basename $FILE`
done
for MODULE in `find . -name module.ts`; do
FINAL_DIR_PATH=$DIST/`dirname $MODULE`
echo "==== $MODULE"
cp _common/*.html $FINAL_DIR_PATH
cp $DIST/_common/*.js $FINAL_DIR_PATH
cp $DIST/_common/*.js.map $FINAL_DIR_PATH
find `dirname $MODULE` -name \*.css -exec cp {} $FINAL_DIR_PATH \;
done
)
+63
View File
@@ -0,0 +1,63 @@
package(default_visibility = ["//visibility:public"])
load("//packages/bazel:index.bzl", "protractor_web_test_suite")
load("//tools:defaults.bzl", "ng_module", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
ng_module(
name = "common_examples",
srcs = glob(
["**/*.ts"],
exclude = ["**/*_spec.ts"],
),
# TODO: FW-1004 Type checking is currently not complete.
type_check = False,
deps = [
"//packages/common",
"//packages/core",
"//packages/platform-browser",
"//packages/platform-browser-dynamic",
"//packages/router",
"@rxjs",
],
)
ts_library(
name = "common_tests_lib",
testonly = True,
srcs = glob(["**/*_spec.ts"]),
tsconfig = "//packages/examples:tsconfig-e2e.json",
deps = [
"//packages/examples/test-utils",
"//packages/private/testing",
"@ngdeps//@types/jasminewd2",
"@ngdeps//protractor",
],
)
ts_devserver(
name = "devserver",
entry_module = "@angular/examples/common/main",
index_html = "//packages/examples:index.html",
port = 4200,
scripts = ["@ngdeps//node_modules/tslib:tslib.js"],
static_files = [
"@ngdeps//node_modules/zone.js:dist/zone.js",
# This is needed because the "ngComponentOutlet" test uses the JIT compiler
# and needs to be able to read metadata at runtime.
"@ngdeps//node_modules/reflect-metadata:Reflect.js",
],
deps = [":common_examples"],
)
protractor_web_test_suite(
name = "protractor_tests",
data = ["//packages/bazel/src/protractor/utils"],
on_prepare = ":start-server.js",
server = ":devserver",
deps = [
":common_tests_lib",
"@ngdeps//protractor",
"@ngdeps//selenium-webdriver",
],
)
@@ -8,7 +8,7 @@
import {$, browser, by, element, protractor} from 'protractor';
import {verifyNoBrowserErrors} from '../../../../_common/e2e_util';
import {verifyNoBrowserErrors} from '../../../../test-utils';
function waitForElement(selector: string) {
@@ -21,10 +21,9 @@ describe('Location', () => {
afterEach(verifyNoBrowserErrors);
it('should verify paths', () => {
browser.get('/common/location/ts/#/bar/baz');
browser.get('/location/#/bar/baz');
waitForElement('hash-location');
expect(element.all(by.css('path-location code')).get(0).getText())
.toEqual('/common/location/ts');
expect(element.all(by.css('path-location code')).get(0).getText()).toEqual('/location');
expect(element.all(by.css('hash-location code')).get(0).getText()).toEqual('/bar/baz');
});
});
@@ -17,14 +17,13 @@ import {PathLocationComponent} from './path_location_component';
selector: 'example-app',
template: `<hash-location></hash-location><path-location></path-location>`
})
export class ExampleAppComponent {
export class AppComponent {
}
@NgModule({
declarations: [ExampleAppComponent, PathLocationComponent, HashLocationComponent],
declarations: [AppComponent, PathLocationComponent, HashLocationComponent],
providers: [{provide: APP_BASE_HREF, useValue: '/'}],
imports: [BrowserModule],
bootstrap: [ExampleAppComponent]
})
export class AppModule {
}
@@ -5,9 +5,8 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import * as mod from './module';
if (mod.AppModule) {
platformBrowserDynamic().bootstrapModule(mod.AppModule);
}
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {TestsAppModuleNgFactory} from './test_module.ngfactory';
platformBrowserDynamic().bootstrapModuleFactory(TestsAppModuleNgFactory);
@@ -7,7 +7,8 @@
*/
import {$, ExpectedConditions, browser, by, element} from 'protractor';
import {verifyNoBrowserErrors} from '../../../../_common/e2e_util';
import {verifyNoBrowserErrors} from '../../../../test-utils';
function waitForElement(selector: string) {
const EC = ExpectedConditions;
@@ -7,21 +7,22 @@
*/
import {CommonModule} from '@angular/common';
import {Compiler, Component, Injectable, Injector, NgModule, NgModuleFactory} from '@angular/core';
import {COMPILER_OPTIONS, Compiler, CompilerFactory, Component, Injectable, Injector, NgModule, NgModuleFactory} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {JitCompilerFactory} from '@angular/platform-browser-dynamic';
// #docregion SimpleExample
@Component({selector: 'hello-world', template: 'Hello World!'})
class HelloWorld {
export class HelloWorld {
}
@Component({
selector: 'ng-component-outlet-simple-example',
template: `<ng-container *ngComponentOutlet="HelloWorld"></ng-container>`
})
class NgTemplateOutletSimpleExample {
export class NgTemplateOutletSimpleExample {
// This field is necessary to expose HelloWorld to the template.
HelloWorld = HelloWorld;
}
@@ -29,7 +30,7 @@ class NgTemplateOutletSimpleExample {
// #docregion CompleteExample
@Injectable()
class Greeter {
export class Greeter {
suffix = '!';
}
@@ -37,7 +38,7 @@ class Greeter {
selector: 'complete-component',
template: `Complete: <ng-content></ng-content> <ng-content></ng-content>{{ greeter.suffix }}`
})
class CompleteComponent {
export class CompleteComponent {
constructor(public greeter: Greeter) {}
}
@@ -48,7 +49,7 @@ class CompleteComponent {
injector: myInjector;
content: myContent"></ng-container>`
})
class NgTemplateOutletCompleteExample {
export class NgTemplateOutletCompleteExample {
// This field is necessary to expose CompleteComponent to the template.
CompleteComponent = CompleteComponent;
myInjector: Injector;
@@ -64,7 +65,7 @@ class NgTemplateOutletCompleteExample {
// #docregion NgModuleFactoryExample
@Component({selector: 'other-module-component', template: `Other Module Component!`})
class OtherModuleComponent {
export class OtherModuleComponent {
}
@Component({
@@ -73,7 +74,7 @@ class OtherModuleComponent {
<ng-container *ngComponentOutlet="OtherModuleComponent;
ngModuleFactory: myModule;"></ng-container>`
})
class NgTemplateOutletOtherModuleExample {
export class NgTemplateOutletOtherModuleExample {
// This field is necessary to expose OtherModuleComponent to the template.
OtherModuleComponent = OtherModuleComponent;
myModule: NgModuleFactory<any>;
@@ -91,19 +92,7 @@ class NgTemplateOutletOtherModuleExample {
<hr/>
<ng-component-outlet-other-module-example></ng-component-outlet-other-module-example>`
})
class ExampleApp {
}
@NgModule({
imports: [BrowserModule],
declarations: [
ExampleApp, NgTemplateOutletSimpleExample, NgTemplateOutletCompleteExample,
NgTemplateOutletOtherModuleExample, HelloWorld, CompleteComponent
],
entryComponents: [HelloWorld, CompleteComponent],
bootstrap: [ExampleApp]
})
export class AppModule {
export class AppComponent {
}
@NgModule({
@@ -113,3 +102,26 @@ export class AppModule {
})
export class OtherModule {
}
export function createCompiler(compilerFactory: CompilerFactory) {
return compilerFactory.createCompiler();
}
@NgModule({
imports: [BrowserModule],
declarations: [
AppComponent, NgTemplateOutletSimpleExample, NgTemplateOutletCompleteExample,
NgTemplateOutletOtherModuleExample, HelloWorld, CompleteComponent
],
entryComponents: [HelloWorld, CompleteComponent],
providers: [
// Setup the JIT compiler that is not set up by default because the examples
// are bootstrapped using their NgModule factory. Since this example uses the
// JIT compiler, we manually set it up for this module.
{provide: COMPILER_OPTIONS, useValue: {}, multi: true},
{provide: CompilerFactory, useClass: JitCompilerFactory, deps: [COMPILER_OPTIONS]},
{provide: Compiler, useFactory: createCompiler, deps: [CompilerFactory]}
]
})
export class AppModule {
}
@@ -7,7 +7,7 @@
*/
import {$, ExpectedConditions, browser, by, element} from 'protractor';
import {verifyNoBrowserErrors} from '../../../../_common/e2e_util';
import {verifyNoBrowserErrors} from '../../../../test-utils';
function waitForElement(selector: string) {
const EC = ExpectedConditions;
@@ -16,7 +16,7 @@ function waitForElement(selector: string) {
}
describe('ngIf', () => {
const URL = 'common/ngIf/ts/';
const URL = '/ngIf';
afterEach(verifyNoBrowserErrors);
describe('ng-if-simple', () => {
+6 -7
View File
@@ -21,7 +21,7 @@ import {Subject} from 'rxjs';
<div *ngIf="show">Text to show</div>
`
})
class NgIfSimple {
export class NgIfSimple {
show: boolean = true;
}
// #enddocregion
@@ -37,7 +37,7 @@ class NgIfSimple {
<ng-template #elseBlock>Alternate text while primary text is hidden</ng-template>
`
})
class NgIfElse {
export class NgIfElse {
show: boolean = true;
}
// #enddocregion
@@ -56,7 +56,7 @@ class NgIfElse {
<ng-template #elseBlock>Alternate text while primary text is hidden</ng-template>
`
})
class NgIfThenElse implements OnInit {
export class NgIfThenElse implements OnInit {
thenBlock: TemplateRef<any>|null = null;
show: boolean = true;
@@ -85,7 +85,7 @@ class NgIfThenElse implements OnInit {
<ng-template #loading let-user>Waiting... (user is {{user|json}})</ng-template>
`
})
class NgIfAs {
export class NgIfAs {
userObservable = new Subject<{first: string, last: string}>();
first = ['John', 'Mike', 'Mary', 'Bob'];
firstIndex = 0;
@@ -116,13 +116,12 @@ class NgIfAs {
<hr>
`
})
class ExampleApp {
export class AppComponent {
}
@NgModule({
imports: [BrowserModule],
declarations: [ExampleApp, NgIfSimple, NgIfElse, NgIfThenElse, NgIfAs],
bootstrap: [ExampleApp]
declarations: [AppComponent, NgIfSimple, NgIfElse, NgIfThenElse, NgIfAs],
})
export class AppModule {
}
@@ -7,7 +7,7 @@
*/
import {$, ExpectedConditions, browser, by, element} from 'protractor';
import {verifyNoBrowserErrors} from '../../../../_common/e2e_util';
import {verifyNoBrowserErrors} from '../../../../test-utils';
function waitForElement(selector: string) {
const EC = ExpectedConditions;
@@ -16,7 +16,7 @@ function waitForElement(selector: string) {
}
describe('ngTemplateOutlet', () => {
const URL = 'common/ngTemplateOutlet/ts/';
const URL = '/ngTemplateOutlet';
afterEach(verifyNoBrowserErrors);
describe('ng-template-outlet-example', () => {
@@ -26,7 +26,7 @@ import {BrowserModule} from '@angular/platform-browser';
<ng-template #svk let-person="localSk"><span>Ahoj {{person}}!</span></ng-template>
`
})
class NgTemplateOutletExample {
export class NgTemplateOutletExample {
myContext = {$implicit: 'World', localSk: 'Svet'};
}
// #enddocregion
@@ -36,13 +36,12 @@ class NgTemplateOutletExample {
selector: 'example-app',
template: `<ng-template-outlet-example></ng-template-outlet-example>`
})
class ExampleApp {
export class AppComponent {
}
@NgModule({
imports: [BrowserModule],
declarations: [ExampleApp, NgTemplateOutletExample],
bootstrap: [ExampleApp]
declarations: [AppComponent, NgTemplateOutletExample],
})
export class AppModule {
}
@@ -58,7 +58,7 @@ export class AsyncObservablePipeComponent {
// protractor will not see us. Also we want to have this outside the docregion so as not to confuse
// the reader.
function setInterval(fn: Function, delay: number) {
const zone = Zone.current;
const zone = (window as any)['Zone'].current;
let rootZone = zone;
while (rootZone.parent) {
rootZone = rootZone.parent;
@@ -7,7 +7,7 @@
*/
import {$, ExpectedConditions, browser, by, element} from 'protractor';
import {verifyNoBrowserErrors} from '../../../../_common/e2e_util';
import {verifyNoBrowserErrors} from '../../../../test-utils';
function waitForElement(selector: string) {
const EC = ExpectedConditions;
@@ -17,7 +17,7 @@ function waitForElement(selector: string) {
describe('pipe', () => {
afterEach(verifyNoBrowserErrors);
const URL = '/common/pipes/ts/';
const URL = '/pipes';
describe('async', () => {
it('should resolve and display promise', () => {
+6 -6
View File
@@ -59,19 +59,19 @@ import {TitleCasePipeComponent} from './titlecase_pipe';
<keyvalue-pipe></keyvalue-pipe>
`
})
export class ExampleAppComponent {
export class AppComponent {
}
@NgModule({
declarations: [
AsyncPromisePipeComponent, AsyncObservablePipeComponent, ExampleAppComponent, JsonPipeComponent,
AsyncPromisePipeComponent, AsyncObservablePipeComponent, AppComponent, JsonPipeComponent,
DatePipeComponent, DeprecatedDatePipeComponent, LowerUpperPipeComponent, TitleCasePipeComponent,
NumberPipeComponent, PercentPipeComponent, DeprecatedPercentPipeComponent,
CurrencyPipeComponent, DeprecatedCurrencyPipeComponent, SlicePipeStringComponent,
SlicePipeListComponent, I18nPluralPipeComponent, I18nSelectPipeComponent, KeyValuePipeComponent
NumberPipeComponent, DeprecatedNumberPipeComponent, PercentPipeComponent,
DeprecatedPercentPipeComponent, CurrencyPipeComponent, DeprecatedCurrencyPipeComponent,
SlicePipeStringComponent, SlicePipeListComponent, I18nPluralPipeComponent,
I18nSelectPipeComponent, KeyValuePipeComponent
],
imports: [BrowserModule],
bootstrap: [ExampleAppComponent]
})
export class AppModule {
}
+17
View File
@@ -0,0 +1,17 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const protractorUtils = require('@angular/bazel/protractor-utils');
const protractor = require('protractor');
module.exports = async function(config) {
const {port} = await protractorUtils.runServer(config.workspace, config.server, '-port', []);
const serverUrl = `http://localhost:${port}`;
protractor.browser.baseUrl = serverUrl;
};
+41
View File
@@ -0,0 +1,41 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Component, NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import * as locationExample from './location/ts/module';
import * as ngComponentOutletExample from './ngComponentOutlet/ts/module';
import * as ngIfExample from './ngIf/ts/module';
import * as ngTemplateOutletExample from './ngTemplateOutlet/ts/module';
import * as pipesExample from './pipes/ts/module';
@Component({selector: 'example-app', template: '<router-outlet></router-outlet>'})
export class TestsAppComponent {
}
@NgModule({
imports: [
locationExample.AppModule, ngComponentOutletExample.AppModule, ngIfExample.AppModule,
ngTemplateOutletExample.AppModule, pipesExample.AppModule,
// Router configuration so that the individual e2e tests can load their
// app components.
RouterModule.forRoot([
{path: 'location', component: locationExample.AppComponent},
{path: 'ngComponentOutlet', component: ngComponentOutletExample.AppComponent},
{path: 'ngIf', component: ngIfExample.AppComponent},
{path: 'ngTemplateOutlet', component: ngTemplateOutletExample.AppComponent},
{path: 'pipes', component: pipesExample.AppComponent},
])
],
declarations: [TestsAppComponent],
bootstrap: [TestsAppComponent]
})
export class TestsAppModule {
}
+13
View File
@@ -0,0 +1,13 @@
package(default_visibility = ["//visibility:public"])
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "compiler_examples",
srcs = glob(["**/*.ts"]),
deps = [
"//packages/core",
"//packages/platform-browser",
"//packages/platform-browser-dynamic",
],
)
@@ -7,11 +7,13 @@
*/
import {UrlResolver} from '@angular/compiler';
import {NgModule} from '@angular/core';
import {Component, NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
let MyApp: any;
@Component({selector: 'my-app', template: 'empty'})
class MyApp {
}
// #docregion url_resolver
class MyUrlResolver extends UrlResolver {
+63
View File
@@ -0,0 +1,63 @@
package(default_visibility = ["//visibility:public"])
load("//packages/bazel:index.bzl", "protractor_web_test_suite")
load("//tools:defaults.bzl", "ng_module", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
ng_module(
name = "core_examples",
srcs = glob(
["**/*.ts"],
exclude = [
"**/*_spec.ts",
"**/*_howto.ts",
],
),
# TODO: FW-1004 Type checking is currently not complete.
type_check = False,
deps = [
"//packages/animations",
"//packages/core",
"//packages/platform-browser",
"//packages/platform-browser-dynamic",
"//packages/platform-browser/animations",
"//packages/router",
],
)
ts_library(
name = "core_e2e_tests_lib",
testonly = True,
srcs = glob(["**/e2e_test/*_spec.ts"]),
tsconfig = "//packages/examples:tsconfig-e2e.json",
deps = [
"//packages/examples/test-utils",
"@ngdeps//@types/jasminewd2",
"@ngdeps//protractor",
],
)
ts_devserver(
name = "devserver",
entry_module = "@angular/examples/core/main",
index_html = "//packages/examples:index.html",
port = 4200,
scripts = ["@ngdeps//node_modules/tslib:tslib.js"],
static_files = [
"@ngdeps//node_modules/zone.js:dist/zone.js",
"@ngdeps//node_modules/zone.js:dist/task-tracking.js",
],
deps = [":core_examples"],
)
protractor_web_test_suite(
name = "protractor_tests",
data = ["//packages/bazel/src/protractor/utils"],
on_prepare = ":start-server.js",
server = ":devserver",
deps = [
":core_e2e_tests_lib",
"@ngdeps//protractor",
"@ngdeps//selenium-webdriver",
],
)
@@ -7,7 +7,7 @@
*/
import {$, ExpectedConditions, browser, by, element} from 'protractor';
import {verifyNoBrowserErrors} from '../../../../../_common/e2e_util';
import {verifyNoBrowserErrors} from '../../../../../test-utils';
function waitForElement(selector: string) {
const EC = ExpectedConditions;
@@ -19,7 +19,7 @@ describe('animation example', () => {
afterEach(verifyNoBrowserErrors);
describe('index view', () => {
const URL = '/core/animation/ts/dsl/';
const URL = '/animation/dsl/';
it('should list out the current collection of items', () => {
browser.get(URL);

Some files were not shown because too many files have changed in this diff Show More