public void SellMultipleStocksFromPositionTableByClickingSubmitAll()
        {
            string symbol;
            string anotherSymbol;

            symbol        = TestDataInfrastructure.GetTestInputData("Symbol");
            anotherSymbol = TestDataInfrastructure.GetTestInputData("PositionSymbol");

            /////////////////////////////////
            //Enter Share 1 Details
            LaunchBuySellPanelFromPositionTable(BuySellEnum.Sell, symbol);
            Order model = new Order(
                symbol,
                Decimal.Parse(TestDataInfrastructure.GetTestInputData("BuySellLimitPrice"), CultureInfo.InvariantCulture),
                TestDataInfrastructure.GetTestInputData("BuySellOrderType"),
                int.Parse(TestDataInfrastructure.GetTestInputData("BuySellNumberOfShares"), CultureInfo.InvariantCulture),
                TestDataInfrastructure.GetTestInputData("TimeInForceEndOfDay"),
                BuySellEnum.Sell.ToString()
                );

            PopulateBuySellPanelWithData(model);
            /////////////////////////////////

            /////////////////////////////////
            //Enter Share 2 Details
            LaunchBuySellPanelFromPositionTable(BuySellEnum.Sell, anotherSymbol);
            Order anotherModel = new Order(
                anotherSymbol,
                Decimal.Parse(TestDataInfrastructure.GetTestInputData("BuySellLimitPrice"), CultureInfo.InvariantCulture),
                TestDataInfrastructure.GetTestInputData("BuySellOrderType"),
                int.Parse(TestDataInfrastructure.GetTestInputData("BuySellNumberOfShares"), CultureInfo.InvariantCulture),
                TestDataInfrastructure.GetTestInputData("TimeInForceEndOfDay"),
                BuySellEnum.Sell.ToString()
                );

            PopulateBuySellPanelWithData(anotherModel);

            Button submitAllButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("BuySellSubmitAllButton"));

            submitAllButton.Click();

            //give time for submit processing
            System.Threading.Thread.Sleep(2000);

            // Validate if expander Buy/Sell Panels disappear.
            // AND
            // Validate if the sell transactions were successful
            GroupBox buySellSymbolGroup = Window.Get <GroupBox>(SearchCriteria.ByAutomationId("CompositeExpander")
                                                                .AndControlType(typeof(GroupBox)));

            Assert.IsNull(buySellSymbolGroup);

            List <Order> orders = TestDataInfrastructure.GetData <OrderDataProvider, Order>();

            Assert.IsNotNull(orders.Find(o => o.Symbol.Equals(symbol) || o.Symbol.Equals(anotherSymbol)));

            // Validate the correctness of data.
            Assert.IsTrue(orders.Find(o => o.Symbol.Equals(symbol)).Equals(model));
            Assert.IsTrue(orders.Find(o => o.Symbol.Equals(anotherSymbol)).Equals(anotherModel));
        }
Beispiel #2
0
        public void DisplayedNewsDoubleClick()
        {
            //Get the handle of the Position table
            ListView list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("PositionTableId"));

            //Click on the particular symbol row
            list.Rows.Find(row => row.Cells[TestDataInfrastructure.GetTestInputData("PositionTableSymbol")].Text.Equals(TestDataInfrastructure.GetTestInputData("Symbol"))).Click();

            //Get the news item for the particular symbol row
            List <News> news = TestDataInfrastructure.GetDataForId <NewsDataProvider, News>(TestDataInfrastructure.GetTestInputData("Symbol"));

            //Get the handle of the articles view
            ListBox articlesView = Window.Get <ListBox>(TestDataInfrastructure.GetControlId("NewsArticlesView"));

            //Double click the first news article item
            articlesView.Items[0].DoubleClick();

            //Get the handle of the News Reader window
            Window newsWindow = App.GetWindows().Find(newsArticleWindow => newsArticleWindow.Title.Equals("News Reader"));

            Assert.IsNotNull(newsWindow);

            //Geth the Body,Title and Published Date from the News Reader window
            string   body          = newsWindow.Get <TextBox>(TestDataInfrastructure.GetControlId("ArticleBody")).Text;
            string   title         = newsWindow.Get <Label>(TestDataInfrastructure.GetControlId("ArticleTitle")).Text;
            DateTime publishedDate = Convert.ToDateTime(newsWindow.Get <Label>(TestDataInfrastructure.GetControlId("ArticlePublishedDate")).Text, CultureInfo.CurrentCulture);

            Assert.AreEqual(body, news[0].Body);
            Assert.AreEqual(title, news[0].Title);
            Assert.AreEqual(publishedDate, news[0].PublishedDate);
        }
        // TODO: Required a single method to toggle between tabs.
        private void SelectPositionTabPage()
        {
            Tab positionBuySellTab = Window.Get <Tab>(SearchCriteria.ByAutomationId(TestDataInfrastructure.GetControlId("PositionBuySellTab"))
                                                      .AndControlType(typeof(Tab)));

            positionBuySellTab.Pages.Find(p => p.NameMatches(TestDataInfrastructure.GetTestInputData("PositionTab"))).Select();
        }
Beispiel #4
0
        public void ValidateDefaultCompositeTrendView()
        {
            // Data Assumptions :
            // Trend data composite is calculated based on all the data - hence they all need the same time span and data sampling
            // We should have some BVT test that validates the test and Sample data ARE OK with our assumption
            // - Validate our Data Set!

            // Get the PositionTable
            // Get ahold of the following trendlineView data
            //    - Get the Title, Validate the default it should be "FAKEINDEX"
            //    - Caluculate the composite data set
            //    - Get the Min Max on the Y axis
            //    - Validate that the test calculated data is bounded by the Y Data range displayed in the view
            //    - Validate the data range and Get the Min Max date value in our Test time span match the displayed time span
            //

            // Loop the the rows
            //  - Select the first row
            //    need to force an invoke
            //

            Assert.IsNotNull(Window.AutomationElement.SearchInRawTreeByName(TestDataInfrastructure.GetTestInputData("DefaultCompositeTrendView")));

            List <MarketHistoryItem> history      = TestDataInfrastructure.GetData <MarketHistoryDataProvider, MarketHistoryItem>();
            List <MarketHistoryItem> defaultItems = history.FindAll(i => i.TickerSymbol.Equals(TestDataInfrastructure.GetTestInputData("DefaultCompositeTrendView")));

            Assert.IsTrue(ValidateXAxisDataRange(defaultItems));
            Assert.IsTrue(ValidateYAxisDataRange(defaultItems));
        }
Beispiel #5
0
        public static void AssertSilverLightEmployeeCurrentProjects()
        {
            AutomationElement employeesListGrid = UICompositionPage <TApp> .EmployeesListGrid;

            AutomationElementCollection aeEmployeesList = UICompositionPage <TApp> .EmployeesGridItems;

            aeEmployeesList[1].Click();
            Thread.Sleep(2000);


            for (int count = 0; count < aeEmployeesList.Count; count++)
            {
                aeEmployeesList[count].Select();
                Thread.Sleep(2000);

                AutomationElement           employeeTabControl = UICompositionPage <TApp> .EmployeeSummaryTabControl;
                AutomationElementCollection employeeTabItems   = UICompositionPage <TApp> .EmployeeTabItems;

                employeeTabItems[1].Select();
                Thread.Sleep(2000);

                //Check if the current projects grid is loaded.
                AutomationElement currentProjectsGrid = UICompositionPage <TApp> .SilverLightProjectsGrid;
                GridPattern       projectPattern      = currentProjectsGrid.GetCurrentPattern(GridPattern.Pattern) as GridPattern;
                Assert.AreEqual(TestDataInfrastructure.GetTestInputData("ProjectsRowCount" + (count + 1).ToString()), projectPattern.Current.RowCount.ToString());
            }
        }
Beispiel #6
0
        public void ValidateEmployeeSelection()
        {
            //select first row (employee)
            ListView list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("EmployeesList"));

            list.SelectEmployee(0);

            //validate details view
            Tab empDetailsTab = Window.Get <Tab>(TestDataInfrastructure.GetControlId("DetailsTabControl"));

            Assert.IsNotNull(empDetailsTab, TestDataInfrastructure.GetTestInputData("EmpDetailsTabNotFound"));

            //validate tab has three tab items, and their names are "General", "Location" and "Current Projects"
            Assert.AreEqual(3, empDetailsTab.Pages.Count, TestDataInfrastructure.GetTestInputData("EmpDetailsTabPagesCount"));
            Assert.IsTrue(
                (empDetailsTab.Pages[0].NameMatches(TestDataInfrastructure.GetTestInputData("EmpDetailsTabGeneral")) &&
                 empDetailsTab.Pages[1].NameMatches(TestDataInfrastructure.GetTestInputData("EmpDetailsTabLocation")) &&
                 empDetailsTab.Pages[2].NameMatches(TestDataInfrastructure.GetTestInputData("EmpDetailsTabCurrentProjects"))),
                TestDataInfrastructure.GetTestInputData("EmpDetailsTabPagesIncorrect"));

            //validate controls in each of the tabs
            ValidateGeneralTabControls();
            ValidateLocationTabControls();
            ValidateCurrentProjectsTabControls();
        }
        private void LaunchBuySellPanelFromPositionTable(BuySellEnum buySell, string symbol)
        {
            //first select the Position Tab
            Tab positionBuySellTab = Window.Get <Tab>("PositionBuySellTab");

            positionBuySellTab.Pages.Find(p => p.NameMatches("POSITION")).Select();

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

            switch (buySell)
            {
            case BuySellEnum.Buy:
                //right click on the added symbol in the Position Table and click Buy
                list.Rows.Find(r => r.Cells[0].Text.Equals(symbol)).RightClick();
                System.Threading.Thread.Sleep(1000);
                Window.PopupMenu("Buy").Click();
                break;

            case BuySellEnum.Sell:
                //TODO: validate if Symbol can be sold

                //right click on the added symbol in the Position Table and click sell
                list.Rows.Find(r => r.Cells[0].Text.Equals(symbol)).RightClick();
                System.Threading.Thread.Sleep(1000);
                Window.PopupMenu("Sell").Click();
                break;
            }
        }
Beispiel #8
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));
        }
Beispiel #9
0
        public void AttemptToolBarSaveAllForMultipleValidOrdersAndOneInvalidOrder()
        {
            int count = 0;

            //Get the hanlde of the order list view
            ListBox orderView  = Window.Get <ListBox>(TestDataInfrastructure.GetControlId("OrderListView"));
            int     orderCount = orderView.Items.Count;

            //Select the orders in the list view one by one and POpulate valid order details for every order
            while (count < orderCount)
            {
                orderView.Items[count].Select();
                Label orderNameLabel = (Label)Window.Get(SearchCriteria.ByAutomationId(TestDataInfrastructure.GetControlId("OrderNameLabel"))
                                                         .AndByText(TestDataInfrastructure.GetTestInputData("Order") + (count + 1))
                                                         .AndControlType(typeof(Label)));
                Assert.IsNotNull(orderNameLabel);
                PopulateOrderDetailsWithData();
                count++;
            }

            //Get the hanlde of te toolbar save all button
            Button saveAllButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("SaveAllToolBarButton"));

            //check if the toolbar save all button is enabled
            Assert.IsTrue(saveAllButton.Enabled);

            //POpulate the selected ordere details with invalid data
            PopulateOrderDetailsWithInvalidData();

            //check if the toolbar save all button is disabled
            Assert.IsFalse(saveAllButton.Enabled);
        }
Beispiel #10
0
        public void ApplicationLaunch()
        {
            SearchCriteria searchCriteria      = SearchCriteria.ByText(TestDataInfrastructure.GetTestInputData("SelectEmployeeLabelText")).AndControlType(typeof(Label));
            Label          selectEmployeeLabel = Window.Get <Label>(searchCriteria);

            Assert.IsNotNull(selectEmployeeLabel);

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

            Assert.IsNotNull(list, TestDataInfrastructure.GetTestInputData("EmployeeListNotFound"));

            Assert.AreEqual(2, list.Rows.Count, TestDataInfrastructure.GetTestInputData("EmployeeListIncorrectRowCount"));
            Assert.AreEqual(2, list.Header.Columns.Count, TestDataInfrastructure.GetTestInputData("EmployeeListIncorrectColumnCount"));

            /* Buttons have been removed
             * searchCriteria = SearchCriteria.ByAutomationId(TestDataInfrastructure.GetControlId("SendEmailButton")).AndControlType(typeof(Button));
             * Button sendEmailButton = window.Get<Button>(searchCriteria);
             * Assert.IsNotNull(sendEmailButton, TestDataInfrastructure.GetTestInputData("SendMailButtonNotFound"));
             *
             * searchCriteria = SearchCriteria.ByAutomationId(TestDataInfrastructure.GetControlId("CallButton")).AndControlType(typeof(Button));
             * Button callButton = window.Get<Button>(searchCriteria);
             * Assert.IsNotNull(callButton, TestDataInfrastructure.GetTestInputData("CallButtonNotFound"));
             *
             * searchCriteria = SearchCriteria.ByAutomationId(TestDataInfrastructure.GetControlId("PastProjectsButton")).AndControlType(typeof(Button));
             * Button pastProjectsButton = window.Get<Button>(searchCriteria);
             * Assert.IsNotNull(callButton, TestDataInfrastructure.GetTestInputData("PastProjectsButtonNotfound"));
             */
        }
Beispiel #11
0
        public void SelectedSymbolRepeatedPositionRowClick()
        {
            //get handle of the Position Table
            ListView    list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("PositionTableId"));
            string      symbol;
            List <News> news;
            ListBox     articlesView;

            //click the particular symbol of the Position table
            ListViewRow symbolRow = list.Rows.Find(row => row.Cells[TestDataInfrastructure.GetTestInputData("PositionTableSymbol")].Text.Equals(TestDataInfrastructure.GetTestInputData("Symbol")));

            symbolRow.Click();

            //Get the news item for a particular symbol
            symbol = TestDataInfrastructure.GetTestInputData("Symbol");
            news   = TestDataInfrastructure.GetDataForId <NewsDataProvider, News>(symbol);

            //Get the handler of the News Article View displayed
            articlesView = Window.Get <ListBox>(TestDataInfrastructure.GetControlId("NewsArticlesView"));

            //Get the number of news items for the particular symbol
            int newsCount = news.Count;

            Assert.AreEqual(newsCount, articlesView.Items.Count);

            //click the particular symbol of the Position table
            symbolRow.Click();

            //Get the handler of the News Article View displayed
            articlesView = Window.Get <ListBox>(TestDataInfrastructure.GetControlId("NewsArticlesView"));

            Assert.AreEqual(newsCount, articlesView.Items.Count);
        }
Beispiel #12
0
        public void ClickingAlreadyShownSymbolDisplaysNewsArticlesCorrespondingly()
        {
            //get handle of the Position Table
            ListView    list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("PositionTableId"));
            string      symbol;
            List <News> news;
            ListBox     articlesView;

            //click the particular symbol of the Position table STOCK0
            ListViewRow symbolRow = list.Rows.Find(row => row.Cells[TestDataInfrastructure.GetTestInputData("PositionTableSymbol")].Text.Equals(TestDataInfrastructure.GetTestInputData("Symbol")));

            symbolRow.Click();

            //click on the position symbol STOCK6
            ListViewRow secondSymbolRow = list.Rows.Find(row => row.Cells[TestDataInfrastructure.GetTestInputData("PositionTableSymbol")].Text.Equals(TestDataInfrastructure.GetTestInputData("PositionSymbol")));

            secondSymbolRow.Click();

            //click the particular symbol of the Position table STOCK0
            symbolRow.Click();

            //Get the news item for a particular symbol
            symbol = TestDataInfrastructure.GetTestInputData("Symbol");
            news   = TestDataInfrastructure.GetDataForId <NewsDataProvider, News>(symbol);

            //Get the handler of the News Article View displayed
            articlesView = Window.Get <ListBox>(TestDataInfrastructure.GetControlId("NewsArticlesView"));

            Assert.AreEqual(news.Count, articlesView.Items.Count);
        }
        private static void SelectItemInComboBox(AutomationElement element, String selectedItemName)
        {
            // Get the mapped item name.
            String itemName = TestDataInfrastructure.GetControlId(selectedItemName);

            // Set focus to ensure that the object is selected.
            element.SetFocus();

            // Expand the ComboBox using ExpandCollapsePattern.
            ExpandCollapsePattern expandPattern = element.GetCurrentPattern(ExpandCollapsePattern.Pattern) as ExpandCollapsePattern;

            expandPattern.Expand();

            // get the desired automation element
            PropertyCondition itemNameCondition = new PropertyCondition(AutomationElement.NameProperty, itemName);
            PropertyCondition itemTypeCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.ListItem);
            AndCondition      itemCondition     = new AndCondition(itemNameCondition, itemTypeCondition);

            AutomationElement item = element.FindFirst(TreeScope.Descendants, itemCondition);

            if (item != null)
            {
                // select combo box item
                ((SelectionItemPattern)item.GetCurrentPattern(SelectionItemPattern.Pattern)).Select();
            }
        }
Beispiel #14
0
        public void ApplicationLaunch()
        {
            //check if the controls expected to be loaded on the Shell window is loaded properly, as expected
            ComboBox customerCombobox = Window.Get <ComboBox>(TestDataInfrastructure.GetControlId("CustomerCombobox"));

            Assert.IsNotNull(customerCombobox);

            ComboBox fundCombobox = Window.Get <ComboBox>(TestDataInfrastructure.GetControlId("FundCombobox"));

            Assert.IsNotNull(fundCombobox);

            Button addButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("AddButton"));

            Assert.IsNotNull(addButton);

            Label activity1Label = (Label)Window.Get(SearchCriteria.ByAutomationId(TestDataInfrastructure.GetControlId("ActivityLabel"))
                                                     .AndByText(TestDataInfrastructure.GetTestInputData("Customer1ActivityLabelText"))
                                                     .AndControlType(typeof(Label)));

            Assert.IsNotNull(activity1Label);

            Label activity2Label = (Label)Window.Get(SearchCriteria.ByAutomationId(TestDataInfrastructure.GetControlId("ActivityLabel"))
                                                     .AndByText(TestDataInfrastructure.GetTestInputData("Customer2ActivityLabelText"))
                                                     .AndControlType(typeof(Label)));

            Assert.IsNotNull(activity2Label);
        }
Beispiel #15
0
        public void AddFundToCustomer()
        {
            WPFComboBox customer;
            WPFComboBox fund;
            Button      addButton;
            Label       activityLabel;

            //Get the handle of the Customer combo box and select Customer1
            customer = Window.Get <WPFComboBox>(TestDataInfrastructure.GetControlId("CustomerCombobox"));
            customer.Select(TestDataInfrastructure.GetTestInputData("DefaultCustomer").ToString());

            //Get the handle of the Fund combo box and select FundA
            fund = Window.Get <WPFComboBox>(TestDataInfrastructure.GetControlId("FundCombobox"));
            fund.Select(TestDataInfrastructure.GetTestInputData("DefaultFund"));

            //Get the handle of the Add button and click on it
            addButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("AddButton"));
            addButton.Click();

            //Get the handle of the Activity Label
            activityLabel = Window.Get <Label>(TestDataInfrastructure.GetControlId("ActivityLabel"));

            //Check if the selected fund is added to the Activity View of the selected customer.
            Assert.AreEqual(activityLabel.Text, TestDataInfrastructure.GetTestInputData("Customer1ActivityLabelText"));
            Assert.IsNotNull((Label)Window.Get(SearchCriteria.ByText(TestDataInfrastructure.GetTestInputData("DefaultFund"))
                                               .AndControlType(typeof(Label))));
        }
Beispiel #16
0
        public static UIItem GetCollapsibleRegionHeader(this UIItemContainer rootElement, string controlId)
        {
            Tab    tab          = rootElement.Get <Tab>(TestDataInfrastructure.GetControlId("CollapsibleRegion"));
            UIItem watchListTab = tab.Pages.Find(x => x.NameMatches(TestDataInfrastructure.GetControlId(controlId))) as UIItem;

            return(watchListTab);
        }
Beispiel #17
0
        public void ProcessMultipleOrdersByClickingToolBarSaveAll()
        {
            int count = 0;
            //Get the hanlde of the Order list view
            ListBox orderView  = Window.Get <ListBox>(TestDataInfrastructure.GetControlId("OrderListView"));
            int     orderCount = orderView.Items.Count;

            //Select the orders in the list view one by one and POpulate valid order details for every order
            while (count < orderCount)
            {
                orderView.Items[count].Select();
                Label orderNameLabel = (Label)Window.Get(SearchCriteria.ByAutomationId(TestDataInfrastructure.GetControlId("OrderNameLabel"))
                                                         .AndByText(TestDataInfrastructure.GetTestInputData("Order") + (count + 1))
                                                         .AndControlType(typeof(Label)));
                Assert.IsNotNull(orderNameLabel);
                PopulateOrderDetailsWithData();
                count++;
            }

            //Get the hanlde of the toolbar Save all button
            Button saveAllButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("SaveAllToolBarButton"));

            //check if the toolbar save all button is enabled
            Assert.IsTrue(saveAllButton.Enabled);
            //click on the tollbar save all button
            saveAllButton.Click();

            //check if all the orders are saved and removed from the listview
            Assert.AreEqual(orderView.Items.Count.ToString(CultureInfo.InvariantCulture), TestDataInfrastructure.GetTestInputData("DefaultData"));
        }
Beispiel #18
0
        public void ValidateEmployeeDetailsCurrentProjectsSection()
        {
            ListView list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("EmployeesList"));

            list.SelectEmployee(TestDataInfrastructure.GetTestInputData("Emp_1_FirstName"));

            ValidateEmployeeDetailsCurrentProjectsTabData();
        }
Beispiel #19
0
        private void ValidateEmployeeDetailsLocationTabData()
        {
            Tab empDetailsTab = Window.Get <Tab>(TestDataInfrastructure.GetControlId("DetailsTabControl"));

            empDetailsTab.Pages[1].Select();

            //TODO: get handle of the frame in location taband validate
        }
Beispiel #20
0
        public void AccountPositionTableRowCount()
        {
            ListView list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("PositionTableId"));
            //read number of account positions from the AccountPosition.xml data file
            int positionRowCount = TestDataInfrastructure.GetCount <AccountPositionDataProvider, AccountPosition>();

            Assert.AreEqual(positionRowCount, list.Rows.Count);
        }
Beispiel #21
0
        private void ValidateLocationTabControls()
        {
            //select the Location tab
            Tab empDetailsTab = Window.Get <Tab>(TestDataInfrastructure.GetControlId("DetailsTabControl"));

            empDetailsTab.Pages[1].Select();

            //TODO: validate display of frame
        }
Beispiel #22
0
        public static void AssertEmployeeGeneralData()
        {
            //select employee by name
            UICompositionPage <WpfAppLauncher> .EmployeesList.SelectEmployee(TestDataInfrastructure.GetTestInputData("Emp_1_FirstName"));

            Employee emp = GetEmployeeId();

            ValidateEmployeeDetailsGeneralTabData(emp);
        }
Beispiel #23
0
        private void PopulateOrderDetailsWithInvalidData()
        {
            AutomationElement quantityTextBox = Window.AutomationElement.SearchInRawTreeByName(TestDataInfrastructure.GetControlId("QuantityTextBox"));

            SetTextBoxValue(quantityTextBox, TestDataInfrastructure.GetTestInputData("InvalidQuantity"));

            AutomationElement priceTextBox = Window.AutomationElement.SearchInRawTreeByName(TestDataInfrastructure.GetControlId("PriceTextBox"));

            SetTextBoxValue(priceTextBox, TestDataInfrastructure.GetTestInputData("InvalidPrice"));
        }
Beispiel #24
0
        public void ValidateEmployeeDetailsGeneralSection()
        {
            ListView list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("EmployeesList"));

            list.SelectEmployee(TestDataInfrastructure.GetTestInputData("Emp_1_FirstName"));

            Employee emp = GetEmployeeId();

            ValidateEmployeeDetailsGeneralTabData(emp);
        }
Beispiel #25
0
 public void MyTestInitialize()
 {
     // Check whether any exception occured during previous application launches.
     // If so, fail the test case.
     if (StateDiagnosis.IsFailed)
     {
         Assert.Fail(TestDataInfrastructure.GetTestInputData("ApplicationLoadFailure"));
     }
     base.TestInitialize();
 }
Beispiel #26
0
        //private static void ValidateGeneralTabControls()
        //{
        //    empDetailsTab = UICompositionPage<WpfAppLauncher>.EmployeeDetailsTab;
        //    empDetailsTab[0].SetFocus();
        //    empDetailsTab[0].Select();
        //    Thread.Sleep(2000);

        //    //check all Labels (TextBlocks)

        //    Assert.IsNotNull(UICompositionPage<WpfAppLauncher>.FirstNameLabel);
        //    Assert.IsNotNull(UICompositionPage<WpfAppLauncher>.LastNameLabel);
        //    Assert.IsNotNull(UICompositionPage<WpfAppLauncher>.PhoneLabel);
        //    Assert.IsNotNull(UICompositionPage<WpfAppLauncher>.EmailLabel);

        //    //check all Textboxes
        //    Assert.IsNotNull(UICompositionPage<WpfAppLauncher>.FirstNameTextbox);
        //    Assert.IsNotNull(UICompositionPage<WpfAppLauncher>.LastNameTextBox);
        //    Assert.IsNotNull(UICompositionPage<WpfAppLauncher>.PhoneTextBox);
        //    Assert.IsNotNull(UICompositionPage<WpfAppLauncher>.EmailTextBox);
        //}

        //private static void ValidateLocationTabControls()
        //{
        //    //Acceptance Tests for UI Composition do not validate the location of the selected Employee
        //    //in the Live Search Maps displayed in a HTML frame control.This method is the right place
        //    //to do any assertions for Employee Location displayed in HTML frame control.

        //    empDetailsTab = UICompositionPage<WpfAppLauncher>.EmployeeDetailsTab;
        //    empDetailsTab[1].SetFocus();
        //    empDetailsTab[1].Select();
        //    Thread.Sleep(2000);

        //}

        //private static void ValidateCurrentProjectsTabControls()
        //{
        //    //select the "Current Projects" tab
        //    empDetailsTab = UICompositionPage<WpfAppLauncher>.EmployeeDetailsTab;
        //    empDetailsTab[2].SetFocus();
        //    empDetailsTab[2].Select();
        //    Thread.Sleep(2000);
        //    Assert.IsNotNull(UICompositionPage<WpfAppLauncher>.ProjectsLabel);
        //    Assert.IsNotNull(UICompositionPage<WpfAppLauncher>.ProjectsList);
        //}
        ////
        //private static void ValidateEmployeeDetailsGeneralTabData(Employee emp)
        //{
        //    empDetailsTab = UICompositionPage<WpfAppLauncher>.EmployeeDetailsTab;

        //    Assert.AreEqual(UICompositionPage<WpfAppLauncher>.FirstNameTextbox.GetValue(), emp.FirstName);
        //    Assert.AreEqual(UICompositionPage<WpfAppLauncher>.LastNameTextBox.GetValue(), emp.LastName);
        //    Assert.AreEqual(UICompositionPage<WpfAppLauncher>.PhoneTextBox.GetValue(), emp.Phone);
        //    Assert.AreEqual(UICompositionPage<WpfAppLauncher>.EmailTextBox.GetValue(), emp.Email);
        //}
        ////
        //private static void ValidateEmployeeDetailsLocationTabData()
        //{
        //    //Acceptance Tests for UI Composition do not validate the location of the selected Employee
        //    //in the Live Search Maps displayed in a HTML frame control.This method is the right place
        //    //to do any assertions for Employee Location displayed in HTML frame control.

        //   empDetailsTab = UICompositionPage<WpfAppLauncher>.EmployeeDetailsTab;
        //   empDetailsTab[1].SetFocus();
        //   empDetailsTab[1].Select();
        //    Thread.Sleep(2000);


        //}

        //private static void ValidateEmployeeDetailsCurrentProjectsTabData()
        //{
        //    empDetailsTab = UICompositionPage<WpfAppLauncher>.EmployeeDetailsTab;
        //    Thread.Sleep(2000);
        //    empDetailsTab[2].SetFocus();
        //    empDetailsTab[2].Select();
        //    Thread.Sleep(2000);

        //   // ListView projectsList = UICompositionPage<WpfAppLauncher>.ProjectsList;
        //    AutomationElementCollection projectsList = UICompositionPage<WpfAppLauncher>.ProjectsList;
        //    ////check if the list has two columns
        //    //Assert.AreEqual(2, projectsList.Header.Columns.Count);
        //    ////check if the list has two rows
        //    Assert.AreEqual(2, projectsList.Count-1);
        //}

        private static Employee GetEmployeeId(string count)
        {
            Employee emp = new Employee(1)
            {
                FirstName = TestDataInfrastructure.GetTestInputData("Emp_" + count + "_FirstName"),
                LastName  = TestDataInfrastructure.GetTestInputData("Emp_" + count + "_LastName"),
                Phone     = TestDataInfrastructure.GetTestInputData("Emp_" + count + "_Phone"),
                Email     = TestDataInfrastructure.GetTestInputData("Emp_" + count + "_Email")
            };

            return(emp);
        }
Beispiel #27
0
        private static Employee GetEmployeeId2()
        {
            Employee emp = new Employee(1)
            {
                FirstName = TestDataInfrastructure.GetTestInputData("Emp_2_FirstName"),
                LastName  = TestDataInfrastructure.GetTestInputData("Emp_2_LastName"),
                Phone     = TestDataInfrastructure.GetTestInputData("Emp_2_Phone"),
                Email     = TestDataInfrastructure.GetTestInputData("Emp_2_Email")
            };

            return(emp);
        }
Beispiel #28
0
        private void ValidateEmployeeDetailsCurrentProjectsTabData()
        {
            Tab empDetailsTab = Window.Get <Tab>(TestDataInfrastructure.GetControlId("DetailsTabControl"));

            empDetailsTab.Pages[2].Select();

            ListView projectsList = Window.Get <ListView>(TestDataInfrastructure.GetControlId("CurrentProjectsList"));

            //check if the list has two columns
            Assert.AreEqual(2, projectsList.Header.Columns.Count);

            //check if the list has two rows
            Assert.AreEqual(2, projectsList.Rows.Count);
        }
Beispiel #29
0
        /// <summary>
        /// Get the required field data from the specified row of the Position Table
        /// </summary>
        /// <param name="list">the position table UI object</param>
        /// <param name="rowNumber">Row number from which data needs to fished out of the Position table</param>
        /// <param name="header">column header of data that is expected</param>
        /// <returns>value in the specified field of the specified row of the Position table</returns>
        public static object GetData(this ListView list, int rowNumber, PositionTableColumnHeader header)
        {
            switch (header)
            {
            case PositionTableColumnHeader.Symbol:
                return(list.Rows[rowNumber].Cells[TestDataInfrastructure.GetTestInputData("PositionTableSymbol")].Text);

            case PositionTableColumnHeader.NumberOfShares:
                return(Convert.ToInt32(list.Rows[rowNumber].Cells[TestDataInfrastructure.GetTestInputData("PositionTableShares")].Text, CultureInfo.CurrentCulture));

            default:
                return(null);
            }
        }
Beispiel #30
0
        public void EachCustomerShouldHaveAnActivityView()
        {
            WPFComboBox customer;

            //Get the handle of the customer combo box
            customer = Window.Get <WPFComboBox>(TestDataInfrastructure.GetControlId("CustomerCombobox"));

            //For every customer in the customer combo box,check if a corresponding article view is displayed
            for (int count = 0; count < customer.Items.Count - 1; count++)
            {
                Assert.IsNotNull((Label)Window.Get(SearchCriteria.ByAutomationId(TestDataInfrastructure.GetControlId("ActivityLabel")).
                                                   AndByText(TestDataInfrastructure.GetTestInputData("ActivityLabelText") + customer.Items[count].Text)
                                                   .AndControlType(typeof(Label))));
            }
        }
Beispiel #31
0
        public void TestInitialize()
        {
            SetupWhiteConfigParameters();

            // Instantiate and initiate the diagnosis process. Diagnosis steps are included
            // to identify the successful launch of the application window without any unexpected
            // exceptions.
            StateDiagnosis.Instance.StartDiagnosis(this);  

            app = Application.Launch(ConfigHandler.GetValue("StockTraderApp"));
            window = App.GetWindow("Shell", Core.Factory.InitializeOption.NoCache);
            tdInfrastructure = new TestDataInfrastructure();

            //Stop the diagnosis.
            StateDiagnosis.Instance.StopDiagnosis(this);
        }