public void ShouldBeAbleTo_ShowClick() { var interpreter = TestBootstrapper.Setup( @" Discriminator, What Show, Click Button1"); Should.Be <SuccessAnswer>(interpreter.Please($"gotourl file:///{_file}")); var answer = interpreter.Please(App.Interpreter.RUN_NEXT_ITEM_IN_PLAN); Should.Be <SuccessAnswer>(answer); Thread.Sleep(2000); Assert.IsTrue(answer.Children.First() is OverlayAnswer); Assert.AreEqual(46, (answer.Children.First() as OverlayAnswer).Artifacts.First().Rectangle.Width); Assert.AreEqual(16, (answer.Children.First() as OverlayAnswer).Artifacts.First().Rectangle.X); //Assert.IsTrue(ServiceLocator.Instance.Resolve<IAnnotationOverlay>().IsShowing); //Assert.IsFalse(ServiceLocator.Instance.Resolve<IAnnotationOverlay>().Form.IsDisposed); Should.Be <SuccessAnswer>(interpreter.Please($"gotourl http://www.google.com")); Thread.Sleep(2000); Should.Be <SuccessAnswer>(interpreter.Please($"gotourl file:///{_file}")); Thread.Sleep(2000); //Assert.IsFalse(ServiceLocator.Instance.Resolve<IAnnotationOverlay>().IsShowing); //Assert.IsNull(ServiceLocator.Instance.Resolve<IAnnotationOverlay>().Form); answer = interpreter.Please("show click Button1"); Assert.IsTrue(answer.Children.First() is OverlayAnswer); Assert.AreEqual(46, (answer.Children.First() as OverlayAnswer).Artifacts.First().Rectangle.Width); Assert.AreEqual(16, (answer.Children.First() as OverlayAnswer).Artifacts.First().Rectangle.X); Thread.Sleep(4000); Assert.IsTrue(ServiceLocator.Instance.Resolve <IAnnotationOverlay>().IsShowing); }
public void Should_UseVariableInFill() { var interpreter = TestBootstrapper.Setup(); Should.Be <SuccessAnswer>(interpreter.Please($"gotourl file:///{_file}")); Should.Be <SuccessAnswer>(interpreter.Please("remember textFieldName 'TextArea1'")); Should.Be <SuccessAnswer>(interpreter.Please("fill [textFieldName] with SampleText")); Should.Have("SampleText").InFieldWithId("IdTextArea1"); }
public void ShouldBeAbleTo_CallOtherTechniques() { var interpreter = TestBootstrapper.Setup(); Should.Be <SuccessAnswer>(interpreter.Please($"gotourl file:///{_file}")); Assert.IsTrue(interpreter.Please("show clear TextArea1").Children.First() is OverlayAnswer); Thread.Sleep(500); Should.Be <OverlayAnswer>(interpreter.Please("show dragAndDrop 100 200 Button1").Children.First()); }
public void Should_BeAbleTo_ParseSpecification() { var interpreter = TestBootstrapper.Setup( @"Discriminator, Instruction Fill, 1st TextArea1 from left with SampleText "); Assert.AreEqual("SampleText", interpreter.Plan.OfType <Fill>().First().Text); Assert.AreEqual("TextArea1", interpreter.Plan.OfType <Fill>().First().LabelText); }
public void ShouldBeAbleTo_ShowTwiceInARow() { var interpreter = TestBootstrapper.Setup(); Should.Be <SuccessAnswer>(interpreter.Please($"gotourl file:///{_file}")); Should.Be <SuccessAnswer>(interpreter.Please("show fill TextArea1")); Thread.Sleep(500); Should.Be <SuccessAnswer>(interpreter.Please("show fill TextArea1")); }
public void Should_UseVariableInFill_UsingFile_with_differentVariable2() { var interpreter = TestBootstrapper.Setup( @"Discriminator, What Fill, TextArea1 with [text] "); Should.Be <SuccessAnswer>(interpreter.Please($"gotourl file:///{_file}")); Should.Be <SuccessAnswer>(interpreter.Please("remember text SampleText")); Should.Be <SuccessAnswer>(interpreter.Please(App.Interpreter.RUN_NEXT_ITEM_IN_PLAN)); Should.Have("SampleText").InFieldWithId("IdTextArea1"); }
public void Should_NotOverwriteValues() { var interpreter = TestBootstrapper.Setup( @"Discriminator, What Fill, {""TextArea1 with SampleText""} "); var fill = interpreter.Plan.First() as Fill; fill.Hydrate(); Assert.AreEqual("SampleText", fill.Text); Assert.AreEqual("TextArea1", fill.LabelText); }
public void CanEvaluate() { var interpreter = TestBootstrapper.Setup( "Discriminator, Url, What, Expect\n" + "GoToUrl, {\"file:///\"+FileFinder.Find(\"Iteration1TestPageRelativeButtons.html\")},,\n" + "GoToUrl, {\"file:///\"+FileFinder.Find(\"Iteration1TestPageRelativeButtons.html\")},,\n"); Should.Be <SuccessAnswer>(interpreter.Please("skip")); Assert.IsFalse((interpreter.Plan.First() as Keyword).IsHydrated); Assert.IsFalse((interpreter.Plan.Last() as Keyword).IsHydrated); Should.Be <SuccessAnswer>(interpreter.Please("eval")); Assert.IsFalse((interpreter.Plan.First() as Keyword).IsHydrated); Assert.IsTrue((interpreter.Plan.Last() as Keyword).IsHydrated); TestBootstrapper.ModifyScenario( "Discriminator, Url, What, Expect\n" + "GoToUrl,{\"file:///\"+FileFinder.Find(\"Iteration1TestPageRelativeButtons.html\")},,\n" + "GoToUrl,{\"file:///\"+FileFinder.Find(\"Iteration1TestPageRelativeButtons.html\")},,\n" + "GoToUrl,{\"file:///\"+FileFinder.Find(\"Iteration1TestPageRelativeButtons.html\")},,\n"); Should.Be <SuccessAnswer>(interpreter.Please("reload")); Assert.AreEqual(3, interpreter.Plan.Count()); Assert.IsFalse(((Keyword)interpreter.Plan.First()).IsHydrated); Assert.IsFalse(((Keyword)interpreter.Plan.Last()).IsHydrated); Assert.AreEqual(1, interpreter.Iterator.Index); Should.Be <SuccessAnswer>(interpreter.Please("eval")); Assert.IsFalse(((Keyword)interpreter.Plan.First()).IsHydrated); Assert.IsTrue(((Keyword)interpreter.Plan.Skip(1).First()).IsHydrated); Assert.IsFalse(((Keyword)interpreter.Plan.Last()).IsHydrated); }
public void ShouldWorkWithSpecialCharacters() { var interpreter = TestBootstrapper.Setup(); Should.Be <SuccessAnswer>(interpreter.Please("Remember Variable1 Hello world")); Should.Be <SuccessAnswer>(interpreter.Please($"gotourl file:///{_file}")); Should.Be <SuccessAnswer>(interpreter.Please("fill TextArea1 with [Variable1]")); Should.Have("Hello world").InFieldWithId("IdTextArea1"); interpreter.Please("clear TextArea1"); Should.Be <SuccessAnswer>(interpreter.Please("fill TextArea1 with \"Hello world\"")); Should.Have("\"Hello world\"").InFieldWithId("IdTextArea1"); interpreter.Please("clear TextArea1"); Should.Be <SuccessAnswer>(interpreter.Please("fill TextArea1 with {hello}")); Should.Have("{hello}").InFieldWithId("IdTextArea1"); interpreter.Please("clear TextArea1"); Should.Be <SuccessAnswer>(interpreter.Please("fill TextArea1 with {[Variable1]}")); Should.Have("{Hello world}").InFieldWithId("IdTextArea1"); interpreter.Please("clear TextArea1"); }
public void ShouldBeAbleTo_ShowFill() { var interpreter = TestBootstrapper.Setup( @" Discriminator, What Fill, TextArea1 with Test Completed!"); Should.Be <SuccessAnswer>(interpreter.Please($"gotourl file:///{_file}")); var answer = interpreter.Please("show"); Should.Be <SuccessAnswer>(answer); Assert.IsTrue(answer.Children.First() is OverlayAnswer); Assert.AreEqual(173, (answer.Children.First() as OverlayAnswer).Artifacts.First().Rectangle.Width); Assert.AreEqual(75, (answer.Children.First() as OverlayAnswer).Artifacts.First().Rectangle.X); Thread.Sleep(2000); Assert.IsTrue(ServiceLocator.Instance.Resolve <IAnnotationOverlay>().IsShowing); Should.Be <SuccessAnswer>(interpreter.Please(App.Interpreter.RUN_NEXT_ITEM_IN_PLAN)); Thread.Sleep(500); Assert.IsFalse(ServiceLocator.Instance.Resolve <IAnnotationOverlay>().IsShowing); Should.Have("Test Completed!").InFieldWithId("IdTextArea1"); Thread.Sleep(500); }