Add more E2E tests

This commit is contained in:
Manuel Friedli 2018-09-08 00:10:37 +02:00
parent 23ea5150f5
commit 532a080ac9
2 changed files with 19 additions and 0 deletions

View file

@ -28,4 +28,14 @@ describe('convertorizr App', () => {
expect(content).toEqual('SGVsbG8sIFdvcmxkIQ=='); 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?');
});
});
}); });

View file

@ -41,4 +41,13 @@ export class ConvertorizrPage {
.element(by.cssContainingText('option', optionName)) .element(by.cssContainingText('option', optionName))
.click(); .click();
} }
getErrorMessage(index: number): promise.Promise<string> {
return element
.all(by.css('app-root div.inputwrapper'))
.get(index)
.element(by.css('app-error-message div.errormessage'))
.getWebElement()
.getText();
}
} }