UNPKG

tia

Version:

Time is All (logs driven test engine with ExtJs support)

175 lines 6.3 kB
"use strict"; // https://stackoverflow.com/questions/11000087/how-to-select-a-combobox-value-in-extjs var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); const component_1 = require("./component"); const _ = __importStar(require("lodash")); const tia_extjs_query_1 = require("../tia-extjs-query"); const extjs_utils_1 = require("../../extjs-utils"); const compName = 'BoundList'; /** * gT.eC.boundlist.a or gT.eC.boundlist.actions */ class BoundListActions extends component_1.ComponentActions { /** * Left mouse button click on the item containing the given text. * @param text - text for row to click. */ static async clickRow(tEQ, text, idForLog, enableLog) { // TODO: wait for idle? const valueStr = gT.e.utils.locKeyToStrAndEscapeSlashes(text); return gT.e.q.wrap({ tEQ, compName, idForLog, act: async () => { const row = await tia_extjs_query_1.queryAndAction({ tEQ, action: `return tiaEJActs.getBoundListItem(cmp, '${valueStr}');`, idForLog, enableLog: false, }); await row.click(); }, actionDesc: `Click Row (${text})`, enableLog, }); } /** * Ctrl + Left mouse button click on the items containing the given texts. * So it selects given string. * @param texts - texts for rows to click. */ static async ctrlClickRows(tEQ, texts, idForLog, enableLog) { // Дождаться idle? let textsArg = _.cloneDeep(texts); textsArg = textsArg.map(text => gT.e.utils.locKeyToStrAndEscapeSlashes(text)); const args = gIn.textUtils.v2s(textsArg); return gT.e.q.wrap({ tEQ, compName, idForLog, act: async () => { const rows = await tia_extjs_query_1.queryAndAction({ tEQ, action: `return tiaEJActs.getBoundListItems(cmp, ${args});`, idForLog, enableLog: false, }); await gT.sOrig.driver .actions({ bridge: true }) .keyDown(gT.sOrig.key.CONTROL) .perform(); for (const row of rows) { await row.click(); } await gT.sOrig.driver .actions({ bridge: true }) .keyUp(gT.sOrig.key.CONTROL) .perform(); }, actionDesc: `Ctrl Click Rows (${gIn.textUtils.v2s(texts)})`, enableLog, }); } } BoundListActions.compName = compName; exports.BoundListActions = BoundListActions; /** * gT.eC.boundlist.c or gT.eC.boundlist.checks */ class BoundListChecks extends component_1.ComponentChecks { } BoundListChecks.compName = compName; exports.BoundListChecks = BoundListChecks; /** * gT.eC.boundlist.g or gT.eC.boundlist.grabs */ class BoundListGrabs extends component_1.ComponentGrabs { /** * Returns all displayField values from the store. * TODO: Incompleted? */ static async contentByStore(tEQ, idForLog) { let result = await tia_extjs_query_1.queryAndAction({ tEQ, action: 'return tiaEJ.ctByObj.getBoundListByStore(cmp);', idForLog, enableLog: false, }); result = result.join('\n'); return extjs_utils_1.getCISContent('Content by store', tEQ, this.compName, idForLog, result); } /** * Returns all innerText DOM element properties for items. */ static async contentByInnerText(tEQ, idForLog) { let result = await tia_extjs_query_1.queryAndAction({ tEQ, action: 'return tiaEJ.ctByObj.getBoundListByInnerText(cmp);', idForLog, enableLog: false, }); result = result.join('\n'); return extjs_utils_1.getCISContent('Content by inner text', tEQ, this.compName, idForLog, result); } /** * Returns innerText DOM element properties for selected items. */ static async selectedContentByInnerText(tEQ, idForLog) { let result = await tia_extjs_query_1.queryAndAction({ tEQ, action: 'return tiaEJ.ctByObj.getBoundListSelectedItemsByInnerText(cmp);', idForLog, enableLog: false, }); result = result.join('\n'); return extjs_utils_1.getCISContent('Selected content by inner text', tEQ, this.compName, idForLog, result); } } BoundListGrabs.compName = compName; exports.BoundListGrabs = BoundListGrabs; class BoundListLogs extends component_1.ComponentLogs { /** * Prints all displayField values from the store. * TODO: Incompleted? */ static async contentByStore(tEQ, idForLog) { const str = await BoundListGrabs.contentByStore(tEQ, idForLog); gIn.logger.logln(str); } /** * Prints all innerText DOM element properties for items. */ static async contentByInnerText(tEQ, idForLog) { const str = await BoundListGrabs.contentByInnerText(tEQ, idForLog); gIn.logger.logln(str); } /** * Prints innerText DOM element properties for selected items. */ static async selectedContentByInnerText(tEQ, idForLog) { const str = await BoundListGrabs.selectedContentByInnerText(tEQ, idForLog); gIn.logger.logln(str); } } BoundListLogs.compName = compName; exports.BoundListLogs = BoundListLogs; class BoundListAPI { } BoundListAPI.a = BoundListActions; BoundListAPI.actions = BoundListActions; BoundListAPI.c = BoundListChecks; BoundListAPI.checks = BoundListChecks; BoundListAPI.g = BoundListGrabs; BoundListAPI.grabs = BoundListGrabs; BoundListAPI.l = BoundListLogs; BoundListAPI.logs = BoundListLogs; exports.BoundListAPI = BoundListAPI; //# sourceMappingURL=boundlist.js.map