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

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

Source:ActionService.java Github

copy

Full Screen

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

Full Screen

Full Screen

doActionWaitNetworkTrafficIdle

Using AI Code Generation

copy

Full Screen

1import org.cerberus.engine.entity.MessageEvent;2import org.cerberus.engine.entity.Session;3import org.cerberus.engine.execution.impl.Test;4import org.cerberus.engine.gwt.impl.ActionService;5import org.cerberus.exception.CerberusException;6import org.cerberus.util.answer.AnswerItem;7import org.openqa.selenium.WebDriver;8public class doActionWaitNetworkTrafficIdle extends ActionService {9 public MessageEvent doAction(AnswerItem answerItem, Test test, TestCaseStepAction testCaseStepAction, TestCaseExecution tCExecution, TestCaseStepExecution testCaseStepExecution, String string, String string1, String string2, String string3, String string4) throws CerberusException {10 MessageEvent message = new MessageEvent(MessageEventEnum.ACTION_SUCCESS_WAITNETWORKTRAFFICIDLE);11 message.setDescription(message.getDescription().replace("%NETWORKTRAFFICIDLETIME%", testCaseStepAction.getValue1()));12 try {13 int networkTrafficIdleTime = 5;14 if (testCaseStepAction.getValue1() != null && !testCaseStepAction.getValue1().isEmpty()) {15 networkTrafficIdleTime = Integer.parseInt(testCaseStepAction.getValue1());16 }17 this.waitNetworkTrafficIdle(tCExecution.getSession(), networkTrafficIdleTime);18 } catch (CerberusException ex) {19 message = new MessageEvent(MessageEventEnum.ACTION_FAILED_WAITNETWORKTRAFFICIDLE);20 message.setDescription(message.getDescription().replace("%NETWORKTRAFFICIDLETIME%", testCaseStepAction.getValue1()));21 message.setDescription(message.getDescription().replace("%ERR%", ex.getMessageError().getDescription()));22 }23 return message;24 }25 private void waitNetworkTrafficIdle(Session session, int networkTrafficIdleTime) throws CerberusException {26 WebDriver driver = session.getDriver();27 long idleTime = 0;28 long startTime = System.currentTimeMillis();29 long endTime = System.currentTimeMillis();30 long lastRequestTime = System.currentTimeMillis();31 long lastResponseTime = System.currentTimeMillis();

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