Update to Angular 6 (#1)
This commit is contained in:
parent
702d86d065
commit
23ca1ee444
24 changed files with 11095 additions and 6655 deletions
31
e2e/src/app.e2e-spec.ts
Normal file
31
e2e/src/app.e2e-spec.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
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==');
|
||||
});
|
||||
});
|
||||
});
|
44
e2e/src/app.po.ts
Normal file
44
e2e/src/app.po.ts
Normal file
|
@ -0,0 +1,44 @@
|
|||
import {browser, by, element, ElementFinder} from 'protractor';
|
||||
import {promise, WebElementPromise} from 'selenium-webdriver';
|
||||
|
||||
export class ConvertorizrPage {
|
||||
navigateTo(): promise.Promise<any> {
|
||||
return browser.get('/');
|
||||
}
|
||||
|
||||
private getInputField(index: number): WebElementPromise {
|
||||
return element
|
||||
.all(by.css('app-root div.inputwrapper'))
|
||||
.get(index)
|
||||
.element(by.css('.textwrapper textarea'))
|
||||
.getWebElement();
|
||||
}
|
||||
|
||||
getInputFieldContent(index: number): promise.Promise<string> {
|
||||
return this.getInputField(index).getText();
|
||||
}
|
||||
|
||||
setInputFieldContent(index: number, content: string): promise.Promise<void> {
|
||||
return this.getInputField(index).sendKeys(content);
|
||||
}
|
||||
|
||||
private getConverterDropdown(index: number): ElementFinder {
|
||||
return element
|
||||
.all(by.css('app-root div.inputwrapper'))
|
||||
.get(index)
|
||||
.element(by.css('.selectwrapper select'));
|
||||
}
|
||||
|
||||
getSelectedConverterOption(index: number): promise.Promise<string> {
|
||||
return this.getConverterDropdown(index)
|
||||
.$('option:checked')
|
||||
.getWebElement()
|
||||
.getText();
|
||||
}
|
||||
|
||||
selectConverterOption(index: number, optionName: string): promise.Promise<void> {
|
||||
return this.getConverterDropdown(index)
|
||||
.element(by.cssContainingText('option', optionName))
|
||||
.click();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue