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

42 lines
1.3 KiB
TypeScript

import {ConvertorizrPage} from './app.po';
describe('convertorizr App', () => {
let page: ConvertorizrPage;
beforeEach(() => {
page = new ConvertorizrPage();
});
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==');
});
});
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?');
});
});
});