Ejemplo n.º 1
0
        public bool AddedCarrier_UIVerify()
        {
            UIItem Lane                  = new UIItem("Routing Guide>> Lane", byLane, _driver);
            UIItem CarrierName           = new UIItem("Routing Guide>> CarrierName", byCarrierName, _driver);
            UIItem CarrierEffDateDisplay = new UIItem("Routing Guide>> CarrierEffDate", byCarrierEffDateDisplay, _driver);
            UIItem CarrierExpDateDisplay = new UIItem("Routing Guide>> CarrierExpDate", byCarrierExpDateDisplay, _driver);

            try
            {
                Assert.IsTrue(Lane.Click());
                _RoutingGuidePage.WaitUntilLoading();
                Assert.IsTrue(CarrierName.WaitUntilDisplayed());
                int index = CarrierEffDateDisplay.GetCountOfElements();
                CarrierExpDateDisplay.ScrollToElement(CarrierExpDateDisplay.ElementByIndex(index));
                Assert.IsFalse(CarrierEffDateDisplay.IsEditable());
                Assert.IsFalse(CarrierExpDateDisplay.IsEditable());
                Assert.IsTrue(carrierEffDate == Constants.Ignore ? true : CarrierEffDateDisplay.GetAllUIItems()[index - 1].UIVerify(carrierEffDate));
                Assert.IsTrue(carrierExpDate == Constants.Ignore ? true : CarrierExpDateDisplay.GetAllUIItems()[index - 1].UIVerify(carrierExpDate));
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public void OpenSentItemsSection()
        {
            AutomationElement sentItemsAE = outlookWindow.GetElement(SearchCriteria.ByText("Sent Items"));
            UIItem            sentItems   = new UIItem(sentItemsAE, new NullActionListener());

            sentItems.Click();
        }
Ejemplo n.º 3
0
        public void WatchListPin()
        {
            ListView watchList          = Window.Get <ListView>(TestDataInfrastructure.GetControlId("WatchListView"));
            UIItem   watchListTabHeader = Window.GetWatchListRegionHeader();

            watchListTabHeader.Click();
            watchList = Window.Get <ListView>(TestDataInfrastructure.GetControlId("WatchListView"));

            //pin the watch list panel
            //Button pinImage = window.Get<Button>(TestDataInfrastructure.GetControlId("WatchListHideButton"));
            Button pinImage = Window.Get <Button>("HeaderAutoHideButton");

            pinImage.Click();

            Assert.IsFalse(IsWatchListWindowCollapsed(watchList));
            Assert.IsFalse(watchListTabHeader.Visible);

            //to lose focus on the WatchList button, click somewhere on the Account Position List
            ListView list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("PositionTableId"));

            list.Click();

            Assert.IsFalse(IsWatchListWindowCollapsed(watchList));

            //unpin the watch list panel (by clicking on the pin again)
            pinImage.Click();

            Assert.IsTrue(watchListTabHeader.Visible);
            Assert.IsTrue(IsWatchListWindowCollapsed(watchList));
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Set value of a DataGridCell and then verify
        /// </summary>
        /// <param name="value">Value to set</param>
        /// <param name="shouldClick">Should click before setting text (yes/no)</param>
        /// <param name="shouldVerify">Indicate whether or not to verify</param>
        /// <param name="window">Window to perform text entry on</param>
        public void SetValue(string value, bool shouldClick = true, bool shouldVerify = true, Window window = null)
        {
            ReportActionValue("SetValue", value);

            if (window == null)
            {
                window = WorkSpace.MainWindow.Window;
            }

            if (shouldClick)
            {
                UIItem.Click();
            }

            window.Keyboard.Enter(value);
            window.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RETURN);

            CaptureImage();

            if (shouldVerify)
            {
                var friendlyMessage = ConstructFriendlyMessage(Resources.FriendlyDataGridCellSetMsg, value);

                QAAssert.Contains(Value, value, friendlyMessage);
            }
        }
Ejemplo n.º 5
0
        public string AddCarrier_Verify()
        {
            UIItem AddCarrierBtn     = new UIItem("Routing Guide>> Add Carrier Button", byAddCarrierBtn, _driver);
            UIItem UpdateCarrierBtn  = new UIItem("Routing Guide>> Update Carrier Button", byUpdateCarrierBtn, _driver);
            UIItem CarrierElement    = new UIItem("Lane>> Carrier Element", byCarrierElement, _driver);
            UIItem UndoChangesButton = new UIItem("Lane>> Undo Changes Button", byUndoCangesBtn, _driver);

            try
            {
                Assert.IsTrue(AddCarrierBtn.WaitUntilDisplayed());
                Assert.IsTrue(UpdateCarrierBtn.WaitUntilDisplayed());
                Assert.IsFalse(UpdateCarrierBtn.IsEnabled());
                IList <IWebElement> carriersBeforeAdd = _driver.FindElements(byCarrierElement);

                Assert.IsTrue(AddCarrierBtn.Click());
                Assert.IsTrue(UpdateCarrierBtn.IsEnabled());
                Assert.IsTrue(UndoChangesButton.WaitUntilDisplayed());
                IList <IWebElement> carriersAfterAdd = _driver.FindElements(byCarrierElement);
                if (carriersAfterAdd.Count <= carriersBeforeAdd.Count)
                {
                    return("VerificationFailed");
                }
                Assert.IsTrue(UndoChangesButton.Click());
                Assert.IsFalse(UpdateCarrierBtn.IsEnabled());

                return("VerificationSuccess");
            }
            catch
            {
                return("VerificationFailed");
            }
        }
Ejemplo n.º 6
0
        public string Inquire()
        {
            UIItem AppTitile         = new UIItem("App title", By.CssSelector("#app-title"), driver);
            UIItem InquireButton     = new UIItem("Inquiry About This Load", By.CssSelector("#load-inquiry"), driver);
            UIItem SendInquireButton = new UIItem("Send Inquiry", By.CssSelector("#send-inquiry"), driver);
            UIItem OptionButton      = new UIItem("Option button", By.CssSelector("#options-button"), driver);
            UIItem CloseButton       = new UIItem("Close Button", By.CssSelector("#modal-header-close-modal-button"), driver);
            UIItem PageTitle         = new UIItem("Page Title - Load detail", By.CssSelector("#app-title"), driver);

            try
            {
                if (testData.Data("EntityName") != "FACTORINGCOMPANY")
                {
                    AppTitile.Click();
                    Assert.IsTrue(OptionButton.WaitUntilDisplayed());
                    OptionButton.Click();
                    Assert.IsTrue(InquireButton.WaitUntilDisplayed());
                }
                Assert.IsTrue(InquireButton.FindAndClickUsingJS());
                Assert.IsTrue(SendInquireButton.WaitUntilDisplayed());
                Assert.IsTrue(CloseButton.FindAndClickUsingJS());
                Assert.IsTrue(SendInquireButton.WaitUtilDisappear());
                return("LoadInquireSuccess");
            }
            catch
            {
                return("LoadInquireFailed");
            }
        }
Ejemplo n.º 7
0
        public void AddReference(string referenceName)
        {
            var solutionExplorerTab = window.Get(SearchCriteria.ByText("Solution Explorer"));

            // Focus the tab
            solutionExplorerTab.Click();

            var solutionExplorerTree = window.Get <Tree>(SearchCriteria.ByAutomationId("SolutionExplorer"));

            var node = FindAutomationElement(solutionExplorerTree.AutomationElement, "References");

            var nodeItem = new UIItem(node, window);

            // Focus
            nodeItem.Click();

            // Click
            nodeItem.RightClick();

            window.Popup.Item("Add Reference...").Click();

            var dialog = window.ModalWindows()[0];

            var listItem = dialog.Get(SearchCriteria.ByText(referenceName));

            listItem.Click();

            var checkBox = listItem.Get <CheckBox>(SearchCriteria.ByControlType(ControlType.CheckBox));

            checkBox.Checked = true;

            dialog.Get <Button>(SearchCriteria.ByText("OK")).Click();
        }
Ejemplo n.º 8
0
 public static void ClickAndWaitWhileBusy(this UIItem item, Window waitOnWindow)
 {
     item.Click();
     waitOnWindow.Mouse.Location = waitOnWindow.TitleBar.Location;
     waitOnWindow.WaitWhileBusy();
     Thread.Sleep(500);
 }
Ejemplo n.º 9
0
        void Items(Design_Item parent, List <Design_Item> baners, UISection U)
        {
            Guid          parentId = parent.Id.Value;
            List <UIItem> list     = new List <UIItem>();

            UMC.Data.WebResource webr = UMC.Data.WebResource.Instance();
            for (int i = 0; i < baners.Count && i < 4; i++)
            {
                Design_Item b      = baners[i];
                WebMeta     icon   = UMC.Data.JSON.Deserialize <WebMeta>(b.Data) ?? new UMC.Web.WebMeta();
                UIItem      slider = UIItem.Create(icon);
                slider.Click(this.Click(b));
                String t = "100";
                switch (baners.Count)
                {
                case 1:
                    t = "4-1";
                    break;

                case 2:
                    t = "2-1";
                    break;

                case 3:
                    if (i == 0)
                    {
                        t = "2-1";
                    }
                    break;
                }

                slider.Src(String.Format("{0}!{1}?{2}", webr.ImageResolve(b.Id.Value, "1", 0), t, TimeSpan(b.ModifiedDate)));
                list.Add(slider);
            }
            if (list.Count > 0)
            {
                U.AddItems(list.ToArray());// (new UIItem[0]));
            }
            else if (_editer)
            {
                ;
                UIDesc desc = new UIDesc("\ue907");
                desc.Desc("{desc}\r\n配置分块栏");

                desc.Style.AlignCenter().Name("desc", new UIStyle().Font("wdk").Size(38).Click(new UIClick(parentId.ToString())
                                                                                               .Send("Design", "Item")));
                U.Add(desc);
            }
        }
Ejemplo n.º 10
0
        public void WatchListClickShow()
        {
            ListView watchList    = Window.Get <ListView>(TestDataInfrastructure.GetControlId("WatchListView"));
            UIItem   watchListTab = Window.GetWatchListRegionHeader();

            watchListTab.Click();
            watchList = Window.Get <ListView>(TestDataInfrastructure.GetControlId("WatchListView"));

            Assert.IsFalse(IsWatchListWindowCollapsed(watchList));

            ListView list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("PositionTableId"));

            list.Click();

            Assert.IsTrue(IsWatchListWindowCollapsed(watchList));
        }
Ejemplo n.º 11
0
        private bool EditStops()
        {
            try
            {
                Assert.IsTrue(stopsUpdateLink.Click());
                Assert.IsTrue(_StopsTab.Stop_UpdateSave.WaitUntilDisplayed());
                Assert.IsTrue(_StopsTab.ArrivalDate.ClearAndEdit(_Data.PickUp_ArrivalDate));
                Assert.IsTrue(_StopsTab.ArrivalTime.ClearAndEdit(_Data.PickUp_ArrivalTime));
                _StopsTab.ArrivalTime.Edit(OpenQA.Selenium.Keys.Enter);
                if (_StopsTab.Latepickup_Reason.WaitUntilDisplayed(10))
                {
                    _StopsTab.Latepickup_Continue.Click();
                }
                Assert.IsTrue(_StopsTab.DepartureDate.ClearAndEdit(_Data.PickUp_DepartureDate));
                Assert.IsTrue(_StopsTab.DepartureTime.ClearAndEdit(_Data.PickUp_DepartureTime));
                _StopsTab.DepartureTime.Edit(OpenQA.Selenium.Keys.Enter);
                if (_StopsTab.Latepickup_Reason.WaitUntilDisplayed(10))
                {
                    _StopsTab.Latepickup_Continue.Click();
                }
                if (_Data.EditLoadCommodity.ToUpper() == "TRUE")
                {
                    double expWeight = Convert.ToDouble(_StopsTab.Commodities1strow_expWeight.GetText() == "--" ? "0" :
                                                        _StopsTab.Commodities1strow_expWeight.GetText().Replace(" lbs", ""));
                    double expWeightPercent = Convert.ToDouble(_Data.WeightPercent == "!IGNORE!" ? "0" : _Data.WeightPercent);
                    int    actualWeight     = (int)Math.Ceiling(expWeight + expWeight * (expWeightPercent / 100));

                    double expPieces = Convert.ToDouble(_StopsTab.Commodities1strow_expPieces.GetText() == "--" ? "0" :
                                                        _StopsTab.Commodities1strow_expPieces.GetText());
                    double expPiecesPercent = Convert.ToDouble(_Data.PiecesPercent == "!IGNORE!" ? "0" : _Data.PiecesPercent);
                    int    actualPieces     = (int)Math.Ceiling(expPieces + expPieces * (expPiecesPercent / 100));
                    if (_Data.WeightPercent != "!IGNORE!")
                    {
                        Assert.IsTrue(_StopsTab.Commodities1stRowActWeight.ClearAndEdit(actualWeight.ToString()));
                    }
                    if (_Data.PiecesPercent != "!IGNORE!")
                    {
                        Assert.IsTrue(_StopsTab.Commodities1stRowActPieces.ClearAndEdit(actualPieces.ToString()));
                    }
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 12
0
        private bool Open_AddCarrier()
        {
            UIItem AddCarrierBtn = new UIItem("Routing Guide>> Add Carrier Button", byAddCarrierBtn, _driver);
            UIItem Lane          = new UIItem("Routing Guide>> Lane", byLane, _driver);

            try
            {
                Assert.IsTrue(Lane.Click());
                Assert.IsTrue(AddCarrierBtn.WaitUntilDisplayed());
                Assert.IsTrue(AddCarrierBtn.Click());

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        ///     Set value of a popup from a TableCell and then verify
        /// </summary>
        /// <param name="value">Value to click</param>
        /// <param name="shouldVerify">Indicate whether or not to verify</param>
        public void SetPopupValue(string value, bool shouldVerify = true)
        {
            ReportActionValue("SetPopupValue", value);
            UIItem.Click();
            UIItem.Click();

            var popup = QAWindow.GetModalWindow(SearchCriteria.ByAutomationId(string.Empty).AndByClassName("Popup"), WorkSpace.MainWindow.Window);

            var listItemPopup = QAListItem.Get(SearchCriteria.ByText(value), string.Empty, popup.Window);

            listItemPopup.Click();
            CaptureImage();

            if (shouldVerify)
            {
                var friendlyMessage = ConstructFriendlyMessage(Resources.FriendlyDataGridCellSetMsg, value);
                QAAssert.AreEqual(Value, value, friendlyMessage);
            }
        }
Ejemplo n.º 14
0
        private bool Submit_AddCarrier()
        {
            UIItem AddCarrierBtn       = new UIItem("Routing Guide>> Add Carrier Button", byAddCarrierBtn, _driver);
            UIItem UpdateCarrierBtn    = new UIItem("Routing Guide>> Update Carrier Button", byUpdateCarrierBtn, _driver);
            UIItem CarrierErrorMessage = new UIItem("Routing Guide>> Carrier Code", byCarrierErrorMessage, _driver);

            try
            {
                Assert.IsTrue(UpdateCarrierBtn.WaitUtilEnabled());
                Assert.IsTrue(UpdateCarrierBtn.Click());
                Thread.Sleep(Constants.Wait_Medium);
                Assert.IsTrue(_RoutingGuidePage.WaitUntilSaving());
                Assert.IsFalse(UpdateCarrierBtn.IsEnabled());
                Assert.IsFalse(CarrierErrorMessage.IsDisplayed());
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        ///     Select item contained inside ComboBox using Automation
        /// </summary>
        /// <param name="itemText">Item text</param>
        /// <param name="shouldVerify">Indicate whether or not to verify</param>
        /// <param name="useReturnForSelection">
        ///     UIItem.Click does not work in all situations,
        ///     for such cases pass the last parameter as true to make sure selection works for those cases
        /// </param>
        public void Select(string itemText, bool shouldVerify = true, bool useReturnForSelection = false)
        {
            ReportAction("Select");
            UIItem.Select(itemText);
            CaptureImage();

            if (shouldVerify)
            {
                var friendlyMessage = ConstructFriendlyMessage(Resources.FriendlyComboBoxSelectMsg, itemText);
                QAAssert.AreEqual(itemText, UIItem.SelectedItemText, friendlyMessage);
            }

            if (useReturnForSelection)
            {
                UIItem.KeyIn(KeyboardInput.SpecialKeys.RETURN);
            }
            else
            {
                UIItem.Click();
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        ///     Set value of a TableCell and then verify
        /// </summary>
        /// <param name="value">Value to set</param>
        /// <param name="shouldClick">Should click before setting text (yes/no)</param>
        /// <param name="shouldVerify">Indicate whether or not to verify</param>
        public void SetValue(string value, bool shouldClick = true, bool shouldVerify = true)
        {
            ReportActionValue("SetValue", value);
            if (shouldClick)
            {
                UIItem.Click();
            }

            WorkSpace.MainWindow.Keyboard.Enter(value);
            WorkSpace.MainWindow.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RETURN);
            Thread.Sleep(100);
            CaptureImage();

            if (shouldVerify)
            {
                var friendlyMessage = ConstructFriendlyMessage(Resources.FriendlyDataGridCellSetMsg, value);

                // Decimal places are often affixed to the end of the text
                // so ensure expected text is a subset of actual text
                QAAssert.Contains(Value, value, friendlyMessage);
            }
        }
Ejemplo n.º 17
0
        private bool VerifyMyLoadsCount(UIItem item, string count)
        {
            try
            {
                Assert.IsTrue(item.Click());
                _DashboardPage.My_Loads_Search_Results_Headers.WaitUntilDisplayed(30);

                UIItem TotalResults = new UIItem("MyLoads>> Total results>>", byTotalResults, driver);
                UIItem CountResults = new UIItem("MyLoads>> Total results>>", byCountResults, driver);

                if (TotalResults.IsDisplayed())
                {
                    Assert.IsTrue(TotalResults.UIVerify("HasText." + count));
                }
                else
                {
                    Assert.IsTrue(CountResults.UIVerify("HasText." + count));
                }

                if (_entityname == Constants.Entity_Carrier)
                {
                    MyTasksPage objToNavigate = new MyTasksPage(this.testConfig);
                    objToNavigate.Navigate();
                }
                else
                {
                    CLAW objToNavigate = new CLAW(testConfig, testData);
                    objToNavigate.NavigateTo("HOME");
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 18
0
        public void CheckForUpdatesTest()
        {
            Action = MainWindow.Get <Menu>(SearchCriteria.ByText("Tools"));
            Action.SubMenu("Options").Click();
            MainWindow.WaitWhileBusy();
            var OptionsWindow = MainWindow.MdiChild(SearchCriteria.ByText("Options"));

            OptionsWindow.Click();
            UpdatesTab = OptionsWindow.Get <UIItem>(SearchCriteria.ByText("Updates"));
            UpdatesTab.Click();
            UpdateCheckForUpdateButton = OptionsWindow.Get <Button>(SearchCriteria.ByText("Check For Updates"));
            UpdateCheckForUpdateButton.Click();
            MainWindow.WaitWhileBusy();
            OKButton = OptionsWindow.Get <Button>(SearchCriteria.ByText("OK"));
            try
            {
                OKButton.Click();
            }
            catch (Exception e)
            {
                ScreenshotsTaker screenshot = new ScreenshotsTaker();
                screenshot.TakeScreenShot();
            }
        }
Ejemplo n.º 19
0
 public void Click()
 {
     // TODO: Find a way to do this (activate window) in White
     this.dialog.ActivateWindow(this.dialog.WorkingWindow.Title);
     item.Click();
 }
Ejemplo n.º 20
0
 /// <summary>
 ///     Click UIItem (this uses cursor to click UIItem).
 ///     Always try to use this method instead of RaiseClickEvent() because this is a closer
 ///     implementation to how a user would normally click a UIItem.
 /// </summary>
 public void Click()
 {
     ReportAction("Click");
     CaptureImage();
     UIItem.Click();
 }