public string ToCsv()
 {
     return(string.Join(",",
                        //AssemblyId.ToString().FormatForCsv(),
                        AssemblyName.FormatForCsv(),
                        //PluginTypeId.ToString().FormatForCsv(),
                        PluginTypeName, StepId.ToString().FormatForCsv(),
                        StepName.FormatForCsv(),
                        FormatForCsv(ImageId),
                        ImageName.FormatForCsv(),
                        Environment.FormatForCsv(),
                        GetStateText(Environment == "Source" ? "target": "source").FormatForCsv(),
                        StepMessageName.FormatForCsv(),
                        EntityName.FormatForCsv(),
                        StepFilteringAttributes.FormatForCsv(),
                        FormatForCsv(RunAsUserId),
                        RunAsUserName.FormatForCsv(),
                        StepRank.ToString().FormatForCsv(),
                        StepDescription.FormatForCsv(),
                        StepStageName.FormatForCsv(),
                        StepModeName.FormatForCsv(),
                        StepSupportedDeploymentName.FormatForCsv(),
                        StepAsyncAutoDelete.ToString(),
                        StepConfiguration.FormatForCsv(),
                        StepSecureConfiguration.FormatForCsv(),
                        ImageAttributes.FormatForCsv()
                        ));
 }
Example #2
0
 public string FormatDescription(StepDescription description)
 {
     // HACK
     return(description.Description
            .Replace("<", "<span class=\"param\">")
            .Replace(">", "</span>"));
 }
Example #3
0
        private Step CreateBigDataStepForLoadTestAsyncWriting(int index)
        {
            var step = new Step();

            // Description
            var stepDescription = new StepDescription
            {
                Index = index,
                ScreenshotFileName =
                    docuFiles.GetScreenshotFile(
                        BranchName,
                        BuildName,
                        SerializationUseCase,
                        ScenarioName,
                        index),
                Title =
                    "this is a step with a lot of data in it such that writing should take realy long for testing async writing\n"
            };

            step.StepDescription = stepDescription;

            // Metdata with a lot of details
            step.StepMetadata = CreateBigMetadata();

            // Page
            step.Page = new Page("test.jsp");

            // Creates HTML (lot of dummy data, just to generate big data for writing)
            step.StepHtml = CreateBigHtml();

            return(step);
        }
Example #4
0
        public void Serialize_A_Step()
        {
            // arrange
            var step            = new Step();
            var stepDescription = new StepDescription {
                Index = StepIndex, Title = "Test Step", Status = "success"
            };

            step.StepDescription = stepDescription;

            step.StepHtml = new StepHtml {
                HtmlSource = "<html>just some page text</html>"
            };
            step.Page = new Page {
                Name = "customer/overview.jsp"
            };

            step.StepMetadata = new StepMetadata
            {
                VisibleText = "just some page text",
            };

            // act
            writer.SaveStep(SerializationUseCase, TestContext.CurrentContext.Test.Name, step);
            writer.Flush();

            // assert
            Assert.IsTrue(File.Exists(docuFiles.GetScenarioStepFile(BranchName, BuildName, SerializationUseCase, TestContext.CurrentContext.Test.Name, 1)));
        }
        private void AddStep_Click(object sender, RoutedEventArgs e)
        {
            bool continueAddStep = false;

            if (curStep != curStepVisibility)
            {
                curStepVisibility          = curStep;
                StepDescription.Text       = "Step Description";
                StepDescription.Foreground = new SolidColorBrush(Colors.Gray);
                AddImages.Visibility       = Visibility.Visible;
                StepDescription.IsEnabled  = true;
                Images.Children.Clear();
                ImagesScrollView.Visibility = Visibility.Collapsed;
                StepCount.Text = $"{curStepVisibility + 1}?/{Steps.Count}";
            }
            else
            {
                if (StepDescription.Text == "Step Description")
                {
                    MessageBox.Show("Bạn phải có hướng dẫn cho bước nấu ăn này chớ");
                    StepDescription.Focus();
                }
                else if (curStep == Steps.Count)
                {
                    var result = MessageBox.Show("Wait Wait! Bước nấu ăn này không có hình ảnh minh họa sao", "", MessageBoxButton.YesNo);
                    if (result == MessageBoxResult.Yes)
                    {
                        List <String> tmp = new List <string>();
                        tmp.Add("");
                        Steps.Add(tmp);
                        continueAddStep = true;
                    }
                    else
                    {
                        /*Do Nothing*/
                    }
                }
                else
                {
                    continueAddStep = true;
                }
                if (continueAddStep)
                {
                    Steps[curStep][0]          = StepDescription.Text;
                    StepDescription.Text       = "Step Description";
                    StepDescription.Foreground = new SolidColorBrush(Colors.Gray);
                    StepDescription.IsEnabled  = true;
                    AddImages.Visibility       = Visibility.Visible;
                    Images.Children.Clear();
                    ImagesScrollView.Visibility = Visibility.Collapsed;
                    curStep++;
                    curStepVisibility = curStep;
                    StepCount.Text    = $"{curStepVisibility + 1}?/{Steps.Count}";
                }
            }
        }
Example #6
0
        private StepDescription GetMethodInfo(Type actionType, string methodName)
        {
            StepDescription info = new StepDescription();

            try
            {
                if (_doc == null)
                {
                    return(info);
                }

                string   path          = $"//members/member[contains(@name, 'M:{actionType.Namespace}.{actionType.Name}.{methodName}')]";
                XElement methodElement = _doc.XPathSelectElement(path);
                if (methodElement != null)
                {
                    info.Description           = methodElement.XPathSelectElement("summary").Value.Trim();
                    info.ParameterDescriptions = new Dictionary <string, string>();
                    foreach (var parameter in methodElement.Elements("param"))
                    {
                        try
                        {
                            info.ParameterDescriptions[parameter.Attribute("name").Value] = parameter.Value;
                        }
                        catch (ArgumentException e)
                        {
                            Console.WriteLine($"Error adding description.  Action: {actionType.Name}, Method: {methodName}, Parameter: {parameter.Attribute("name").Value}");
                            Console.WriteLine(e);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error reading method info.  Action: {actionType.Name}, Method: {methodName}");
                Console.WriteLine(e);
            }

            return(info);
        }
Example #7
0
 public void SetUpContext()
 {
     Result = GetRegexMatcherResult("RegExExample");
 }
Example #8
0
 public void SetUpContext()
 {
     Result = GetRegexMatcherResult("RegExExampleWithParameter");
 }
Example #9
0
        public void Write_Steps_With_Screen_Annotations()
        {
            // arrange
            var usecase = new UseCase
            {
                Name        = "Screen Annotations",
                Description = "Usecase to show the screen annotations",
                Status      = "failed",
            };

            writer.SaveUseCase(usecase);

            var scenario = new Scenario
            {
                Name        = "All screen annotations on one page",
                Description = "this is a typical scenario with a decription",
                Status      = "failed",
            };

            writer.SaveScenario(usecase.Name, scenario);
            writer.Flush();

            // act
            var step            = new Step();
            var stepDescription = new StepDescription {
                Index = StepIndex, Title = "Test Step", Status = "success"
            };

            step.StepDescription = stepDescription;

            step.StepHtml = new StepHtml {
                HtmlSource = "<html>just some page text</html>"
            };
            step.Page = new Page {
                Name = "Sample Screen Annotation Page"
            };
            step.StepDescription.ScreenshotFileName = "000.png";
            step.StepDescription.Index = 0;

            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(10, 50, ScreenAnnotationStyle.Highlight));
            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(10, 150, ScreenAnnotationStyle.Click, ScreenAnnotationClickAction.ToUrl, "next-url"));
            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(10, 250, ScreenAnnotationStyle.Error));
            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(10, 350, ScreenAnnotationStyle.Expected));
            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(10, 450, ScreenAnnotationStyle.Info));
            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(400, 50, ScreenAnnotationStyle.Keyboard));
            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(400, 150, ScreenAnnotationStyle.Warn));
            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(400, 250, ScreenAnnotationStyle.Default));
            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(400, 350, ScreenAnnotationStyle.NavigateToUrl, ScreenAnnotationClickAction.ToUrl, "blabla"));

            var details = new Details();

            details.AddDetail("details-key", "details-value");
            step.ScreenAnnotations.Last().Details = details;


            writer.SaveStep(usecase.Name, scenario.Name, step);
            writer.Flush();

            writer.SaveScreenshot(usecase.Name, scenario.Name, step, File.ReadAllBytes("data/screenshot.png"));
            writer.Flush();

            usecase.Status  = "success";
            scenario.Status = "success";

            writer.SaveUseCase(usecase);
            writer.SaveScenario(usecase.Name, scenario);

            var stepAsString = File.ReadAllText(docuFiles.GetScenarioStepFile(BranchName, BuildName, usecase.Name, scenario.Name, 0));

            // well this is a really sloppy assertion. BUT: we don't have to test the whole serialization because this is done by .NET framework.
            // we have to do some little things that the java deserializer likes our xml. So we do just some checks on "problem zones". the whole
            // import should still be checked with an api call on the scenarioo backend.
            StringAssert.Contains("<style>HIGHLIGHT</style>", stepAsString);
            StringAssert.Contains("<style>CLICK</style>", stepAsString);
            StringAssert.Contains("<style>ERROR</style>", stepAsString);
            StringAssert.Contains("<style>INFO</style>", stepAsString);
            StringAssert.Contains("<style>EXPECTED</style>", stepAsString);
        }
Example #10
0
 public void SetUpContext()
 {
     Result = GetRegexMatcherResult("RegExExampleWithEmbeddedParameter");
 }
Example #11
0
 public void SetUpContext()
 {
     Result = GetRegexMatcherResult("RegExExample");
 }