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;
            }
        }
        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;
            }
        }
Example #3
0
        public static string GetBuySell(BuySellEnum value)
        {
            switch (value)
            {
            case BuySellEnum.Buy:
                return(fxcore2.Constants.Buy);

            case BuySellEnum.Sell:
                return(fxcore2.Constants.Sell);
            }

            throw new ArgumentOutOfRangeException("value");
        }
        //validate if the screen has all the required controls and default values
        private void ValidateBuySellPanelControls(BuySellEnum buySell)
        {
            SelectBuySellTabPage();

            TextBox symbolTextBox = Window.Get <TextBox>(TestDataInfrastructure.GetControlId("BuySellSymbolTextBox"));

            Assert.IsNotNull(symbolTextBox);

            RadioButton buyRadButton = Window.Get <RadioButton>(TestDataInfrastructure.GetControlId("BuyRadio"));

            Assert.IsNotNull(buyRadButton);
            RadioButton sellRadButton = Window.Get <RadioButton>(TestDataInfrastructure.GetControlId("SellRadio"));

            Assert.IsNotNull(sellRadButton);

            //check if Order type combobox is present
            WPFComboBox orderTypeComboBox = Window.Get <WPFComboBox>(TestDataInfrastructure.GetControlId("BuySellOrderTypeCombo"));

            Assert.IsNotNull(orderTypeComboBox);

            //check if shares textbox is present
            TextBox shareTextBox = Window.Get <TextBox>(TestDataInfrastructure.GetControlId("BuySellSharesTextBox"));

            Assert.IsNotNull(shareTextBox);

            //check if limit / stop price  textbox is present
            TextBox limitStopPriceTextBox = Window.Get <TextBox>(TestDataInfrastructure.GetControlId("BuySellStopLimitPriceTextBox"));

            Assert.IsNotNull(limitStopPriceTextBox);

            WPFComboBox timeInForceComboBox = Window.Get <WPFComboBox>(TestDataInfrastructure.GetControlId("BuySellTimeInForceCombo"));

            Assert.IsNotNull(timeInForceComboBox);

            switch (buySell)
            {
            case BuySellEnum.Buy:
                Assert.IsTrue(buyRadButton.IsSelected);
                break;

            case BuySellEnum.Sell:
                Assert.IsTrue(sellRadButton.IsSelected);
                break;
            }

            //Button buyLastButton = window.Get<Button>(TestDataInfrastructure.GetControlId("BuySellBuyLastButton"));
            //Assert.IsNotNull(buyLastButton);

            //Button sellLastButton = window.Get<Button>(TestDataInfrastructure.GetControlId("BuySellSellLastButton"));
            //Assert.IsNotNull(sellLastButton);

            Button submitButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("BuySellSubmitButton"));

            Assert.IsNotNull(submitButton);

            Button cancelButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("BuySellCancelButton"));

            Assert.IsNotNull(cancelButton);

            //check if Submit All and Cancel All buttons are present
            Button submitAllButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("BuySellSubmitAllButton"));

            Assert.IsNotNull(submitAllButton);

            Button cancelAllButton = Window.Get <Button>(TestDataInfrastructure.GetControlId("BuySellCancelAllButton"));

            Assert.IsNotNull(cancelAllButton);
        }
        //validate if the screen has all the required controls and default values
        private void ValidateBuySellPanelControls(BuySellEnum buySell)
        {
            SelectBuySellTabPage();

            TextBox symbolTextBox = Window.Get<TextBox>(TestDataInfrastructure.GetControlId("BuySellSymbolTextBox"));
            Assert.IsNotNull(symbolTextBox);

            RadioButton buyRadButton = Window.Get<RadioButton>(TestDataInfrastructure.GetControlId("BuyRadio"));
            Assert.IsNotNull(buyRadButton);
            RadioButton sellRadButton = Window.Get<RadioButton>(TestDataInfrastructure.GetControlId("SellRadio"));
            Assert.IsNotNull(sellRadButton);

            //check if Order type combobox is present
            WPFComboBox orderTypeComboBox = Window.Get<WPFComboBox>(TestDataInfrastructure.GetControlId("BuySellOrderTypeCombo"));
            Assert.IsNotNull(orderTypeComboBox);

            //check if shares textbox is present
            TextBox shareTextBox = Window.Get<TextBox>(TestDataInfrastructure.GetControlId("BuySellSharesTextBox"));
            Assert.IsNotNull(shareTextBox);

            //check if limit / stop price  textbox is present            
            TextBox limitStopPriceTextBox = Window.Get<TextBox>(TestDataInfrastructure.GetControlId("BuySellStopLimitPriceTextBox"));
            Assert.IsNotNull(limitStopPriceTextBox);

            WPFComboBox timeInForceComboBox = Window.Get<WPFComboBox>(TestDataInfrastructure.GetControlId("BuySellTimeInForceCombo"));
            Assert.IsNotNull(timeInForceComboBox);

            switch (buySell)
            {
                case BuySellEnum.Buy:
                    Assert.IsTrue(buyRadButton.IsSelected);
                    break;
                case BuySellEnum.Sell:
                    Assert.IsTrue(sellRadButton.IsSelected);
                    break;
            }

            //Button buyLastButton = window.Get<Button>(TestDataInfrastructure.GetControlId("BuySellBuyLastButton"));
            //Assert.IsNotNull(buyLastButton);

            //Button sellLastButton = window.Get<Button>(TestDataInfrastructure.GetControlId("BuySellSellLastButton"));
            //Assert.IsNotNull(sellLastButton);

            Button submitButton = Window.Get<Button>(TestDataInfrastructure.GetControlId("BuySellSubmitButton"));
            Assert.IsNotNull(submitButton);

            Button cancelButton = Window.Get<Button>(TestDataInfrastructure.GetControlId("BuySellCancelButton"));
            Assert.IsNotNull(cancelButton);

            //check if Submit All and Cancel All buttons are present
            Button submitAllButton = Window.Get<Button>(TestDataInfrastructure.GetControlId("BuySellSubmitAllButton"));
            Assert.IsNotNull(submitAllButton);

            Button cancelAllButton = Window.Get<Button>(TestDataInfrastructure.GetControlId("BuySellCancelAllButton"));
            Assert.IsNotNull(cancelAllButton);
        }