Beispiel #1
0
 //This method Type the value which passed to this method
 public static bool Type(TestStack.White.UIItems.WindowItems.Window window, string elementid, string value)
 {
     try
     {
         TextBox textbox = window.Get <TextBox>(SearchCriteria.ByAutomationId(elementid));
         textbox.Text = value;
         return(true);
     }
     catch (Exception)  {
         try
         {
             TextBox textbox = window.Get <TextBox>(SearchCriteria.ByText(elementid));
             textbox.Text = value;
             return(true);
         }
         catch (Exception)
         {
             try
             {
                 TextBox textbox = window.Get <TextBox>(SearchCriteria.ByClassName(elementid));
                 textbox.Text = value;
                 return(true);
             }
             catch (Exception)
             {
                 Console.WriteLine("Not able to find the element");
                 return(false);
             }
         }
     }
 }
Beispiel #2
0
 //Read TestBox value
 public static string ReadTextBoxValue(TestStack.White.UIItems.WindowItems.Window window, string elementid)
 {
     try
     {
         TextBox textbox = window.Get <TextBox>(SearchCriteria.ByAutomationId(elementid));
         return(textbox.Text);
     }
     catch (Exception)
     {
         try
         {
             TextBox textbox = window.Get <TextBox>(SearchCriteria.ByText(elementid));
             return(textbox.Text);
         }
         catch (Exception)
         {
             try
             {
                 TextBox textbox = window.Get <TextBox>(SearchCriteria.ByClassName(elementid));
                 return(textbox.Text);
             }
             catch (Exception)
             {
                 Console.WriteLine("Not able to get the text value");
                 return(null);
             }
         }
     }
 }
Beispiel #3
0
        private void AddFilesToConvert(String FileName)
        {
            // Add File for Consumption File
            SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle);
            btnAddFile = window.Get <TestStack.White.UIItems.Button>("btnAddFile");
            window.WaitWhileBusy();
            btnAddFile.Click();
            window.WaitWhileBusy();
            SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle);
            window.WaitWhileBusy();

            // Set File which one is to be process
            SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle);
            window.WaitWhileBusy();
            txtSetFileName = window.Get <TestStack.White.UIItems.TextBox>("1148");
            window.WaitWhileBusy();
            SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle);
            window.WaitWhileBusy();
            txtSetFileName.SetValue(FileName);
            window.WaitWhileBusy();
            SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle);
            window.WaitWhileBusy();

            // Click Open Button
            SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle);
            window.WaitWhileBusy();
            btnOpen = window.Get <TestStack.White.UIItems.Button>("1");
            window.WaitWhileBusy();
            btnOpen.Click();
            window.WaitWhileBusy();
            SetForegroundWindow(pdfToExcelApp.Process.MainWindowHandle);
            window.WaitWhileBusy();
        }
Beispiel #4
0
        /// <summary>
        /// executing the action
        /// </summary>
        /// <returns>true - if click success</returns>
        public override int Execute()
        {
            TestStack.White.UIItems.TextBox txt = Control as TestStack.White.UIItems.TextBox;
            if (txt.IsReadOnly)
            {
                Result = ActionResult.WARNING;
                MoreDetailAboutResult = Constants.WarningMessages.Warning_ReadOnly_TextBox;
            }

            txt.Text = Text;
            return(0);
        }
Beispiel #5
0
        public static void SetValueToFGenEditControl(string value, string units, string controlName)
        {
            string _textBoxID = GetTextBoxID(controlName);

            TextBox _textBox = AWGUI.currentUIControlPanel.Get <TextBox>(SearchCriteria.ByAutomationId(_textBoxID));

            Assert.IsNotNull(_textBox);

            Assert.IsTrue(_textBox.Enabled);

            _textBox.Click();
            _textBox.Enter(value + units);
        }
        public static void SetValuesOnProcessCreditCardPaymentWindow(Window paymentWin, string ccNumber, string expMonth, string expYear, string nameOnCard, string secCode, string billingAddr, string zipCode)
        {
            try
            {
                Logger.logMessage("---------------------------------------------------------------------------------");

                var paymentPanel = Actions.GetPaneByName(paymentWin, "Quickbooks Payments: Process Credit Card");

                PropertyCondition editCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Edit);
                AutomationElementCollection editElements = paymentPanel.AutomationElement.FindAll(TreeScope.Children, editCondition);
                int count = 0;

                foreach (AutomationElement item in editElements)
                {
                    count = count + 1;
                    TestStack.White.UIItems.TextBox t = new TestStack.White.UIItems.TextBox(item, paymentWin.ActionListener);

                    if (count == 1)
                        t.Text = ccNumber;

                    if (count == 2)
                        t.Text = expMonth;

                    if (count == 3)
                        t.Text = expYear;

                    if (count == 4)
                        t.Text = nameOnCard;

                    if (count == 5)
                        t.Text = secCode;

                    if (count == 6)
                        t.Text = billingAddr;

                    if (count == 7)
                        t.Text = zipCode;
                }

                Thread.Sleep(int.Parse(Execution_Speed));
                Logger.logMessage("---------------------------------------------------------------------------------");
            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }

        }
Beispiel #7
0
        public static void FGenEditControlValueShouldBe(string value, string units, string controlName)
        {
            string textBoxId     = GetTextBoxID(controlName);
            string expectedValue = value + " " + units; //The system imposes a space between units and value
            string actualValue;

            TextBox _textBox = AWGUI.currentUIControlPanel.Get <TextBox>(SearchCriteria.ByAutomationId(textBoxId));

            Assert.IsNotNull(_textBox);

            Assert.IsTrue(_textBox.Enabled);

            actualValue = _textBox.Text;
            Assert.AreEqual(actualValue, expectedValue, "The actual value of the FGen " + controlName + "edit box: " + actualValue + " did not match the expected value: " + expectedValue);
        }
        public void ThenIStartLabWareAndProcessedResults()
        {
            System.Media.SystemSounds.Beep.Play();

            //System.Media.SoundPlayer sp = new System.Media.SoundPlayer(@"D:\STalkToME.wav");
            //sp.Play();

            application = TestStack.White.Application.Launch("\\\\tst10-lwapp.medlinx.corp\\LW-LIMS-V6\\lw-lims.lnk");
            Window mainWindow = application.GetWindow("LabWare LIMS");

            TestStack.White.UIItems.Button btnbuttonintoolbar = mainWindow.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByText("Log into LIMS"));
            btnbuttonintoolbar.Click();
            Window logInWindow = application.GetWindow("Please Log In");

            TestStack.White.UIItems.TextBox loginField = logInWindow.Get <TestStack.White.UIItems.TextBox>(SearchCriteria.ByAutomationId("101"));
            loginField.BulkText = "testopr";
            TestStack.White.UIItems.TextBox passField = logInWindow.Get <TestStack.White.UIItems.TextBox>(SearchCriteria.ByAutomationId("102"));
            passField.BulkText = "123456";
            TestStack.White.UIItems.Button okButton = logInWindow.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByAutomationId("104"));
            okButton.Click();

            Window locationWin = application.GetWindow("Выберите расположение");

            TestStack.White.UIItems.ListViewRow chooseSPB = locationWin.Get <TestStack.White.UIItems.ListViewRow>(SearchCriteria.ByText("HELIX-SPB")); //= locationWin.Get<TestStack.White.UIItems.TextBox>(SearchCriteria.ByClassName("HELIX-SPB"));
            chooseSPB.Click();
            TestStack.White.UIItems.Button okLocationButton = locationWin.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByAutomationId("104"));
            okLocationButton.Click();


            Window windowAfterLogin = Desktop.Instance.Windows().Find(obj => obj.Title.Contains("User TESTOPR logged"));
            var    menuBar          = windowAfterLogin.Get <MenuBar>(SearchCriteria.ByText("Приложение"));
            var    menu             = menuBar.MenuItem("Configure", "System", "Client...");

            menu.Click();

            Window passworDialogWindow = application.GetWindow("Password Dialog");

            TestStack.White.UIItems.Button okButtonInPasswordDialog = passworDialogWindow.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByAutomationId("102"));
            okButtonInPasswordDialog.Click();

            Window configurationManagerWindow = application.GetWindow("Configuration Manager");

            TestStack.White.UIItems.Button okButtonInConfigurationManager = configurationManagerWindow.Get <TestStack.White.UIItems.Button>(SearchCriteria.ByAutomationId("102"));
            okButtonInConfigurationManager.Click();
            System.Threading.Thread.Sleep(3000);
            application.Close();
        }
Beispiel #9
0
        static void Main(string[] args)
        {
            for (int i = 0; i < Convert.ToInt32(args[1]); i++)
            {
                StreamWriter file2     = new StreamWriter(@"e:\RunningTimeWhiteLogin.txt", true);
                Stopwatch    stopwatch = Stopwatch.StartNew(); //creates and start the instance of Stopwatch

                var psi = new ProcessStartInfo(@"C:\\Users\\pth\\AppData\\Local\\Personify\\Omni\\Personify.exe");
                TestStack.White.Application app = TestStack.White.Application.AttachOrLaunch(psi);
                int    numWaits = 0;
                Window window;
                do
                {
                    Console.WriteLine("\n Looking for Chat application...");
                    // Find window with title "Personify"
                    window = app.GetWindow("Personify", TestStack.White.Factory.InitializeOption.NoCache);
                    ++numWaits;
                    Thread.Sleep(100);
                } while (window == null && numWaits < 50);
                Assert.IsNotNull(window);
                TestStack.White.UIItems.TextBox username = window.Get <TestStack.White.UIItems.TextBox>(SearchCriteria.ByAutomationId("Username"));
                TestStack.White.UIItems.TextBox password = window.Get <TestStack.White.UIItems.TextBox>(SearchCriteria.ByAutomationId("Password"));

                if (username == null || password == null)
                {
                    Assert.Fail("!!Can not find any textbox");
                }

                AutomationElement aeTemp = TreeWalker.ControlViewWalker.GetNextSibling(password.AutomationElement);
                // Input valid nxchattest1 user account to sign in.
                AutomationElement aeSignInButton      = TreeWalker.ControlViewWalker.GetNextSibling(aeTemp);
                TestStack.White.UIItems.Button signIn = new TestStack.White.UIItems.Button(aeSignInButton, window.ActionListener);
                username.BulkText = "";
                password.BulkText = "";
                signIn.Click();
                Thread.Sleep(1000);
                username.BulkText = "*****@*****.**";
                password.BulkText = "123456";
                signIn.Click();
                Thread.Sleep(2000);
                // Waiting for Chat Deck Window display
                numWaits = 0;
                do
                {
                    Console.WriteLine("\n Looking for Chat Deck...");
                    window = app.GetWindow("Home", TestStack.White.Factory.InitializeOption.NoCache);
                    ++numWaits;
                    Thread.Sleep(100);
                } while (window == null && numWaits < 50);


                //TestStack.White.UIItems.TextBox texttemp = window.Get<TestStack.White.UIItems.TextBox>(SearchCriteria.ByText("Create an immersive recording with your persona and content on screen."));
                TestStack.White.UIItems.Label  texttemp = window.Get <TestStack.White.UIItems.Label>(SearchCriteria.ByNativeProperty(AutomationElement.NameProperty, "Create an immersive recording with your persona and content on screen."));
                AutomationElement              aemenu   = TreeWalker.ControlViewWalker.GetNextSibling(texttemp.AutomationElement);
                TestStack.White.UIItems.Button menubtn  = new TestStack.White.UIItems.Button(aemenu, window.ActionListener);
                menubtn.Toggle();
                TestStack.White.UIItems.MenuItems.Menu signout = window.Get <TestStack.White.UIItems.MenuItems.Menu>(SearchCriteria.ByText("Sign out"));
                signout.Click();
                app.Kill();
                stopwatch.Stop();
                file2.WriteLine(stopwatch.ElapsedMilliseconds + " miliseconds");
                file2.Close();
            }
        }
Beispiel #10
0
        public static void CreateMultOrders()
        {
            //github.com/TestStack/White/blob/master/LICENSE-MIT.txt

            //string portalName = "TilePortal: SimCorp Dimension 6.3 PUBLIC";
            string portalName = "TilePortal: SimCorp Dimension 6.3 CONFIG_IMM";
            //string scdPath = @"\\Dk01snt899\public\PUBLIC63\Bin\";
            string scdPath = @"\\Dk01sv7033\t7020230\READYFORTEST\63\CONFIG_IMM\Bin\";
            //string titleLogon = "Logon - SimCorp Dimension Version 6.3 (PUBLIC)";
            string titleLogon = "Logon - SimCorp Dimension [Release Candidate] 6.3 (CONFIG_IMM)";

            //Console.WriteLine("Portal:");
            //string portalName = Console.ReadLine();
            //Console.WriteLine("SCD path:");
            //string scdPath = Console.ReadLine();
            //Console.WriteLine("Logon window:");
            //string titleLogon = Console.ReadLine();

            //Start App
            Console.WriteLine("Starting application...");
            Installation scd = new Installation(portalName, scdPath);

            scd.StartOrAttach();

            //Logon if needed

            scd.TryLogon(titleLogon, "MSBZ", "MSBZ");

            //Portal search
            Console.WriteLine("Openning the window...");
            WindowSCD.WaitWindow(portalName);
            Window portal = WindowSCD.GetWindow(portalName);

            TestStack.White.UIItems.TextBox textBoxSearch = portal.Get <TestStack.White.UIItems.TextBox>(SearchCriteria.ByText("SearchTextBox"));
            portal.Focus(DisplayState.Restored);
            string windowName = "Multiple Portfolio Orders";

            textBoxSearch.Text = windowName;
            Keyboard.Instance.PressSpecialKey(KeyboardInput.SpecialKeys.RETURN);

            //Open window
            WindowSCD.WaitWindow(windowName);
            Window window = WindowSCD.GetWindow(windowName);

            //set value
            List <string> gridColumns = new List <string> {
                "Security ID",
                "Portfolio group*",
                "Transaction code",
                "Nominal/Lots",
                "Order type",
                "Force time",
                "Order class*",
                "Broker",
                "Dealer",
                "Exchange",
                "Counterparty",
                "Custodian",
                "Custody",
                "Bank",
                "Bank account",
                "Requested status*",
                "Order flag",
                "Model portfolio",
                "Purpose",
                "Leg No.",
                "Portfolio*",
                "Currency",
            };

            WindowSCD.PrepareMultipleGridFields(window, gridColumns);
            Thread.Sleep(500);
            string filePath = @"U:\Desktop\PerformanceProj\orders.txt";

            try {
                string orders = File.ReadAllText(filePath);
                //Clipboard.SetText("J ACCR INT\t1\tHEG_TEST2\tGEN\t01.10.2018");
                Clipboard.SetText(orders);
                WindowSCD.PasteClipboardToGrid(windowName);
                Thread.Sleep(500);
                WindowSCD.Save();
            } catch (Exception) {
                Console.WriteLine("File not found");
            }
        }