@progress/kendo-e2e
Version:
Kendo UI end-to-end test utilities.
61 lines • 2.58 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Form = void 0;
const ui_component_1 = require("./ui-component");
const selenium_1 = require("../selenium");
class Form extends ui_component_1.UIComponent {
constructor(browser, locator = '.k-form', parentElement) {
super(browser, locator, parentElement);
this.parentElement = parentElement;
}
submitButton() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.findChild(Form.SUBMIT);
});
}
clearButton() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.findChild(Form.CLEAR);
});
}
submit() {
return __awaiter(this, void 0, void 0, function* () {
yield (yield this.submitButton()).click();
});
}
clear() {
return __awaiter(this, void 0, void 0, function* () {
yield (yield this.clearButton()).click();
});
}
getValidationByIndex(index) {
return __awaiter(this, void 0, void 0, function* () {
const parent = yield (yield this.root()).findElement(selenium_1.By.xpath('./..'));
return yield parent.findElement(selenium_1.By.css(`.k-validation-summary li:nth-of-type(${index})`));
});
}
getValidationErrorByIndex(index) {
return __awaiter(this, void 0, void 0, function* () {
return yield ((yield this.findChildren(`.k-form-error div`))[index]).getText();
});
}
getSuccessMessage() {
return __awaiter(this, void 0, void 0, function* () {
return yield (yield this.findChild('.k-messagebox-success')).getText();
});
}
}
exports.Form = Form;
Form.SELECTOR = '.k-form';
Form.SUBMIT = '.k-button.k-form-submit';
Form.CLEAR = '.k-button.k-form-clear';
//# sourceMappingURL=form.js.map
;