Пример #1
0
        //[TestMethod,TestCategory("Smoke")]
        public void TestBox()
        {
            NavigationHelper.NavigateToUrl(ObjectRepository.Config.GetWebsite());
            LinkHelper.ClickLink(By.LinkText("File a Bug"));
            TextBoxHelper.TypeInTextBox(By.Id("Bugzilla_login"), ObjectRepository.Config.GetUsername());
            TextBoxHelper.TypeInTextBox(By.Id("Bugzilla_password"), ObjectRepository.Config.GetPassword());
            // TextBoxHelper.ClearTextBox(By.Id("Bugzilla_login"));
            IWebElement ele = ObjectRepository.Driver.FindElement(By.Id("Bugzilla_login"));

            Console.WriteLine(ele.Text);
            Console.WriteLine(CheckBoxHelper.IsCheckBoxChecked(By.Id("Bugzilla_restrictlogin")));
            CheckBoxHelper.CheckedCheckBox(By.Id("Bugzilla_restrictlogin"));
            Console.WriteLine(CheckBoxHelper.IsCheckBoxChecked(By.Id("Bugzilla_restrictlogin")));
            ButtonHelper.Logout();
        }
        public void TestUpload()
        {
            NavigationHelper.NavigateToUrl(ObjectRepository.Config.GetWebsite());
            ButtonHelper.ClickButton(By.Id("enter_bug"));
            TextBoxHelper.TypeInTextBox(By.Id("Bugzilla_login"), ObjectRepository.Config.GetUsername());
            TextBoxHelper.TypeInTextBox(By.Id("Bugzilla_password"), ObjectRepository.Config.GetPassword());
            ButtonHelper.ClickButton(By.Id("log_in"));
            ButtonHelper.ClickButton(By.LinkText("Testng"));
            ButtonHelper.ClickButton(By.XPath("//div[@id='attachment_false']/input"));
            GenericHelper.WaitForWebElement(By.Id("data"), TimeSpan.FromSeconds(30));
            ButtonHelper.ClickButton(By.Id("data"));

            Console.WriteLine("\"" + Directory.GetCurrentDirectory() + @"\ExcelData.xlsx" + "\"");

            var processinfo = new ProcessStartInfo()
            {
                FileName  = "FileUpload.exe",
                Arguments = "\"" + Directory.GetCurrentDirectory() + @"\ExcelData.xlsx" + "\""
            };

            //processinfo.FileName = @"F:\Auto\FileUpload.exe";
            //processinfo.Arguments = @"C:\downloads\ExcelData.xlsx";

            //Process process = Process.Start(processinfo);
            //process.WaitForExit();
            //process.Close();

            using (var process = Process.Start(processinfo))
            {
                process.WaitForExit();
            }


            Thread.Sleep(5000);
            ButtonHelper.Logout();
        }
 public void ThenILogoutFromTheApplication()
 {
     ButtonHelper.Logout();
 }