Example #1
0
        public void Place_SpecificBet(IWebDriver tb2Driver, string amount, string eventName, BetEventType ET, string marketPlace = null, string amount2 = null, int numberOfSelection = 1, int selectedCount = 1, bool placeBet = true)
        {
            BaseTest.AddTestCase("Place a Bet successfully in Telebet", "Bet should be placed successfully");

            if (ET == BetEventType.BIR)
            {
                wAction.Click(tb2Driver, By.LinkText("Bet In Play"), "BIR link not found", 0, false);
                System.Threading.Thread.Sleep(2000);

                wAction.Click(tb2Driver, By.XPath("//div[text()='Football']"), "Football link not found", 0, false);
                wAction.Click(tb2Driver, By.LinkText(eventName), eventName + " link not found", 0, false);
                System.Threading.Thread.Sleep(2000);
            }
            else if (ET == BetEventType.Double || ET == BetEventType.Yankee)
            {
                if (!wAction.IsElementPresent(tb2Driver, By.LinkText(marketPlace)))
                {
                    wAction.Click(tb2Driver, By.XPath("//div[a[text()='Horse Racing']]/div[@class='menuArrow']"), "Horse Racing link not found", 0, false);
                }
                wAction.Click(tb2Driver, By.LinkText(marketPlace), marketPlace + "link not found");
                wAction.Click(tb2Driver, By.XPath("//div[@class='marketExpand']/div[contains(text(),'" + eventName + "')]"), eventName + " not found", 0, false);
            }
            else if (ET == BetEventType.Trixie || ET == BetEventType.Trebele)
            {
                if (!wAction.IsElementPresent(tb2Driver, By.LinkText(marketPlace)))
                {
                    wAction.Click(tb2Driver, By.XPath("//div[a[text()='Football']]/div[contains(@class,'menuArrow')]"), "Football link not found", 0, false);
                    System.Threading.Thread.Sleep(3000);
                    wAction.Click(tb2Driver, By.XPath("//div[a[text()='English']]/div[contains(@class,'menuArrow')]"), "English link not found");
                }
                wAction.Click(tb2Driver, By.PartialLinkText(marketPlace), marketPlace + "link not found");
                wAction.Click(tb2Driver, By.XPath("//div[@class='displayrowExpand']//div[contains(text(),'" + eventName + "')]"), eventName + " not found", 0, false);
            }
            List <IWebElement> Selections = null;

            if (ET == BetEventType.BIR)
            {
                Selections = wAction.ReturnWebElements(tb2Driver, By.XPath("//div[contains(@class,'marketPrice')]"), "Selections not found in bet page");
            }
            else if (ET == BetEventType.Trixie || ET == BetEventType.Trebele)
            {
                Selections = wAction.ReturnWebElements(tb2Driver, By.XPath("//div[@class='displayrowExpand' and div[div[contains(text(),'" + eventName + "')]]]//div[contains(@class,'marketPrice')]"), "Selections not found in bet page");
            }

            else
            {
                Selections = wAction.ReturnWebElements(tb2Driver, By.XPath("//div[@class='marketRow' and div[div[contains(text(),'" + eventName + "')]]]//div[contains(@class,'marketPrice')]"), "Selections not found in bet page");
            }

            for (int i = 1; i <= numberOfSelection; i++)
            {
                //IJavaScriptExecutor executor = (IJavaScriptExecutor)tb2Driver;
                //    executor.ExecuteScript("arguments[0].click();", Selections[i]);


                Selections[i].Click();
                System.Threading.Thread.Sleep(3000);
                wAction.IsElementPresent(tb2Driver, By.Id(Telebet_Control.stakeAmt_ID));
            }

            List <IWebElement> count = wAction.ReturnWebElements(tb2Driver, By.XPath("//div[@class='betSlipOutcome']"), "betlsip not found", 0, false);

            System.Threading.Thread.Sleep(3000);
            if (count.Count != selectedCount)
            {
                BaseTest.Fail(selectedCount + " selections not added");
            }

            if (ET == BetEventType.BIR)
            {
                wAction.Type(tb2Driver, By.Id(Telebet_Control.stakeAmt_ID), amount);
            }
            else if (ET == BetEventType.Double)
            {
                if (selectedCount == 2)
                {
                    wAction.Click(tb2Driver, By.XPath("//div[contains(@class,'betStakeButton betTypeButton') and contains(text(),'DBL')]"), "DBL link not found");
                    System.Threading.Thread.Sleep(1000);
                    wAction.Type(tb2Driver, By.XPath("//div[div[text()='SGL']]//input[contains(@id,'win_stake')]"), amount, "Single stake box not found");
                    wAction.Type(tb2Driver, By.XPath("//div[div[text()='DBL']]//input[contains(@id,'win_stake')]"), amount2, "Double stake box not found");
                }
            }
            else if (ET == BetEventType.Trixie)
            {
                if (selectedCount == 3)
                {
                    wAction.Clear(tb2Driver, By.Id("betTypeInput"), "Bet Type selection dropdown not found");
                    wAction.Type(tb2Driver, By.Id("betTypeInput"), "TRX", "Bet Type selection dropdown not found");
                    wAction.Click(tb2Driver, By.Id("BetTypeTRX"), "Trixie selection dropdown not found");
                    wAction.Clear(tb2Driver, By.Id("betTypeInput"), "Bet Type selection dropdown not found");
                    wAction.Type(tb2Driver, By.Id("betTypeInput"), "PAT", "Bet Type selection dropdown not found");
                    wAction.Click(tb2Driver, By.Id("BetTypePAT"), "Patent selection dropdown not found");

                    System.Threading.Thread.Sleep(1000);
                    wAction.Click(tb2Driver, By.XPath("//div[div[text()='SGL']]//div[contains(@class,'betTypeRemove')]"), "Single stake box not found");
                    wAction.Clear(tb2Driver, By.XPath("//div[div[text()='TRX']]//input[contains(@id,'win_stake')]"), "Single stake box not found");
                    wAction.Type(tb2Driver, By.XPath("//div[div[text()='TRX']]//input[contains(@id,'win_stake')]"), amount, "Single stake box not found");
                    wAction.Clear(tb2Driver, By.XPath("//div[div[text()='PAT']]//input[contains(@id,'win_stake')]"), "Double stake box not found");
                    wAction.Type(tb2Driver, By.XPath("//div[div[text()='PAT']]//input[contains(@id,'win_stake')]"), amount2, "Double stake box not found");
                }
            }
            else if (ET == BetEventType.Trebele)
            {
                if (selectedCount == 4)
                {
                    wAction.Click(tb2Driver, By.XPath("//div[contains(@class,'betStakeButton betTypeButton') and contains(text(),'TBL')]"), "TBL link not found");
                    wAction.Click(tb2Driver, By.XPath("//div[contains(@class,'betStakeButton betTypeButton') and contains(text(),'ACCA')]"), "ACCA link not found");

                    System.Threading.Thread.Sleep(1000);
                    wAction.Click(tb2Driver, By.XPath("//div[div[text()='SGL']]//div[contains(@class,'betTypeRemove')]"), "Single stake box not found");
                    wAction.Clear(tb2Driver, By.XPath("//div[div[text()='TBL']]//input[contains(@id,'win_stake')]"), "TBL stake box not found");
                    wAction.Type(tb2Driver, By.XPath("//div[div[text()='TBL']]//input[contains(@id,'win_stake')]"), amount, "TBL stake box not found");
                    wAction.Clear(tb2Driver, By.XPath("//div[div[text()='ACC4']]//input[contains(@id,'win_stake')]"), "ACC4 stake box not found");
                    wAction.Type(tb2Driver, By.XPath("//div[div[text()='ACC4']]//input[contains(@id,'win_stake')]"), amount2, "ACC4 stake box not found");
                }
            }
            else if (ET == BetEventType.Yankee)
            {
                if (selectedCount == 4)
                {
                    wAction.Clear(tb2Driver, By.Id("betTypeInput"), "Bet Type selection dropdown not found");
                    wAction.Type(tb2Driver, By.Id("betTypeInput"), "YAN", "Bet Type yankee selection dropdown not found");
                    wAction.Click(tb2Driver, By.Id("BetTypeYAN"), "YAN selection dropdown not found");
                    wAction.Clear(tb2Driver, By.Id("betTypeInput"), "Bet Type selection dropdown not found");
                    wAction.Type(tb2Driver, By.Id("betTypeInput"), "L15", "Bet Type lucky15 selection dropdown not found");
                    wAction.Click(tb2Driver, By.Id("BetTypeL15"), "L15 selection dropdown not found");

                    System.Threading.Thread.Sleep(1000);
                    wAction.Click(tb2Driver, By.XPath("//div[div[text()='SGL']]//div[contains(@class,'betTypeRemove')]"), "single stake box not found");
                    wAction.Clear(tb2Driver, By.XPath("//div[div[text()='YAN']]//input[contains(@id,'win_stake')]"), "yankee stake box not found");
                    wAction.Type(tb2Driver, By.XPath("//div[div[text()='YAN']]//input[contains(@id,'win_stake')]"), amount, "Single stake box not found");
                    wAction.Clear(tb2Driver, By.XPath("//div[div[text()='L15']]//input[contains(@id,'win_stake')]"), "lucky15 stake box not found");
                    wAction.Type(tb2Driver, By.XPath("//div[div[text()='L15']]//input[contains(@id,'win_stake')]"), amount2, "lucky15 stake box not found");
                }
            }


            if (placeBet)
            {
                wAction.Click(tb2Driver, By.Id(Telebet_Control.CheckBet_ID), "CheckBet btn not found");
                System.Threading.Thread.Sleep(2000);

                wAction.Click(tb2Driver, By.Id(Telebet_Control.PlaceBet_ID), "Placebet Btn not found");
                System.Threading.Thread.Sleep(1000);
                wAction.Click(tb2Driver, By.Id(Telebet_Control.okButton_ID));
                System.Threading.Thread.Sleep(4000);
                wAction.Click(tb2Driver, By.XPath("//div[@class='popupSubmit' and text()='Place Bet']"));
                System.Threading.Thread.Sleep(2000);
                if (!wAction.GetText(tb2Driver, By.XPath(Telebet_Control.Receipt_XP), "Betreceipt did not appear").Contains("Your bet has been placed"))
                {
                    wAction.Click(tb2Driver, By.XPath("//*[text()='Override All']"));
                    wAction.Click(tb2Driver, By.ClassName("popupSubmit"));
                }
                BaseTest.Assert.IsTrue(wAction.GetText(tb2Driver, By.XPath(Telebet_Control.Receipt_XP), "Betreceipt did not appear").Contains("Your bet has been placed"), "'Your bet has been placed' msg not found");
                wAction.Click(tb2Driver, By.Id(Telebet_Control.okButton_ID));
            }
            BaseTest.Pass();
        }
        public void Withdraw_Netteller(IWebDriver driverObj, MyAcct_Data acctData, bool closeWindow = true)
        {
            BaseTest.AddTestCase("Verify the Banking / My Account Links to the Withdraw amount from wallet", "Withdrawed Amount should be Cancelled from the selected wallet");

            string withWalletPath = "//tr[td[contains(text(),'" + acctData.withdrawWallet + "')]]/td[2]";
            string portalWindow   = driverObj.WindowHandles.ToArray()[0].ToString();

            driverObj.SwitchTo().Window(driverObj.WindowHandles.ToArray()[1].ToString());


            double beforeVal = 0;


            if (FrameGlobals.BrowserToLoad == BrowserTypes.Chrome)
            {
                wAction._Click(driverObj, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "WithdrawTab", "Withdraw Tab not found", 0, false);
            }
            else
            {
                wAction._Click_Javascript(driverObj, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "WithdrawTab", "Withdraw Tab not found", 0, false);
            }

            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(2));
            String temp = wAction.GetText(driverObj, By.XPath(withWalletPath), acctData.withdrawWallet + " Wallet value not found", false).ToString();

            if (StringCommonMethods.ReadDoublefromString(temp) != -1)
            {
                beforeVal = StringCommonMethods.ReadDoublefromString(temp);
            }
            else
            {
                BaseTest.Fail("Wallet value is null/Blank");
            }

            BaseTest.AddTestCase("Verify that the amount in the " + acctData.withdrawWallet + " wallet is less than the desired amount" + acctData.depositAmt, "Amount should be more than the desired amount");
            if (beforeVal < double.Parse(acctData.depositAmt))
            {
                BaseTest.Fail("Insufficient balance in the wallet to withdraw");
            }
            else
            {
                BaseTest.Pass();
            }

            wAction.SelectDropdownOption_ByPartialText(driverObj, By.Id(CashierPage.Sofort_withdraw_To_ID), "NETeller", "Netteller option not found", 0, false);

            wAction._Clear(driverObj, ORFile.Accounts_Wallets_Banking, wActions.locatorType.id, "wAmount_txt", "Amount_txt not found");
            wAction._Type(driverObj, ORFile.Accounts_Wallets_Banking, wActions.locatorType.id, "wAmount_txt", acctData.depositAmt, "Amount_txt not found");
            wAction._SelectDropdownOption_ByPartialText(driverObj, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "transferFrom_cmb", acctData.withdrawWallet, "destinationWallet_cmb not found");


            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(2));
            wAction._Click(driverObj, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "Withdraw_btn", "deposit_btn not found");

            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(2));
            wAction._Click(driverObj, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "Success_Dlg", "Successfull message did not appear", 0, false);
            wAction._Click(driverObj, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "Confirmation_Dlg", "Confirmation_Dlg button not found");
            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(2));
            wAction.Click(driverObj, By.LinkText("Refresh Balances"));
            wAction.WaitforPageLoad(driverObj);
            double AfterVal = 0;

            temp = wAction.GetText(driverObj, By.XPath(withWalletPath), acctData.withdrawWallet + " Wallet value not found", false).ToString();
            if (StringCommonMethods.ReadDoublefromString(temp) != -1)
            {
                AfterVal = StringCommonMethods.ReadDoublefromString(temp);
            }
            else
            {
                BaseTest.Fail("Wallet value is null/Blank");
            }


            driverObj.SwitchTo().DefaultContent();

            if (closeWindow)
            {
                driverObj.Close();
            }
            BaseTest.AddTestCase("Wallet:" + acctData.withdrawWallet + " Transaction Amount:" + acctData.withdrawWallet + " => Amount Before Cancellation:" + beforeVal + ", Amount after Cancellation:" + AfterVal, "Amount should be calculated accordingly");
            BaseTest.Pass();
            BaseTest.Assert.IsTrue(AfterVal == beforeVal - double.Parse(acctData.depositAmt), "Cancelled withdraw amount not added back");

            if (closeWindow)
            {
                driverObj.Close();
            }


            BaseTest.Pass();
            driverObj.SwitchTo().Window(portalWindow);
        }
Example #3
0
        public void Verify_SingleWallet_Cashier(IWebDriver driverObj, string ListOfWallets, string SingleWallet, double Balance)
        {
            BaseTest.AddTestCase("Verify Cashier for Single Wallet", "Single wallet should be displayed in all places");
            wAction.Click(driverObj, By.Id("deposit_tab_list_item"), "Deposit button not found in Customer page", FrameGlobals.reloadTimeOut, false);


            //  driverObj.SwitchTo().Window(driverObj.WindowHandles.ToArray()[1].ToString());
            wAction.WaitforPageLoad(driverObj);
            string SingleWalletPath = "//tr[td[contains(text(),'" + SingleWallet + "')]]/td[2]";

            wAction.WaitAndMovetoFrame(driverObj, By.Id("acctIframe"));

            if (wAction.IsElementPresent(driverObj, By.XPath("id('sourceWallet')/option")))
            {
                List <IWebElement> depDropDown = wAction.ReturnWebElements(driverObj, By.XPath("id('sourceWallet')/option"));
                foreach (IWebElement options in depDropDown)
                {
                    if (ListOfWallets.Contains(options.Text.Trim()))
                    {
                        continue;
                    }
                    else
                    {
                        BaseTest.Fail("Invalid wallet name found:" + options.Text.Trim());
                    }
                }
            }


            wAction._Click(driverObj, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "WithdrawTab", "Withdraw Tab not found", 0, false);
            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(2));

            List <IWebElement> listOfWall = wAction.ReturnWebElements(driverObj, By.XPath("//tr/td[1]"), "Wallet balance sheet not loaded");

            foreach (IWebElement options in listOfWall)
            {
                BaseTest.Assert.IsTrue(ListOfWallets.Contains(options.Text.Trim()), "Invalid wallet name found:" + options.Text.Trim());
            }


            string temp = wAction.GetText(driverObj, By.XPath(SingleWalletPath), SingleWallet + " Wallet value not found", false);
            double val  = 0;

            if (StringCommonMethods.ReadDoublefromString(temp) != -1)
            {
                val = StringCommonMethods.ReadDoublefromString(temp);
            }

            BaseTest.Assert.IsTrue((val == Balance), "Single wallet balance not matching , Expected:" + Balance + " ;Actual:" + val);



            wAction._Click(driverObj, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "TransferTab", "Transfer Tab not found", 0, false);
            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(2));
            listOfWall = wAction.ReturnWebElements(driverObj, By.XPath("//tr/td[1]"), "Wallet drop down not loaded in deposit page");

            foreach (IWebElement options in listOfWall)
            {
                BaseTest.Assert.IsTrue(ListOfWallets.Contains(options.Text.Trim()), "Invalid wallet name found:" + options.Text.Trim());
            }

            temp = wAction.GetText(driverObj, By.XPath(SingleWalletPath), SingleWallet + " Wallet value not found", false);
            val  = 0;
            if (StringCommonMethods.ReadDoublefromString(temp) != -1)
            {
                val = StringCommonMethods.ReadDoublefromString(temp);
            }

            BaseTest.Assert.IsTrue((val == Balance), "Single wallet balance not matching , Expected:" + Balance + " ;Actual:" + val);



            BaseTest.Pass();
        }