How to use doActionSetContent method of org.cerberus.engine.gwt.impl.ActionService class

Best Cerberus-source code snippet using org.cerberus.engine.gwt.impl.ActionService.doActionSetContent

Source:ActionService.java Github

copy

Full Screen

...387 case TestCaseStepAction.ACTION_SETSERVICECALLCONTENT:388 res = this.doActionSetServiceCallContent(tCExecution, actionExecution);389 break;390 case TestCaseStepAction.ACTION_SETCONTENT:391 res = this.doActionSetContent(tCExecution, actionExecution, value1);392 break;393 case TestCaseStepAction.ACTION_DONOTHING:394 res = new MessageEvent(MessageEventEnum.ACTION_SUCCESS);395 break;396 /**397 * DEPRECATED ACTIONS FROM HERE.398 */399 case TestCaseStepAction.ACTION_MOUSEOVERANDWAIT:400 res = this.doActionMouseOverAndWait(tCExecution, value1, value2);401 res.setDescription(MESSAGE_DEPRECATED + " " + res.getDescription());402 logEventService.createForPrivateCalls("ENGINE", "mouseOverAndWait", MESSAGE_DEPRECATED + " Deprecated Action triggered by TestCase : ['" + actionExecution.getTest() + "|" + actionExecution.getTestCase() + "']");403 LOG.warn(MESSAGE_DEPRECATED + " Deprecated Action mouseOverAndWait triggered by TestCase : ['" + actionExecution.getTest() + "'|'" + actionExecution.getTestCase() + "']");404 break;405 case TestCaseStepAction.ACTION_REMOVEDIFFERENCE:406 res = this.doActionRemoveDifference(actionExecution, value1, value2);407 res.setDescription(MESSAGE_DEPRECATED + " " + res.getDescription());408 logEventService.createForPrivateCalls("ENGINE", "removeDifference", MESSAGE_DEPRECATED + " Deprecated Action triggered by TestCase : ['" + actionExecution.getTest() + "|" + actionExecution.getTestCase() + "']");409 LOG.warn(MESSAGE_DEPRECATED + " Deprecated Action removeDifference triggered by TestCase : ['" + actionExecution.getTest() + "'|'" + actionExecution.getTestCase() + "']");410 break;411 default:412 res = new MessageEvent(MessageEventEnum.ACTION_FAILED_UNKNOWNACTION);413 res.setDescription(res.getDescription().replace("%ACTION%", actionExecution.getAction()));414 }415 } catch (final Exception unexpected) {416 LOG.error("Unexpected exception: " + unexpected.getMessage(), unexpected);417 res = new MessageEvent(MessageEventEnum.ACTION_FAILED_GENERIC).resolveDescription("DETAIL", unexpected.getMessage());418 }419 LOG.debug("Result of the action : " + res.getCodeString() + " " + res.getDescription());420 // Reset Timeout to default421 robotServerService.setOptionsToDefault(tCExecution.getSession());422 /**423 * In case 1/ the action is flagged as not fatal with a specific return424 * code = N and 2/ the return of the action is stopping the test -->425 * whatever the return of the action is, we force the return to move426 * forward the test with no screenshot, pagesource.427 */428 if (actionExecution.isFatal().equals("N") && res.isStopTest()) {429 res.setDescription(res.getDescription() + " -- Execution forced to continue.");430 res.setStopTest(false);431 res.setMessage(MessageGeneralEnum.EXECUTION_PE_TESTEXECUTING);432 }433 actionExecution.setActionResultMessage(res);434 /**435 * Determine here the impact of the Action on the full test return code436 * from the ResultMessage of the Action.437 */438 actionExecution.setExecutionResultMessage(new MessageGeneral(res.getMessage()));439 /**440 * Determine here if we stop the test from the ResultMessage of the441 * Action.442 */443 actionExecution.setStopExecution(res.isStopTest());444 /**445 * Timestamp stops here.446 */447 actionExecution.setEnd(new Date().getTime());448 return actionExecution;449 }450 private MessageEvent doActionInstallApp(TestCaseExecution tCExecution, String appPath) {451 MessageEvent message;452 try {453 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {454 return androidAppiumService.installApp(tCExecution.getSession(), appPath);455 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {456 return iosAppiumService.installApp(tCExecution.getSession(), appPath);457 }458 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);459 message.setDescription(message.getDescription().replace("%ACTION%", "scrollTo"));460 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));461 return message;462 } catch (Exception e) {463 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_GENERIC);464 String messageString = e.getMessage().split("\n")[0];465 message.setDescription(message.getDescription().replace("%DETAIL%", messageString));466 LOG.debug("Exception Running install app :" + messageString, e);467 return message;468 }469 }470 private MessageEvent doActionRemoveApp(TestCaseExecution tCExecution, String appPackage) {471 MessageEvent message;472 try {473 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {474 return androidAppiumService.removeApp(tCExecution.getSession(), appPackage);475 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {476 return iosAppiumService.removeApp(tCExecution.getSession(), appPackage);477 }478 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);479 message.setDescription(message.getDescription().replace("%ACTION%", "scrollTo"));480 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));481 return message;482 } catch (Exception e) {483 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_GENERIC);484 String messageString = e.getMessage().split("\n")[0];485 message.setDescription(message.getDescription().replace("%DETAIL%", messageString));486 LOG.debug("Exception Running remove app :" + messageString, e);487 return message;488 }489 }490 private MessageEvent doActionScrollTo(TestCaseExecution tCExecution, String element, String text) {491 MessageEvent message;492 try {493 Identifier identifier = null;494 if (!StringUtil.isNullOrEmpty(element)) {495 identifier = identifierService.convertStringToIdentifier(element);496 }497 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {498 return androidAppiumService.scrollTo(tCExecution.getSession(), identifier, text);499 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {500 return iosAppiumService.scrollTo(tCExecution.getSession(), identifier, text);501 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {502 return webdriverService.scrollTo(tCExecution.getSession(), identifier, text);503 }504 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);505 message.setDescription(message.getDescription().replace("%ACTION%", "scrollTo"));506 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));507 return message;508 } catch (Exception e) {509 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_GENERIC);510 String messageString = e.getMessage().split("\n")[0];511 message.setDescription(message.getDescription().replace("%DETAIL%", messageString));512 LOG.debug("Exception Running scroll to :" + messageString, e);513 return message;514 }515 }516 private MessageEvent doActionExecuteCommand(TestCaseExecution tCExecution, String command, String args) {517 MessageEvent message;518 try {519 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK) || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {520 return androidAppiumService.executeCommand(tCExecution.getSession(), command, args);521 }522 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);523 message.setDescription(message.getDescription().replace("%ACTION%", TestCaseStepAction.ACTION_EXECUTECOMMAND));524 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));525 return message;526 } catch (Exception e) {527 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_EXECUTECOMMAND);528 String messageString = e.getMessage().split("\n")[0];529 message.setDescription(message.getDescription().replace("%EXCEPTION%", messageString));530 LOG.debug("Exception Running Shell :" + messageString, e);531 return message;532 }533 }534 private MessageEvent doActionExecuteCerberusCommand(TestCaseExecution tCExecution, String command) {535 MessageEvent message;536 try {537 return cerberusCommand.executeCerberusCommand(command);538 } catch (CerberusEventException e) {539 message = e.getMessageError();540 LOG.debug("Exception Running Shell :" + message.getMessage().getDescription());541 return message;542 }543 }544 private MessageEvent doActionClick(TestCaseExecution tCExecution, String value1, String value2) {545 String element;546 try {547 /**548 * Get element to use String object if not empty, String property if549 * object empty, throws Exception if both empty)550 */551 element = value1;552 /**553 * Get Identifier (identifier, locator) and check it's valid554 */555 Identifier identifier = identifierService.convertStringToIdentifier(element);556 LOG.debug("Click : " + identifier.toString());557 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {558 if (tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.ANDROID.toString())) {559 identifierService.checkWebElementIdentifier(identifier.getIdentifier());560 return webdriverService.doSeleniumActionClick(tCExecution.getSession(), identifier, false, false);561 } else {562 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {563 return sikuliService.doSikuliActionClick(tCExecution.getSession(), identifier.getLocator(), "");564 } else if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_TEXT)) {565 return sikuliService.doSikuliActionClick(tCExecution.getSession(), "", identifier.getLocator());566 } else {567 identifierService.checkWebElementIdentifier(identifier.getIdentifier());568 return webdriverService.doSeleniumActionClick(tCExecution.getSession(), identifier, true, true);569 }570 }571 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {572 identifierService.checkWebElementIdentifier(identifier.getIdentifier());573 return androidAppiumService.click(tCExecution.getSession(), identifier);574 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {575 identifierService.checkWebElementIdentifier(identifier.getIdentifier());576 return iosAppiumService.click(tCExecution.getSession(), identifier);577 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {578 if (StringUtil.isNullOrEmpty(identifier.getLocator())) {579 return sikuliService.doSikuliActionClick(tCExecution.getSession(), "", "");580 }581 identifierService.checkSikuliIdentifier(identifier.getIdentifier());582 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {583 return sikuliService.doSikuliActionClick(tCExecution.getSession(), identifier.getLocator(), "");584 } else {585 return sikuliService.doSikuliActionClick(tCExecution.getSession(), "", identifier.getLocator());586 }587 } else {588 return new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION)589 .resolveDescription("ACTION", "Click")590 .resolveDescription("APPLICATIONTYPE", tCExecution.getApplicationObj().getType());591 }592 } catch (CerberusEventException ex) {593 LOG.fatal("Error doing Action Click :" + ex, ex);594 return ex.getMessageError();595 }596 }597 private MessageEvent doActionExecuteJS(TestCaseExecution tCExecution, String value1, String value2) {598 MessageEvent message;599 String script = value1;600 String valueFromJS;601 try {602 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {603 valueFromJS = this.webdriverService.getValueFromJS(tCExecution.getSession(), script);604 message = new MessageEvent(MessageEventEnum.ACTION_SUCCESS_EXECUTEJS);605 message.setDescription(message.getDescription().replace("%SCRIPT%", script));606 message.setDescription(message.getDescription().replace("%VALUE%", valueFromJS));607 return message;608 }609 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);610 message.setDescription(message.getDescription().replace("%ACTION%", "executeJS"));611 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));612 return message;613 } catch (Exception e) {614 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_EXECUTEJS);615 String messageString = e.getMessage().split("\n")[0];616 message.setDescription(message.getDescription().replace("%EXCEPTION%", messageString));617 LOG.debug("Exception Running JS Script :" + messageString);618 return message;619 }620 }621 private MessageEvent doActionMouseLeftButtonPress(TestCaseExecution tCExecution, String value1, String value2) {622 MessageEvent message;623 String element;624 try {625 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT) || StringUtil.isNullOrEmpty(value1)) {626 // If value1 is empty, the Sikuli engine must be used in order to click without element to click.627 return sikuliService.doSikuliActionLeftButtonPress(tCExecution.getSession());628 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {629 /**630 * Get element to use String object if not empty, String631 * property if object empty, throws Exception if both empty)632 */633 element = getElementToUse(value1, value2, "mouseLeftButtonPress", tCExecution);634 /**635 * Get Identifier (identifier, locator)636 */637 Identifier identifier = identifierService.convertStringToIdentifier(value1);638 identifierService.checkWebElementIdentifier(identifier.getIdentifier());639 return webdriverService.doSeleniumActionMouseDown(tCExecution.getSession(), identifier, true, true);640 }641 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);642 message.setDescription(message.getDescription().replace("%ACTION%", "MouseDown"));643 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));644 return message;645 } catch (CerberusEventException ex) {646 LOG.fatal("Error doing Action MouseDown :" + ex);647 return ex.getMessageError();648 }649 }650 private MessageEvent doActionRightClick(TestCaseExecution tCExecution, String value1, String value2) {651 MessageEvent message;652 String element;653 try {654 /**655 * Get element to use String object if not empty, String property if656 * object empty, throws Exception if both empty)657 */658 element = value1;659 /**660 * Get Identifier (identifier, locator)661 */662 Identifier identifier = identifierService.convertStringToIdentifier(element);663 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {664 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {665 return sikuliService.doSikuliActionRightClick(tCExecution.getSession(), identifier.getLocator(), "");666 } else if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_TEXT)) {667 return sikuliService.doSikuliActionRightClick(tCExecution.getSession(), "", identifier.getLocator());668 } else {669 identifierService.checkWebElementIdentifier(identifier.getIdentifier());670 return webdriverService.doSeleniumActionRightClick(tCExecution.getSession(), identifier);671 }672 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {673 if (StringUtil.isNullOrEmpty(identifier.getLocator())) {674 return sikuliService.doSikuliActionRightClick(tCExecution.getSession(), "", "");675 }676 identifierService.checkSikuliIdentifier(identifier.getIdentifier());677 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {678 return sikuliService.doSikuliActionRightClick(tCExecution.getSession(), identifier.getLocator(), "");679 } else {680 return sikuliService.doSikuliActionRightClick(tCExecution.getSession(), "", identifier.getLocator());681 }682 }683 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);684 message.setDescription(message.getDescription().replace("%ACTION%", "rightClick"));685 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));686 return message;687 } catch (CerberusEventException ex) {688 LOG.fatal("Error doing Action RightClick :" + ex);689 return ex.getMessageError();690 }691 }692 private MessageEvent doActionMouseLeftButtonRelease(TestCaseExecution tCExecution, String value1, String value2) {693 MessageEvent message;694 String element;695 try {696 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT) || StringUtil.isNullOrEmpty(value1)) {697 // If value1 is empty, the Sikuli engine must be used in order to click without element to click.698 return sikuliService.doSikuliActionLeftButtonRelease(tCExecution.getSession());699 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {700 /**701 * Get element to use String object if not empty, String702 * property if object empty, throws Exception if both empty)703 */704 element = getElementToUse(value1, value2, "mouseLeftButtonRelease", tCExecution);705 /**706 * Get Identifier (identifier, locator)707 */708 Identifier identifier = identifierService.convertStringToIdentifier(element);709 identifierService.checkWebElementIdentifier(identifier.getIdentifier());710 return webdriverService.doSeleniumActionMouseUp(tCExecution.getSession(), identifier, true, true);711 }712 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);713 message.setDescription(message.getDescription().replace("%ACTION%", "MouseUp"));714 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));715 return message;716 } catch (CerberusEventException ex) {717 LOG.fatal("Error doing Action MouseUp :" + ex);718 return ex.getMessageError();719 }720 }721 private MessageEvent doActionMouseMove(TestCaseExecution tCExecution, String value1, String value2) {722 MessageEvent message;723 String element;724 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)725 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {726 return sikuliService.doSikuliActionMouseMove(tCExecution.getSession(), value1);727 }728 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);729 message.setDescription(message.getDescription().replace("%ACTION%", "MouseMove"));730 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));731 return message;732 }733 private MessageEvent doActionSwitchToWindow(TestCaseExecution tCExecution, String object, String property) {734 String element;735 try {736 /**737 * Get element to use String object if not empty, String property if738 * object empty, throws Exception if both empty)739 */740 element = getElementToUse(object, property, "switchToWindow", tCExecution);741 /**742 * Get Identifier (identifier, locator)743 */744 Identifier identifier = identifierService.convertStringToIdentifier(element);745 //identifierService.checkWebElementIdentifier(identifier.getIdentifier());746 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {747 return webdriverService.doSeleniumActionSwitchToWindow(tCExecution.getSession(), identifier);748 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {749 return androidAppiumService.switchToContext(tCExecution.getSession(), identifier);750 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {751 return iosAppiumService.switchToContext(tCExecution.getSession(), identifier);752 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {753 return sikuliService.doSikuliActionSwitchApp(tCExecution.getSession(), identifier.getLocator());754 } else {755 return new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION)756 .resolveDescription("ACTION", "SwitchToWindow")757 .resolveDescription("APPLICATIONTYPE", tCExecution.getApplicationObj().getType());758 }759 } catch (CerberusEventException ex) {760 LOG.fatal("Error doing Action SwitchToWindow :" + ex);761 return ex.getMessageError();762 }763 }764 private MessageEvent doActionManageDialog(TestCaseExecution tCExecution, String value1, String value2) {765 MessageEvent message;766 String element;767 try {768 /**769 * Get element to use String object if not empty, String property if770 * object empty, throws Exception if both empty)771 */772 element = getElementToUse(value1, value2, "manageDialog", tCExecution);773 /**774 * Get Identifier (identifier, locator)775 */776 Identifier identifier = identifierService.convertStringToIdentifier(element);777 identifierService.checkWebElementIdentifier(identifier.getIdentifier());778 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {779 return webdriverService.doSeleniumActionManageDialog(tCExecution.getSession(), identifier);780 }781 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);782 message.setDescription(message.getDescription().replace("%ACTION%", "ManageDialog"));783 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));784 return message;785 } catch (CerberusEventException ex) {786 LOG.fatal("Error doing Action ManageDialog :" + ex);787 return ex.getMessageError();788 }789 }790 private MessageEvent doActionManageDialogKeyPress(TestCaseExecution tCExecution, String value1) {791 MessageEvent message;792 String element;793 try {794 /**795 * Get element to use String object if not empty, String property if796 * object empty, throws Exception if both empty)797 */798 element = getElementToUse(value1, "", "manageDialogKeyPress", tCExecution);799 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {800 return webdriverService.doSeleniumActionManageDialogKeyPress(tCExecution.getSession(), element);801 }802 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);803 message.setDescription(message.getDescription().replace("%ACTION%", "ManageDialogKeypress"));804 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));805 return message;806 } catch (CerberusEventException ex) {807 LOG.fatal("Error doing Action ManageDialogKeypress :" + ex);808 return ex.getMessageError();809 }810 }811 private MessageEvent doActionDoubleClick(TestCaseExecution tCExecution, String value1, String value2) {812 MessageEvent message;813 String element;814 try {815 /**816 * Get element to use String object if not empty, String property if817 * object empty, throws Exception if both empty)818 */819 element = value1;820 /**821 * Get Identifier (identifier, locator)822 */823 Identifier identifier = identifierService.convertStringToIdentifier(element);824 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {825 if (tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.ANDROID.toString())) {826 identifierService.checkWebElementIdentifier(identifier.getIdentifier());827 return webdriverService.doSeleniumActionDoubleClick(tCExecution.getSession(), identifier, false, false);828 } else {829 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {830 return sikuliService.doSikuliActionDoubleClick(tCExecution.getSession(), identifier.getLocator(), "");831 } else if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_TEXT)) {832 return sikuliService.doSikuliActionDoubleClick(tCExecution.getSession(), "", identifier.getLocator());833 } else {834 identifierService.checkWebElementIdentifier(identifier.getIdentifier());835 return webdriverService.doSeleniumActionDoubleClick(tCExecution.getSession(), identifier, true, true);836 }837 }838 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)839 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {840 identifierService.checkWebElementIdentifier(identifier.getIdentifier());841 return webdriverService.doSeleniumActionDoubleClick(tCExecution.getSession(), identifier, true, false);842 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {843 if (StringUtil.isNullOrEmpty(identifier.getLocator())) {844 return sikuliService.doSikuliActionDoubleClick(tCExecution.getSession(), "", "");845 }846 identifierService.checkSikuliIdentifier(identifier.getIdentifier());847 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {848 return sikuliService.doSikuliActionDoubleClick(tCExecution.getSession(), identifier.getLocator(), "");849 } else {850 return sikuliService.doSikuliActionDoubleClick(tCExecution.getSession(), "", identifier.getLocator());851 }852 }853 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);854 message.setDescription(message.getDescription().replace("%ACTION%", "doubleClick"));855 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));856 return message;857 } catch (CerberusEventException ex) {858 LOG.fatal("Error doing Action DoubleClick :" + ex);859 return ex.getMessageError();860 }861 }862 private MessageEvent doActionType(TestCaseExecution tCExecution, String value1, String value2, String propertyName) {863 try {864 /**865 * Check object and property are not null for GUI/APK/IPA Check866 * property is not null for FAT Application867 */868 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)869 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)870 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {871 if (value1 == null || value2 == null) {872 return new MessageEvent(MessageEventEnum.ACTION_FAILED_TYPE);873 }874 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {875 if (value2 == null) {876 return new MessageEvent(MessageEventEnum.ACTION_FAILED_TYPE);877 }878 }879 /**880 * Get Identifier (identifier, locator) if object not null881 */882 Identifier identifier = new Identifier();883 if (value1 != null) {884 identifier = identifierService.convertStringToIdentifier(value1);885 }886 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {887 if (tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.ANDROID.toString())) {888 identifierService.checkWebElementIdentifier(identifier.getIdentifier());889 return webdriverService.doSeleniumActionType(tCExecution.getSession(), identifier, value2, propertyName, false, false);890 } else {891 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {892 return sikuliService.doSikuliActionType(tCExecution.getSession(), identifier.getLocator(), value2);893 } else {894 identifierService.checkWebElementIdentifier(identifier.getIdentifier());895 return webdriverService.doSeleniumActionType(tCExecution.getSession(), identifier, value2, propertyName, true, true);896 }897 }898 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {899 return androidAppiumService.type(tCExecution.getSession(), identifier, value2, propertyName);900 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {901 return iosAppiumService.type(tCExecution.getSession(), identifier, value2, propertyName);902 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {903 String locator = "";904 if (!StringUtil.isNullOrEmpty(value1)) {905 identifierService.checkSikuliIdentifier(identifier.getIdentifier());906 locator = identifier.getLocator();907 }908 return sikuliService.doSikuliActionType(tCExecution.getSession(), locator, value2);909 } else {910 return new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION)911 .resolveDescription("ACTION", "Type")912 .resolveDescription("APPLICATIONTYPE", tCExecution.getApplicationObj().getType());913 }914 } catch (CerberusEventException ex) {915 LOG.fatal("Error doing Action Type : " + ex);916 return ex.getMessageError();917 }918 }919 private MessageEvent doActionMouseOver(TestCaseExecution tCExecution, String object, String property) {920 MessageEvent message;921 String element;922 try {923 /**924 * Get element to use String object if not empty, String property if925 * object empty, throws Exception if both empty)926 */927 element = getElementToUse(object, property, "mouseOver", tCExecution);928 /**929 * Get Identifier (identifier, locator)930 */931 Identifier identifier = identifierService.convertStringToIdentifier(element);932 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {933 if (tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.ANDROID.toString())) {934 identifierService.checkWebElementIdentifier(identifier.getIdentifier());935 return webdriverService.doSeleniumActionMouseOver(tCExecution.getSession(), identifier, false, false);936 } else {937 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {938 return sikuliService.doSikuliActionMouseOver(tCExecution.getSession(), identifier.getLocator(), "");939 } else if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_TEXT)) {940 return sikuliService.doSikuliActionMouseOver(tCExecution.getSession(), "", identifier.getLocator());941 } else {942 identifierService.checkWebElementIdentifier(identifier.getIdentifier());943 return webdriverService.doSeleniumActionMouseOver(tCExecution.getSession(), identifier, true, true);944 }945 }946 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {947 identifierService.checkSikuliIdentifier(identifier.getIdentifier());948 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {949 return sikuliService.doSikuliActionMouseOver(tCExecution.getSession(), identifier.getLocator(), "");950 } else {951 return sikuliService.doSikuliActionMouseOver(tCExecution.getSession(), "", identifier.getLocator());952 }953 }954 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);955 message.setDescription(message.getDescription().replace("%ACTION%", "mouseOver"));956 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));957 return message;958 } catch (CerberusEventException ex) {959 LOG.fatal("Error doing Action MouseOver :" + ex);960 return ex.getMessageError();961 }962 }963 private MessageEvent doActionMouseOverAndWait(TestCaseExecution tCExecution, String object, String property) {964 MessageEvent message;965 try {966 /**967 * Check object is not null968 */969 if (object == null) {970 return new MessageEvent(MessageEventEnum.ACTION_FAILED_MOUSEOVERANDWAIT_GENERIC);971 }972 /**973 * Get Identifier (identifier, locator)974 */975 Identifier identifier = identifierService.convertStringToIdentifier(object);976 identifierService.checkWebElementIdentifier(identifier.getIdentifier());977 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {978 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {979 message = sikuliService.doSikuliActionMouseOver(tCExecution.getSession(), identifier.getLocator(), "");980 } else if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_TEXT)) {981 message = sikuliService.doSikuliActionMouseOver(tCExecution.getSession(), "", identifier.getLocator());982 } else {983 message = webdriverService.doSeleniumActionMouseOver(tCExecution.getSession(), identifier, true, true);984 }985 if (message.getCodeString().equals("OK")) {986 message = this.doActionWait(tCExecution, property, null);987 }988 return message;989 }990 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);991 message.setDescription(message.getDescription().replace("%ACTION%", "mouseOverAndWait"));992 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));993 return message;994 } catch (CerberusEventException ex) {995 LOG.fatal("Error doing Action MouseOverAndWait :" + ex);996 return ex.getMessageError();997 }998 }999 private MessageEvent doActionWait(TestCaseExecution tCExecution, String value1, String value2) {1000 MessageEvent message;1001 String element;1002 long timeToWaitInMs = 0;1003 Identifier identifier = null;1004 try {1005 /**1006 * Get element to use String object if not empty, String property if1007 * object empty, null if both are empty1008 */1009 element = getElementToUse(value1, value2, "wait", tCExecution);1010 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)1011 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)1012 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)1013 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) { // If application are Selenium or appium based, we have a session and can use it to wait.1014 /**1015 * if element is integer, set time to that value else Get1016 * Identifier (identifier, locator)1017 */1018 if (StringUtil.isNullOrEmpty(element)) {1019 timeToWaitInMs = tCExecution.getCerberus_action_wait_default();1020 } else if (StringUtil.isInteger(element)) {1021 timeToWaitInMs = Long.valueOf(element);1022 } else {1023 identifier = identifierService.convertStringToIdentifier(element);1024 }1025 if (identifier != null && identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {1026 return sikuliService.doSikuliActionWait(tCExecution.getSession(), identifier.getLocator(), "");1027 } else if (identifier != null && identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_TEXT)) {1028 return sikuliService.doSikuliActionWait(tCExecution.getSession(), "", identifier.getLocator());1029 } else if (identifier != null) {1030 identifierService.checkWebElementIdentifier(identifier.getIdentifier());1031 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {1032 return androidAppiumService.wait(tCExecution.getSession(), identifier);1033 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {1034 return iosAppiumService.wait(tCExecution.getSession(), identifier);1035 } else {1036 return webdriverService.doSeleniumActionWait(tCExecution.getSession(), identifier);1037 }1038 } else {1039 return this.waitTime(timeToWaitInMs);1040 }1041 } else { // For any other application we wait for the integer value.1042 if (StringUtil.isNullOrEmpty(element)) {1043 // Get default wait from parameter1044 timeToWaitInMs = tCExecution.getCerberus_action_wait_default();1045 } else if (StringUtil.isInteger(element)) {1046 timeToWaitInMs = Long.valueOf(element);1047 }1048 return this.waitTime(timeToWaitInMs);1049 }1050 } catch (CerberusEventException ex) {1051 LOG.fatal("Error doing Action Wait :" + ex);1052 return ex.getMessageError();1053 }1054 }1055 private MessageEvent doActionKeyPress(TestCaseExecution tCExecution, String element, String valueToKey, String modifier) {1056 try {1057 String appType = tCExecution.getApplicationObj().getType();1058 /**1059 * Check value1 and value2 are not null For IPA and APK, only value21060 * (key to press) is mandatory For GUI and FAT, both parameters are1061 * mandatory1062 */1063 if (StringUtil.isNullOrEmpty(valueToKey)) {1064 return new MessageEvent(MessageEventEnum.ACTION_FAILED_KEYPRESS_MISSINGKEY).resolveDescription("APPLICATIONTYPE", appType);1065 }1066 /**1067 * Get Identifier (identifier, locator)1068 */1069 if (StringUtil.isNullOrEmpty(element) && appType.equalsIgnoreCase(Application.TYPE_GUI)) {1070 element = "xpath=//body";1071 }1072 Identifier objectIdentifier = identifierService.convertStringToIdentifier(element);1073 if (appType.equalsIgnoreCase(Application.TYPE_GUI)) {1074 if (tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.MAC.toString())1075 || tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.IOS.toString())) {1076 return iosAppiumService.keyPress(tCExecution.getSession(), valueToKey);1077 } else if (tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.ANDROID.toString())) {1078 return webdriverService.doSeleniumActionKeyPress(tCExecution.getSession(), objectIdentifier, valueToKey, false, false);1079 }1080 if (objectIdentifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {1081 return sikuliService.doSikuliActionKeyPress(tCExecution.getSession(), objectIdentifier.getLocator(), valueToKey, modifier);1082 } else {1083 identifierService.checkWebElementIdentifier(objectIdentifier.getIdentifier());1084 return webdriverService.doSeleniumActionKeyPress(tCExecution.getSession(), objectIdentifier, valueToKey, true, true);1085 }1086 } else if (appType.equalsIgnoreCase(Application.TYPE_APK)) {1087 return androidAppiumService.keyPress(tCExecution.getSession(), valueToKey);1088 } else if (appType.equalsIgnoreCase(Application.TYPE_IPA)) {1089 return iosAppiumService.keyPress(tCExecution.getSession(), valueToKey);1090 } else if (appType.equalsIgnoreCase(Application.TYPE_FAT)) {1091 return sikuliService.doSikuliActionKeyPress(tCExecution.getSession(), objectIdentifier.getLocator(), valueToKey, modifier);1092 } else {1093 return new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION)1094 .resolveDescription("ACTION", "KeyPress")1095 .resolveDescription("APPLICATIONTYPE", appType);1096 }1097 } catch (CerberusEventException ex) {1098 LOG.debug("Error doing Action KeyPress :" + ex);1099 return ex.getMessageError();1100 } catch (Exception ex) {1101 LOG.debug("Error doing Action KeyPress :" + ex);1102 return new MessageEvent(MessageEventEnum.ACTION_FAILED_GENERIC)1103 .resolveDescription("DETAIL", ex.toString());1104 }1105 }1106 private MessageEvent doActionOpenURL(TestCaseExecution execution, String value1, String value2, boolean withBase) {1107 MessageEvent message;1108 String element;1109 try {1110 /**1111 * Get element to use String object if not empty, String property if1112 * object empty, throws Exception if both empty)1113 */1114 if (withBase && StringUtil.isNullOrEmpty(value1)) {1115 value1 = "/";1116 }1117 element = getElementToUse(value1, value2, "openUrl[WithBase]", execution);1118 /**1119 * Get Identifier (identifier, locator)1120 */1121 Identifier identifier = new Identifier();1122 identifier.setIdentifier("url");1123 identifier.setLocator(element);1124 if (execution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1125 return webdriverService.doSeleniumActionOpenURL(execution.getSession(), execution.getUrl(), identifier, withBase);1126 }1127 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1128 message.setDescription(message.getDescription().replace("%ACTION%", "OpenURL[WithBase]"));1129 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", execution.getApplicationObj().getType()));1130 return message;1131 } catch (CerberusEventException ex) {1132 LOG.fatal("Error doing Action OpenUrl :" + ex);1133 return ex.getMessageError();1134 }1135 }1136 private MessageEvent doActionOpenApp(TestCaseExecution tCExecution, String value1, String value2) {1137 MessageEvent message;1138 /**1139 * Check value1 is not null or empty1140 */1141 if (value1 == null || "".equals(value1)) {1142 return new MessageEvent(MessageEventEnum.ACTION_FAILED_OPENAPP);1143 }1144 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)1145 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1146 return sikuliService.doSikuliActionOpenApp(tCExecution.getSession(), value1);1147 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {1148 return androidAppiumService.openApp(tCExecution.getSession(), value1, value2);1149 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {1150 return iosAppiumService.openApp(tCExecution.getSession(), value1, value2);1151 }1152 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1153 message.setDescription(message.getDescription().replace("%ACTION%", "OpenApp"));1154 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1155 return message;1156 }1157 private MessageEvent doActionCloseApp(TestCaseExecution tCExecution, String value1) {1158 MessageEvent message;1159 /**1160 * Check value1 is not null or empty1161 */1162 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)1163 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1164 if (value1 == null || "".equals(value1)) {1165 return new MessageEvent(MessageEventEnum.ACTION_FAILED_CLOSEAPP);1166 }1167 return sikuliService.doSikuliActionCloseApp(tCExecution.getSession(), value1);1168 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {1169 return androidAppiumService.closeApp(tCExecution.getSession());1170 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {1171 return iosAppiumService.closeApp(tCExecution.getSession());1172 }1173 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1174 message.setDescription(message.getDescription().replace("%ACTION%", "CloseApp"));1175 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1176 return message;1177 }1178 private MessageEvent doActionWaitVanish(TestCaseExecution tCExecution, String value1) {1179 try {1180 /**1181 * Check value1 is not null or empty1182 */1183 if (value1 == null || "".equals(value1)) {1184 return new MessageEvent(MessageEventEnum.ACTION_FAILED_CLOSEAPP);1185 }1186 /**1187 * Get Identifier (identifier, locator)1188 */1189 Identifier identifier = identifierService.convertStringToIdentifier(value1);1190 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1191 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {1192 return sikuliService.doSikuliActionWaitVanish(tCExecution.getSession(), identifier.getLocator(), "");1193 } else if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_TEXT)) {1194 return sikuliService.doSikuliActionWaitVanish(tCExecution.getSession(), "", identifier.getLocator());1195 } else {1196 identifierService.checkWebElementIdentifier(identifier.getIdentifier());1197 return webdriverService.doSeleniumActionWaitVanish(tCExecution.getSession(), identifier);1198 }1199 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)1200 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {1201 identifierService.checkWebElementIdentifier(identifier.getIdentifier());1202 return webdriverService.doSeleniumActionWaitVanish(tCExecution.getSession(), identifier);1203 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {1204 identifierService.checkSikuliIdentifier(identifier.getIdentifier());1205 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {1206 return sikuliService.doSikuliActionWaitVanish(tCExecution.getSession(), identifier.getLocator(), "");1207 } else {1208 return sikuliService.doSikuliActionWaitVanish(tCExecution.getSession(), "", identifier.getLocator());1209 }1210 } else {1211 return new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION)1212 .resolveDescription("ACTION", "WaitVanish")1213 .resolveDescription("APPLICATIONTYPE", tCExecution.getApplicationObj().getType());1214 }1215 } catch (CerberusEventException ex) {1216 LOG.fatal("Error doing Action KeyPress :" + ex);1217 return ex.getMessageError();1218 }1219 }1220 private MessageEvent doActionWaitNetworkTrafficIdle(TestCaseExecution tCExecution) {1221 try {1222 return executorService.waitForIdleNetwork(tCExecution.getRobotExecutorObj().getExecutorExtensionHost(), tCExecution.getRobotExecutorObj().getExecutorExtensionPort(),1223 tCExecution.getRemoteProxyUUID(), tCExecution.getSystem());1224 } catch (CerberusEventException ex) {1225 LOG.fatal("Error doing Action WaitNetworkTrafficIdle :" + ex);1226 return ex.getMessageError();1227 }1228 }1229 private MessageEvent doActionSelect(TestCaseExecution tCExecution, String value1, String value2) {1230 MessageEvent message;1231 try {1232 /**1233 * Check object and property are not null1234 */1235 if (StringUtil.isNullOrEmpty(value1) || StringUtil.isNullOrEmpty(value2)) {1236 return new MessageEvent(MessageEventEnum.ACTION_FAILED_SELECT);1237 }1238 /**1239 * Get Identifier (identifier, locator)1240 */1241 Identifier identifierValue1 = identifierService.convertStringToIdentifier(value1);1242 Identifier identifierValue2 = identifierService.convertStringToSelectIdentifier(value2);1243 identifierService.checkWebElementIdentifier(identifierValue1.getIdentifier());1244 identifierService.checkSelectOptionsIdentifier(identifierValue2.getIdentifier());1245 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)1246 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)1247 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {1248 if (tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.ANDROID.toString())) {1249 return webdriverService.doSeleniumActionSelect(tCExecution.getSession(), identifierValue1, identifierValue2, false, false);1250 }1251 return webdriverService.doSeleniumActionSelect(tCExecution.getSession(), identifierValue1, identifierValue2, true, true);1252 }1253 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1254 message.setDescription(message.getDescription().replace("%ACTION%", "Select"));1255 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1256 return message;1257 } catch (CerberusEventException ex) {1258 LOG.fatal("Error doing Action Select :" + ex);1259 return ex.getMessageError();1260 }1261 }1262 private MessageEvent doActionUrlLogin(TestCaseExecution tCExecution) {1263 MessageEvent message;1264 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1265 return webdriverService.doSeleniumActionUrlLogin(tCExecution.getSession(), tCExecution.getUrl(), tCExecution.getCountryEnvironmentParameters().getUrlLogin());1266 }1267 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1268 message.setDescription(message.getDescription().replace("%ACTION%", "UrlLogin"));1269 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1270 return message;1271 }1272 private MessageEvent doActionFocusToIframe(TestCaseExecution tCExecution, String object, String property) {1273 MessageEvent message;1274 String element;1275 try {1276 /**1277 * Get element to use String object if not empty, String property if1278 * object empty, throws Exception if both empty)1279 */1280 element = getElementToUse(object, property, "focusToIframe", tCExecution);1281 /**1282 * Get Identifier (identifier, locator)1283 */1284 Identifier identifier = identifierService.convertStringToIdentifier(element);1285 identifierService.checkWebElementIdentifier(identifier.getIdentifier());1286 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1287 return webdriverService.doSeleniumActionFocusToIframe(tCExecution.getSession(), identifier);1288 }1289 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1290 message.setDescription(message.getDescription().replace("%ACTION%", "FocusToIframe"));1291 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1292 return message;1293 } catch (CerberusEventException ex) {1294 LOG.fatal("Error doing Action FocusToIframe :" + ex);1295 return ex.getMessageError();1296 }1297 }1298 private MessageEvent doActionFocusDefaultIframe(TestCaseExecution tCExecution) {1299 MessageEvent message;1300 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1301 return webdriverService.doSeleniumActionFocusDefaultIframe(tCExecution.getSession());1302 }1303 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1304 message.setDescription(message.getDescription().replace("%ACTION%", "FocusDefaultIframe"));1305 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1306 return message;1307 }1308 public MessageEvent doActionDragAndDrop(TestCaseExecution tCExecution, String value1, String value2) throws IOException {1309 MessageEvent message;1310 try {1311 /**1312 * Check source and target are not null1313 */1314 if (StringUtil.isNullOrEmpty(value1)) {1315 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_DRAGANDDROP);1316 message.setDescription(message.getDescription().replace("%ELEMENT%", value1));1317 return message;1318 } else if (StringUtil.isNullOrEmpty(value2)) {1319 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_DRAGANDDROP);1320 message.setDescription(message.getDescription().replace("%ELEMENT%", value2));1321 return message;1322 }1323 Identifier identifierDrag = identifierService.convertStringToIdentifier(value1);1324 Identifier identifierDrop = identifierService.convertStringToIdentifier(value2);1325 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1326 identifierService.checkWebElementIdentifier(identifierDrag.getIdentifier());1327 identifierService.checkWebElementIdentifier(identifierDrop.getIdentifier());1328 if (identifierDrag.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)1329 && identifierDrop.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {1330 return sikuliService.doSikuliActionDragAndDrop(tCExecution.getSession(), identifierDrag, identifierDrop);1331 } else {1332 return webdriverService.doSeleniumActionDragAndDrop(tCExecution.getSession(), identifierDrag, identifierDrop, true, true);1333 }1334 }1335 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {1336 identifierService.checkSikuliIdentifier(identifierDrag.getIdentifier());1337 identifierService.checkSikuliIdentifier(identifierDrop.getIdentifier());1338 return sikuliService.doSikuliActionDragAndDrop(tCExecution.getSession(), identifierDrag, identifierDrop);1339 }1340 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1341 message.setDescription(message.getDescription().replace("%ACTION%", "Select"));1342 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1343 return message;1344 } catch (CerberusEventException ex) {1345 LOG.fatal("Error doing Action DragAndDrop :" + ex);1346 return ex.getMessageError();1347 }1348 }1349 private MessageEvent doActionCallService(TestCaseStepActionExecution testCaseStepActionExecution, String value1, String value2, String value3) {1350 MessageEvent message = new MessageEvent(MessageEventEnum.ACTION_FAILED_CALLSERVICE);1351 TestCaseExecution tCExecution = testCaseStepActionExecution.getTestCaseStepExecution().gettCExecution();1352 AnswerItem lastServiceCalledAnswer;1353 lastServiceCalledAnswer = serviceService.callService(value1, value2, value3, null, null, null, null, tCExecution);1354 message = lastServiceCalledAnswer.getResultMessage();1355 if (lastServiceCalledAnswer.getItem() != null) {1356 AppService lastServiceCalled = (AppService) lastServiceCalledAnswer.getItem();1357 tCExecution.setLastServiceCalled(lastServiceCalled);1358 tCExecution.setOriginalLastServiceCalled(lastServiceCalled.getResponseHTTPBody());1359 tCExecution.setOriginalLastServiceCalledContent(lastServiceCalled.getResponseHTTPBodyContentType());1360 /**1361 * Record the Request and Response in file system.1362 */1363 testCaseStepActionExecution.addFileList(recorderService.recordServiceCall(tCExecution, testCaseStepActionExecution, 0, null, lastServiceCalled));1364 }1365 return message;1366 }1367 private MessageEvent doActionRemoveDifference(TestCaseStepActionExecution testCaseStepActionExecution, String object, String property) {1368 // Filters differences from the given object pattern1369 String filteredDifferences = xmlUnitService.removeDifference(object, property);1370 // If filtered differences are null then service has returned with errors1371 if (filteredDifferences == null) {1372 MessageEvent message = new MessageEvent(MessageEventEnum.ACTION_FAILED_REMOVEDIFFERENCE);1373 message.setDescription(message.getDescription().replace("%DIFFERENCE%", object));1374 message.setDescription(message.getDescription().replace("%DIFFERENCES%", property));1375 return message;1376 }1377 // Sets the property value to the new filtered one1378 for (TestCaseExecutionData data : testCaseStepActionExecution.getTestCaseExecutionDataList()) {1379 if (data.getProperty().equals(testCaseStepActionExecution.getPropertyName())) {1380 data.setValue(filteredDifferences);1381 break;1382 }1383 }1384 // Sends success1385 MessageEvent message = new MessageEvent(MessageEventEnum.ACTION_SUCCESS_REMOVEDIFFERENCE);1386 message.setDescription(message.getDescription().replace("%DIFFERENCE%", object));1387 message.setDescription(message.getDescription().replace("%DIFFERENCES%", property));1388 return message;1389 }1390 private MessageEvent doActionCalculateProperty(TestCaseStepActionExecution testCaseStepActionExecution, String value1, String value2) {1391 MessageEvent message;1392 AnswerItem<String> answerDecode = new AnswerItem<>();1393 if (StringUtil.isNullOrEmpty(value1)) {1394 // Value1 is a mandatory parameter.1395 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_CALCULATEPROPERTY_MISSINGPROPERTY);1396 message.setDescription(message.getDescription().replace("%ACTION%", TestCaseStepAction.ACTION_CALCULATEPROPERTY));1397 } else {1398 try {1399 TestCaseExecution tCExecution = testCaseStepActionExecution.getTestCaseStepExecution().gettCExecution();1400 // Getting the Country property definition.1401 TestCaseCountryProperties tccp = null;1402 boolean propertyExistOnAnyCountry = false;1403 for (TestCaseCountryProperties object : tCExecution.getTestCaseCountryPropertyList()) {1404 if ((object.getProperty().equalsIgnoreCase(value1)) && (object.getCountry().equalsIgnoreCase(tCExecution.getCountry()))) {1405 tccp = object;1406 }1407 if ((object.getProperty().equalsIgnoreCase(value1))) {1408 propertyExistOnAnyCountry = true;1409 }1410 }1411 if (tccp == null) { // Could not find a country property inside the existing execution.1412 if (propertyExistOnAnyCountry) {1413 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NO_PROPERTY_DEFINITION);1414 message.setDescription(message.getDescription().replace("%ACTION%", TestCaseStepAction.ACTION_CALCULATEPROPERTY)1415 .replace("%PROP%", value1)1416 .replace("%COUNTRY%", tCExecution.getCountry()));1417 return message;1418 } else {1419 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_CALCULATEPROPERTY_PROPERTYNOTFOUND);1420 message.setDescription(message.getDescription().replace("%ACTION%", TestCaseStepAction.ACTION_CALCULATEPROPERTY)1421 .replace("%PROP%", value1)1422 .replace("%COUNTRY%", tCExecution.getCountry()));1423 return message;1424 }1425 } else {1426 if (!(StringUtil.isNullOrEmpty(value2))) {1427 // If value2 is fed with something, we control here that value is a valid property name and gets its defintion.1428 tccp = null;1429 propertyExistOnAnyCountry = false;1430 for (TestCaseCountryProperties object : tCExecution.getTestCaseCountryPropertyList()) {1431 if ((object.getProperty().equalsIgnoreCase(value2)) && (object.getCountry().equalsIgnoreCase(tCExecution.getCountry()))) {1432 tccp = object;1433 }1434 if ((object.getProperty().equalsIgnoreCase(value2))) {1435 propertyExistOnAnyCountry = true;1436 }1437 }1438 if (tccp == null) { // Could not find a country property inside the existing execution.1439 if (propertyExistOnAnyCountry) {1440 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NO_PROPERTY_DEFINITION);1441 message.setDescription(message.getDescription().replace("%ACTION%", TestCaseStepAction.ACTION_CALCULATEPROPERTY)1442 .replace("%PROP%", value2)1443 .replace("%COUNTRY%", tCExecution.getCountry()));1444 return message;1445 } else {1446 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_CALCULATEPROPERTY_PROPERTYNOTFOUND);1447 message.setDescription(message.getDescription().replace("%ACTION%", TestCaseStepAction.ACTION_CALCULATEPROPERTY)1448 .replace("%PROP%", value2)1449 .replace("%COUNTRY%", tCExecution.getCountry()));1450 return message;1451 }1452 }1453 }1454 // We calculate the property here.1455 long now = new Date().getTime();1456 TestCaseExecutionData tcExeData;1457 tcExeData = factoryTestCaseExecutionData.create(tCExecution.getId(), tccp.getProperty(), 1, tccp.getDescription(), null, tccp.getType(),1458 tccp.getRank(), tccp.getValue1(), tccp.getValue2(), null, null, now, now, now, now, new MessageEvent(MessageEventEnum.PROPERTY_PENDING),1459 tccp.getRetryNb(), tccp.getRetryPeriod(), tccp.getDatabase(), tccp.getValue1(), tccp.getValue2(), tccp.getLength(), tccp.getLength(),1460 tccp.getRowLimit(), tccp.getNature(), "", "", "", "", "", "N");1461 tcExeData.setTestCaseCountryProperties(tccp);1462 propertyService.calculateProperty(tcExeData, tCExecution, testCaseStepActionExecution, tccp, true);1463 // Property message goes to Action message.1464 message = tcExeData.getPropertyResultMessage();1465 if (message.getCodeString().equals("OK")) {1466 // If Property calculated successfully we summarize the message to a shorter version.1467 message = new MessageEvent(MessageEventEnum.ACTION_SUCCESS_CALCULATEPROPERTY);1468 message.resolveDescription("VALUE", tcExeData.getValue());1469 message.resolveDescription("PROP", value1);1470 if (tcExeData.getDataLibRawData() != null) {1471 message.setDescription(message.getDescription() + " %NBROWS% row(s) with %NBSUBDATA% Subdata(s) calculated."1472 .replace("%NBROWS%", String.valueOf(tcExeData.getDataLibRawData().size()))1473 .replace("%NBSUBDATA%", String.valueOf(tcExeData.getDataLibRawData().get(0).size())));1474 }1475 }1476 if (!(StringUtil.isNullOrEmpty(value2))) {1477 // If value2 is fed we force the result to value1.1478 tcExeData.setProperty(value1);1479 }1480 //saves the result1481 try {1482 testCaseExecutionDataService.save(tcExeData, tCExecution.getSecrets());1483 LOG.debug("Adding into Execution data list. Property : '" + tcExeData.getProperty() + "' Index : '" + tcExeData.getIndex() + "' Value : '" + tcExeData.getValue() + "'");1484 tCExecution.getTestCaseExecutionDataMap().put(tcExeData.getProperty(), tcExeData);1485 if (tcExeData.getDataLibRawData() != null) { // If the property is a TestDataLib, we same all rows retreived in order to support nature such as NOTINUSe or RANDOMNEW.1486 for (int i = 1; i < (tcExeData.getDataLibRawData().size()); i++) {1487 now = new Date().getTime();1488 TestCaseExecutionData tcedS = factoryTestCaseExecutionData.create(tcExeData.getId(), tcExeData.getProperty(), (i + 1),1489 tcExeData.getDescription(), tcExeData.getDataLibRawData().get(i).get(""), tcExeData.getType(), tcExeData.getRank(), "", "",1490 tcExeData.getRC(), "", now, now, now, now, null, 0, 0, "", "", "", "", "", 0, "", "", "", "", "", "", "N");1491 testCaseExecutionDataService.save(tcedS, tCExecution.getSecrets());1492 }1493 }1494 } catch (CerberusException cex) {1495 LOG.error(cex.getMessage(), cex);1496 }1497 }1498 } catch (Exception ex) {1499 LOG.error(ex.toString(), ex);1500 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_GENERIC).resolveDescription("DETAIL", ex.toString());1501 }1502 }1503 return message;1504 }1505 private MessageEvent doActionSetNetworkTrafficContent(TestCaseExecution exe, TestCaseStepActionExecution actionexe, String urlToFilter, String withResponseContent) throws IOException {1506 MessageEvent message;1507 try {1508 // Check that robot has executor activated1509 if (!"Y".equalsIgnoreCase(exe.getRobotExecutorObj().getExecutorProxyActive()) || StringUtil.isNullOrEmpty(exe.getRobotExecutorObj().getExecutorProxyHost())) {1510 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_SETNETWORKTRAFFICCONTENT_ROBOTEXECUTORPROXYNOTACTIVATED);1511 message.setDescription(message.getDescription().replace("%ROBOT%", exe.getRobotExecutorObj().getRobot()).replace("%EXECUTOR%", exe.getRobotExecutorObj().getExecutor()));1512 return message;1513 }1514 LOG.debug("Getting Network Traffic content.");1515 Integer indexFrom = 0;1516 if (!exe.getNetworkTrafficIndexList().isEmpty()) {1517 // Take the value from the last entry.1518 indexFrom = exe.getNetworkTrafficIndexList().get(exe.getNetworkTrafficIndexList().size() - 1).getIndexRequestNb();1519 }1520 // We now get the har data.1521 boolean doWithResponse = ParameterParserUtil.parseBooleanParam(withResponseContent, false);1522 JSONObject har = executorService.getHar(urlToFilter, doWithResponse, exe.getRobotExecutorObj().getExecutorExtensionHost(), exe.getRobotExecutorObj().getExecutorExtensionPort(), exe.getRemoteProxyUUID(), exe.getSystem(), indexFrom);1523 har = harService.enrichWithStats(har, exe.getCountryEnvironmentParameters().getDomain(), exe.getSystem(), exe.getNetworkTrafficIndexList());1524 AppService appSrv = factoryAppService.create("", AppService.TYPE_REST, AppService.METHOD_HTTPGET, "", "", "", "", "", "", "", "", "", "", "", true, "", "", false, "", "", "", null, "", null, null);1525 appSrv.setResponseHTTPBody(har.toString());1526 appSrv.setResponseHTTPBodyContentType(AppService.RESPONSEHTTPBODYCONTENTTYPE_JSON);1527 appSrv.setRecordTraceFile(false);1528 exe.setLastServiceCalled(appSrv);1529 /**1530 * Record the Request and Response in file system.1531 */1532 actionexe.addFileList(recorderService.recordNetworkTrafficContent(exe, actionexe, 0, null, appSrv, true));1533 // Forcing the apptype to SRV in order to allow all controls to plug to the json context of the har.1534 exe.setAppTypeEngine(Application.TYPE_SRV);1535 if (!exe.getNetworkTrafficIndexList().isEmpty()) {1536 // Message will include the index and request nb when the content start.1537 message = new MessageEvent(MessageEventEnum.ACTION_SUCCESS_SETNETWORKTRAFFICCONTENT).resolveDescription("INDEX", String.valueOf(exe.getNetworkTrafficIndexList().size())).resolveDescription("NBHITS", String.valueOf(indexFrom));1538 } else {1539 message = new MessageEvent(MessageEventEnum.ACTION_SUCCESS_SETNETWORKTRAFFICCONTENT_FROMINDEX0);1540 }1541 return message;1542 } catch (Exception ex) {1543 LOG.error("Error doing Action setNetworkTrafficContent :" + ex, ex);1544 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_SETNETWORKTRAFFICCONTENT);1545 message.setDescription(message.getDescription().replace("%DETAIL%", ex.toString()));1546 return message;1547 }1548 }1549 private MessageEvent doActionIndexNetworkTraffic(TestCaseExecution exe, TestCaseStepActionExecution actionexe, String value1) throws IOException {1550 MessageEvent message;1551 try {1552 // Check that robot has executor activated1553 if (!"Y".equalsIgnoreCase(exe.getRobotExecutorObj().getExecutorProxyActive()) || StringUtil.isNullOrEmpty(exe.getRobotExecutorObj().getExecutorProxyHost())) {1554 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_INDEXNETWORKTRAFFIC_ROBOTEXECUTORPROXYNOTACTIVATED);1555 message.setDescription(message.getDescription().replace("%ROBOT%", exe.getRobotExecutorObj().getRobot()).replace("%EXECUTOR%", exe.getRobotExecutorObj().getExecutor()));1556 return message;1557 }1558 LOG.debug("Getting Network Traffic index");1559 /**1560 * Building the url to get the Latest index from cerberus-executor1561 */1562 Integer nbHits = executorService.getHitsNb(exe.getRobotExecutorObj().getExecutorExtensionHost(), exe.getRobotExecutorObj().getExecutorExtensionPort(), exe.getRemoteProxyUUID());1563 NetworkTrafficIndex nti = new NetworkTrafficIndex();1564 if (StringUtil.isNullOrEmpty(value1)) {1565 value1 = "INDEX" + (exe.getNetworkTrafficIndexList().size() + 1);1566 }1567 nti.setName(value1);1568 nti.setIndexRequestNb(nbHits);1569 exe.appendNetworkTrafficIndexList(nti);1570 LOG.debug("New Index : " + exe.getNetworkTrafficIndexList());1571 message = new MessageEvent(MessageEventEnum.ACTION_SUCCESS_INDEXNETWORKTRAFFIC).resolveDescription("NB", nbHits.toString()).resolveDescription("INDEX", String.valueOf(exe.getNetworkTrafficIndexList().size()));1572 return message;1573 } catch (Exception ex) {1574 LOG.error("Error doing Action indexNetworkTraffic :" + ex, ex);1575 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_INDEXNETWORKTRAFFIC);1576 message.setDescription(message.getDescription().replace("%DETAIL%", ex.toString()));1577 return message;1578 }1579 }1580 private MessageEvent doActionSetConsoleContent(TestCaseExecution exe, TestCaseStepActionExecution actionexe, String textToFilter) throws IOException {1581 MessageEvent message;1582 try {1583 /**1584 * Building the url to get the Har file from cerberus-executor1585 */1586 LOG.debug("Getting Console Logs content.");1587 JSONObject consoleRecap = new JSONObject();1588 JSONArray consoleLogs = webdriverService.getJSONConsoleLog(exe.getSession());1589 consoleRecap.put("logs", consoleLogs);1590 JSONObject consoleStat = new JSONObject();1591 consoleStat = consolelogService.enrichWithStats(consoleLogs);1592 consoleRecap.put("stat", consoleStat);1593 AppService appSrv = factoryAppService.create("", "", "", "", "", "", "", "", "", "", "", "", "", "", false, "", "", false, "", null, "", null, "", null, "");1594 appSrv.setResponseHTTPBody(consoleRecap.toString());1595 appSrv.setResponseHTTPBodyContentType(AppService.RESPONSEHTTPBODYCONTENTTYPE_JSON);1596 appSrv.setRecordTraceFile(false);1597 exe.setLastServiceCalled(appSrv);1598 /**1599 * Record the Request and Response in file system.1600 */1601 actionexe.addFileList(recorderService.recordConsoleContent(exe, actionexe, 0, null, consoleRecap, true));1602 // Forcing the apptype to SRV in order to allow all controls to plug to the json context of the har.1603 exe.setAppTypeEngine(Application.TYPE_SRV);1604 message = new MessageEvent(MessageEventEnum.ACTION_SUCCESS_SETCONSOLECONTENT);1605 return message;1606 } catch (Exception ex) {1607 LOG.error("Error doing Action setNetworkTrafficContent :" + ex);1608 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_SETCONSOLECONTENT);1609 message.setDescription(message.getDescription().replace("%DETAIL%", ex.toString()));1610 return message;1611 }1612 }1613 private MessageEvent doActionSetContent(TestCaseExecution exe, TestCaseStepActionExecution actionexe, String textContent) throws IOException {1614 MessageEvent message;1615 try {1616 /**1617 * Building the url to get the Har file from cerberus-executor1618 */1619 LOG.debug("Setting static content.");1620 AppService appSrv = factoryAppService.create("", "", "", "", "", "", "", "", "", "", "", "", "", "", false, "", "", false, "", "", "", null, "", null, "");1621 appSrv.setResponseHTTPBody(textContent);1622 appSrv.setResponseHTTPBodyContentType(appServiceService.guessContentType(appSrv, AppService.RESPONSEHTTPBODYCONTENTTYPE_JSON));1623 appSrv.setRecordTraceFile(false);1624 exe.setLastServiceCalled(appSrv);1625 /**1626 * Record the Request and Response in file system.1627 */...

Full Screen

Full Screen

doActionSetContent

Using AI Code Generation

copy

Full Screen

1importPackage(org.cerberus.engine.entity);2importPackage(org.cerberus.engine.gwt.impl);3var actionService = new ActionService();4actionService.doActionSetContent("myPage", "content", false, false, false, false, false);5var page = appService.getPage("myPage");6return page.getContent();

Full Screen

Full Screen

doActionSetContent

Using AI Code Generation

copy

Full Screen

1var content = "Hello World";2var selector = "#elementId";3var action = "doActionSetContent";4var parameters = [selector,content];5var json = {};6var actionService = new org.cerberus.engine.gwt.impl.ActionService();7var actionObject = new org.cerberus.engine.entity.Action(action,parameters,json);8var executionService = new org.cerberus.engine.gwt.impl.ExecutionService();9var executionObject = new org.cerberus.engine.entity.Execution("1",actionObject);10executionService.execute(executionObject);11var result = executionObject.getResult();12var resultString = result.toString();13var resultInt = result.toInteger();14var resultBool = result.toBoolean();15var resultDouble = result.toDouble();16var resultFloat = result.toFloat();17var resultLong = result.toLong();18var resultShort = result.toShort();19var resultByte = result.toByte();20var resultChar = result.toChar();21var resultStringArray = result.toStringArray();22var resultIntArray = result.toIntegerArray();23var resultBoolArray = result.toBooleanArray();24var resultDoubleArray = result.toDoubleArray();25var resultFloatArray = result.toFloatArray();

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful