UNPKG

systelab-components-wdio-test

Version:
72 lines (71 loc) 2.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.KeyboardAPI = void 0; const http_status_1 = require("./http-status"); const error_handler_api_1 = require("./error-handler.api"); const wdio_1 = require("../../wdio"); const json_schema_validator_1 = require("./schema/json-schema-validator"); class KeyboardAPI { static async pressEscape(req, res) { try { wdio_1.AutomationEnvironment.setApplication(+req.params.id); await wdio_1.Browser.pressEsc(); return res.status(http_status_1.HttpStatus.NO_CONTENT).send(); } catch (err) { return error_handler_api_1.ErrorHandlerAPI.handle(res, err); } } static async pressTab(req, res) { try { wdio_1.AutomationEnvironment.setApplication(+req.params.id); await wdio_1.Browser.pressTab(); return res.status(http_status_1.HttpStatus.NO_CONTENT).send(); } catch (err) { return error_handler_api_1.ErrorHandlerAPI.handle(res, err); } } static async pressBackspace(req, res) { try { wdio_1.AutomationEnvironment.setApplication(+req.params.id); await wdio_1.Browser.pressBackspace(); return res.status(http_status_1.HttpStatus.NO_CONTENT).send(); } catch (err) { return error_handler_api_1.ErrorHandlerAPI.handle(res, err); } } static async pressEnter(req, res) { try { wdio_1.AutomationEnvironment.setApplication(+req.params.id); await wdio_1.Browser.pressEnter(); return res.status(http_status_1.HttpStatus.NO_CONTENT).send(); } catch (err) { return error_handler_api_1.ErrorHandlerAPI.handle(res, err); } } static async pressDelete(req, res) { try { wdio_1.AutomationEnvironment.setApplication(+req.params.id); await wdio_1.Browser.pressDelete(); return res.status(http_status_1.HttpStatus.NO_CONTENT).send(); } catch (err) { return error_handler_api_1.ErrorHandlerAPI.handle(res, err); } } static async writeText(req, res) { try { wdio_1.AutomationEnvironment.setApplication(+req.params.id); const requestBody = json_schema_validator_1.JSONSchemaValidator.validateApplicationWriteTextRequest(req.body); await wdio_1.Browser.writeText(requestBody.stringToWrite); return res.status(http_status_1.HttpStatus.NO_CONTENT).send(); } catch (err) { return error_handler_api_1.ErrorHandlerAPI.handle(res, err); } } } exports.KeyboardAPI = KeyboardAPI;