protected override void ExecuteCore(ICommandAdapter adapter)
        {
            // adapter.Execute(new DevExpress.ExpressApp.EasyTest.BlazorAdapter.Commands.AutoTestCommand());
            string logonCaption = "Log In";

            if (adapter.IsControlExist(TestControlType.Action, logonCaption))
            {
                adapter.CreateTestControl(TestControlType.Action, logonCaption).GetInterface <IControlAct>().Act(null);
            }

            var navigationTestControl = GetNavigationTestControl(adapter);
            var grid            = navigationTestControl.GetInterface <IGridBase>();
            int itemsCount      = grid.GetRowCount();
            var namigationItems = Enumerable.Range(0, itemsCount).Select(i => grid.GetCellValue(i, grid.Columns.First())).ToArray();

            for (int i = 0; i < itemsCount; i++)
            {
                var namigationItem = namigationItems[i];
                if (namigationItem != null)
                {
                    if (_excludeMatch == null || !Regex.IsMatch(namigationItem, _excludeMatch))
                    {
                        var testControl        = GetNavigationTestControl(adapter);
                        var gridBase           = testControl.GetInterface <IGridBase>();
                        var navigationItemName = gridBase.GetCellValue(i, gridBase.Columns.First());
                        var controlAct         = testControl.GetInterface <IControlAct>();
                        controlAct.Act(navigationItemName);
                        if (adapter.IsControlExist(TestControlType.Action, "New"))
                        {
                            try {
                                adapter.CreateTestControl(TestControlType.Action, "New").FindInterface <IControlAct>().Act("");
                            }
                            catch (Exception e) {
                                throw new CommandException(
                                          $"The 'New' action execution failed. Navigation item: {navigationItemName}\r\nInner Exception: {e.Message}", this.StartPosition);
                            }
                            if (adapter.IsControlExist(TestControlType.Action, "Cancel"))
                            {
                                try {
                                    ITestControl cancelActionTestControl = adapter.CreateTestControl(TestControlType.Action, "Cancel");
                                    if (cancelActionTestControl.GetInterface <IControlEnabled>().Enabled)
                                    {
                                        cancelActionTestControl.FindInterface <IControlAct>().Act(null);
                                    }
                                }
                                catch (Exception e) {
                                    throw new CommandException(
                                              $"The 'Cancel' action execution failed. Navigation item: {navigationItemName}\r\nInner Exception: {e.Message}", this.StartPosition);
                                }
                            }

                            var command = new OptionalActionCommand {
                                Parameters = { MainParameter = new MainParameter("Yes"), ExtraParameter = new MainParameter() }
                            };
                            command.Execute(adapter);
                        }
                    }
                }
            }
        }
예제 #2
0
        protected override void InternalExecute(ICommandAdapter adapter)
        {
            if (adapter.IsControlExist(TestControlType.Action, LogonCaption))
            {
                adapter.CreateTestControl(TestControlType.Action, LogonCaption).GetInterface <IControlAct>().Act(null);
            }
            int itemsCount = adapter.GetNavigationTestControl().GetInterface <IGridBase>().GetRowCount();

            for (int i = 0; i < itemsCount; i++)
            {
                var    testControl        = GetTestControl(adapter);
                var    gridBase           = testControl.GetInterface <IGridBase>();
                string navigationItemName = gridBase.GetCellValue(i, new List <IGridColumn>(gridBase.Columns)[0]);
                if (!string.IsNullOrEmpty(navigationItemName))
                {
                    EasyTestTracer.Tracer.LogText(string.Format("EnumerateNavigationItem '{0}'", navigationItemName));
                    var controlActionItems = testControl.FindInterface <IControlActionItems>();
                    if (controlActionItems != null && controlActionItems.IsEnabled(navigationItemName))
                    {
                        try{
                            testControl.GetInterface <IControlAct>().Act(navigationItemName);
                        }
                        catch (Exception e) {
                            throw new CommandException(string.Format("The 'Navigation' action execution failed. Navigation item: {0}\r\nInner Exception: {1}", navigationItemName, e.Message), StartPosition);
                        }
                        if (adapter.IsControlExist(TestControlType.Action, "New"))
                        {
                            try{
                                adapter.CreateTestControl(TestControlType.Action, "New").FindInterface <IControlAct>().Act("");
                            }
                            catch (Exception e) {
                                throw new CommandException(string.Format("The 'New' action execution failed. Navigation item: {0}\r\nInner Exception: {1}", navigationItemName, e.Message), StartPosition);
                            }
                            if (adapter.IsControlExist(TestControlType.Action, "Cancel"))
                            {
                                try{
                                    var cancelActionTestControl = adapter.CreateTestControl(TestControlType.Action, "Cancel");
                                    if (cancelActionTestControl.GetInterface <IControlEnabled>().Enabled)
                                    {
                                        cancelActionTestControl.FindInterface <IControlAct>().Act(null);
                                    }
                                }
                                catch (Exception e) {
                                    throw new CommandException(string.Format("The 'Cancel' action execution failed. Navigation item: {0}\r\nInner Exception: {1}", navigationItemName, e.Message), StartPosition);
                                }
                            }
                            var command = new OptionalActionCommand();
                            command.Parameters.MainParameter  = new MainParameter("Yes");
                            command.Parameters.ExtraParameter = new MainParameter();
                            command.Execute(adapter);
                        }
                    }
                }
            }
        }
예제 #3
0
 private void TryClosePopupWindow(ICommandAdapter adapter){
     try{
         var command = new OptionalActionCommand();
         command.Parameters.MainParameter = new MainParameter("Close");
         command.Parameters.ExtraParameter = new MainParameter();
         command.Execute(adapter);
     }
     catch (Exception e){
         Console.WriteLine(e);
     }
 }
예제 #4
0
 private void TryClosePopupWindow(ICommandAdapter adapter)
 {
     try{
         var command = new OptionalActionCommand();
         command.Parameters.MainParameter  = new MainParameter("Close");
         command.Parameters.ExtraParameter = new MainParameter();
         command.Execute(adapter);
     }
     catch (Exception e) {
         Console.WriteLine(e);
     }
 }
예제 #5
0
 protected override void InternalExecute(ICommandAdapter adapter){
     if (adapter.IsControlExist(TestControlType.Action, LogonCaption)){
         adapter.CreateTestControl(TestControlType.Action, LogonCaption).GetInterface<IControlAct>().Act(null);
     }
     int itemsCount = adapter.GetNavigationTestControl().GetInterface<IGridBase>().GetRowCount();
     for (int i = 0; i < itemsCount; i++){
         var testControl = GetTestControl(adapter);
         var gridBase = testControl.GetInterface<IGridBase>();
         string navigationItemName = gridBase.GetCellValue(i, new List<IGridColumn>(gridBase.Columns)[0]);
         if (!string.IsNullOrEmpty(navigationItemName)){
             EasyTestTracer.Tracer.LogText(string.Format("EnumerateNavigationItem '{0}'", navigationItemName));
             var controlActionItems = testControl.FindInterface<IControlActionItems>();
             if (controlActionItems != null && controlActionItems.IsEnabled(navigationItemName)){
                 try{
                     testControl.GetInterface<IControlAct>().Act(navigationItemName);
                 }
                 catch (Exception e){
                     throw new CommandException(string.Format("The 'Navigation' action execution failed. Navigation item: {0}\r\nInner Exception: {1}",navigationItemName, e.Message), StartPosition);
                 }
                 if (adapter.IsControlExist(TestControlType.Action, "New")){
                     try{
                         adapter.CreateTestControl(TestControlType.Action, "New").FindInterface<IControlAct>().Act("");
                     }
                     catch (Exception e){
                         throw new CommandException(string.Format("The 'New' action execution failed. Navigation item: {0}\r\nInner Exception: {1}",navigationItemName, e.Message), StartPosition);
                     }
                     if (adapter.IsControlExist(TestControlType.Action, "Cancel")){
                         try{
                             var cancelActionTestControl =adapter.CreateTestControl(TestControlType.Action, "Cancel");
                             if (cancelActionTestControl.GetInterface<IControlEnabled>().Enabled){
                                 cancelActionTestControl.FindInterface<IControlAct>().Act(null);
                             }
                         }
                         catch (Exception e){
                             throw new CommandException(string.Format("The 'Cancel' action execution failed. Navigation item: {0}\r\nInner Exception: {1}",navigationItemName, e.Message), StartPosition);
                         }
                     }
                     var command = new OptionalActionCommand();
                     command.Parameters.MainParameter = new MainParameter("Yes");
                     command.Parameters.ExtraParameter = new MainParameter();
                     command.Execute(adapter);
                 }
             }
         }
     }
 }
예제 #6
0
        protected override void InternalExecute(ICommandAdapter adapter)
        {
            var executeTableActionCommand = new ExecuteTableActionCommand();

            executeTableActionCommand.SetApplicationOptions(_applicationOptions);
            var mainParameter = new MainParameter {
                Value = ""
            };

            executeTableActionCommand.Parameters.MainParameter = mainParameter;
            executeTableActionCommand.Parameters.Add(new Parameter(" SelectAll = True", EndPosition));
            executeTableActionCommand.Execute(adapter);

            var optionalActionCommand = new OptionalActionCommand();

            optionalActionCommand.DoAction(adapter, "Delete", null);
            optionalActionCommand.DoAction(adapter, "Yes", null);
        }