示例#1
0
        /**
         * definitionName: definition of what you want to recognize
         * documentName: document name
         * input: string to search to see if the page recognizes it
         */
        public void Recognition(string definitionName, string documentName, string input)   // test to make sure there are documents in recognize
        {
            CreateDocumentForRecognize();
            AddRecognition();
            OpenOrganizer();
            m.Click(By.Name(definitionName));
            window = m.Locate(By.Name(documentName));
            action.DoubleClick(window).Build().Perform();
            Thread.Sleep(2000);

            Print(method, "x: " + Cursor.Position.X + " y: " + Cursor.Position.Y);
            m.Click(By.Id("lblType"));
            Print(method, "x: " + Cursor.Position.X + " y: " + Cursor.Position.Y);
            action.MoveByOffset(470, -40).Click().Build().Perform();
            Print(method, "x: " + Cursor.Position.X + " y: " + Cursor.Position.Y);

            window = m.Locate(By.Name("Find"));
            m.SendKeys(By.Name(""), input, m.Locate(By.Id("txtFind"), window));
            m.Click(By.Id("btnFind"));

            if (m.IsElementPresent(By.Name("Search Text Not Found"), window))
            {
                Print(method, "Search Text not found for Recognize");
                //throw new AssertFailedException("Search Text not found for Recognize");
            }
            m.Click(By.Id("btnCancel"));
            m.Click(By.Id("btnClose"));
        }
示例#2
0
        /**Creates docs
         * numOfDocs: specifies how many to create
         * if isPDF = true --> gets pdf from the directory, else tif
         * docPath: allows you to specify the directory of docs, default is set in config
         * fileNumber: allows you to specify which file you want to use
         */
        public void SimpleCreateDocument(bool isPDF = true, string docPath = "", int?fileNumber = 0)
        {
            method = MethodBase.GetCurrentMethod().Name;
            Print(method, "Started");

            m.Click(By.Name("Add Document"));

            //add document button (+ icon)
            Print(method, "x: " + Cursor.Position.X + " y: " + Cursor.Position.Y);
            m.Click(By.Id("lblType"));
            Print(method, "x: " + Cursor.Position.X + " y: " + Cursor.Position.Y);
            action.MoveByOffset(20, -40).Click().MoveByOffset(20, 60).Click().Build().Perform();
            Print(method, "x: " + Cursor.Position.X + " y: " + Cursor.Position.Y);

            //find the document to add in file explorer
            //configure docpath in app.config, takes arg of pdf or tif
            if (docPath.Length < 1)
            {
                docPath = ConfigurationManager.AppSettings.Get("AddDocumentStorage");
            }
            m.SendKeys(By.Id("1001"), docPath);
            Print(method, "Go to \"" + docPath + "\"");
            m.Click(By.Name("Go to \"" + docPath + "\""));

            var rand = new Random();

            if (isPDF)
            {
                Winium.Elements.Desktop.ComboBox filesOfType = new Winium.Elements.Desktop.ComboBox(m.Locate(By.Name("Files of type:")));
                filesOfType.SendKeys("p");
                filesOfType.SendKeys(OpenQA.Selenium.Keys.Enter);
                Thread.Sleep(500);
                if (fileNumber == 0)
                {
                    action.MoveToElement(m.Locate(By.Id(rand.Next(Directory.GetFiles(docPath, "*.pdf").Length).ToString()))).DoubleClick().Build().Perform();
                }
                else
                {
                    action.MoveToElement(m.Locate(By.Id(fileNumber.ToString()))).DoubleClick().Build().Perform();
                }
                m.Click(By.Name("Open"));
            }
            else
            {
                if (fileNumber == 0)
                {
                    action.MoveToElement(m.Locate(By.Id(rand.Next(Directory.GetFiles(docPath, "*.tif").Length).ToString()))).DoubleClick().Build().Perform();
                }
                else
                {
                    action.MoveToElement(m.Locate(By.Id(fileNumber.ToString()))).DoubleClick().Build().Perform();
                }
                m.Click(By.Name("Open"));
            }

            Print(method, "save and quit");
            m.Click(By.Id("btnSave"));
            m.Click(By.Id("btnClose"));
            Print(method, "Finished");
        }
示例#3
0
 public void AddToIPack()
 {
     OpenOrganizer();
     window = m.Locate(By.Name("DEFAULT DEF"));
     action.MoveToElement(window).ContextClick().Build().Perform();
     window = m.Locate(By.Name("DropDown"));
     m.Click(By.Name("Add to iPack..."));
     m.Click(By.Name("Yes"));
     m.Click(By.Id("btnNewIpack"));
     Thread.Sleep(1000);
     window = m.Locate(By.Id("frmNewiPack"));
     m.SendKeys(By.Name(""), "test" + new Random().Next().ToString(), window);
     m.Click(By.Id("rbnOK"));
     m.Click(By.Id("btnOK"));
     window = m.Locate(By.Name("&Intact"), m.Locate(By.Name("radMenu1")));
     m.Click(By.Name("iPack"), window);
     //m.Click(By.Id("rbnBatch"));
     Thread.Sleep(1000);
     window = m.Locate(By.Id("frmIntactMain"));
     if (m.IsElementPresent(By.Name("No documents were selected"), window))
     {
         m.Click(By.Name("OK"));
     }
     Thread.Sleep(1000);
     m.Click(By.Id("radButton1"));
     Thread.Sleep(5000);
 }
        /**THIS METHOD HAS TO BE RAN FIRST WITH TESTS, Logs into intact with admin login
         */
        public void Login()   //TODO: have to add connectToRemoteDesktop
        {
            method = MethodBase.GetCurrentMethod().Name;

            //both of these will most likely stay false all the time, but we can test either of them by changing value in app.config
            bool needToSetDB     = ConfigurationManager.AppSettings.Get("setDataBase") == "true";;
            bool connectToRemote = ConfigurationManager.AppSettings.Get("connectToRemote") == "true";

            Thread.Sleep(10000);
            m.SendKeys(By.Name(""), "admin");
            if (!needToSetDB)
            {
                m.Click(By.Name("&Logon"));
            }
            else
            {
                SetDatabaseInformation();
                m.Click(By.Name("&Logon"));
            }
            Thread.Sleep(2000);
        }