Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(ivy): update e2e tests to use Renderer2 instead of Renderer #28558

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 15 additions & 17 deletions modules/playground/e2e_test/hello_world/hello_world_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,32 @@
* found in the LICENSE file at https://angular.io/license
*/

import {fixmeIvy} from '@angular/private/testing';
import {browser} from 'protractor';

import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';

fixmeIvy('FW-1032: Ivy doesn\'t support injecting Renderer, the deprecated renderer V1')
.describe('hello world', function() {
describe('hello world', function() {

afterEach(verifyNoBrowserErrors);
afterEach(verifyNoBrowserErrors);

describe('hello world app', function() {
const URL = '/';
describe('hello world app', function() {
const URL = '/';

it('should greet', function() {
browser.get(URL);
it('should greet', function() {
browser.get(URL);

expect(getComponentText('hello-app', '.greeting')).toEqual('hello world!');
});

it('should change greeting', function() {
browser.get(URL);
expect(getComponentText('hello-app', '.greeting')).toEqual('hello world!');
});

clickComponentButton('hello-app', '.changeButton');
expect(getComponentText('hello-app', '.greeting')).toEqual('howdy world!');
});
});
it('should change greeting', function() {
browser.get(URL);

clickComponentButton('hello-app', '.changeButton');
expect(getComponentText('hello-app', '.greeting')).toEqual('howdy world!');
});
});

});

function getComponentText(selector: string, innerSelector: string) {
return browser.executeScript(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,54 @@
* found in the LICENSE file at https://angular.io/license
*/

import {fixmeIvy} from '@angular/private/testing';
import {ExpectedConditions, browser, by, element, protractor} from 'protractor';

import {verifyNoBrowserErrors} from '../../../../e2e_util/e2e_util';

fixmeIvy('FW-1032: Ivy doesn\'t support injecting Renderer, the deprecated renderer V1')
.describe('WebWorkers Kitchen Sink', function() {
afterEach(() => {
verifyNoBrowserErrors();
browser.ignoreSynchronization = false;
});
const selector = 'hello-app .greeting';
const URL = '/';

it('should greet', () => {
// This test can't wait for Angular as Testability is not available when using WebWorker
browser.ignoreSynchronization = true;
browser.get(URL);

browser.wait(protractor.until.elementLocated(by.css(selector)), 15000);
const elem = element(by.css(selector));
browser.wait(ExpectedConditions.textToBePresentInElement(elem, 'hello world!'), 5000);
expect(elem.getText()).toEqual('hello world!');

});

it('should change greeting', () => {
// This test can't wait for Angular as Testability is not available when using WebWorker
browser.ignoreSynchronization = true;
browser.get(URL);
const changeButtonSelector = 'hello-app .changeButton';

browser.wait(protractor.until.elementLocated(by.css(changeButtonSelector)), 15000);
element(by.css(changeButtonSelector)).click();
const elem = element(by.css(selector));
browser.wait(ExpectedConditions.textToBePresentInElement(elem, 'howdy world!'), 5000);
expect(elem.getText()).toEqual('howdy world!');
});

it('should display correct key names', () => {
// This test can't wait for Angular as Testability is not available when using WebWorker
browser.ignoreSynchronization = true;
browser.get(URL);
browser.wait(protractor.until.elementLocated(by.css('.sample-area')), 15000);

const area = element.all(by.css('.sample-area')).first();
expect(area.getText()).toEqual('(none)');

area.sendKeys('u');
browser.wait(ExpectedConditions.textToBePresentInElement(area, 'U'), 5000);
expect(area.getText()).toEqual('U');
});
});
describe('WebWorkers Kitchen Sink', function() {
afterEach(() => {
verifyNoBrowserErrors();
browser.ignoreSynchronization = false;
});
const selector = 'hello-app .greeting';
const URL = '/';

it('should greet', () => {
// This test can't wait for Angular as Testability is not available when using WebWorker
browser.ignoreSynchronization = true;
browser.get(URL);

browser.wait(protractor.until.elementLocated(by.css(selector)), 15000);
const elem = element(by.css(selector));
browser.wait(ExpectedConditions.textToBePresentInElement(elem, 'hello world!'), 5000);
expect(elem.getText()).toEqual('hello world!');

});

it('should change greeting', () => {
// This test can't wait for Angular as Testability is not available when using WebWorker
browser.ignoreSynchronization = true;
browser.get(URL);
const changeButtonSelector = 'hello-app .changeButton';

browser.wait(protractor.until.elementLocated(by.css(changeButtonSelector)), 15000);
element(by.css(changeButtonSelector)).click();
const elem = element(by.css(selector));
browser.wait(ExpectedConditions.textToBePresentInElement(elem, 'howdy world!'), 5000);
expect(elem.getText()).toEqual('howdy world!');
});

it('should display correct key names', () => {
// This test can't wait for Angular as Testability is not available when using WebWorker
browser.ignoreSynchronization = true;
browser.get(URL);
browser.wait(protractor.until.elementLocated(by.css('.sample-area')), 15000);

const area = element.all(by.css('.sample-area')).first();
expect(area.getText()).toEqual('(none)');

area.sendKeys('u');
browser.wait(ExpectedConditions.textToBePresentInElement(area, 'U'), 5000);
expect(area.getText()).toEqual('U');
});
});
6 changes: 3 additions & 3 deletions modules/playground/src/hello_world/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {Component, Directive, ElementRef, Injectable, NgModule, Renderer} from '@angular/core';
import {Component, Directive, ElementRef, Injectable, NgModule, Renderer2} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';

Expand All @@ -22,8 +22,8 @@ export class GreetingService {
export class RedDec {
// ElementRef is always injectable and it wraps the element on which the
// directive was found by the compiler.
constructor(el: ElementRef, renderer: Renderer) {
renderer.setElementStyle(el.nativeElement, 'color', 'red');
constructor(el: ElementRef, renderer: Renderer2) {
renderer.setStyle(el.nativeElement, 'color', 'red');
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {Component, Directive, ElementRef, Injectable, Renderer} from '@angular/core';
import {Component, Directive, ElementRef, Injectable, Renderer2} from '@angular/core';

// A service available to the Injector, used by the HelloCmp component.
@Injectable()
Expand All @@ -20,8 +20,8 @@ export class GreetingService {
export class RedDec {
// ElementRef is always injectable and it wraps the element on which the
// directive was found by the compiler.
constructor(el: ElementRef, renderer: Renderer) {
renderer.setElementStyle(el.nativeElement, 'color', 'red');
constructor(el: ElementRef, renderer: Renderer2) {
renderer.setStyle(el.nativeElement, 'color', 'red');
}
}

Expand Down