Пример #1
0
        public void TestLogin(ConfigurationManager config, IWebDriver driver, string browser)
        {
            log.Info("Waiting for page to load and element userName to be visible");

            WaitAndFindSelector.FindNameAndSendText("username", config.UserName, driver);

            WaitAndFindSelector.FindIdAndSendText("txtPassword", config.Password, driver);

            WaitAndFindSelector.FindCssAndClick("button.btn.btn-primary", driver);


            log.Info("login Successful");
        }
        public void CreateDM(DataMart dataMart, IWebDriver driver, string browser)
        {
            log.Info("Waiting for New DataMart Button to be loaded and Clicked");
            System.Threading.Thread.Sleep(1000);

            WaitAndFindSelector.FindIdAndClick("btnNewDataMart", driver);

            //First we loop over to Create the DataMart
            System.Threading.Thread.Sleep(1000);
            foreach (var action in dataMart.Actions)
            {
                try
                {
                    log.Info("Executing the action: " + action.InputType + " on property " + action.ByType + " " + action.ByValue);

                    WaitAndFindSelector.FindByAndExecute(action, driver);

                    log.Info("Executing the action: " + action.InputType + " on property " + action.ByType + " " + action.ByValue + " successfull");
                }
                catch (Exception ex)
                {
                    log.Error("error in DataMart Creation for " + dataMart.DMTestName + " in action " + action.Name);
                }
            }

            log.Info("Refreshing page to validate entries");

            driver.Navigate().Refresh();

            System.Threading.Thread.Sleep(2000);

            foreach (var action in dataMart.Actions.Where(x => x.Validate))
            {
                try
                {
                    log.Info("Validating the action: " + action.InputType + " on property " + action.ByType + " " + action.ByValue);

                    WaitAndFindSelector.ValidateFindByAndExecute(action, driver);

                    log.Info("Executing the action: " + action.InputType + " on property " + action.ByType + " " + action.ByValue + " successfull");
                }
                catch (Exception ex)
                {
                    log.Error("error in DataMart validation for " + dataMart.DMTestName + " in action " + action.Name);
                }
            }
        }
        public void DeleteDataMart(string datamart, IWebDriver driver, string browser)
        {
            try
            {
                log.Info("Waiting for DataMart Grid to load");
                System.Threading.Thread.Sleep(1000);

                WaitAndFindSelector.FindXPathAndClick("//a[.='" + datamart + "']", driver);

                System.Threading.Thread.Sleep(2000);

                WaitAndFindSelector.FindIdAndClick("btnDelete", driver);

                System.Threading.Thread.Sleep(2000);

                WaitAndFindSelector.FindIdAndClick("confirmYes", driver);

                System.Threading.Thread.Sleep(2000);
            }
            catch (Exception ex)
            {
                log.Error("error in DataMart Deletion for " + datamart);
            }
        }