public void ValidateWalletBalance_AcctHistory(IWebDriver driverObj, string SingleWallet, string amt) { BaseTest.AddTestCase("Verify balance after the transaction", "Balance should be updated as expected"); string portal = driverObj.WindowHandles.ToArray()[0].ToString(); driverObj.SwitchTo().Window(driverObj.WindowHandles.ToArray()[1].ToString()); wAction.WaitforPageLoad(driverObj); string SingleWalletPath = "//tr[td[div[contains(text(),'" + SingleWallet + "')]]]/td[2]"; wAction.WaitUntilElementDisappears(driverObj, By.XPath(MyAcctPage.LoadingPrompt_XP)); wAction.Click(driverObj, By.XPath(MyAcctPage.MyAcct_History_XP), "Account History link not found", 0, false); wAction.WaitUntilElementDisappears(driverObj, By.XPath(MyAcctPage.LoadingPrompt_XP)); 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); } double Balance = double.Parse(amt); BaseTest.Assert.IsTrue((val == Balance), "Single wallet balance not matching , Expected:" + Balance + " ;Actual:" + val); driverObj.Close(); driverObj.SwitchTo().Window(portal); BaseTest.Pass(); }
public void ValidateFreeBet(IWebDriver driverObj, string BetName, string Promo) { string portal = driverObj.WindowHandles.ToArray()[0].ToString(); BaseTest.AddTestCase("Validate Freebet in the customer", "Freebet should be added"); driverObj.SwitchTo().Window(driverObj.WindowHandles.ToArray()[1].ToString()); wAction.WaitforPageLoad(driverObj); wAction.WaitUntilElementDisappears(driverObj, By.XPath(MyAcctPage.LoadingPrompt_XP)); wAction.Click(driverObj, By.LinkText(MyAcctPage.MyAcct_Free_Bets_lnk), "Freebet link not found"); wAction.WaitUntilElementDisappears(driverObj, By.XPath(MyAcctPage.LoadingPrompt_XP)); List <IWebElement> FreebetRow = wAction.ReturnWebElements(driverObj, By.XPath(MyAcctPage.Freebet_reflection_XP), "No freebet row found", 0, false); string name = FreebetRow[0].Text; string date = FreebetRow[1].Text; BaseTest.Assert.IsTrue(name == BetName, "Betname not matching"); DateTime dateValue; bool flag = DateTime.TryParse(date, out dateValue); BaseTest.Assert.IsTrue(flag , "Expiry date not in expected format/blank"); driverObj.Close(); driverObj.SwitchTo().Window(portal); BaseTest.Pass(); }
public string GetBalance(IWebDriver tb2Driver) { BaseTest.AddTestCase("Read Header Balance in Telebet", "Balance should be present"); string val = wAction.GetText(tb2Driver, By.Id("accBalValue"), "Balance header not found", false); BaseTest.Pass(); return(val); }
//===========================SW=================================================== public void OpenDepositPage(ref IWebDriver tb2Driver) { String portalWindow = tb2Driver.WindowHandles.ToArray()[0].ToString(); BaseTest.AddTestCase("Open Deposit page for the customer in Telebet", "Customer should be searched successfully"); tb2Driver.FindElement(By.Id("deposit_tab_list_item")).Click(); System.Threading.Thread.Sleep(3000); wAction.WaitAndMovetoFrame(tb2Driver, By.Id("acctIframe")); }
public void Init(IWebDriver driver = null) { BaseTest.AddTestCase("Login to IMS Admin", "Login should be sucessfull"); if (driver != null) { IMSDriver = driver; } else { if (FrameGlobals.useGrid.ToUpper() == "YES") { FirefoxProfile ffProfile = new FirefoxProfile(); DesiredCapabilities desriredCapibilities = null; desriredCapibilities = new DesiredCapabilities(); desriredCapibilities = DesiredCapabilities.Firefox(); desriredCapibilities.SetCapability(CapabilityType.BrowserName, "firefox"); // ffProfile.SetPreference("general.useragent.override", FrameGlobals.userAgentValue); IMSDriver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), desriredCapibilities, TimeSpan.FromSeconds(420.0)); // IMSBrowser = new WebDriverBackedSelenium(IMSDriver, "http://www.google.com"); //_seleniumContainer.Add(Gallio.Framework.TestContext.CurrentContext.Test.Name, MyBrowser); } else { IMSDriver = new ChromeDriver(); // IMSBrowser = new WebDriverBackedSelenium(IMSDriver, "https://admin-stg.ladbrokes.com"); } } // IMSBrowser.Start(); wAction.OpenURL(IMSDriver, FrameGlobals.telebet, "Telebet stage not loaded", FrameGlobals.reloadTimeOut); IMSDriver.Manage().Window.Maximize(); // IMSBrowser.WindowMaximize(); wAction._Type(IMSDriver, ICE.ObjectRepository.ORFile.Telebet, wActions.locatorType.id, "username", FrameGlobals.AdminName, "Username Textbox not found", FrameGlobals.elementTimeOut, false); wAction._Type(IMSDriver, ICE.ObjectRepository.ORFile.Telebet, wActions.locatorType.name, "password", FrameGlobals.AdminPass, "Password Textbox not found"); string terminalcode; if (FrameGlobals.projectName == "IP2") { terminalcode = "violet143"; } else { terminalcode = "TEST3"; } wAction._Type(IMSDriver, ICE.ObjectRepository.ORFile.Telebet, wActions.locatorType.id, "terminalcode", terminalcode, "Terminal code Textbox not found", FrameGlobals.elementTimeOut, false); wAction._Click(IMSDriver, ICE.ObjectRepository.ORFile.Telebet, wActions.locatorType.id, "submit", "Submit Textbox not found"); //IMSDriver.SwitchTo().DefaultContent(); //wAction.WaitAndMovetoFrame(IMSDriver, "menu", "Frame menu is not found", FrameGlobals.elementTimeOut); BaseTest.Assert.IsTrue(wAction._IsElementPresent(IMSDriver, ICE.ObjectRepository.ORFile.Telebet, wActions.locatorType.id, "searchacc"), "User not logged in"); BaseTest.Pass(); //IMSDriver.SwitchTo().DefaultContent(); //wAction.WaitAndMovetoFrame(IMSDriver, "top", "Top Frame not found", FrameGlobals.elementTimeOut); //wAction._Click(IMSDriver, ORFile.IMSCommon, wActions.locatorType.xpath, "tryout_newlook_lnk", "Could not find try out new look link", 0, false); }
public void SearchSelfExCustomer(IWebDriver tb2Driver, string userName) { BaseTest.AddTestCase("Searching customer " + userName + " in Telebet", "Customer should be searched successfully"); tb2Driver.FindElement(By.Id(Telebet_Control.searchAcct_ID)).Clear(); tb2Driver.FindElement(By.Id(Telebet_Control.searchAcct_ID)).SendKeys(userName); tb2Driver.FindElement(By.Id(Telebet_Control.searchAcct_ID)).SendKeys(Keys.Enter); System.Threading.Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.IsElementPresent(tb2Driver, By.XPath("id('popText')/p[contains(text(),'Your account is currently excluded. If you believe this is incorrect, please e-mail')]")) , "Customer search failed"); BaseTest.Pass(); }
public void LogoutCustomer(IWebDriver tb2Driver) { BaseTest.AddTestCase("Logout customer in Telebet", "Customer should be logged out successfully"); wAction.Click(tb2Driver, By.Id("cancel_call_tab_list_item"), "Cancel button not found", 0, false); wAction.Click(tb2Driver, By.Id("okBtn"), "confirmation button not found", 0, false); System.Threading.Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.WaitUntilElementDisappears(tb2Driver, By.Id("accNoValueTxtBox")), "Customer logout failed"); BaseTest.Assert.IsTrue(wAction.IsElementPresent(tb2Driver, By.Id(Telebet_Control.searchAcct_ID)), "Search accout box did not appear"); BaseTest.Pass(); }
public void Verify_SignUpDeposit_bonus_Satisfies() { #region Declaration Registration_Data regData = new Registration_Data(); IMS_Base baseIMS = new IMS_Base(); IMS_AdminSuite.Common commIMS = new IMS_AdminSuite.Common(); Ladbrokes_IMS_TestRepository.Common commTest = new Ladbrokes_IMS_TestRepository.Common(); MyAcct_Data acctData = new MyAcct_Data(); AccountAndWallets AnW = new AccountAndWallets(); #endregion #region DriverInitiation IWebDriver driverObj; ISelenium iBrowser = commonFramework.GetDriverByTestCaseName(SeleniumContainer, Gallio.Framework.TestContext.CurrentContext.Test.Name); driverObj = browserInitialize(iBrowser, FrameGlobals.VegasURL); #endregion try { AddTestCase("Create customer from Playtech pages", "Customer should be created."); regData.update_Registration_Data(ReadxmlData("regdata", "Fname", DataFilePath.Accounts_Wallets), ReadxmlData("regdata", "country_UK", DataFilePath.Accounts_Wallets), ReadxmlData("regdata", "City_Web", DataFilePath.Accounts_Wallets), ReadxmlData("regdata", "Password", DataFilePath.Accounts_Wallets)); wAction._Click(driverObj, ICE.ObjectRepository.ORFile.Accounts_Wallets_Registration, wActions.locatorType.xpath, "createAcct_Xpath", "Find Address button not found", 0, false); string portalWindow = driverObj.WindowHandles.ToArray()[0].ToString(); commonWebMethods.WaitAndMovetoPopUPWindow(driverObj, driverObj.WindowHandles.ToArray()[1].ToString(), "Unable to locate registration page"); // AnW.Registration_PlaytechPages(driverObj, ref regData,0,false, ReadxmlData("bonus", "regProm", DataFilePath.Accounts_Wallets)); commTest.PP_Registration(driverObj, ref regData, ReadxmlData("bonus", "regProm", DataFilePath.Accounts_Wallets)); wAction.WaitAndMovetoFrame(driverObj, By.Id(Reg_Control.CashierFrame_ID), null, 10); Pass("Customer registered succesfully"); WriteCommentToMailer("UserName: "******";\nPassword: "******"Username:"******" Password:"******""); Pass(); wAction.WaitAndMovetoFrame(driverObj, By.Id(Reg_Control.CashierFrame_ID), null, 10); BaseTest.AddTestCase("Verify if new customers get bonus on Register (with promo Code) -> First Deposit if condition satisfies.", "First deposit should be successful"); // driverObj.SwitchTo().Window(driverObj.WindowHandles.ToArray()[1].ToString()); BaseTest.Assert.IsTrue(AnW.Verify_FirstCashier_Neteller(driverObj, ReadxmlData("netdata", "account_id", DataFilePath.Accounts_Wallets), ReadxmlData("netdata", "account_pwd", DataFilePath.Accounts_Wallets), ReadxmlData("bonus", "depoWallet", DataFilePath.Accounts_Wallets), ReadxmlData("bonus", "bonusWallet", DataFilePath.Accounts_Wallets), ReadxmlData("bonus", "depoAmnt", DataFilePath.Accounts_Wallets)), "Bonus amount not added to: " + ReadxmlData("bonus", "bonusWallet", DataFilePath.Accounts_Wallets)); BaseTest.Pass("Bonus amount added & successfully verified"); } catch (Exception e) { exceptionStack(e); CaptureScreenshot(driverObj, "Portal"); Fail("Verify_SignUpDeposit_bonus_Satisfies - failed"); } }
// ICE.DataRepository.Vegas_IMS_Data.Registration_Data registration_data = new ICE.DataRepository.Vegas_IMS_Data.Registration_Data(); public void SearchCustomer(IWebDriver tb2Driver, string userName) { BaseTest.AddTestCase("Searching customer " + userName + " in Telebet", "Customer should be searched successfully"); tb2Driver.FindElement(By.Id(Telebet_Control.searchAcct_ID)).Clear(); tb2Driver.FindElement(By.Id(Telebet_Control.searchAcct_ID)).SendKeys(userName); tb2Driver.FindElement(By.Id(Telebet_Control.searchAcct_ID)).SendKeys(Keys.Enter); System.Threading.Thread.Sleep(3000); wAction.Click(tb2Driver, By.XPath("id('modalButtons')/a")); BaseTest.Assert.IsTrue(wAction._WaitUntilElementPresent(tb2Driver, ICE.ObjectRepository.ORFile.Telebet, wActions.locatorType.id, "customername"), "Customer search failed"); BaseTest.Pass(); }
public void Search_Customer_GeneralError(IWebDriver tb2Driver, string userName, string err) { BaseTest.AddTestCase("Searching customer " + userName + " in Telebet", "Customer should be searched successfully"); tb2Driver.FindElement(By.Id(Telebet_Control.searchAcct_ID)).Clear(); tb2Driver.FindElement(By.Id(Telebet_Control.searchAcct_ID)).SendKeys(userName); tb2Driver.FindElement(By.Id(Telebet_Control.searchAcct_ID)).SendKeys(Keys.Enter); System.Threading.Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.IsElementPresent(tb2Driver, By.XPath("//p[contains(text(),'" + err + "')]")) , "Customer search failed"); BaseTest.Pass(); }
public void SearchValidLoyalityCustomer(IWebDriver tb2Driver, string userName) { BaseTest.AddTestCase("Searching customer " + userName + " in Telebet", "Customer should be searched successfully"); tb2Driver.FindElement(By.Id(Telebet_Control.searchAcct_ID)).Clear(); tb2Driver.FindElement(By.Id(Telebet_Control.searchAcct_ID)).SendKeys(userName); tb2Driver.FindElement(By.Id(Telebet_Control.searchAcct_ID)).SendKeys(Keys.Enter); System.Threading.Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.GetText(tb2Driver, By.Id("popText")).Contains("Loyalty Customer") , "Customer search failed"); BaseTest.Pass(); }
public void SearchFrozenCustomer(IWebDriver tb2Driver, string userName) { BaseTest.AddTestCase("Searching customer " + userName + " in Telebet", "Customer should be searched successfully"); tb2Driver.FindElement(By.Id(Telebet_Control.searchAcct_ID)).Clear(); tb2Driver.FindElement(By.Id(Telebet_Control.searchAcct_ID)).SendKeys(userName); tb2Driver.FindElement(By.Id(Telebet_Control.searchAcct_ID)).SendKeys(Keys.Enter); System.Threading.Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.IsElementPresent(tb2Driver, By.XPath(Telebet_Control.FrozenCustMsg_XP)) , "Customer search failed"); BaseTest.Pass(); }
public void Place_SingleBet(IWebDriver tb2Driver, string amount) { BaseTest.AddTestCase("Place a Bet successfully in Telebet", "Bet should be placed successfully"); wAction.Click(tb2Driver, By.XPath(Telebet_Control.FootBall_XP), "Footbal link not found", 0, false); System.Threading.Thread.Sleep(2000); List <IWebElement> expand = wAction.ReturnWebElements(tb2Driver, By.XPath(Telebet_Control.EventExpand_Colapse_XP), "Events not found in bet page", 0, false); foreach (IWebElement xp in expand) { xp.Click(); } System.Threading.Thread.Sleep(2000); List <IWebElement> Selections = wAction.ReturnWebElements(tb2Driver, By.XPath(Telebet_Control.RandomSelection_XP), "Selections not found in bet page"); for (int i = 1; i < 10; i++) { Selections[i].Click(); System.Threading.Thread.Sleep(3000); if (wAction.IsElementPresent(tb2Driver, By.Id(Telebet_Control.stakeAmt_ID))) { break; } } wAction.Type(tb2Driver, By.Id(Telebet_Control.stakeAmt_ID), amount); 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(5000); 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 Verify_SingleWallet_MyAcct(IWebDriver driverObj, string ListOfWallets, string SingleWallet, double Balance) { BaseTest.AddTestCase("Verify My Acct for Single Wallet", "Single wallet should be displayed in all places"); if (!driverObj.Url.ToLower().Contains("sports")) { wAction._Click(driverObj, ORFile.Ladbrokes_Header, wActions.locatorType.id, "Menu_Btn", noWait: false); } //wAction.Click(driverObj, By.XPath("//a[text()='My Account']"), "Welcome text not found", 0, false); wAction.Click(driverObj, By.LinkText("My Account"), "My Account link not found"); string portal = driverObj.WindowHandles.ToArray()[0].ToString(); driverObj.SwitchTo().Window(driverObj.WindowHandles.ToArray()[1].ToString()); wAction.WaitforPageLoad(driverObj); string SingleWalletPath = "//tr[td[span[contains(text(),'" + SingleWallet + "')]]]/td[2]/span"; wAction.WaitUntilElementDisappears(driverObj, By.XPath(MyAcctPage.LoadingPrompt_XP)); wAction.Click(driverObj, By.XPath(MyAcctPage.MyAcct_History_XP), "Account History link not found", 0, false); wAction.WaitUntilElementDisappears(driverObj, By.XPath(MyAcctPage.LoadingPrompt_XP)); System.Threading.Thread.Sleep(TimeSpan.FromSeconds(5)); List <IWebElement> listOfWall = wAction.ReturnWebElements(driverObj, By.XPath("//table[@id='account-history-table']//td[1]/span"), "History table loaded in my acct page"); 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); driverObj.Close(); driverObj.SwitchTo().Window(portal); BaseTest.Pass(); }
public void AccountHistory_Transfer(IWebDriver tb2Driver, MyAcct_Data acctData) { BaseTest.AddTestCase("Verifying acct history page in Telebet", "All transfer history should be recorded"); String portalWindow = tb2Driver.WindowHandles.ToArray()[0].ToString(); wAction.Click(tb2Driver, By.Id("deposit_tab_list_item"), "Deposit button not found in Customer page", FrameGlobals.reloadTimeOut, false); wAction.Click(tb2Driver, By.Id("acctMenuCustStmt"), "Acct statement Link not found in Customer page", 0, false); wAction.WaitAndMovetoFrame(tb2Driver, By.Id("acctIframe")); wAction.SelectDropdownOption(tb2Driver, By.Id("hist_state_time"), "Today", "History Time dropdown not found / Value = Today not present in the list", 0, false); wAction.Click(tb2Driver, By.Id("histSubmitButton"), "View statement Button not found in History page"); if (acctData.depositWallet.Contains("Sports") && acctData.depositWallet.Contains("Games")) { BaseTest.Assert.IsTrue(wAction.IsElementPresent(tb2Driver, By.XPath("//div[string()='Transfer from Games wallet to Sports wallet' and contains(@class,'accHistTrans')]")) , "Transaction for Transfer from Games wallet to Sports wallet not found"); BaseTest.Assert.IsTrue(wAction.IsElementPresent(tb2Driver, By.XPath("//div[string()='Transfer from Sports wallet to Games wallet' and contains(@class,'accHistTrans')]")) , "Transaction for Transfer from Sports wallet to Games wallet not found"); } if (acctData.depositWallet.Contains("Games") && acctData.depositWallet.Contains("Vegas")) { BaseTest.Assert.IsTrue(wAction.IsElementPresent(tb2Driver, By.XPath("//div[string()='Transfer from Games wallet to Vegas wallet' and contains(@class,'accHistTrans')]")) , "Transaction for Transfer from Games wallet to Vegas wallet not found"); BaseTest.Assert.IsTrue(wAction.IsElementPresent(tb2Driver, By.XPath("//div[string()='Transfer from Vegas wallet to Games wallet' and contains(@class,'accHistTrans')]")) , "Transaction for Transfer from Vegas wallet to Games wallet not found"); } if (acctData.depositWallet.Contains("Sports") && acctData.depositWallet.Contains("Vegas")) { BaseTest.Assert.IsTrue(wAction.IsElementPresent(tb2Driver, By.XPath("//div[string()='Transfer from Sports wallet to Vegas wallet' and contains(@class,'accHistTrans')]")) , "Transaction for Transfer from Sports wallet to Vegas wallet not found"); BaseTest.Assert.IsTrue(wAction.IsElementPresent(tb2Driver, By.XPath("//div[string()='Transfer from Vegas wallet to Sports wallet' and contains(@class,'accHistTrans')]")) , "Transaction for Transfer from Vegas wallet to Sports wallet not found"); } BaseTest.Pass(); }
public void DepositRestrictTelebet(IWebDriver tb2Driver, MyAcct_Data acctData, string netAcc, string error, string site = null) { BaseTest.AddTestCase("Verify the customer is able to perform withdraw and not deposit", "Deposit should not be successfull"); AccountAndWallets anw = new AccountAndWallets(); String portalWindow = tb2Driver.WindowHandles.ToArray()[0].ToString(); wAction.Click(tb2Driver, By.Id("deposit_tab_list_item"), "Deposit link not found"); System.Threading.Thread.Sleep(3000); wAction.WaitAndMovetoFrame(tb2Driver, By.Id("acctIframe")); Framework.BaseTest.Assert.IsTrue(common.CommonWithdraw_Netteller_PT(tb2Driver, acctData, acctData.depositAmt, false, false, "Games"), "Amount not deducted after withdraw"); #region Deposit // tb2Driver.SwitchTo().Window(tb2Driver.WindowHandles.ToArray()[1].ToString()); wAction._Click(tb2Driver, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "DepositTab", "Deposit Tab not found", 0, false); BaseTest.AddTestCase("Verify that Payment method is added to the customer but cannot deposit", "The customer should have the payment option added to it but gets error msg during deposit"); wAction.WaitAndMovetoFrame(tb2Driver, By.Id("acctIframe")); String nettellerImg = "//table[contains(@class,'data')]//tbody[contains(@id,'accounts')]//td[contains(text(),'" + netAcc + "')]"; wAction.Click(tb2Driver, By.XPath(nettellerImg), "Netteller Image not found", 0, false); wAction._Type(tb2Driver, ORFile.Accounts_Wallets_Banking, wActions.locatorType.id, "NettellerPwd_txt", acctData.card, "Net teller Security Text not found", FrameGlobals.reloadTimeOut, false); wAction._Clear(tb2Driver, ORFile.Accounts_Wallets_Banking, wActions.locatorType.id, "Amount_txt", "Amount_txt not found"); wAction._Type(tb2Driver, ORFile.Accounts_Wallets_Banking, wActions.locatorType.id, "Amount_txt", acctData.depositAmt, "Amount_txt not found"); wAction._SelectDropdownOption_ByPartialText(tb2Driver, ORFile.Accounts_Wallets_Banking, wActions.locatorType.id, "sourceWallet_cmb", acctData.depositWallet, "sourceWallet_cmb not found"); System.Threading.Thread.Sleep(TimeSpan.FromSeconds(2)); wAction._Click(tb2Driver, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "deposit_btn", "deposit_btn not found"); BaseTest.Assert.IsTrue(wAction.GetText(tb2Driver, By.XPath("id('globalErrors')//span"), "Restrict message not found", false).Contains(error), "Restrict login error message is incorrect"); BaseTest.Pass(); #endregion BaseTest.Pass(); }
public void AddFreeBet(IWebDriver driverObj, string Promo) { string portal = driverObj.WindowHandles.ToArray()[0].ToString(); BaseTest.AddTestCase("Add Freebet to the customer", "Freebet should be added"); driverObj.SwitchTo().Window(driverObj.WindowHandles.ToArray()[1].ToString()); wAction.WaitforPageLoad(driverObj); wAction.WaitUntilElementDisappears(driverObj, By.XPath(MyAcctPage.LoadingPrompt_XP)); wAction.Click(driverObj, By.LinkText(MyAcctPage.MyAcct_Free_Bets_lnk), "Freebet link not found"); wAction.WaitUntilElementDisappears(driverObj, By.XPath(MyAcctPage.LoadingPrompt_XP)); wAction.Clear(driverObj, By.Name(MyAcctPage.Freebet_promotionCode_name), "Promo code box not found", 0, false); wAction.Type(driverObj, By.Name(MyAcctPage.Freebet_promotionCode_name), Promo, "Promo code box not found"); wAction.Click(driverObj, By.XPath(MyAcctPage.Freebet_Submit_XP), "Submit btn not found"); BaseTest.Assert.IsTrue(wAction.IsElementPresent(driverObj, By.XPath(MyAcctPage.Freebet_Success_XP)), "Success message not found"); driverObj.Close(); driverObj.SwitchTo().Window(portal); BaseTest.Pass(); }
public void AllWallets_TransferTB2(IWebDriver tb2Driver, MyAcct_Data acctData, string wallets, string table) { List <string> wallet = wallets.ToString().Split(';').ToList <string>(); List <string> walletTbl = table.ToString().Split(';').ToList <string>(); tb2Driver.FindElement(By.Id("deposit_tab_list_item")).Click(); System.Threading.Thread.Sleep(3000); wAction.WaitAndMovetoFrame(tb2Driver, By.Id("acctIframe")); String portalWindow = tb2Driver.WindowHandles.ToArray()[0].ToString(); for (int fromWalletInd = 0; fromWalletInd < wallet.Count(); fromWalletInd++) { for (int toWalletInd = 0; toWalletInd < wallet.Count(); toWalletInd++) { if (wallet[fromWalletInd].ToString() == wallet[toWalletInd].ToString()) { continue; } else { BaseTest.AddTestCase("Validating transfer from wallet:" + wallet[fromWalletInd].ToString() + " to Towallet: " + wallet[toWalletInd].ToString(), "Transfer Should be successfull"); acctData.depositWallet = wallet[fromWalletInd]; acctData.withdrawWallet = wallet[toWalletInd]; acctData.wallet1 = walletTbl[fromWalletInd]; acctData.wallet2 = walletTbl[toWalletInd]; Framework.BaseTest.Assert.IsTrue(common.CommonTransferWithdraw_Netteller_PT(tb2Driver, acctData, acctData.depositAmt), "Amount not added/deducted after transfer"); BaseTest.Pass(); wAction._Click(tb2Driver, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "DepositTab", "Deposit Tab not found", 0, false); // tb2Driver.SwitchTo().DefaultContent(); } } } }
public void ValidateHTTPSTelebet(IWebDriver tb2Driver) { BaseTest.AddTestCase("Customer should be taken to HTTPS page on accessing any page from Telebet having sensitive data", "Sensitive page should not be having HTTPS"); AccountAndWallets anw = new AccountAndWallets(); String portalWindow = tb2Driver.WindowHandles.ToArray()[0].ToString(); wAction.Click(tb2Driver, By.Id("deposit_tab_list_item"), "Deposit link not found"); System.Threading.Thread.Sleep(3000); wAction.WaitAndMovetoFrame(tb2Driver, By.Id("acctIframe")); BaseTest.Assert.IsTrue(wAction._IsElementPresent(tb2Driver, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "WithdrawTab"), "Cashier page not loaded"); BaseTest.Assert.IsTrue(tb2Driver.Url.Contains("https"), "URL is not HTTPS when accessing deposit page:" + tb2Driver.Url); tb2Driver.SwitchTo().DefaultContent(); wAction.Click(tb2Driver, By.LinkText("Account Overview"), "Account Overview link not found"); BaseTest.Assert.IsTrue(tb2Driver.Url.Contains("https"), "URL is not HTTPS when accessing My ACct page:" + tb2Driver.Url); BaseTest.Pass(); }
public void Verify_SportsFreeBet_bonus_notsatisfies_Ecom() { #region Declaration Registration_Data regData = new Registration_Data(); IMS_Base baseIMS = new IMS_Base(); IMS_AdminSuite.Common commIMS = new IMS_AdminSuite.Common(); Ladbrokes_IMS_TestRepository.Common commTest = new Ladbrokes_IMS_TestRepository.Common(); MyAcct_Data acctData = new MyAcct_Data(); AccountAndWallets AnW = new AccountAndWallets(); #endregion #region DriverInitiation IWebDriver driverObj; ISelenium iBrowser = commonFramework.GetDriverByTestCaseName(SeleniumContainer, Gallio.Framework.TestContext.CurrentContext.Test.Name); driverObj = browserInitialize(iBrowser, FrameGlobals.EcomURL); #endregion try { AddTestCase("Create customer from Playtech pages", "Customer should be created."); regData.update_Registration_Data(ReadxmlData("regdata", "Fname", DataFilePath.Accounts_Wallets), ReadxmlData("regdata", "country_UK", DataFilePath.Accounts_Wallets), ReadxmlData("regdata", "City_Web", DataFilePath.Accounts_Wallets), ReadxmlData("regdata", "Password", DataFilePath.Accounts_Wallets)); wAction._Type(driverObj, ICE.ObjectRepository.ORFile.Accounts_Wallets_Registration, wActions.locatorType.xpath, "Join_Ecom_Btn", Keys.Enter, "Join button not found", 0, false); string portalWindow = driverObj.WindowHandles.ToArray()[0].ToString(); commonWebMethods.WaitAndMovetoPopUPWindow(driverObj, driverObj.WindowHandles.ToArray()[1].ToString(), "Unable to locate registration page"); // AnW.Registration_PlaytechPages(driverObj, ref regData,0,false, ReadxmlData("bonus", "regProm", DataFilePath.Accounts_Wallets)); commTest.PP_Registration(driverObj, ref regData, ReadxmlData("bonus", "betProm", DataFilePath.Accounts_Wallets)); Pass("Customer registered succesfully"); WriteCommentToMailer("UserName: "******";\nPassword: "******"Username:"******" Password:"******""); Pass(); BaseTest.AddTestCase("Verify if new customers get bonus on Register (with promo Code) -> First Deposit if condition satisfies.", "First deposit should be successful"); // driverObj.SwitchTo().Window(driverObj.WindowHandles.ToArray()[1].ToString()); BaseTest.Assert.IsTrue(AnW.Verify_FirstCashier_Neteller(driverObj, ReadxmlData("netdata", "account_id", DataFilePath.Accounts_Wallets), ReadxmlData("netdata", "account_pwd", DataFilePath.Accounts_Wallets), ReadxmlData("bonus", "depoWallet", DataFilePath.Accounts_Wallets), ReadxmlData("bonus", "depoWallet", DataFilePath.Accounts_Wallets), ReadxmlData("bonus", "betDepAmt", DataFilePath.Accounts_Wallets)), "Depositted amount not added to: " + ReadxmlData("bonus", "depoWallet", DataFilePath.Accounts_Wallets)); Pass(); driverObj.Close(); driverObj.SwitchTo().Window(portalWindow); //switch to main window string eventName = ReadxmlData("eventdata", "eventID", DataFilePath.Accounts_Wallets); string oddValue = ReadxmlData("bonus", "selectionOdd_Negative", DataFilePath.Accounts_Wallets); string stake = ReadxmlData("bonus", "stake_Negative", DataFilePath.Accounts_Wallets); string bonusname = ReadxmlData("bonus", "betBonus", DataFilePath.Accounts_Wallets); string bonusvalue = ReadxmlData("bonus", "bet_value", DataFilePath.Accounts_Wallets); AnW.SearchEvent(driverObj, eventName); AnW.AddToBetSlipPlaceBet_selection(driverObj, oddValue, stake); AddTestCase("Verify whether freebet is triggered?", "Freebet should not be triggered"); wAction._Click(driverObj, ORFile.Betslip, wActions.locatorType.xpath, "Close_Receipt", "close receipt button not found", 0, false); BaseTest.Assert.IsFalse(wAction.IsElementPresent(driverObj, By.XPath("//label[contains(text(),'£" + bonusvalue + " - " + bonusname + "')]")), "Freebet has triggered after placebet"); Pass(); Pass("Bonus amount added & successfully verified"); } catch (Exception e) { exceptionStack(e); CaptureScreenshot(driverObj, "Portal"); Fail("Verify_SportsFreeBet_bonus_notsatisfies_Ecom - failed"); } }
public void sessionManagement_Login(IWebDriver driverObj, string sites) { wAction.ExecJavaScript(driverObj, "window.open('','_blank');"); string main = driverObj.CurrentWindowHandle; driverObj.SwitchTo().Window(driverObj.WindowHandles[1]); if (sites.Contains("S")) { BaseTest.AddTestCase("Verify session for sports", "User should be logged in"); // wAction.ExecJavaScript(driverObj, "window.open('" + FrameGlobals.SportsURL + "','_blank');"); wAction.OpenURL(driverObj, FrameGlobals.SportsURL, "Sports load failed", 60); Thread.Sleep(3000); wAction.Click(driverObj, By.XPath(Sportsbook_Control.LoggedinMenu_XP), "Sports user menu not found", 0, false); BaseTest.Assert.IsTrue(wAction.WaitUntilElementPresent(driverObj, By.XPath(Sportsbook_Control.Logout_XP)), "Sports not logged in"); BaseTest.Pass(); } if (sites.Contains("P")) { BaseTest.AddTestCase("Verify session for Vegas", "User should be logged in"); wAction.OpenURL(driverObj, FrameGlobals.VegasURL, "Vegas load failed", 60); Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.WaitUntilElementPresent(driverObj, By.Id(Portal_Control.Customer_Menu_Id)), "Vegas not logged in"); BaseTest.Pass(); BaseTest.AddTestCase("Verify session for Casino", "User should be logged in"); wAction.OpenURL(driverObj, FrameGlobals.CasinoURL, "Casino load failed", 60); Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.WaitUntilElementPresent(driverObj, By.Id(Portal_Control.Customer_Menu_Id)), "Casino not logged in"); BaseTest.Pass(); BaseTest.AddTestCase("Verify session for Bingo", "User should be logged in"); wAction.OpenURL(driverObj, FrameGlobals.BingoURL, "Bingo load failed", 60); Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.WaitUntilElementPresent(driverObj, By.Id(Portal_Control.Customer_Menu_Id)), "Bingo not logged in"); BaseTest.Pass(); } if (sites.Contains("G")) { BaseTest.AddTestCase("Verify session for Games", "User should be logged in"); wAction.OpenURL(driverObj, FrameGlobals.GamesURL, "Ecomm load failed", 60); Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.WaitUntilElementPresent(driverObj, By.XPath(Games_Control.depositLink)), "Games not logged in"); BaseTest.Pass(); } if (sites.Contains("B")) { BaseTest.AddTestCase("Verify session for backgammon", "User should be logged in"); wAction.OpenURL(driverObj, FrameGlobals.BackgammonURL, "Backgammon load failed", 60); Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.WaitUntilElementPresent(driverObj, By.LinkText("Logout")), "BackGammon not logged in"); BaseTest.Pass(); } if (sites.Contains("E")) { BaseTest.AddTestCase("Verify session for ecom", "User should be logged in"); wAction.OpenURL(driverObj, FrameGlobals.EcomURL, "Ecomm load failed", 60); BaseTest.Assert.IsTrue(wAction._WaitUntilElementPresent(driverObj, ORFile.Accounts_Wallets_Banking, wActions.locatorType.link, "Logout"), "Ecomm not logged in"); BaseTest.Pass(); } driverObj.Close(); driverObj.SwitchTo().Window(main); }
public void sessionManagement_Logout(IWebDriver driverObj, string sites) { wAction.ExecJavaScript(driverObj, "window.open('','_blank');"); string main = driverObj.CurrentWindowHandle; driverObj.SwitchTo().Window(driverObj.WindowHandles[1]); if (sites.Contains("S")) { BaseTest.AddTestCase("Verify session for sports", "User should be logged in"); // wAction.ExecJavaScript(driverObj, "window.open('" + FrameGlobals.SportsURL + "','_blank');"); wAction.OpenURL(driverObj, FrameGlobals.SportsURL, "Sports load failed", 60); Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.WaitUntilElementPresent(driverObj, By.Id(Sportsbook_Control.username_Id)), "Customer still not logged out!"); BaseTest.Pass(); } if (sites.Contains("P")) { BaseTest.AddTestCase("Verify session for Vegas", "User should be logged in"); wAction.OpenURL(driverObj, FrameGlobals.VegasURL, "Vegas load failed", 60); Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.WaitUntilElementPresent(driverObj, By.Name("username")), "Customer might not have logged off successfully please check"); BaseTest.Pass(); BaseTest.AddTestCase("Verify session for Casino", "User should be logged in"); wAction.OpenURL(driverObj, FrameGlobals.CasinoURL, "Casino load failed", 60); Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.WaitUntilElementPresent(driverObj, By.Name("username")), "Customer might not have logged off successfully please check"); BaseTest.Pass(); BaseTest.AddTestCase("Verify session for Bingo", "User should be logged in"); wAction.OpenURL(driverObj, FrameGlobals.BingoURL, "Bingo load failed", 60); Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.WaitUntilElementPresent(driverObj, By.Name("username")), "Customer might not have logged off successfully please check"); BaseTest.Pass(); } if (sites.Contains("G")) { BaseTest.AddTestCase("Verify session for Games", "User should be logged in"); wAction.OpenURL(driverObj, FrameGlobals.GamesURL, "Ecomm load failed", 60); Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.WaitUntilElementPresent(driverObj, By.Id("tbUsername")), "Logout not working"); BaseTest.Pass(); } if (sites.Contains("B")) { BaseTest.AddTestCase("Verify session for backgammon", "User should be logged in"); wAction.OpenURL(driverObj, FrameGlobals.BackgammonURL, "Backgammon load failed", 60); Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.WaitUntilElementPresent(driverObj, By.Id("tbUsername")), "Logout did not happaned"); BaseTest.Pass(); } if (sites.Contains("X")) { BaseTest.AddTestCase("Verify session for Exchange", "User should be logged in"); wAction.OpenURL(driverObj, FrameGlobals.ExchangeURL, "ExchangeURL load failed", 60); Thread.Sleep(3000); BaseTest.Assert.IsTrue(wAction.WaitUntilElementPresent(driverObj, By.Id(Ecomm_Control.Username_ID)), "Logout not working"); BaseTest.Pass(); } if (sites.Contains("E")) { BaseTest.AddTestCase("Verify session for ecom", "User should be logged in"); wAction.OpenURL(driverObj, FrameGlobals.EcomURL, "Ecomm load failed", 60); BaseTest.Assert.IsTrue(wAction.WaitUntilElementPresent(driverObj, By.Id("loginusername")), "Customer might not have logged off successfully please check"); BaseTest.Pass(); } driverObj.Close(); driverObj.SwitchTo().Window(main); }
//========================================================= public void Cancel_Withdraw(IWebDriver driverObj, MyAcct_Data acctData, bool closeWindow = true, bool inWithdrawPage = false) { BaseTest.AddTestCase("Verify the Banking / My Account Links to Cancel the Withdraw amount from wallet", "Withdrawed Amount should be Cancelled from the selected wallet"); DateTime varElapseTime = DateTime.Now.AddSeconds(FrameGlobals.reloadTimeOut); string depositWalletPath = "//tr[td[contains(text(),'" + acctData.withdrawWallet + "')]]/td[2]"; string portalWindow = driverObj.WindowHandles.ToArray()[0].ToString(); driverObj.SwitchTo().Window(driverObj.WindowHandles.ToArray()[1].ToString()); if (!inWithdrawPage) { wAction._Click(driverObj, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "WithdrawTab", "Withdraw Tab not found", 0, false); } string temp = wAction.GetText(driverObj, By.XPath(depositWalletPath), acctData.withdrawWallet + " Wallet value not found", false).ToString(); double beforeVal = 0; if (StringCommonMethods.ReadDoublefromString(temp) != -1) { beforeVal = StringCommonMethods.ReadDoublefromString(temp); } else { BaseTest.Fail("Wallet value is null/Blank"); } wAction.Click(driverObj, By.XPath(Cashier_Control_SW.CancelWithdraw), "CancelWithdraw Tab not found", 0, false); System.Threading.Thread.Sleep(TimeSpan.FromSeconds(6)); BaseTest.AddTestCase("Check if any Withdraw transaction availabel to cancel", "Minimum one withdraw request should be present"); // wAction._Type(driverObj, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "Cancel_btn",Keys.Enter, "No Withdraw request available / Cancel button not found", 0, false); List <IWebElement> ele = wAction.ReturnWebElements(driverObj, By.XPath("//button[contains(text(),'Cancel')]"), "No Pending withdrawals", 0, false); ele[0].Click(); BaseTest.Pass(); System.Threading.Thread.Sleep(TimeSpan.FromSeconds(2)); wAction._Click(driverObj, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "CancelConfirmation_Dlg", "CancelConfirmation dialog not found", 0, false); wAction.Click(driverObj, By.LinkText("Go back"), null, 0, false); System.Threading.Thread.Sleep(TimeSpan.FromSeconds(2)); wAction._Click(driverObj, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "WithdrawTab", "Withdraw Tab not found", 0, false); System.Threading.Thread.Sleep(TimeSpan.FromSeconds(5)); // double AfterVal = double.Parse(wAction.GetText(driverObj, By.XPath(depositWalletPath), acctData.withdrawWallet + " Wallet value not found", false).ToString().Replace('£', ' ').Trim()); temp = wAction.GetText(driverObj, By.XPath(depositWalletPath), acctData.withdrawWallet + " Wallet value not found", false).ToString(); double AfterVal = 0; if (StringCommonMethods.ReadDoublefromString(temp) != -1) { AfterVal = StringCommonMethods.ReadDoublefromString(temp); } else { BaseTest.Fail("Wallet value is null/Blank"); } BaseTest.AddTestCase("Wallet:" + acctData.depositWallet + " Transaction Amount:" + acctData.depositAmt + " => 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); }
//========================================================== 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"); String portal = AnW.OpenCashier(driverObj); string SingleWalletPath = "//tr[td[contains(text(),'" + SingleWallet + "')]]/td[2]"; wAction.WaitAndMovetoFrame(driverObj, By.Id(Reg_Control.CashierFrame_ID)); 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", "Transfer 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); driverObj.Close(); driverObj.SwitchTo().Window(portal); BaseTest.Pass(); }
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); }