From 6586265a0c9b381d89bbd94f612658f582119ee0 Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Tue, 3 Oct 2017 10:38:43 +0100 Subject: [PATCH] docs(aio): fix pipes example e2e spec to work with Angular v4 (#19511) There was a breaking change between 4 and 5 for i18n formatting of dates. PR Close #19511 --- aio/content/examples/pipes/e2e/app.e2e-spec.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aio/content/examples/pipes/e2e/app.e2e-spec.ts b/aio/content/examples/pipes/e2e/app.e2e-spec.ts index 195b02649b..ec9d15cbdf 100644 --- a/aio/content/examples/pipes/e2e/app.e2e-spec.ts +++ b/aio/content/examples/pipes/e2e/app.e2e-spec.ts @@ -1,6 +1,7 @@ 'use strict'; // necessary for es6 output in node import { browser, element, by } from 'protractor'; +const { version: angularVersion } = require('@angular/core/package.json'); describe('Pipes', function () { @@ -28,7 +29,11 @@ describe('Pipes', function () { it('should be able to toggle birthday formats', function () { let birthDayEle = element(by.css('app-hero-birthday2 > p')); - expect(birthDayEle.getText()).toEqual(`The hero's birthday is 4/15/88`); + if (angularVersion.indexOf('4.') === 0) { // Breaking change between v4 and v5 (https://github.com/angular/angular/commit/079d884) + expect(birthDayEle.getText()).toEqual(`The hero's birthday is 4/15/1988`); + } else { + expect(birthDayEle.getText()).toEqual(`The hero's birthday is 4/15/88`); + } let buttonEle = element(by.cssContainingText('app-hero-birthday2 > button', 'Toggle Format')); expect(buttonEle.isDisplayed()).toBe(true); buttonEle.click().then(function() {