From 306bf44bc924b0394ce4ef0c4ecade153d4c0817 Mon Sep 17 00:00:00 2001 From: Ferdinand Malcher Date: Tue, 8 May 2018 12:54:00 +0200 Subject: [PATCH] fix(@schematics/angular): fix e2e schematic to expect welcome message with prefix The "application" schematic generates the welcome message in AppComponent with the app prefix. The "e2e" schematic should include the prefix in the spec file accordingly. --- packages/schematics/angular/application/index.ts | 1 + packages/schematics/angular/e2e/files/src/app.e2e-spec.ts | 2 +- packages/schematics/angular/e2e/schema.d.ts | 4 ++++ packages/schematics/angular/e2e/schema.json | 6 ++++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/schematics/angular/application/index.ts b/packages/schematics/angular/application/index.ts index 80a71d0153..5200563d33 100644 --- a/packages/schematics/angular/application/index.ts +++ b/packages/schematics/angular/application/index.ts @@ -275,6 +275,7 @@ export default function (options: ApplicationOptions): Rule { name: `${options.name}-e2e`, relatedAppName: options.name, rootSelector: appRootSelector, + prefix, }; if (options.projectRoot !== undefined) { e2eOptions.projectRoot = 'e2e'; diff --git a/packages/schematics/angular/e2e/files/src/app.e2e-spec.ts b/packages/schematics/angular/e2e/files/src/app.e2e-spec.ts index e42d1f965f..142212d50d 100644 --- a/packages/schematics/angular/e2e/files/src/app.e2e-spec.ts +++ b/packages/schematics/angular/e2e/files/src/app.e2e-spec.ts @@ -9,6 +9,6 @@ describe('workspace-project App', () => { it('should display welcome message', () => { page.navigateTo(); - expect(page.getParagraphText()).toEqual('Welcome to app!'); + expect(page.getParagraphText()).toEqual('Welcome to <%= prefix %>!'); }); }); diff --git a/packages/schematics/angular/e2e/schema.d.ts b/packages/schematics/angular/e2e/schema.d.ts index 2180f69412..17d3c3ebae 100644 --- a/packages/schematics/angular/e2e/schema.d.ts +++ b/packages/schematics/angular/e2e/schema.d.ts @@ -23,4 +23,8 @@ export interface Schema { * The name of the app being tested. */ relatedAppName: string; + /** + * The prefix to apply to generated selectors. + */ + prefix?: string; } diff --git a/packages/schematics/angular/e2e/schema.json b/packages/schematics/angular/e2e/schema.json index df166cf4a2..cfef3056ae 100644 --- a/packages/schematics/angular/e2e/schema.json +++ b/packages/schematics/angular/e2e/schema.json @@ -23,6 +23,12 @@ "type": "string", "default": "app-root" }, + "prefix": { + "type": "string", + "format": "html-selector", + "description": "The prefix to apply to generated selectors.", + "default": "app" + }, "relatedAppName": { "description": "The name of the app being tested.", "type": "string"