diff --git a/integration/bazel-schematics/angular.json.original b/integration/bazel-schematics/angular.json.original new file mode 100644 index 0000000000..9c70cea203 --- /dev/null +++ b/integration/bazel-schematics/angular.json.original @@ -0,0 +1,135 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "demo": { + "root": "", + "sourceRoot": "src", + "projectType": "application", + "prefix": "app", + "schematics": {}, + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist/demo", + "index": "src/index.html", + "main": "src/main.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "src/tsconfig.app.json", + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "src/styles.css" + ], + "scripts": [] + }, + "configurations": { + "production": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "extractCss": true, + "namedChunks": false, + "aot": true, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + } + ] + } + } + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "options": { + "browserTarget": "demo:build" + }, + "configurations": { + "production": { + "browserTarget": "demo:build:production" + } + } + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "demo:build" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "src/test.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "src/tsconfig.spec.json", + "karmaConfig": "src/karma.conf.js", + "styles": [ + "src/styles.css" + ], + "scripts": [], + "assets": [ + "src/favicon.ico", + "src/assets" + ] + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "src/tsconfig.app.json", + "src/tsconfig.spec.json" + ], + "exclude": [ + "**/node_modules/**" + ] + } + } + } + }, + "demo-e2e": { + "root": "e2e/", + "projectType": "application", + "prefix": "", + "architect": { + "e2e": { + "builder": "@angular-devkit/build-angular:protractor", + "options": { + "protractorConfig": "e2e/protractor.conf.js", + "devServerTarget": "demo:serve" + }, + "configurations": { + "production": { + "devServerTarget": "demo:serve:production" + } + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": "e2e/tsconfig.e2e.json", + "exclude": [ + "**/node_modules/**" + ] + } + } + } + } + }, + "defaultProject": "demo" +} \ No newline at end of file diff --git a/integration/bazel-schematics/app.e2e-spec.ts b/integration/bazel-schematics/app.e2e-spec.ts new file mode 100644 index 0000000000..e2a9edb43d --- /dev/null +++ b/integration/bazel-schematics/app.e2e-spec.ts @@ -0,0 +1,20 @@ +import { AppPage } from './app.po'; +import { browser } from 'protractor'; + +describe('workspace-project App', () => { + let page: AppPage; + + beforeEach(() => { + page = new AppPage(); + }); + + it('should display welcome message', () => { + page.navigateTo(); + expect(page.getTitleText()).toEqual('Welcome to demo!'); + }); + + afterEach(async () => { + const logs = await browser.manage().logs().get('browser'); + expect(logs).toEqual([]); + }); +}); diff --git a/integration/bazel-schematics/index.html b/integration/bazel-schematics/index.html new file mode 100644 index 0000000000..77e5ff2c6c --- /dev/null +++ b/integration/bazel-schematics/index.html @@ -0,0 +1,14 @@ + + + + + Demo + + + + + + + + + diff --git a/integration/bazel-schematics/test.sh b/integration/bazel-schematics/test.sh index 35e326f52b..b939e4f666 100755 --- a/integration/bazel-schematics/test.sh +++ b/integration/bazel-schematics/test.sh @@ -2,7 +2,7 @@ set -eux -o pipefail -function test() { +function testBazel() { # Set up bazel version rm -rf demo @@ -18,4 +18,20 @@ function test() { ng e2e } -test +function testNonBazel() { + # Replace angular.json that uses Bazel builder with the default generated by CLI + cp ../angular.json.original ./angular.json + # TODO(kyliau) Remove this once the additional assertion is added to CLI + cp ../app.e2e-spec.ts ./e2e/src/ + # TODO(kyliau) Remove this once web_package rule is in use + cp ../index.html ./src/ + rm -rf dist src/main.dev.ts src/main.prod.ts + # Just make a symlink instead of full yarn install to expose node_modules + ln -s $(bazel info output_base)/external/npm/node_modules node_modules + ng build + ng test --watch=false + ng e2e +} + +testBazel +testNonBazel