parent
98e5af1480
commit
29513296fb
|
@ -6,6 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {fixmeIvy} from '@angular/private/testing';
|
||||
import {$, ExpectedConditions, browser, by, element} from 'protractor';
|
||||
|
||||
import {verifyNoBrowserErrors} from '../../../../test-utils';
|
||||
|
@ -16,29 +17,34 @@ function waitForElement(selector: string) {
|
|||
browser.wait(EC.presenceOf($(selector)), 20000);
|
||||
}
|
||||
|
||||
describe('ngComponentOutlet', () => {
|
||||
const URL = 'common/ngComponentOutlet/ts/';
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
fixmeIvy(
|
||||
'unknown. Run "yarn bazel run packages/examples/common:devserver --define=compile=aot" ' +
|
||||
'to debug')
|
||||
.describe('ngComponentOutlet', () => {
|
||||
const URL = '/ngComponentOutlet';
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
|
||||
describe('ng-component-outlet-example', () => {
|
||||
it('should render simple', () => {
|
||||
browser.get(URL);
|
||||
waitForElement('ng-component-outlet-simple-example');
|
||||
expect(element.all(by.css('hello-world')).getText()).toEqual(['Hello World!']);
|
||||
});
|
||||
describe('ng-component-outlet-example', () => {
|
||||
it('should render simple', () => {
|
||||
browser.get(URL);
|
||||
waitForElement('ng-component-outlet-simple-example');
|
||||
expect(element.all(by.css('hello-world')).getText()).toEqual(['Hello World!']);
|
||||
});
|
||||
|
||||
it('should render complete', () => {
|
||||
browser.get(URL);
|
||||
waitForElement('ng-component-outlet-complete-example');
|
||||
expect(element.all(by.css('complete-component')).getText()).toEqual(['Complete: AhojSvet!']);
|
||||
});
|
||||
it('should render complete', () => {
|
||||
browser.get(URL);
|
||||
waitForElement('ng-component-outlet-complete-example');
|
||||
expect(element.all(by.css('complete-component')).getText()).toEqual([
|
||||
'Complete: AhojSvet!'
|
||||
]);
|
||||
});
|
||||
|
||||
it('should render other module', () => {
|
||||
browser.get(URL);
|
||||
waitForElement('ng-component-outlet-other-module-example');
|
||||
expect(element.all(by.css('other-module-component')).getText()).toEqual([
|
||||
'Other Module Component!'
|
||||
]);
|
||||
it('should render other module', () => {
|
||||
browser.get(URL);
|
||||
waitForElement('ng-component-outlet-other-module-example');
|
||||
expect(element.all(by.css('other-module-component')).getText()).toEqual([
|
||||
'Other Module Component!'
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {fixmeIvy} from '@angular/private/testing';
|
||||
import {$, ExpectedConditions, browser, by, element} from 'protractor';
|
||||
import {verifyNoBrowserErrors} from '../../../../test-utils';
|
||||
|
||||
|
@ -44,18 +45,21 @@ describe('ngIf', () => {
|
|||
|
||||
describe('ng-if-then-else', () => {
|
||||
let comp = 'ng-if-then-else';
|
||||
it('should hide/show content', () => {
|
||||
browser.get(URL);
|
||||
waitForElement(comp);
|
||||
expect(element.all(by.css(comp)).get(0).getText())
|
||||
.toEqual('hideSwitch Primary show = true\nPrimary text to show');
|
||||
element.all(by.css(comp + ' button')).get(1).click();
|
||||
expect(element.all(by.css(comp)).get(0).getText())
|
||||
.toEqual('hideSwitch Primary show = true\nSecondary text to show');
|
||||
element.all(by.css(comp + ' button')).get(0).click();
|
||||
expect(element.all(by.css(comp)).get(0).getText())
|
||||
.toEqual('showSwitch Primary show = false\nAlternate text while primary text is hidden');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown. Run "yarn bazel run packages/examples/common:devserver" to debug')
|
||||
.it('should hide/show content', () => {
|
||||
browser.get(URL);
|
||||
waitForElement(comp);
|
||||
expect(element.all(by.css(comp)).get(0).getText())
|
||||
.toEqual('hideSwitch Primary show = true\nPrimary text to show');
|
||||
element.all(by.css(comp + ' button')).get(1).click();
|
||||
expect(element.all(by.css(comp)).get(0).getText())
|
||||
.toEqual('hideSwitch Primary show = true\nSecondary text to show');
|
||||
element.all(by.css(comp + ' button')).get(0).click();
|
||||
expect(element.all(by.css(comp)).get(0).getText())
|
||||
.toEqual(
|
||||
'showSwitch Primary show = false\nAlternate text while primary text is hidden');
|
||||
});
|
||||
});
|
||||
|
||||
describe('ng-if-let', () => {
|
||||
|
|
|
@ -6,40 +6,45 @@
|
|||
* 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 '../../../../_common/e2e_util';
|
||||
|
||||
describe('simpleNgModel example', () => {
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
let input: ElementFinder;
|
||||
let paragraphs: ElementArrayFinder;
|
||||
let button: ElementFinder;
|
||||
import {verifyNoBrowserErrors} from '../../../../test-utils';
|
||||
|
||||
beforeEach(() => {
|
||||
browser.get('/forms/ts/simpleNgModel/index.html');
|
||||
input = element(by.css('input'));
|
||||
paragraphs = element.all(by.css('p'));
|
||||
button = element(by.css('button'));
|
||||
});
|
||||
fixmeIvy(
|
||||
'unkown; verifyNoBrowserErrors fails due to "ExpressionChangedAfterItHasBeenCheckedError"' +
|
||||
'Debug by running "yarn bazel run //packages/examples/forms:devserver --define=compile=aot')
|
||||
.describe('simpleNgModel example', () => {
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
let input: ElementFinder;
|
||||
let paragraphs: ElementArrayFinder;
|
||||
let button: ElementFinder;
|
||||
|
||||
it('should update the domain model as you type', () => {
|
||||
input.click();
|
||||
input.sendKeys('Carson');
|
||||
beforeEach(() => {
|
||||
browser.get('/simpleNgModel');
|
||||
input = element(by.css('input'));
|
||||
paragraphs = element.all(by.css('p'));
|
||||
button = element(by.css('button'));
|
||||
});
|
||||
|
||||
expect(paragraphs.get(0).getText()).toEqual('Value: Carson');
|
||||
});
|
||||
it('should update the domain model as you type', () => {
|
||||
input.click();
|
||||
input.sendKeys('Carson');
|
||||
|
||||
it('should report the validity correctly', () => {
|
||||
expect(paragraphs.get(1).getText()).toEqual('Valid: false');
|
||||
input.click();
|
||||
input.sendKeys('a');
|
||||
expect(paragraphs.get(0).getText()).toEqual('Value: Carson');
|
||||
});
|
||||
|
||||
expect(paragraphs.get(1).getText()).toEqual('Valid: true');
|
||||
});
|
||||
it('should report the validity correctly', () => {
|
||||
expect(paragraphs.get(1).getText()).toEqual('Valid: false');
|
||||
input.click();
|
||||
input.sendKeys('a');
|
||||
|
||||
it('should set the value by changing the domain model', () => {
|
||||
button.click();
|
||||
expect(input.getAttribute('value')).toEqual('Nancy');
|
||||
});
|
||||
expect(paragraphs.get(1).getText()).toEqual('Valid: true');
|
||||
});
|
||||
|
||||
});
|
||||
it('should set the value by changing the domain model', () => {
|
||||
button.click();
|
||||
expect(input.getAttribute('value')).toEqual('Nancy');
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {fixmeIvy} from '@angular/private/testing';
|
||||
import {browser, by, element} from 'protractor';
|
||||
import {verifyNoBrowserErrors} from '../../../../../test-utils';
|
||||
|
||||
|
@ -28,26 +29,28 @@ describe('upgrade/static (full)', () => {
|
|||
expect(heroComponents.count()).toEqual(3);
|
||||
});
|
||||
|
||||
it('should add a new hero when the "Add Hero" button is pressed', () => {
|
||||
const addHeroButton = element.all(by.css('button')).last();
|
||||
expect(addHeroButton.getText()).toEqual('Add Hero');
|
||||
addHeroButton.click();
|
||||
const heroComponents = element.all(by.css('ng1-hero'));
|
||||
expect(heroComponents.last().element(by.css('h2')).getText()).toEqual('Kamala Khan');
|
||||
});
|
||||
fixmeIvy('unknown; <ng1Hero> component does not seem to render name & description')
|
||||
.it('should add a new hero when the "Add Hero" button is pressed', () => {
|
||||
const addHeroButton = element.all(by.css('button')).last();
|
||||
expect(addHeroButton.getText()).toEqual('Add Hero');
|
||||
addHeroButton.click();
|
||||
const heroComponents = element.all(by.css('ng1-hero'));
|
||||
expect(heroComponents.last().element(by.css('h2')).getText()).toEqual('Kamala Khan');
|
||||
});
|
||||
|
||||
it('should remove a hero when the "Remove" button is pressed', () => {
|
||||
let firstHero = element.all(by.css('ng1-hero')).get(0);
|
||||
expect(firstHero.element(by.css('h2')).getText()).toEqual('Superman');
|
||||
fixmeIvy('unknown; <ng1Hero> component does not seem to render name & description')
|
||||
.it('should remove a hero when the "Remove" button is pressed', () => {
|
||||
let firstHero = element.all(by.css('ng1-hero')).get(0);
|
||||
expect(firstHero.element(by.css('h2')).getText()).toEqual('Superman');
|
||||
|
||||
const removeHeroButton = firstHero.element(by.css('button'));
|
||||
expect(removeHeroButton.getText()).toEqual('Remove');
|
||||
removeHeroButton.click();
|
||||
const removeHeroButton = firstHero.element(by.css('button'));
|
||||
expect(removeHeroButton.getText()).toEqual('Remove');
|
||||
removeHeroButton.click();
|
||||
|
||||
const heroComponents = element.all(by.css('ng1-hero'));
|
||||
expect(heroComponents.count()).toEqual(2);
|
||||
const heroComponents = element.all(by.css('ng1-hero'));
|
||||
expect(heroComponents.count()).toEqual(2);
|
||||
|
||||
firstHero = element.all(by.css('ng1-hero')).get(0);
|
||||
expect(firstHero.element(by.css('h2')).getText()).toEqual('Wonder Woman');
|
||||
});
|
||||
firstHero = element.all(by.css('ng1-hero')).get(0);
|
||||
expect(firstHero.element(by.css('h2')).getText()).toEqual('Wonder Woman');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
* 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';
|
||||
|
||||
|
@ -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');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue