build: convert examples package to bazel (#28733)

* build: switch example e2e tests to bazel

* 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.

* test: disable failing ivy example e2e tests

*Note for patch branch:* We had to disable more examples in Ivy because
the patch branch does not contain all Ivy/ngtsc fixes.
This commit is contained in:
Paul Gschwendtner
2019-02-15 00:25:00 +01:00
committed by Miško Hevery
parent b6dffa9763
commit ac6b2b4dc3
103 changed files with 1049 additions and 521 deletions

View File

@ -0,0 +1,14 @@
package(default_visibility = ["//visibility:public"])
load("//packages/examples/upgrade:upgrade_example.bzl", "create_upgrade_example_targets")
create_upgrade_example_targets(
name = "lite",
srcs = glob(
["**/*.ts"],
exclude = ["e2e_test/*"],
),
assets = ["styles.css"],
e2e_srcs = glob(["e2e_test/*.ts"]),
entry_module = "@angular/examples/upgrade/static/ts/lite/module",
)

View File

@ -6,14 +6,15 @@
* found in the LICENSE file at https://angular.io/license
*/
import {fixmeIvy} from '@angular/private/testing';
import {ElementArrayFinder, ElementFinder, browser, by, element} from 'protractor';
import {verifyNoBrowserErrors} from '../../../../../test-utils';
import {verifyNoBrowserErrors} from '../../../../../_common/e2e_util';
import {addCustomMatchers} from './e2e_util';
function loadPage() {
browser.rootEl = 'example-app';
browser.get('/upgrade/static/ts/lite/');
browser.get('/');
}
describe('upgrade/static (lite)', () => {
@ -58,32 +59,35 @@ describe('upgrade/static (lite)', () => {
it('should initially not render the heroes', () => expectHeroes(false));
it('should toggle the heroes when clicking the "show/hide" button', () => {
showHideBtn.click();
expectHeroes(true);
fixmeIvy('unknown; <ng1Hero> component does not seem to render name & description')
.it('should toggle the heroes when clicking the "show/hide" button', () => {
showHideBtn.click();
expectHeroes(true);
showHideBtn.click();
expectHeroes(false);
});
showHideBtn.click();
expectHeroes(false);
});
it('should add a new hero when clicking the "add" button', () => {
showHideBtn.click();
ng2HeroesAddBtn.click();
fixmeIvy('unknown; <ng1Hero> component does not seem to render name & description')
.it('should add a new hero when clicking the "add" button', () => {
showHideBtn.click();
ng2HeroesAddBtn.click();
expectHeroes(true, 4, 'Added hero Kamala Khan');
expect(ng1Heroes.last()).toHaveName('Kamala Khan');
});
expectHeroes(true, 4, 'Added hero Kamala Khan');
expect(ng1Heroes.last()).toHaveName('Kamala Khan');
});
it('should remove a hero when clicking its "remove" button', () => {
showHideBtn.click();
fixmeIvy('unknown; <ng1Hero> component does not seem to render name & description')
.it('should remove a hero when clicking its "remove" button', () => {
showHideBtn.click();
const firstHero = ng1Heroes.first();
expect(firstHero).toHaveName('Superman');
const firstHero = ng1Heroes.first();
expect(firstHero).toHaveName('Superman');
const removeBtn = firstHero.element(by.buttonText('Remove'));
removeBtn.click();
const removeBtn = firstHero.element(by.buttonText('Remove'));
removeBtn.click();
expectHeroes(true, 2, 'Removed hero Superman');
expect(ng1Heroes.first()).not.toHaveName('Superman');
});
expectHeroes(true, 2, 'Removed hero Superman');
expect(ng1Heroes.first()).not.toHaveName('Superman');
});
});