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