Ejemplo n.º 1
0
        public void WhenIBuyTheFollowingPet(Table catTable)
        {
            dynamic dynamicCatInstance = catTable.CreateDynamicInstance();
            var     pet = TestActions.AddCat(dynamicCatInstance);

            ScenarioContext.Current.Add("pet", pet);
        }
Ejemplo n.º 2
0
        public void WhenIBuyTheFollowingDog(Table dogTable)
        {
            var dynamicDogInstance = dogTable.CreateDynamicInstance();
            var dog = TestActions.AddDog(dynamicDogInstance);

            ScenarioContext.Current.Add("dog", dog);
        }
 public void FillPersonalInfo(string firstName, string lastName, string password)
 {
     TestActions.WaitForElement(this.driver, By.Id("id_gender1"));
     TestActions.ClickOn(this.driver, genderButton);
     TestActions.TypeField(this.driver, customerFirstNameField, firstName);
     TestActions.TypeField(this.driver, customerLastNameField, lastName);
     TestActions.TypeField(this.driver, passwordField, password);
 }
Ejemplo n.º 4
0
 public void Fillform(string email, string orderReference, string msg)
 {
     TestActions.SelectDropdown(this.driver, selectSubject, "2");
     TestActions.TypeField(this.driver, emailAddressField, email);
     TestActions.TypeField(this.driver, orderReferenceField, orderReference);
     TestActions.TypeField(this.driver, messageField, msg);
     TestActions.ClickOn(this.driver, sendButton);
 }
Ejemplo n.º 5
0
        public void GivenIHaveTwoDataTablesCreatedForSterlingAndEuroCurrencies(Table table)
        {
            var SterlingData = table.CreateInstance <SterlingModal>();
            var EuroData     = table.CreateInstance <EuroModal>();

            SCurrencyTable = TestActions.GetSterlingCurrencyData(SterlingData.SCurrency1, SterlingData.SCurrency2,
                                                                 SterlingData.SCurrency3, SterlingData.SCurrency4, SterlingData.STotal);
            ECurrencyTable = TestActions.GetEuroCurrencyData(EuroData.ECurrency1, EuroData.ECurrency2, EuroData.ECurrency3, EuroData.ECurrency4,
                                                             EuroData.ETotal);
        }
Ejemplo n.º 6
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         Debug.Log("Press");
         TestActions.TestInstantWithError(new Exception("This exception won't break anything..."))
         .OnFailure(e => Debug.Log(e.Message + "and was caught!"))
         .Execute();
     }
 }
Ejemplo n.º 7
0
        private void Start()
        {
            /*TestActions.TestCoroutine(1)
             *  .OnSuccess(() => Debug.Log("Coroutine Success"))
             *  .Enqueue();
             *
             * TestActions.TestInstant("A wonderful first test").Enqueue();
             * TestActions.TestCoroutine(3).Enqueue();
             * TestActions.TestInstant("A wonderful second test").Enqueue();
             * TestActions.TestInstant("A wonderful third test but called first").Execute();*/

            /*GameAction action = TestActions.TestInstantWithError(new Exception("Test Exception"))
             *  .OnFailure((e) => Debug.Log("An error occured as expected: " + e))
             *  .OnSuccess(() => Debug.LogError("An error should have occured..."));*/

            /*TestActions.TestInstant("A wonderful first test").Enqueue();
             * GeneralActions.Wait(1).Enqueue();
             *
             * GroupAction.Create("My first group action",
             *  GeneralActions.Wait(3),
             *  GroupAction.Create("Inner group action",
             *      GeneralActions.Wait(3),
             *      TestActions.TestInstant("A wonderful Inner test")
             *  ),
             *  TestActions.TestInstant("A wonderful second test")
             * ).Enqueue();
             *
             * TestActions.TestInstant("A wonderful third test").Enqueue();
             * GeneralActions.Wait(2).Enqueue();*/

            TestActions.TestCoroutineWithError(3, new Exception("Coroutine Error"))
            .OnFailure(e => Debug.Log("Yay! the error has been caught: " + e))
            .OnSuccess(() => Debug.LogError("An error should have occured..."))
            .Enqueue();

            GroupAction.Create("Group action with failure inside",
                               TestActions.TestInstantWithError(new Exception("Test Exception"))
                               .OnFailure((e) => Debug.Log("An error occured as expected: " + e))
                               .OnSuccess(() => Debug.LogError("An error should have occured...")),
                               TestActions.TestCoroutineWithError(3, new Exception("Coroutine Error"))
                               .OnFailure(e => Debug.Log("Yay! the error has been caught: " + e))
                               .OnSuccess(() => Debug.LogError("An error should have occured..."))
                               .StopOnError(true)
                               )
            .Enqueue();


            TestActions.TestInstantWithError(new Exception("Should not be called Exception"))
            .OnFailure((e) => Debug.Log("An error occured as expected: " + e))
            .OnSuccess(() => Debug.LogError("An error should have occured..."))
            .Enqueue();
        }
 public void FillAddress(string company, string address1, string address2, string city, string state, string postal, string country, string phone, string alias)
 {
     TestActions.TypeField(this.driver, companyField, company);
     TestActions.TypeField(this.driver, addressField, address1);
     TestActions.TypeField(this.driver, address2Field, address2);
     TestActions.TypeField(this.driver, cityField, city);
     TestActions.SelectDropdown(this.driver, stateDropdown, state);
     TestActions.SelectDropdown(this.driver, countryDropdown, country);
     TestActions.TypeField(this.driver, postalCodeField, postal);
     TestActions.TypeField(this.driver, phoneField, phone);
     TestActions.TypeField(this.driver, aliasField, alias);
     TestActions.ClickOn(this.driver, submitButton);
 }
Ejemplo n.º 9
0
        public HubWindow(TestActions action)
        {
            InitializeComponent();

            this.action = action;

            var hubCore = new HubCore();

            if (action == TestActions.ViewResult)
            {
                filePaths = new List <string>(hubCore.GetFiles <TestResult>());
            }
            else
            {
                filePaths = new List <string>(hubCore.GetFiles <Test>());
            }

            foreach (var filePath in filePaths)
            {
                PathsList.Items.Add(new ListBoxItem()
                {
                    Content = filePath.Substring(filePath.LastIndexOf('\\') + 1)
                });
            }

            ChoosePathButton.Click += ChoosePathButtonClick;
            AddNewTestButton.Click += AddNewTestButtonClick;
            BackToMenuButton.Click += BackToMenuButtonClick;

            PathsList.SelectionChanged += PathsListSelectionChanged;

            ChoosePathButton.IsEnabled = false;

            if (action != TestActions.RedactTest)
            {
                AddNewTestButton.IsEnabled = false;
            }
        }
Ejemplo n.º 10
0
 public void ClickOnSubmitLogin()
 {
     TestActions.ClickOnButton(driver, By.Id("SubmitLogin"));
 }
Ejemplo n.º 11
0
 public void FillSignIn(string email, string password)
 {
     TestActions.TypeField(this.driver, emailfield, email);
     TestActions.TypeField(this.driver, passwordField, password);
     TestActions.ClickOn(this.driver, signInButton);
 }
Ejemplo n.º 12
0
 public void ClickOnWomenOption()
 {
     TestActions.ClickOnButton(driver, By.XPath("//*[@id=\"block_top_menu\"]/ul/li[1]"));
 }
Ejemplo n.º 13
0
        /*[FindsBy(How = How.ClassName, Using = "info-account")]
         * private IWebElement success;*/

        /*[FindsBy(How = How.XPath, Using = "//*[@id=\"block_top_menu\"]/ul/li[1]")]
         * private IWebElement womenOption;*/


        public string GetSuccessMessage()
        {
            return(TestActions.GetText(driver, By.ClassName("info-account")));
        }
Ejemplo n.º 14
0
        private void PassButtonClick(object sender, RoutedEventArgs e)
        {
            action = TestActions.PassTest;

            MoveToHub();
        }
Ejemplo n.º 15
0
 public GeneralActions(TestActions wrapper)
 {
     m_Wrapper = wrapper;
 }
Ejemplo n.º 16
0
 public void ClickOnProceedCheckout()
 {
     TestActions.ClickOnButton(driver, By.XPath("//*[@id=\"cart_navigation\"]/button"));
 }
Ejemplo n.º 17
0
 public void ClickOnContactLink()
 {
     TestActions.ClickOn(driver, contactLink);
 }
Ejemplo n.º 18
0
 public void CreateAccount(string email)
 {
     TestActions.TypeField(this.driver, emailCreateField, email);
     TestActions.ClickOn(this.driver, createAccountButton);
 }
Ejemplo n.º 19
0
        /*[FindsBy(How = How.XPath, Using = "//*[@id=\"layer_cart\"]/div[1]/div[2]/div[4]/a")]
         * private IWebElement proceedButton;*/



        public void ClickOnProceedCheckout()
        {
            TestActions.ClickOnButton(driver, By.XPath("//*[@id=\"layer_cart\"]/div[1]/div[2]/div[4]/a"));
        }
Ejemplo n.º 20
0
        /*[FindsBy(How = How.XPath, Using = "//*[@id=\"center_column\"]/ul/li[1]/div/div[2]/div[2]/a[1]")]
         * private IWebElement addcartButton;*/



        public void ClickOnAddtoCartButton()
        {
            TestActions.ClickOnButton(driver, By.XPath("//*[@id=\"center_column\"]/ul/li[1]/div/div[2]/div[2]/a[1]"));
        }
Ejemplo n.º 21
0
 public void ClickOnSignIn()
 {
     TestActions.ClickOn(driver, signIn);
 }
Ejemplo n.º 22
0
 public void PaybyCheck()
 {
     TestActions.ClickOnButton(driver, By.ClassName("payment_module"));
 }
 public void FillDropdowns(string valueDays, string valueMonths, string valueYears)
 {
     TestActions.SelectDropdown(this.driver, daysDropdown, valueDays);
     TestActions.SelectDropdown(this.driver, monthsDropdown, valueMonths);
     TestActions.SelectDropdown(this.driver, yearsDropdown, valueYears);
 }
Ejemplo n.º 24
0
 public void AgreeTermsOfService()
 {
     TestActions.ClickOnCheckBox(driver, By.Id("cgv"));
 }
Ejemplo n.º 25
0
        private void ViewResultsButtonClick(object sender, RoutedEventArgs e)
        {
            action = TestActions.ViewResult;

            MoveToHub();
        }
Ejemplo n.º 26
0
 public void ClickOnProceedCheckout()
 {
     TestActions.ClickOnButton(driver, By.XPath("//*[@id=\"form\"]/p/button"));
 }
Ejemplo n.º 27
0
        private void RedactButtonClick(object sender, RoutedEventArgs e)
        {
            action = TestActions.RedactTest;

            MoveToHub();
        }
Ejemplo n.º 28
0
        private void DoTest(TestConfig cfg, TestActions actions, int timeoutMillis)
        {
            ManualResetEvent ev = new ManualResetEvent(false);

            cfg.Ports = new ushort[6];

            for (int i = 0; i < 6; i++)
            {
                cfg.Ports[i] = StateMachineManager.GetFreePort();
            }

            cfg.RslData = ".\\rsldata";
            cfg.LogPath = ".\\logpath";

            if (Directory.Exists(cfg.RslData))
            {
                Directory.Delete(cfg.RslData, true);
            }

            if (Directory.Exists(cfg.LogPath))
            {
                Directory.Delete(cfg.LogPath, true);
            }

            TestTracer tr = new TestTracer();

            AppDomainStarter ad0             = null;
            AppDomainStarter ad1             = null;
            AppDomainStarter ad2             = null;
            Exception        resultException = null;

            if (cfg.Subject1 != null)
            {
                cfg.Subject1 = cfg.Subject1.Split('=').Last();
            }

            if (cfg.Subject2 != null)
            {
                cfg.Subject2 = cfg.Subject2.Split('=').Last();
            }

            ManagedRSLStateMachine.Init(cfg.LogPath, cfg.Th1, cfg.Th2, cfg.Subject1, cfg.ThumbprintsParent1, cfg.Subject2, cfg.Subjectparent2, false, true, false, false);

            ThreadPool.QueueUserWorkItem(_ =>
            {
                if (!ev.WaitOne(timeoutMillis))
                {
                    resultException = new TimeoutException("not finished on time");
                    ad0.Stop();
                    ad1.Stop();
                    ad2.Stop();
                }
            });

            try
            {
                ad0        = new AppDomainStarter("sm0", 0, cfg);
                ad0.Tracer = tr;
                ad0.Start(true);

                ad1        = new AppDomainStarter("sm1", 1, cfg);
                ad1.Tracer = tr;
                ad1.Start(false);

                ad2        = new AppDomainStarter("sm2", 2, cfg);
                ad2.Tracer = tr;
                ad2.Start(false);

                ad0.SM.WaitForPrimary(30000);

                Console.WriteLine("we got the primary!!");
                ad0.SM.ReplicateCommand(new CommandA(11));
                ad0.SM.ReplicateCommand(new CommandB("eleven"), true);

                if (actions.HasFlag(TestActions.FailoverPrimary))
                {
                    Console.WriteLine("stopping first instance...");
                    ad1.SM.CanBP = true;
                    ad0.Stop();
                    ad1.SM.WaitForPrimary(30000);
                }

                Thread.Sleep(5000);
                if (actions.HasFlag(TestActions.ThumbprintRollover))
                {
                    Console.WriteLine("rolling over thumbprints");
                    ManagedRSLStateMachine.ReplaceThumbprints(cfg.Th3, cfg.Th4, false, false);
                }

                if (actions.HasFlag(TestActions.RecoverFirstInstance) || actions.HasFlag(TestActions.ReturnToFirstPrimary))
                {
                    Console.WriteLine("restarting first instance");
                    ad0.Start(false);
                }

                if (actions.HasFlag(TestActions.ReturnToFirstPrimary))
                {
                    Console.WriteLine("failing second instance into first instance");
                    ad0.SM.CanBP = true;
                    ad1.Stop();
                    ad0.SM.WaitForPrimary(30000);
                }

                ev.Set();
            }
            catch (Exception e)
            {
                if (resultException == null)
                {
                    resultException = e;
                }
            }
            finally
            {
                Console.WriteLine("Unloading all");

                if (ad0 != null)
                {
                    ad0.Stop();
                }

                if (ad1 != null)
                {
                    ad1.Stop();
                }

                if (ad2 != null)
                {
                    ad2.Stop();
                }

                ManagedRSLStateMachine.Unload();
            }

            if (resultException != null)
            {
                if (resultException.InnerException != null)
                {
                    resultException = resultException.InnerException;
                }

                throw resultException;
            }
        }
Ejemplo n.º 29
0
 public void ClickOnProceedCheckout()
 {
     TestActions.ClickOnButton(driver, By.XPath("//*[@id=\"center_column\"]/form/p/button"));
 }
Ejemplo n.º 30
0
        /*[FindsBy(How = How.Id, Using = "email")]
         * private IWebElement emailLogIn;
         *
         * [FindsBy(How = How.Id, Using = "passwd")]
         * private IWebElement password;
         *
         * [FindsBy(How = How.Id, Using = "SubmitLogin")]
         * private IWebElement btnSignIn;*/



        public void FillLogInForm(string email, string pass)
        {
            TestActions.Type(driver, By.Id("email"), email);
            TestActions.Type(driver, By.Id("passwd"), pass);
        }