예제 #1
0
        public void Register(string outputFile)
        {
            var fnInput = Driver.Instance.FindElement(By.Name("fn"));

            fnInput.SendKeys(fn);

            var userInput = Driver.Instance.FindElement(By.Name("name"));

            userInput.SendKeys(userName);

            var passwordInput = Driver.Instance.FindElement(By.Name("pass"));

            passwordInput.SendKeys(password);

            var mailInput = Driver.Instance.FindElement(By.Name("mail"));

            mailInput.SendKeys(mail);

            var regButton = Driver.Instance.FindElement(By.LinkText("Регистрация"));

            regButton.Click();

            Driver.Wait(TimeSpan.FromSeconds(2));

            if (!LoginPage.IsAt)
            {
                CSVWriter.Write(@outputFile, "failed," + fn + ',' + userName + ',' + password + ',' + mail);
            }
            else
            {
                CSVWriter.Write(@outputFile, "success," + fn + ',' + userName + ',' + password + ',' + mail);
            }
        }
예제 #2
0
        public void Upload(string outputFile)
        {
            UploadDocsPage.StoreCount();

            var     fileChooser = Driver.Instance.FindElement(By.Id("userfile"));
            Actions action      = new Actions(Driver.Instance);

            action.MoveToElement(fileChooser).Click().Build().Perform();

            Driver.Wait(TimeSpan.FromSeconds(2));
            SendKeys.SendWait(@filePath);
            Driver.Wait(TimeSpan.FromSeconds(2));
            SendKeys.SendWait(@"{Enter}");

            var commentInput = Driver.Instance.FindElement(By.Id("comment"));

            commentInput.SendKeys(comment);

            var uploadButton = Driver.Instance.FindElement(By.LinkText("Качи"));

            uploadButton.Click();
            Driver.Wait(TimeSpan.FromSeconds(3));

            var expected = UploadDocsPage.PreviousUploadsCount + 1;
            var actual   = UploadDocsPage.CurrentUploadsCount();

            if (expected != actual)
            {
                CSVWriter.Write(@outputFile, "failed," + filePath);
                throw new System.Exception("File is not correctly uploaded. Expected number of revisions: " + expected + ", Got: " + actual);
            }
            else
            {
                CSVWriter.Write(@outputFile, "success," + filePath);
            }
        }