UNPKG

@progress/kendo-e2e

Version:

Kendo UI end-to-end test utilities.

99 lines 4.36 kB
"use strict"; 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.Upload = void 0; const const_1 = require("./const"); const ui_component_1 = require("./ui-component"); class Upload extends ui_component_1.UIComponent { constructor(browser, locator = Upload.SELECTOR, parentElement) { super(browser, locator, parentElement); this.parentElement = parentElement; } uploadInput() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild('input'); }); } uploadButton() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild('.k-upload-button'); }); } uploadStatus() { return __awaiter(this, void 0, void 0, function* () { const element = yield this.findChild(".k-upload-status"); try { return yield element.getText(); } catch (_a) { return undefined; } }); } uploads() { return __awaiter(this, void 0, void 0, function* () { return yield this.findChildren(".k-upload-files .k-file", { waitForChild: false }); }); } uploadFileName(index) { return __awaiter(this, void 0, void 0, function* () { const element = yield this.findChild(`.k-upload-files .k-file:nth-of-type(${index}) .k-file-name`); return yield element.getText(); }); } uploadValidationMessage(index) { return __awaiter(this, void 0, void 0, function* () { const element = yield this.findChild(`.k-upload-files .k-file:nth-of-type(${index}) .k-file-validation-message`); return yield element.getText(); }); } uploadAction(index) { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild(`.k-upload-files .k-file:nth-of-type(${index}) .k-upload-actions`); }); } uplaodStatus(index) { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild(`.k-upload-files .k-file:nth-of-type(${index}) .k-upload-actions .k-upload-pct`); }); } pauseButton(index) { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild(`.k-upload-files .k-file:nth-of-type(${index}) .k-upload-actions button[aria-label=Pause]`); }); } resumeButton(index) { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild(`.k-upload-files .k-file:nth-of-type(${index}) .k-upload-actions button[aria-label=Resume]`); }); } cancelButton(index) { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild(`.k-upload-files .k-file:nth-of-type(${index}) .k-upload-actions button[aria-label=Cancel]`); }); } removeButton(index) { return __awaiter(this, void 0, void 0, function* () { return yield this.findChild(`.k-upload-files .k-file:nth-of-type(${index}) .k-upload-actions .k-svg-i-x`); }); } waitForUploadStatus(status) { return __awaiter(this, void 0, void 0, function* () { yield this.browser.wait(() => __awaiter(this, void 0, void 0, function* () { return (yield this.uploadStatus()) === status; }), { timeout: 10000, message: `Failed to wait for "${status}" status, actual: ${yield this.uploadStatus()}` }); }); } } exports.Upload = Upload; Upload.SELECTOR = const_1.SELECTORS.UPLOAD; //# sourceMappingURL=upload.js.map