From 532a080ac904c3bb9c5b1770dfa712eb0366356f Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Sat, 8 Sep 2018 00:10:37 +0200 Subject: [PATCH] Add more E2E tests --- e2e/src/app.e2e-spec.ts | 10 ++++++++++ e2e/src/app.po.ts | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/e2e/src/app.e2e-spec.ts b/e2e/src/app.e2e-spec.ts index 0edff10..f7e057f 100644 --- a/e2e/src/app.e2e-spec.ts +++ b/e2e/src/app.e2e-spec.ts @@ -28,4 +28,14 @@ describe('convertorizr App', () => { expect(content).toEqual('SGVsbG8sIFdvcmxkIQ=='); }); }); + + it('should display an error message if the conversion fails', () => { + page.navigateTo() + .then(() => page.setInputFieldContent(0, 'Oh noes!')) + .then(() => page.selectConverterOption(0, 'Decode Base 64')) + .then(() => page.getErrorMessage(0)) + .then((content: string) => { + expect(content).toEqual('Could not decode base64 string. Maybe corrupt input?'); + }); + }); }); diff --git a/e2e/src/app.po.ts b/e2e/src/app.po.ts index da1d885..b659e5f 100644 --- a/e2e/src/app.po.ts +++ b/e2e/src/app.po.ts @@ -41,4 +41,13 @@ export class ConvertorizrPage { .element(by.cssContainingText('option', optionName)) .click(); } + + getErrorMessage(index: number): promise.Promise { + return element + .all(by.css('app-root div.inputwrapper')) + .get(index) + .element(by.css('app-error-message div.errormessage')) + .getWebElement() + .getText(); + } }