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

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

Source:ActionService.java Github

copy

Full Screen

...304 case TestCaseStepAction.ACTION_REMOVEAPP:305 res = this.doActionRemoveApp(tCExecution, value1);306 break;307 case TestCaseStepAction.ACTION_DRAGANDDROP:308 res = this.doActionDragAndDrop(tCExecution, value1, value2);309 break;310 case TestCaseStepAction.ACTION_LONGPRESS:311 res = this.doActionLongPress(tCExecution, value1, value2);312 break;313 case TestCaseStepAction.ACTION_CLEARFIELD:314 res = this.doActionClearField(tCExecution, value1);315 break;316 case TestCaseStepAction.ACTION_REFRESHCURRENTPAGE:317 res = this.doActionRefreshCurrentPage(tCExecution);318 break;319 /**320 * DEPRECATED ACTIONS FROM HERE.321 */322 case TestCaseStepAction.ACTION_MOUSEOVERANDWAIT:323 res = this.doActionMouseOverAndWait(tCExecution, value1, value2);324 res.setDescription(MESSAGE_DEPRECATED + " " + res.getDescription());325 logEventService.createForPrivateCalls("ENGINE", "mouseOverAndWait", MESSAGE_DEPRECATED + " Deprecated Action triggered by TestCase : ['" + testCaseStepActionExecution.getTest() + "|" + testCaseStepActionExecution.getTestCase() + "']");326 LOG.warn(MESSAGE_DEPRECATED + " Deprecated Action mouseOverAndWait triggered by TestCase : ['" + testCaseStepActionExecution.getTest() + "'|'" + testCaseStepActionExecution.getTestCase() + "']");327 break;328 case TestCaseStepAction.ACTION_REMOVEDIFFERENCE:329 res = this.doActionRemoveDifference(testCaseStepActionExecution, value1, value2);330 res.setDescription(MESSAGE_DEPRECATED + " " + res.getDescription());331 logEventService.createForPrivateCalls("ENGINE", "removeDifference", MESSAGE_DEPRECATED + " Deprecated Action triggered by TestCase : ['" + testCaseStepActionExecution.getTest() + "|" + testCaseStepActionExecution.getTestCase() + "']");332 LOG.warn(MESSAGE_DEPRECATED + " Deprecated Action removeDifference triggered by TestCase : ['" + testCaseStepActionExecution.getTest() + "'|'" + testCaseStepActionExecution.getTestCase() + "']");333 break;334 default:335 res = new MessageEvent(MessageEventEnum.ACTION_FAILED_UNKNOWNACTION);336 res.setDescription(res.getDescription().replace("%ACTION%", testCaseStepActionExecution.getAction()));337 }338 } catch (final Exception unexpected) {339 LOG.error("Unexpected exception: " + unexpected.getMessage(), unexpected);340 res = new MessageEvent(MessageEventEnum.ACTION_FAILED_GENERIC).resolveDescription("DETAIL", unexpected.getMessage());341 }342 LOG.debug("Result of the action : " + res.getCodeString() + " " + res.getDescription());343 /**344 * In case 1/ the action is flaged as being Forced with a specific345 * return code = PE and 2/ the return of the action is stoping the test346 * --> whatever the return of the action is, we force the return to move347 * forward the test with no screenshot, pagesource.348 */349 if (testCaseStepActionExecution.getForceExeStatus().equals("PE") && res.isStopTest()) {350 res.setDescription(res.getDescription() + " -- Execution forced to continue.");351 res.setDoScreenshot(false);352 res.setGetPageSource(false);353 res.setStopTest(false);354 res.setMessage(MessageGeneralEnum.EXECUTION_PE_TESTEXECUTING);355 }356 testCaseStepActionExecution.setActionResultMessage(res);357 /**358 * Determine here the impact of the Action on the full test return code359 * from the ResultMessage of the Action.360 */361 testCaseStepActionExecution.setExecutionResultMessage(new MessageGeneral(res.getMessage()));362 /**363 * Determine here if we stop the test from the ResultMessage of the364 * Action.365 */366 testCaseStepActionExecution.setStopExecution(res.isStopTest());367 testCaseStepActionExecution.setEnd(new Date().getTime());368 return testCaseStepActionExecution;369 }370 private MessageEvent doActionInstallApp(TestCaseExecution tCExecution, String appPath) {371 MessageEvent message;372 try {373 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {374 return androidAppiumService.installApp(tCExecution.getSession(), appPath);375 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {376 return iosAppiumService.installApp(tCExecution.getSession(), appPath);377 }378 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);379 message.setDescription(message.getDescription().replace("%ACTION%", "scrollTo"));380 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));381 return message;382 } catch (Exception e) {383 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_GENERIC);384 String messageString = e.getMessage().split("\n")[0];385 message.setDescription(message.getDescription().replace("%DETAIL%", messageString));386 LOG.debug("Exception Running install app :" + messageString, e);387 return message;388 }389 }390 private MessageEvent doActionRemoveApp(TestCaseExecution tCExecution, String appPackage) {391 MessageEvent message;392 try {393 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {394 return androidAppiumService.removeApp(tCExecution.getSession(), appPackage);395 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {396 return iosAppiumService.removeApp(tCExecution.getSession(), appPackage);397 }398 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);399 message.setDescription(message.getDescription().replace("%ACTION%", "scrollTo"));400 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));401 return message;402 } catch (Exception e) {403 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_GENERIC);404 String messageString = e.getMessage().split("\n")[0];405 message.setDescription(message.getDescription().replace("%DETAIL%", messageString));406 LOG.debug("Exception Running remove app :" + messageString, e);407 return message;408 }409 }410 private MessageEvent doActionScrollTo(TestCaseExecution tCExecution, String element, String text) {411 MessageEvent message;412 try {413 Identifier identifier = null;414 if (!StringUtil.isNullOrEmpty(element)) {415 identifier = identifierService.convertStringToIdentifier(element);416 }417 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {418 return androidAppiumService.scrollTo(tCExecution.getSession(), identifier, text);419 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {420 return iosAppiumService.scrollTo(tCExecution.getSession(), identifier, text);421 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {422 return webdriverService.scrollTo(tCExecution.getSession(), identifier, text);423 }424 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);425 message.setDescription(message.getDescription().replace("%ACTION%", "scrollTo"));426 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));427 return message;428 } catch (Exception e) {429 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_GENERIC);430 String messageString = e.getMessage().split("\n")[0];431 message.setDescription(message.getDescription().replace("%DETAIL%", messageString));432 LOG.debug("Exception Running scroll to :" + messageString, e);433 return message;434 }435 }436 private MessageEvent doActionExecuteCommand(TestCaseExecution tCExecution, String command, String args) {437 MessageEvent message;438 try {439 return androidAppiumService.executeCommand(tCExecution.getSession(), command, args);440 } catch (Exception e) {441 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_EXECUTECOMMAND);442 String messageString = e.getMessage().split("\n")[0];443 message.setDescription(message.getDescription().replace("%EXCEPTION%", messageString));444 LOG.debug("Exception Running Shell :" + messageString, e);445 return message;446 }447 }448 private MessageEvent doActionExecuteCerberusCommand(TestCaseExecution tCExecution, String command) {449 MessageEvent message;450 try {451 return cerberusCommand.executeCerberusCommand(command);452 } catch (CerberusEventException e) {453 message = e.getMessageError();454 LOG.debug("Exception Running Shell :" + message.getMessage().getDescription());455 return message;456 }457 }458 private MessageEvent doActionClick(TestCaseExecution tCExecution, String value1, String value2) {459 String element;460 try {461 /**462 * Get element to use String object if not empty, String property if463 * object empty, throws Exception if both empty)464 */465 element = getElementToUse(value1, value2, TestCaseStepAction.ACTION_CLICK, tCExecution);466 /**467 * Get Identifier (identifier, locator) and check it's valid468 */469 Identifier identifier = identifierService.convertStringToIdentifier(element);470 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {471 if (tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.ANDROID.toString())) {472 identifierService.checkWebElementIdentifier(identifier.getIdentifier());473 return webdriverService.doSeleniumActionClick(tCExecution.getSession(), identifier, false, false);474 } else {475 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {476 return sikuliService.doSikuliActionClick(tCExecution.getSession(), identifier.getLocator(), "");477 } else if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_TEXT)) {478 return sikuliService.doSikuliActionClick(tCExecution.getSession(), "", identifier.getLocator());479 } else {480 identifierService.checkWebElementIdentifier(identifier.getIdentifier());481 return webdriverService.doSeleniumActionClick(tCExecution.getSession(), identifier, true, true);482 }483 }484 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {485 identifierService.checkWebElementIdentifier(identifier.getIdentifier());486 return androidAppiumService.click(tCExecution.getSession(), identifier);487 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {488 identifierService.checkWebElementIdentifier(identifier.getIdentifier());489 return iosAppiumService.click(tCExecution.getSession(), identifier);490 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {491 identifierService.checkSikuliIdentifier(identifier.getIdentifier());492 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {493 return sikuliService.doSikuliActionClick(tCExecution.getSession(), identifier.getLocator(), "");494 } else {495 return sikuliService.doSikuliActionClick(tCExecution.getSession(), "", identifier.getLocator());496 }497 } else {498 return new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION)499 .resolveDescription("ACTION", "Click")500 .resolveDescription("APPLICATIONTYPE", tCExecution.getApplicationObj().getType());501 }502 } catch (CerberusEventException ex) {503 LOG.fatal("Error doing Action Click :" + ex, ex);504 return ex.getMessageError();505 }506 }507 private MessageEvent doActionExecuteJS(TestCaseExecution tCExecution, String value1, String value2) {508 MessageEvent message;509 String script = value1;510 String valueFromJS;511 try {512 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {513 valueFromJS = this.webdriverService.getValueFromJS(tCExecution.getSession(), script);514 message = new MessageEvent(MessageEventEnum.ACTION_SUCCESS_EXECUTEJS);515 message.setDescription(message.getDescription().replace("%SCRIPT%", script));516 message.setDescription(message.getDescription().replace("%VALUE%", valueFromJS));517 return message;518 }519 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);520 message.setDescription(message.getDescription().replace("%ACTION%", "executeJS"));521 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));522 return message;523 } catch (Exception e) {524 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_EXECUTEJS);525 String messageString = e.getMessage().split("\n")[0];526 message.setDescription(message.getDescription().replace("%EXCEPTION%", messageString));527 LOG.debug("Exception Running JS Script :" + messageString);528 return message;529 }530 }531 private MessageEvent doActionMouseLeftButtonPress(TestCaseExecution tCExecution, String object, String property) {532 MessageEvent message;533 String element;534 try {535 /**536 * Get element to use String object if not empty, String property if537 * object empty, throws Exception if both empty)538 */539 element = getElementToUse(object, property, "mouseLeftButtonPress", tCExecution);540 /**541 * Get Identifier (identifier, locator)542 */543 Identifier identifier = identifierService.convertStringToIdentifier(element);544 identifierService.checkWebElementIdentifier(identifier.getIdentifier());545 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {546 return webdriverService.doSeleniumActionMouseDown(tCExecution.getSession(), identifier, true, true);547 }548 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);549 message.setDescription(message.getDescription().replace("%ACTION%", "MouseDown"));550 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));551 return message;552 } catch (CerberusEventException ex) {553 LOG.fatal("Error doing Action MouseDown :" + ex);554 return ex.getMessageError();555 }556 }557 private MessageEvent doActionRightClick(TestCaseExecution tCExecution, String object, String property) {558 MessageEvent message;559 String element;560 try {561 /**562 * Get element to use String object if not empty, String property if563 * object empty, throws Exception if both empty)564 */565 element = getElementToUse(object, property, "rightClick", tCExecution);566 /**567 * Get Identifier (identifier, locator)568 */569 Identifier identifier = identifierService.convertStringToIdentifier(element);570 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {571 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {572 return sikuliService.doSikuliActionRightClick(tCExecution.getSession(), identifier.getLocator(), "");573 } else if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_TEXT)) {574 return sikuliService.doSikuliActionRightClick(tCExecution.getSession(), "", identifier.getLocator());575 } else {576 identifierService.checkWebElementIdentifier(identifier.getIdentifier());577 return webdriverService.doSeleniumActionRightClick(tCExecution.getSession(), identifier);578 }579 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {580 identifierService.checkSikuliIdentifier(identifier.getIdentifier());581 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {582 return sikuliService.doSikuliActionRightClick(tCExecution.getSession(), identifier.getLocator(), "");583 } else {584 return sikuliService.doSikuliActionRightClick(tCExecution.getSession(), "", identifier.getLocator());585 }586 }587 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);588 message.setDescription(message.getDescription().replace("%ACTION%", "rightClick"));589 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));590 return message;591 } catch (CerberusEventException ex) {592 LOG.fatal("Error doing Action RightClick :" + ex);593 return ex.getMessageError();594 }595 }596 private MessageEvent doActionMouseLeftButtonRelease(TestCaseExecution tCExecution, String object, String property) {597 MessageEvent message;598 String element;599 try {600 /**601 * Get element to use String object if not empty, String property if602 * object empty, throws Exception if both empty)603 */604 element = getElementToUse(object, property, "mouseLeftButtonRelease", tCExecution);605 /**606 * Get Identifier (identifier, locator)607 */608 Identifier identifier = identifierService.convertStringToIdentifier(element);609 identifierService.checkWebElementIdentifier(identifier.getIdentifier());610 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {611 return webdriverService.doSeleniumActionMouseUp(tCExecution.getSession(), identifier, true, true);612 }613 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);614 message.setDescription(message.getDescription().replace("%ACTION%", "MouseUp"));615 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));616 return message;617 } catch (CerberusEventException ex) {618 LOG.fatal("Error doing Action MouseUp :" + ex);619 return ex.getMessageError();620 }621 }622 private MessageEvent doActionSwitchToWindow(TestCaseExecution tCExecution, String object, String property) {623 String element;624 try {625 /**626 * Get element to use String object if not empty, String property if627 * object empty, throws Exception if both empty)628 */629 element = getElementToUse(object, property, "switchToWindow", tCExecution);630 /**631 * Get Identifier (identifier, locator)632 */633 Identifier identifier = identifierService.convertStringToIdentifier(element);634 //identifierService.checkWebElementIdentifier(identifier.getIdentifier());635 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {636 return webdriverService.doSeleniumActionSwitchToWindow(tCExecution.getSession(), identifier);637 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {638 return androidAppiumService.switchToContext(tCExecution.getSession(), identifier);639 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {640 return iosAppiumService.switchToContext(tCExecution.getSession(), identifier);641 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {642 return sikuliService.doSikuliActionSwitchApp(tCExecution.getSession(), identifier.getLocator());643 } else {644 return new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION)645 .resolveDescription("ACTION", "SwitchToWindow")646 .resolveDescription("APPLICATIONTYPE", tCExecution.getApplicationObj().getType());647 }648 } catch (CerberusEventException ex) {649 LOG.fatal("Error doing Action SwitchToWindow :" + ex);650 return ex.getMessageError();651 }652 }653 private MessageEvent doActionManageDialog(TestCaseExecution tCExecution, String value1, String value2) {654 MessageEvent message;655 String element;656 try {657 /**658 * Get element to use String object if not empty, String property if659 * object empty, throws Exception if both empty)660 */661 element = getElementToUse(value1, value2, "manageDialog", tCExecution);662 /**663 * Get Identifier (identifier, locator)664 */665 Identifier identifier = identifierService.convertStringToIdentifier(element);666 identifierService.checkWebElementIdentifier(identifier.getIdentifier());667 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {668 return webdriverService.doSeleniumActionManageDialog(tCExecution.getSession(), identifier);669 }670 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);671 message.setDescription(message.getDescription().replace("%ACTION%", "ManageDialog"));672 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));673 return message;674 } catch (CerberusEventException ex) {675 LOG.fatal("Error doing Action ManageDialog :" + ex);676 return ex.getMessageError();677 }678 }679 private MessageEvent doActionManageDialogKeyPress(TestCaseExecution tCExecution, String value1) {680 MessageEvent message;681 String element;682 try {683 /**684 * Get element to use String object if not empty, String property if685 * object empty, throws Exception if both empty)686 */687 element = getElementToUse(value1, "", "manageDialogKeyPress", tCExecution);688 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {689 return webdriverService.doSeleniumActionManageDialogKeyPress(tCExecution.getSession(), element);690 }691 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);692 message.setDescription(message.getDescription().replace("%ACTION%", "ManageDialogKeypress"));693 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));694 return message;695 } catch (CerberusEventException ex) {696 LOG.fatal("Error doing Action ManageDialogKeypress :" + ex);697 return ex.getMessageError();698 }699 }700 private MessageEvent doActionDoubleClick(TestCaseExecution tCExecution, String object, String property) {701 MessageEvent message;702 String element;703 try {704 /**705 * Get element to use String object if not empty, String property if706 * object empty, throws Exception if both empty)707 */708 element = getElementToUse(object, property, "doubleClick", tCExecution);709 /**710 * Get Identifier (identifier, locator)711 */712 Identifier identifier = identifierService.convertStringToIdentifier(element);713 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {714 if (tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.ANDROID.toString())) {715 identifierService.checkWebElementIdentifier(identifier.getIdentifier());716 return webdriverService.doSeleniumActionDoubleClick(tCExecution.getSession(), identifier, false, false);717 } else {718 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {719 return sikuliService.doSikuliActionDoubleClick(tCExecution.getSession(), identifier.getLocator(), "");720 } else if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_TEXT)) {721 return sikuliService.doSikuliActionDoubleClick(tCExecution.getSession(), "", identifier.getLocator());722 } else {723 identifierService.checkWebElementIdentifier(identifier.getIdentifier());724 return webdriverService.doSeleniumActionDoubleClick(tCExecution.getSession(), identifier, true, true);725 }726 }727 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)728 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {729 identifierService.checkWebElementIdentifier(identifier.getIdentifier());730 return webdriverService.doSeleniumActionDoubleClick(tCExecution.getSession(), identifier, true, false);731 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {732 identifierService.checkSikuliIdentifier(identifier.getIdentifier());733 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {734 return sikuliService.doSikuliActionDoubleClick(tCExecution.getSession(), identifier.getLocator(), "");735 } else {736 return sikuliService.doSikuliActionDoubleClick(tCExecution.getSession(), "", identifier.getLocator());737 }738 }739 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);740 message.setDescription(message.getDescription().replace("%ACTION%", "doubleClick"));741 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));742 return message;743 } catch (CerberusEventException ex) {744 LOG.fatal("Error doing Action DoubleClick :" + ex);745 return ex.getMessageError();746 }747 }748 private MessageEvent doActionType(TestCaseExecution tCExecution, String object, String property, String propertyName) {749 try {750 /**751 * Check object and property are not null for GUI/APK/IPA Check752 * property is not null for FAT Application753 */754 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)755 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)756 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {757 if (object == null || property == null) {758 return new MessageEvent(MessageEventEnum.ACTION_FAILED_TYPE);759 }760 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {761 if (property == null) {762 return new MessageEvent(MessageEventEnum.ACTION_FAILED_TYPE);763 }764 }765 /**766 * Get Identifier (identifier, locator) if object not null767 */768 Identifier identifier = new Identifier();769 if (object != null) {770 identifier = identifierService.convertStringToIdentifier(object);771 }772 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {773 if (tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.ANDROID.toString())) {774 identifierService.checkWebElementIdentifier(identifier.getIdentifier());775 return webdriverService.doSeleniumActionType(tCExecution.getSession(), identifier, property, propertyName, false, false);776 } else {777 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {778 return sikuliService.doSikuliActionType(tCExecution.getSession(), identifier.getLocator(), property);779 } else {780 identifierService.checkWebElementIdentifier(identifier.getIdentifier());781 return webdriverService.doSeleniumActionType(tCExecution.getSession(), identifier, property, propertyName, true, true);782 }783 }784 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {785 return androidAppiumService.type(tCExecution.getSession(), identifier, property, propertyName);786 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {787 return iosAppiumService.type(tCExecution.getSession(), identifier, property, propertyName);788 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {789 String locator = "";790 if (!StringUtil.isNullOrEmpty(object)) {791 identifierService.checkSikuliIdentifier(identifier.getIdentifier());792 locator = identifier.getLocator();793 }794 return sikuliService.doSikuliActionType(tCExecution.getSession(), locator, property);795 } else {796 return new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION)797 .resolveDescription("ACTION", "Type")798 .resolveDescription("APPLICATIONTYPE", tCExecution.getApplicationObj().getType());799 }800 } catch (CerberusEventException ex) {801 LOG.fatal("Error doing Action Type : " + ex);802 return ex.getMessageError();803 }804 }805 private MessageEvent doActionMouseOver(TestCaseExecution tCExecution, String object, String property) {806 MessageEvent message;807 String element;808 try {809 /**810 * Get element to use String object if not empty, String property if811 * object empty, throws Exception if both empty)812 */813 element = getElementToUse(object, property, "mouseOver", tCExecution);814 /**815 * Get Identifier (identifier, locator)816 */817 Identifier identifier = identifierService.convertStringToIdentifier(element);818 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {819 if (tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.ANDROID.toString())) {820 identifierService.checkWebElementIdentifier(identifier.getIdentifier());821 return webdriverService.doSeleniumActionMouseOver(tCExecution.getSession(), identifier, false, false);822 } else {823 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {824 return sikuliService.doSikuliActionMouseOver(tCExecution.getSession(), identifier.getLocator(), "");825 } else if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_TEXT)) {826 return sikuliService.doSikuliActionMouseOver(tCExecution.getSession(), "", identifier.getLocator());827 } else {828 identifierService.checkWebElementIdentifier(identifier.getIdentifier());829 return webdriverService.doSeleniumActionMouseOver(tCExecution.getSession(), identifier, true, true);830 }831 }832 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {833 identifierService.checkSikuliIdentifier(identifier.getIdentifier());834 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {835 return sikuliService.doSikuliActionMouseOver(tCExecution.getSession(), identifier.getLocator(), "");836 } else {837 return sikuliService.doSikuliActionMouseOver(tCExecution.getSession(), "", identifier.getLocator());838 }839 }840 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);841 message.setDescription(message.getDescription().replace("%ACTION%", "mouseOver"));842 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));843 return message;844 } catch (CerberusEventException ex) {845 LOG.fatal("Error doing Action MouseOver :" + ex);846 return ex.getMessageError();847 }848 }849 private MessageEvent doActionMouseOverAndWait(TestCaseExecution tCExecution, String object, String property) {850 MessageEvent message;851 try {852 /**853 * Check object is not null854 */855 if (object == null) {856 return new MessageEvent(MessageEventEnum.ACTION_FAILED_MOUSEOVERANDWAIT_GENERIC);857 }858 /**859 * Get Identifier (identifier, locator)860 */861 Identifier identifier = identifierService.convertStringToIdentifier(object);862 identifierService.checkWebElementIdentifier(identifier.getIdentifier());863 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {864 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {865 message = sikuliService.doSikuliActionMouseOver(tCExecution.getSession(), identifier.getLocator(), "");866 } else if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_TEXT)) {867 message = sikuliService.doSikuliActionMouseOver(tCExecution.getSession(), "", identifier.getLocator());868 } else {869 message = webdriverService.doSeleniumActionMouseOver(tCExecution.getSession(), identifier, true, true);870 }871 if (message.getCodeString().equals("OK")) {872 message = this.doActionWait(tCExecution, property, null);873 }874 return message;875 }876 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);877 message.setDescription(message.getDescription().replace("%ACTION%", "mouseOverAndWait"));878 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));879 return message;880 } catch (CerberusEventException ex) {881 LOG.fatal("Error doing Action MouseOverAndWait :" + ex);882 return ex.getMessageError();883 }884 }885 private MessageEvent doActionWait(TestCaseExecution tCExecution, String object, String property) {886 MessageEvent message;887 String element;888 long timeToWaitInMs = 0;889 Identifier identifier = null;890 try {891 /**892 * Get element to use String object if not empty, String property if893 * object empty, null if both are empty894 */895 element = getElementToUse(object, property, "wait", tCExecution);896 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)897 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)898 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)899 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) { // If application are Selenium or appium based, we have a session and can use it to wait.900 /**901 * if element is integer, set time to that value else Get902 * Identifier (identifier, locator)903 */904 if (StringUtil.isNullOrEmpty(element)) {905 timeToWaitInMs = tCExecution.getCerberus_action_wait_default();906 } else if (StringUtil.isInteger(element)) {907 timeToWaitInMs = Long.valueOf(element);908 } else {909 identifier = identifierService.convertStringToIdentifier(element);910 }911 if (identifier != null && identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {912 return sikuliService.doSikuliActionWait(tCExecution.getSession(), identifier.getLocator(), "");913 } else if (identifier != null && identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_TEXT)) {914 return sikuliService.doSikuliActionWait(tCExecution.getSession(), "", identifier.getLocator());915 } else if (identifier != null) {916 identifierService.checkWebElementIdentifier(identifier.getIdentifier());917 return webdriverService.doSeleniumActionWait(tCExecution.getSession(), identifier);918 } else {919 return this.waitTime(timeToWaitInMs);920 }921 } else { // For any other application we wait for the integer value.922 if (StringUtil.isNullOrEmpty(element)) {923 // Get default wait from parameter924 timeToWaitInMs = tCExecution.getCerberus_action_wait_default();925 } else if (StringUtil.isInteger(element)) {926 timeToWaitInMs = Long.valueOf(element);927 }928 return this.waitTime(timeToWaitInMs);929 }930 } catch (CerberusEventException ex) {931 LOG.fatal("Error doing Action Wait :" + ex);932 return ex.getMessageError();933 }934 }935 private MessageEvent doActionKeyPress(TestCaseExecution tCExecution, String value1, String value2) {936 try {937 String appType = tCExecution.getApplicationObj().getType();938 /**939 * Check value1 and value2 are not null For IPA and APK, only value2940 * (key to press) is mandatory For GUI and FAT, both parameters are941 * mandatory942 */943 if (StringUtil.isNullOrEmpty(value2)) {944 return new MessageEvent(MessageEventEnum.ACTION_FAILED_KEYPRESS_MISSINGKEY).resolveDescription("APPLICATIONTYPE", appType);945 }946 /**947 * Get Identifier (identifier, locator)948 */949 if (StringUtil.isNullOrEmpty(value1) && appType.equalsIgnoreCase(Application.TYPE_GUI)) {950 value1 = "xpath=//body";951 }952 Identifier objectIdentifier = identifierService.convertStringToIdentifier(value1);953 if (appType.equalsIgnoreCase(Application.TYPE_GUI)) {954 if (tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.MAC.toString())955 || tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.IOS.toString())) {956 return iosAppiumService.keyPress(tCExecution.getSession(), value2);957 } else if (tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.ANDROID.toString())) {958 return webdriverService.doSeleniumActionKeyPress(tCExecution.getSession(), objectIdentifier, value2, false, false);959 }960 if (objectIdentifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {961 return sikuliService.doSikuliActionKeyPress(tCExecution.getSession(), objectIdentifier.getLocator(), value2);962 } else {963 identifierService.checkWebElementIdentifier(objectIdentifier.getIdentifier());964 return webdriverService.doSeleniumActionKeyPress(tCExecution.getSession(), objectIdentifier, value2, true, true);965 }966 } else if (appType.equalsIgnoreCase(Application.TYPE_APK)) {967 return androidAppiumService.keyPress(tCExecution.getSession(), value2);968 } else if (appType.equalsIgnoreCase(Application.TYPE_IPA)) {969 return iosAppiumService.keyPress(tCExecution.getSession(), value2);970 } else if (appType.equalsIgnoreCase(Application.TYPE_FAT)) {971 return sikuliService.doSikuliActionKeyPress(tCExecution.getSession(), objectIdentifier.getLocator(), value2);972 } else {973 return new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION)974 .resolveDescription("ACTION", "KeyPress")975 .resolveDescription("APPLICATIONTYPE", appType);976 }977 } catch (CerberusEventException ex) {978 LOG.debug("Error doing Action KeyPress :" + ex);979 return ex.getMessageError();980 } catch (Exception ex) {981 LOG.debug("Error doing Action KeyPress :" + ex);982 return new MessageEvent(MessageEventEnum.ACTION_FAILED_GENERIC)983 .resolveDescription("DETAIL", ex.toString());984 }985 }986 private MessageEvent doActionOpenURL(TestCaseExecution tCExecution, String object, String property, boolean withBase) {987 MessageEvent message;988 String element;989 try {990 /**991 * Get element to use String object if not empty, String property if992 * object empty, throws Exception if both empty)993 */994 element = getElementToUse(object, property, "openUrl[WithBase]", tCExecution);995 /**996 * Get Identifier (identifier, locator)997 */998 Identifier identifier = new Identifier();999 identifier.setIdentifier("url");1000 identifier.setLocator(element);1001 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1002 return webdriverService.doSeleniumActionOpenURL(tCExecution.getSession(), tCExecution.getUrl(), identifier, withBase);1003 }1004 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1005 message.setDescription(message.getDescription().replace("%ACTION%", "OpenURL[WithBase]"));1006 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1007 return message;1008 } catch (CerberusEventException ex) {1009 LOG.fatal("Error doing Action OpenUrl :" + ex);1010 return ex.getMessageError();1011 }1012 }1013 private MessageEvent doActionOpenApp(TestCaseExecution tCExecution, String value1, String value2) {1014 MessageEvent message;1015 /**1016 * Check value1 is not null or empty1017 */1018 if (value1 == null || "".equals(value1)) {1019 return new MessageEvent(MessageEventEnum.ACTION_FAILED_OPENAPP);1020 }1021 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)1022 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1023 return sikuliService.doSikuliActionOpenApp(tCExecution.getSession(), value1);1024 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {1025 return androidAppiumService.openApp(tCExecution.getSession(), value1, value2);1026 }1027 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1028 message.setDescription(message.getDescription().replace("%ACTION%", "OpenApp"));1029 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1030 return message;1031 }1032 private MessageEvent doActionCloseApp(TestCaseExecution tCExecution, String value1) {1033 MessageEvent message;1034 /**1035 * Check value1 is not null or empty1036 */1037 if (value1 == null || "".equals(value1)) {1038 return new MessageEvent(MessageEventEnum.ACTION_FAILED_CLOSEAPP);1039 }1040 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)1041 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1042 return sikuliService.doSikuliActionCloseApp(tCExecution.getSession(), value1);1043 }1044 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1045 message.setDescription(message.getDescription().replace("%ACTION%", "CloseApp"));1046 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1047 return message;1048 }1049 private MessageEvent doActionWaitVanish(TestCaseExecution tCExecution, String value1) {1050 try {1051 /**1052 * Check value1 is not null or empty1053 */1054 if (value1 == null || "".equals(value1)) {1055 return new MessageEvent(MessageEventEnum.ACTION_FAILED_CLOSEAPP);1056 }1057 /**1058 * Get Identifier (identifier, locator)1059 */1060 Identifier identifier = identifierService.convertStringToIdentifier(value1);1061 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1062 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {1063 return sikuliService.doSikuliActionWaitVanish(tCExecution.getSession(), identifier.getLocator(), "");1064 } else if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_TEXT)) {1065 return sikuliService.doSikuliActionWaitVanish(tCExecution.getSession(), "", identifier.getLocator());1066 } else {1067 identifierService.checkWebElementIdentifier(identifier.getIdentifier());1068 return webdriverService.doSeleniumActionWaitVanish(tCExecution.getSession(), identifier);1069 }1070 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)1071 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {1072 identifierService.checkWebElementIdentifier(identifier.getIdentifier());1073 return webdriverService.doSeleniumActionWaitVanish(tCExecution.getSession(), identifier);1074 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {1075 identifierService.checkSikuliIdentifier(identifier.getIdentifier());1076 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {1077 return sikuliService.doSikuliActionWaitVanish(tCExecution.getSession(), identifier.getLocator(), "");1078 } else {1079 return sikuliService.doSikuliActionWaitVanish(tCExecution.getSession(), "", identifier.getLocator());1080 }1081 } else {1082 return new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION)1083 .resolveDescription("ACTION", "WaitVanish")1084 .resolveDescription("APPLICATIONTYPE", tCExecution.getApplicationObj().getType());1085 }1086 } catch (CerberusEventException ex) {1087 LOG.fatal("Error doing Action KeyPress :" + ex);1088 return ex.getMessageError();1089 }1090 }1091 private MessageEvent doActionSelect(TestCaseExecution tCExecution, String value1, String value2) {1092 MessageEvent message;1093 try {1094 /**1095 * Check object and property are not null1096 */1097 if (StringUtil.isNullOrEmpty(value1) || StringUtil.isNullOrEmpty(value2)) {1098 return new MessageEvent(MessageEventEnum.ACTION_FAILED_SELECT);1099 }1100 /**1101 * Get Identifier (identifier, locator)1102 */1103 Identifier identifierObject = identifierService.convertStringToIdentifier(value1);1104 Identifier identifierValue = identifierService.convertStringToSelectIdentifier(value2);1105 identifierService.checkWebElementIdentifier(identifierObject.getIdentifier());1106 identifierService.checkSelectOptionsIdentifier(identifierValue.getIdentifier());1107 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)1108 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)1109 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {1110 if (tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.ANDROID.toString())) {1111 return webdriverService.doSeleniumActionSelect(tCExecution.getSession(), identifierObject, identifierValue, false, false);1112 }1113 return webdriverService.doSeleniumActionSelect(tCExecution.getSession(), identifierObject, identifierValue, true, true);1114 }1115 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1116 message.setDescription(message.getDescription().replace("%ACTION%", "Select"));1117 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1118 return message;1119 } catch (CerberusEventException ex) {1120 LOG.fatal("Error doing Action Select :" + ex);1121 return ex.getMessageError();1122 }1123 }1124 private MessageEvent doActionUrlLogin(TestCaseExecution tCExecution) {1125 MessageEvent message;1126 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1127 return webdriverService.doSeleniumActionUrlLogin(tCExecution.getSession(), tCExecution.getUrl(), tCExecution.getCountryEnvironmentParameters().getUrlLogin());1128 }1129 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1130 message.setDescription(message.getDescription().replace("%ACTION%", "UrlLogin"));1131 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1132 return message;1133 }1134 private MessageEvent doActionFocusToIframe(TestCaseExecution tCExecution, String object, String property) {1135 MessageEvent message;1136 String element;1137 try {1138 /**1139 * Get element to use String object if not empty, String property if1140 * object empty, throws Exception if both empty)1141 */1142 element = getElementToUse(object, property, "focusToIframe", tCExecution);1143 /**1144 * Get Identifier (identifier, locator)1145 */1146 Identifier identifier = identifierService.convertStringToIdentifier(element);1147 identifierService.checkWebElementIdentifier(identifier.getIdentifier());1148 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1149 return webdriverService.doSeleniumActionFocusToIframe(tCExecution.getSession(), identifier);1150 }1151 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1152 message.setDescription(message.getDescription().replace("%ACTION%", "FocusToIframe"));1153 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1154 return message;1155 } catch (CerberusEventException ex) {1156 LOG.fatal("Error doing Action FocusToIframe :" + ex);1157 return ex.getMessageError();1158 }1159 }1160 private MessageEvent doActionFocusDefaultIframe(TestCaseExecution tCExecution) {1161 MessageEvent message;1162 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1163 return webdriverService.doSeleniumActionFocusDefaultIframe(tCExecution.getSession());1164 }1165 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1166 message.setDescription(message.getDescription().replace("%ACTION%", "FocusDefaultIframe"));1167 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1168 return message;1169 }1170 public MessageEvent doActionDragAndDrop(TestCaseExecution tCExecution, String value1, String value2) throws IOException {1171 MessageEvent message;1172 try {1173 /**1174 * Check source and target are not null1175 */1176 if (StringUtil.isNullOrEmpty(value1)) {1177 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_DRAGANDDROP);1178 message.setDescription(message.getDescription().replace("%ELEMENT%", value1));1179 return message;1180 } else if (StringUtil.isNullOrEmpty(value2)) {1181 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_DRAGANDDROP);1182 message.setDescription(message.getDescription().replace("%ELEMENT%", value2));1183 return message;1184 }...

Full Screen

Full Screen

doActionDragAndDrop

Using AI Code Generation

copy

Full Screen

1var actionService = new org.cerberus.engine.gwt.impl.ActionService();2var action = new org.cerberus.engine.entity.Action();3action.setTest("MyTest");4action.setTestcase("MyTestCase");5action.setStep(1);6action.setSort(1);7action.setAction("dragAndDrop");8action.setObject("MyObject");9action.setValue("MyValue");10actionService.doActionDragAndDrop(action);11var actionService = new org.cerberus.engine.gwt.impl.ActionService();12var action = new org.cerberus.engine.entity.Action();13action.setTest("MyTest");14action.setTestcase("MyTestCase");15action.setStep(1);16action.setSort(1);17action.setAction("click");18action.setObject("MyObject");19action.setValue("MyValue");20actionService.doActionClick(action);21var actionService = new org.cerberus.engine.gwt.impl.ActionService();22var action = new org.cerberus.engine.entity.Action();23action.setTest("MyTest");24action.setTestcase("MyTestCase");25action.setStep(1);26action.setSort(1);27action.setAction("wait");28action.setObject("MyObject");29action.setValue("MyValue");30actionService.doActionWait(action);31var actionService = new org.cerberus.engine.gwt.impl.ActionService();

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