converter/e2e/src/app.e2e-spec.ts

42 lines
1.3 KiB
TypeScript
Raw Normal View History

2017-04-15 19:04:49 +02:00
import {ConvertorizrPage} from './app.po';
2017-04-15 14:47:43 +02:00
describe('convertorizr App', () => {
let page: ConvertorizrPage;
beforeEach(() => {
2017-04-15 14:47:43 +02:00
page = new ConvertorizrPage();
});
2017-07-25 23:40:19 +02:00
it('should display a textarea that is initially empty', () => {
page.navigateTo()
.then(() => page.getInputFieldContent(0))
.then((value: string) => {
expect(value).toEqual('');
});
});
it('should convert a string to its base64 representation', () => {
page.navigateTo()
.then(() => page.setInputFieldContent(0, 'Hello, World!'))
.then(() => page.getSelectedConverterOption(0))
.then((option: string) => {
expect(option).toEqual('Select conversion ...');
})
.then(() => page.selectConverterOption(0, 'Encode Base 64'))
.then(() => page.getInputFieldContent(1))
.then((content: string) => {
expect(content).toEqual('SGVsbG8sIFdvcmxkIQ==');
});
});
2018-09-08 00:10:37 +02:00
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?');
});
});
});