Ejemplo n.º 1
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))));
        }
Ejemplo n.º 2
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"));
             */
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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"));
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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);
        }
        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));
        }
Ejemplo n.º 9
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());
            }
        }
Ejemplo n.º 10
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));
        }
Ejemplo n.º 11
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();
        }
Ejemplo n.º 12
0
        // 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();
        }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
0
        public void ValidateEmployeeDetailsCurrentProjectsSection()
        {
            ListView list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("EmployeesList"));

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

            ValidateEmployeeDetailsCurrentProjectsTabData();
        }
Ejemplo n.º 15
0
        public static void AssertEmployeeGeneralData()
        {
            //select employee by name
            UICompositionPage <WpfAppLauncher> .EmployeesList.SelectEmployee(TestDataInfrastructure.GetTestInputData("Emp_1_FirstName"));

            Employee emp = GetEmployeeId();

            ValidateEmployeeDetailsGeneralTabData(emp);
        }
Ejemplo n.º 16
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"));
        }
Ejemplo n.º 17
0
        public void ValidateEmployeeDetailsGeneralSection()
        {
            ListView list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("EmployeesList"));

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

            Employee emp = GetEmployeeId();

            ValidateEmployeeDetailsGeneralTabData(emp);
        }
Ejemplo n.º 18
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();
 }
Ejemplo n.º 19
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);
        }
Ejemplo n.º 20
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);
        }
Ejemplo n.º 21
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);
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Get the required field data for the specified symbol from the Position Table
        /// </summary>
        /// <param name="list">the position table UI object</param>
        /// <param name="forSymbol">symbol for which data is required</param>
        /// <param name="header">column header of data that is expected</param>
        /// <returns>value in the specified field of the specified symbol row of the Position table</returns>
        public static object GetData(this ListView list, string forSymbol, PositionTableColumnHeader header)
        {
            switch (header)
            {
            case PositionTableColumnHeader.Symbol:
                return(forSymbol);

            case PositionTableColumnHeader.NumberOfShares:
                return(Convert.ToInt32(list.Rows.Find(r => r.Cells[TestDataInfrastructure.GetTestInputData("PositionTableSymbol")].Text.Equals(forSymbol))
                                       .Cells[TestDataInfrastructure.GetTestInputData("PositionTableShares")].Text, CultureInfo.CurrentCulture));

            default:
                return(null);
            }
        }
Ejemplo n.º 23
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))));
            }
        }
Ejemplo n.º 24
0
        private void ValidateCurrentProjectsTabControls()
        {
            //select the "Current Projects" tab
            Tab empDetailsTab = Window.Get <Tab>(TestDataInfrastructure.GetControlId("DetailsTabControl"));

            empDetailsTab.Pages[2].Select();

            SearchCriteria searchCriteria = SearchCriteria.ByText(TestDataInfrastructure.GetTestInputData("PartOfFollowingProjectsLabel")).AndControlType(typeof(Label));
            Label          projectsLabel  = Window.Get <Label>(searchCriteria);

            Assert.IsNotNull(projectsLabel);

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

            Assert.IsNotNull(projectsList);
        }
        public void BuySellScreenLoadForBuyFromPositionTable()
        {
            string symbol;

            symbol = TestDataInfrastructure.GetTestInputData("Symbol");
            LaunchBuySellPanelFromPositionTable(BuySellEnum.Buy, symbol);

            Order model =
                new Order(symbol, 0,
                          String.Empty, 0,
                          String.Empty,
                          BuySellEnum.Buy.ToString());

            ValidateBuySellPanelControls(BuySellEnum.Buy);
            ValidateBuySellPanelData(model);
        }
Ejemplo n.º 26
0
        public void AddingWatchListItemFromToolBarAddsRowToListAndExpandsWatchList()
        {
            Window.GetWatchListRegionHeader().Click();
            ListView watchList           = Window.Get <ListView>(TestDataInfrastructure.GetControlId("WatchListView"));
            int      oldCount            = watchList.Rows.Count;
            TextBox  addWatchListTextBox = Window.Get <TextBox>(TestDataInfrastructure.GetControlId("WatchListAddTextBox"));

            addWatchListTextBox.Text = TestDataInfrastructure.GetTestInputData("WatchListSymbol");

            Button addWatchListButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("WatchListAddButton"));

            addWatchListButton.Click();

            Window.GetWatchListRegionHeader().Click();
            Assert.AreEqual(oldCount + 1, watchList.Rows.Count);
            Assert.IsFalse(IsWatchListWindowCollapsed(watchList));
        }
        public void BuySellScreenLoadForSellFromPositionTable()
        {
            string symbol;

            symbol = TestDataInfrastructure.GetTestInputData("Symbol");
            LaunchBuySellPanelFromPositionTable(BuySellEnum.Sell, symbol);

            Order model =
                new Order(symbol, 0,
                          String.Empty, 0,
                          String.Empty,
                          BuySellEnum.Sell.ToString());

            //validate if loaded screen has correct pre-defined data loaded and the necessary controls
            ValidateBuySellPanelControls(BuySellEnum.Sell);
            ValidateBuySellPanelData(model);
        }
Ejemplo n.º 28
0
        public void SelectedFundIsAddedOnlyToTheSelectedCustomer()
        {
            string[] selectedCustomer = new string[2];
            string[] selectedFund     = new string[2];

            const int CUSTOMERS_IN_DROPDOWN = 2;

            for (int i = 0; i < CUSTOMERS_IN_DROPDOWN; i++)
            {
                //Get the handle of the Customer combo box and select customer.
                WPFComboBox customer = Window.Get <WPFComboBox>(TestDataInfrastructure.GetControlId("CustomerCombobox"));
                customer.Select(TestDataInfrastructure.GetTestInputData("Customer" + i.ToString(CultureInfo.InvariantCulture)).ToString());
                selectedCustomer[i] = customer.Items[i].Text;

                //Get the handle of the Fund combo box and select fund.
                WPFComboBox fund = Window.Get <WPFComboBox>(TestDataInfrastructure.GetControlId("FundCombobox"));
                fund.Select(TestDataInfrastructure.GetTestInputData("Fund" + i.ToString(CultureInfo.InvariantCulture)));
                selectedFund[i] = fund.Items[i].Text;

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

            // Now validate whether the fund has been added correctly.
            List <AutomationElement> elements = Window.AutomationElement.FindSiblingsInTreeByName("ActivityView");
            int counter = 0;

            foreach (AutomationElement element in elements)
            {
                if (counter < CUSTOMERS_IN_DROPDOWN)
                {
                    // Find the text box and the fund text associated.
                    AutomationElement textBox       = element.SearchInRawTreeByName("ActivityLabel");
                    string            textBoxValue  = textBox.Current.Name;
                    string            expectedValue = TestDataInfrastructure.GetTestInputData("ActivityLabelText") + selectedCustomer[counter].ToString();
                    Assert.AreEqual(expectedValue, textBoxValue);

                    // Find the fund values
                    AutomationElement fund = element.SearchInRawTreeByName(selectedFund[counter].ToString());
                    Assert.AreEqual(fund.Current.Name, selectedFund[counter].ToString());
                    counter++;
                }
            }
        }
Ejemplo n.º 29
0
        public static void AssertSilverLightEmployeeCurrentProjects()
        {
            AutomationElement employeeTab = UICompositionPage <TApp> .EmployeeDetailsTabControl;

            // Select Current Projects Tab
            AutomationElement aeTabPage = employeeTab.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "Current Projects"));

            Core.InputDevices.Mouse.Instance.Location = new System.Drawing.Point((int)Math.Floor(aeTabPage.Current.BoundingRectangle.X), (int)Math.Floor(aeTabPage.Current.BoundingRectangle.Y));

            Core.InputDevices.Mouse.Instance.Click();


            //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"), projectPattern.Current.RowCount.ToString());
        }
        public void ClickLoadModuleCButton()
        {
            Button button = Window.Get <Button>(
                SearchCriteria
                .ByText(TestDataInfrastructure.GetControlId("LoadModuleCButtonText"))
                .AndControlType(typeof(Button)));

            Assert.IsNotNull(button);

            button.Click();

            Label moduleCContent = Window.Get <Label>(
                SearchCriteria
                .ByText(TestDataInfrastructure.GetTestInputData("ModuleCContent"))
                .AndControlType(typeof(Label)));

            Assert.IsNotNull(moduleCContent);
        }