Skip to content

Commit

Permalink
build: adding basic e2e testing infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMinar committed May 2, 2016
1 parent fdd8bd1 commit 2e1f3f0
Show file tree
Hide file tree
Showing 105 changed files with 341 additions and 182 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ env:
# Order: a slower build first, so that we don't occupy an idle travis worker waiting for others to complete.
- CI_MODE=js
- CI_MODE=lint
# - CI_MODE=dart
- CI_MODE=build_only
- CI_MODE=e2e
- CI_MODE=saucelabs_required
- CI_MODE=browserstack_required

Expand Down
19 changes: 19 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ cd `dirname $0`
TSCONFIG=./modules/tsconfig.json
echo "====== (all)COMPILING: \$(npm bin)/ng2tc -p ${TSCONFIG} ====="
rm -rf ./dist/all/
mkdir ./dist/all/

# prepare all files for e2e tests
cp -r ./modules/playground ./dist/all/
cp -r ./modules/playground/favicon.ico ./dist/
#rsync -aP ./modules/playground/* ./dist/all/playground/
mkdir ./dist/all/playground/vendor
cd ./dist/all/playground/vendor
ln -s ../../../../node_modules/es6-shim/es6-shim.js .
ln -s ../../../../node_modules/zone.js/dist/zone.js .
ln -s ../../../../node_modules/zone.js/dist/long-stack-trace-zone.js .
ln -s ../../../../node_modules/systemjs/dist/system.src.js .
ln -s ../../../../node_modules/base64-js/lib/b64.js .
ln -s ../../../../node_modules/reflect-metadata/Reflect.js .
ln -s ../../../../node_modules/rxjs/bundles/Rx.js .
ln -s ../../../../node_modules/angular/angular.js .
cd -

# compile ts code
$(npm bin)/ng2tc -p ${TSCONFIG}


Expand Down
4 changes: 2 additions & 2 deletions modules/playground/e2e_test/async/async_spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

describe('async', () => {
var URL = 'playground/src/async/index.html';
var URL = 'all/playground/src/async/index.html';

beforeEach(() => browser.get(URL));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

function waitForElement(selector) {
var EC = (<any>protractor).ExpectedConditions;
Expand All @@ -9,7 +9,7 @@ function waitForElement(selector) {
describe('hash routing example app', function() {
afterEach(verifyNoBrowserErrors);

var URL = 'playground/src/hash_routing/index.html';
var URL = 'all/playground/src/hash_routing/index.html';

it('should navigate between routes', function() {
browser.get(URL + '#/bye');
Expand All @@ -28,7 +28,7 @@ describe('hash routing example app', function() {


it('should open in new window if target is _blank', () => {
var URL = 'playground/src/hash_routing/index.html';
var URL = 'all/playground/src/hash_routing/index.html';
browser.get(URL + '#/');
waitForElement('hello-cmp');

Expand Down
4 changes: 2 additions & 2 deletions modules/playground/e2e_test/hello_world/hello_world_spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

describe('hello world', function() {

afterEach(verifyNoBrowserErrors);

describe('hello world app', function() {
var URL = 'playground/src/hello_world/index.html';
var URL = 'all/playground/src/hello_world/index.html';

it('should greet', function() {
browser.get(URL);
Expand Down
4 changes: 2 additions & 2 deletions modules/playground/e2e_test/http/http_spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

describe('http', function() {

afterEach(verifyNoBrowserErrors);

describe('fetching', function() {
var URL = 'playground/src/http/index.html';
var URL = 'all/playground/src/http/index.html';

it('should fetch and display people', function() {
browser.get(URL);
Expand Down
4 changes: 2 additions & 2 deletions modules/playground/e2e_test/jsonp/jsonp_spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

describe('jsonp', function() {

afterEach(verifyNoBrowserErrors);

describe('fetching', function() {
var URL = 'playground/src/jsonp/index.html';
var URL = 'all/playground/src/jsonp/index.html';

it('should fetch and display people', function() {
browser.get(URL);
Expand Down
2 changes: 1 addition & 1 deletion modules/playground/e2e_test/key_events/key_events_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {verifyNoBrowserErrors} from '@angular/platform-browser/testing/e2e_util'

describe('key_events', function() {

var URL = 'playground/src/key_events/index.html';
var URL = 'all/playground/src/key_events/index.html?bundles=false';

afterEach(verifyNoBrowserErrors);
beforeEach(() => { browser.get(URL); });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

describe('Model-Driven Forms', function() {

afterEach(verifyNoBrowserErrors);

var URL = 'playground/src/model_driven_forms/index.html';
var URL = 'all/playground/src/model_driven_forms/index.html';

it('should display errors', function() {
browser.get(URL);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

describe('Order Management CRUD', function() {
var URL = 'playground/src/order_management/index.html';
var URL = 'all/playground/src/order_management/index.html';

it('should work', function() {
browser.get(URL);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

describe('Person Management CRUD', function() {
var URL = 'playground/src/person_management/index.html';
var URL = 'all/playground/src/person_management/index.html';

it('should work', function() {
browser.get(URL);
Expand Down
4 changes: 2 additions & 2 deletions modules/playground/e2e_test/relative_assets/assets_spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

function waitForElement(selector) {
var EC = (<any>protractor).ExpectedConditions;
Expand All @@ -10,7 +10,7 @@ describe('relative assets relative-app', () => {

afterEach(verifyNoBrowserErrors);

var URL = 'playground/src/relative_assets/';
var URL = 'all/playground/src/relative_assets/';

it('should load in the templateUrl relative to the my-cmp component', () => {
browser.get(URL);
Expand Down
8 changes: 4 additions & 4 deletions modules/playground/e2e_test/routing/routing_spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

function waitForElement(selector) {
var EC = (<any>protractor).ExpectedConditions;
Expand All @@ -11,7 +11,7 @@ describe('routing inbox-app', () => {
afterEach(verifyNoBrowserErrors);

describe('index view', () => {
var URL = 'playground/src/routing/';
var URL = 'all/playground/src/routing/';

it('should list out the current collection of items', () => {
browser.get(URL);
Expand All @@ -31,7 +31,7 @@ describe('routing inbox-app', () => {


describe('drafts view', () => {
var URL = 'playground/src/routing/#/drafts';
var URL = 'all/playground/src/routing/#/drafts';

it('should navigate to the drafts view when the drafts link is clicked', () => {
browser.get(URL);
Expand All @@ -55,7 +55,7 @@ describe('routing inbox-app', () => {


describe('detail view', () => {
var URL = 'playground/src/routing/';
var URL = 'all/playground/src/routing/';

it('should navigate to the detail view when an email is clicked', () => {
browser.get(URL);
Expand Down
6 changes: 3 additions & 3 deletions modules/playground/e2e_test/sourcemap/sourcemap_spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as testUtil from '@angular/testing/src/e2e_util';
import * as testUtil from '@angular/platform-browser/testing_e2e';

var fs = require('fs');
var sourceMap = require('source-map');

describe('sourcemaps', function() {
var URL = 'playground/src/sourcemap/index.html';
var URL = 'all/playground/src/sourcemap/index.html';

it('should map sources', function() {
browser.get(URL);
Expand All @@ -30,7 +30,7 @@ describe('sourcemaps', function() {


const content =
fs.readFileSync('dist/js/dev/es5/playground/src/sourcemap/index.js').toString("utf8");
fs.readFileSync('dist/all/playground/src/sourcemap/index.js').toString("utf8");
const marker = "//# sourceMappingURL=data:application/json;base64,";
const index = content.indexOf(marker);
const sourceMapData =
Expand Down
4 changes: 2 additions & 2 deletions modules/playground/e2e_test/svg/svg_spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

describe('SVG', function() {

var URL = 'playground/src/svg/index.html';
var URL = 'all/playground/src/svg/index.html';

afterEach(verifyNoBrowserErrors);
beforeEach(() => { browser.get(URL); });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

describe('Template-Driven Forms', function() {

afterEach(verifyNoBrowserErrors);

var URL = 'playground/src/template_driven_forms/index.html';
var URL = 'all/playground/src/template_driven_forms/index.html';

it('should display errors', function() {
browser.get(URL);
Expand Down
4 changes: 2 additions & 2 deletions modules/playground/e2e_test/web_workers/input/input_spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

describe('WebWorkers Input', function() {
afterEach(() => {
verifyNoBrowserErrors();
browser.ignoreSynchronization = false;
});
const selector = 'input-app';
const URL = 'playground/src/web_workers/input/index.html';
const URL = 'all/playground/src/web_workers/input/index.html';
const VALUE = 'test val';

it('should bootstrap', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

describe('WebWorkers Kitchen Sink', function() {
afterEach(() => {
verifyNoBrowserErrors();
browser.ignoreSynchronization = false;
});
var selector = "hello-app .greeting";
var URL = "playground/src/web_workers/kitchen_sink/index.html";
var URL = 'all/playground/src/web_workers/kitchen_sink/index.html';

it('should greet', () => {
// This test can't wait for Angular 2 as Testability is not available when using WebWorker
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {PromiseWrapper} from '@angular/facade';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

var URL = 'playground/src/web_workers/message_broker/index.html';
var URL = 'all/playground/src/web_workers/message_broker/index.html';

describe("MessageBroker", function() {

Expand Down
4 changes: 2 additions & 2 deletions modules/playground/e2e_test/web_workers/router/router_spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

describe("WebWorker Router", () => {
beforeEach(() => {
Expand All @@ -14,7 +14,7 @@ describe("WebWorker Router", () => {

let contentSelector = "app main h1";
let navSelector = "app nav ul";
var baseUrl = "playground/src/web_workers/router/index.html";
var baseUrl = 'all/playground/src/web_workers/router/index.html';

it("should route on click", () => {
browser.get(baseUrl);
Expand Down
4 changes: 2 additions & 2 deletions modules/playground/e2e_test/web_workers/todo/todo_spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

describe('WebWorkers Todo', function() {
afterEach(() => {
verifyNoBrowserErrors();
browser.ignoreSynchronization = false;
});

var URL = "playground/src/web_workers/todo/index.html";
var URL = 'all/playground/src/web_workers/todo/index.html';

it('should bootstrap', () => {
// This test can't wait for Angular 2 as Testability is not available when using WebWorker
Expand Down
4 changes: 2 additions & 2 deletions modules/playground/e2e_test/zippy_component/zippy_spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';

describe('Zippy Component', function() {

afterEach(verifyNoBrowserErrors);

describe('zippy', function() {
var URL = 'playground/src/zippy_component/index.html';
var URL = 'all/playground/src/zippy_component/index.html';

beforeEach(function() { browser.get(URL); });

Expand Down
Binary file added modules/playground/favicon.ico
Binary file not shown.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, Injectable} from 'angular2/core';
import {Component, Injectable} from '@angular/core';
import {
Routes,
Route,
Expand All @@ -11,10 +11,10 @@ import {
UrlTree
} from 'angular2/alt_router';
import * as db from './data';
import {Location} from 'angular2/platform/common';
import {PromiseWrapper} from 'angular2/src/facade/async';
import {isPresent, DateWrapper} from 'angular2/src/facade/lang';
import {PromiseCompleter} from 'angular2/src/facade/promise';
import {Location} from '@angular/common';
import {PromiseWrapper} from '@angular/core/src/facade/async';
import {isPresent, DateWrapper} from '@angular/core/src/facade/lang';
import {PromiseCompleter} from '@angular/core/src/facade/promise';

class InboxRecord {
id: string = '';
Expand Down Expand Up @@ -93,7 +93,7 @@ class DbService {
}

@Component(
{selector: 'inbox-detail', directives: ROUTER_DIRECTIVES, templateUrl: 'inbox-detail.html'})
{selector: 'inbox-detail', directives: ROUTER_DIRECTIVES, templateUrl: 'app/inbox-detail.html'})
class InboxDetailCmp implements OnActivate {
record: InboxRecord = new InboxRecord();
ready: boolean = false;
Expand All @@ -107,7 +107,7 @@ class InboxDetailCmp implements OnActivate {
}
}

@Component({selector: 'inbox', templateUrl: 'inbox.html', directives: ROUTER_DIRECTIVES})
@Component({selector: 'inbox', templateUrl: 'app/inbox.html', directives: ROUTER_DIRECTIVES})
class InboxCmp implements OnActivate {
items: InboxRecord[] = [];
ready: boolean = false;
Expand Down Expand Up @@ -135,7 +135,7 @@ class InboxCmp implements OnActivate {
}


@Component({selector: 'drafts', templateUrl: 'drafts.html', directives: ROUTER_DIRECTIVES})
@Component({selector: 'drafts', templateUrl: 'app/drafts.html', directives: ROUTER_DIRECTIVES})
class DraftsCmp {
items: InboxRecord[] = [];
ready: boolean = false;
Expand All @@ -151,7 +151,7 @@ class DraftsCmp {
@Component({
selector: 'inbox-app',
providers: [DbService, ROUTER_PROVIDERS],
templateUrl: 'inbox-app.html',
templateUrl: 'app/inbox-app.html',
directives: ROUTER_DIRECTIVES,
})
@Routes([
Expand Down
Loading

0 comments on commit 2e1f3f0

Please sign in to comment.