44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
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();
|
|
}
|
|
}
|