Jeff Cross f14b212dc9 refactor: export core APIs from angular2/core
This change moves many APIs to the angular2/core export.

This change also automatically adds FORM_BINDINGS in
the application root injector.

BREAKING CHANGE:
    Many dependencies that were previously exported from specific
    APIs are now exported from angular2/core. Affected exports, which
    should now be included from angular2/core include:

    angular2/forms
    angular2/di
    angular2/directives
    angular2/change_detection
    angular2/bootstrap (except for dart users)
    angular2/render
    angular2/metadata
    angular2/debug
    angular2/pipes
Closes #3977
2015-09-05 07:01:34 +00:00

81 lines
2.8 KiB
TypeScript

import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util';
import {Promise} from 'angular2/src/core/facade/async';
function waitForElement(selector) {
var EC = (<any>protractor).ExpectedConditions;
// Waits for the element with id 'abc' to be present on the dom.
browser.wait(EC.presenceOf($(selector)), 20000);
}
describe('routing inbox-app', function() {
afterEach(verifyNoBrowserErrors);
describe('index view', function() {
var URL = 'examples/src/routing/';
it('should list out the current collection of items', function() {
browser.get(URL);
waitForElement('.inbox-item-record');
expect(element.all(by.css('.inbox-item-record')).count()).toEqual(200);
});
it('should build a link which points to the detail page', function() {
browser.get(URL);
waitForElement('#item-15');
expect(element(by.css('#item-15')).getAttribute('href')).toMatch(/\/detail\/15$/);
element(by.css('#item-15')).click();
waitForElement('#record-id');
expect(browser.getCurrentUrl()).toMatch(/\/detail\/15$/);
});
});
describe('drafts view', function() {
var URL = 'examples/src/routing/#/drafts';
it('should navigate to the drafts view when the drafts link is clicked', function() {
browser.get(URL);
waitForElement('.inbox-item-record');
element(by.linkText('Drafts')).click();
waitForElement('.page-title');
expect(element(by.css('.page-title')).getText()).toEqual('Drafts');
});
it('should navigate to email details', function() {
browser.get(URL);
element(by.linkText('Drafts')).click();
waitForElement('.inbox-item-record');
expect(element.all(by.css('.inbox-item-record')).count()).toEqual(2);
expect(element(by.css('#item-201')).getAttribute('href')).toMatch(/\/detail\/201$/);
element(by.css('#item-201')).click();
waitForElement('#record-id');
expect(browser.getCurrentUrl()).toMatch(/\/detail\/201$/);
});
});
describe('detail view', function() {
var URL = 'examples/src/routing/';
it('should navigate to the detail view when an email is clicked', function() {
browser.get(URL);
waitForElement('#item-10');
element(by.css('#item-10')).click();
waitForElement('#record-id');
var recordId = element(by.css("#record-id"));
browser.wait(protractor.until.elementTextIs(recordId, "ID: 10"), 5000);
expect(recordId.getText()).toEqual('ID: 10');
});
it('should navigate back to the email inbox page when the back button is clicked', function() {
browser.get(URL);
waitForElement('#item-10');
element(by.css('#item-10')).click();
waitForElement('.back-button');
element(by.css('.back-button')).click();
expect(browser.getCurrentUrl()).toMatch('/#');
});
})
});