public static void SignOut() { GenericMethods.ButtonClick(myDriver, "XPath", "//body/div/div/div[2]/div[4]/i"); GenericMethods.ButtonClick(myDriver, "XPath", "//body/div/div/div[2]/div[4]/div/a[4]"); Thread.Sleep(500); GenericMethods.ValidateTitle("Log In", myDriver.Title, "Sign Out is Successful", "Sign Out is failed"); }
public static void Signup() { // Finding the excel path for data driven input Global.ExcelData.PopulateInCollection(CommonFeatures.ExcelPath, "Login"); //passing the url myDriver.Navigate().GoToUrl(Global.ExcelData.ReadData(2, "Url")); //Assertion and reporting comments Assert.AreEqual("Log In", myDriver.Title); CommonFeatures.test = CommonFeatures.extent.StartTest("Navigation Successful"); //clicking on signup button Thread.Sleep(1500); GenericMethods.ButtonClick(myDriver, "XPath", "//body/div/div/div/div/form/div[3]/a"); //filling the data for registration GenericMethods.TextBox(myDriver, "Id", "FirstName", "Ishanu"); GenericMethods.TextBox(myDriver, "Id", "LastName", "Chatterjee"); GenericMethods.TextBox(myDriver, "Id", "UserName", "*****@*****.**"); GenericMethods.TextBox(myDriver, "Id", "Password", "Ishanu123"); //GenericMethods.ButtonClick(myDriver, "XPath", "//body/div/div/div/div/form/div/div[5]/div/div"); GenericMethods.ButtonClick(myDriver, "XPath", "//body/div/div/div/div/form/div/div[5]/div/div/div"); GenericMethods.ButtonClick(myDriver, "XPath", "//body/div/div/div/div/form/div/div[5]/div/div/div[2]/div"); GenericMethods.ButtonClick(myDriver, "XPath", "//*[@id='sign_in']/div[1]/div[6]/div/label/a"); Thread.Sleep(1500); GenericMethods.ButtonClick(myDriver, "Id", "btnAccept"); Thread.Sleep(1000); GenericMethods.ButtonClick(myDriver, "Id", "SignupButton"); //saving screenshot var ScreenshotPath = Global.SaveScreenShot.SaveScreenshot(myDriver, "Registration Successful", Global.CommonFeatures.ScreenshotPath); }
public static void PageNavigation() { //To skip the alert GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[5]/div/div[5]/a[1]"); Thread.Sleep(1500); //navigate to Owners>Properties GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[1]/div/div[2]/div[1]"); GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[1]/div/div[2]/div[1]/div/a[1]"); //Checking the right page Assert.AreEqual("Properties | Property Community", myDriver.Title); CommonFeatures.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "In My Properties page"); var ScreenshotPath = Global.SaveScreenShot.SaveScreenshot(myDriver, "We are at first page", Global.CommonFeatures.NavigationSC); //navigating to the 2nd page GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div/div/div[4]/div/ul/li[8]//a"); var ScreenshotPath1 = Global.SaveScreenShot.SaveScreenshot(myDriver, "This is second page", Global.CommonFeatures.NavigationSC); //navigating to the last page Thread.Sleep(1000); GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div/div/div[4]/div/ul/li[10]/a"); var ScreenshotPath2 = Global.SaveScreenShot.SaveScreenshot(myDriver, "This is last page", Global.CommonFeatures.NavigationSC); //returning to the first page Thread.Sleep(1000); GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div/div/div[4]/div/ul/li/a"); var ScreenshotPath3 = Global.SaveScreenShot.SaveScreenshot(myDriver, "This is again first page page", Global.CommonFeatures.NavigationSC); }
public static void SearchAndSort() { //To skip the alert GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[5]/div/div[5]/a[1]"); Thread.Sleep(1500); //navigate to Owners>Properties GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[1]/div/div[2]/div[1]"); GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[1]/div/div[2]/div[1]/div/a[1]"); //Checking the right page Assert.AreEqual("Properties | Property Community", myDriver.Title); CommonFeatures.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "In My Properties page"); //Searching property GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div/div/div/div[2]/div/form/div/input"); GenericMethods.TextBox(myDriver, "XPath", "//body/div[2]/section/div/div/div/div[2]/div/form/div/input", "PropIshanu" + Keys.Enter); //Search is successful CommonFeatures.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Search is successful"); //sorting by name GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div/div/div[2]/div/div/div/div/i"); GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div/div/div[2]/div/div/div/div/div[2]/div"); //Sorting is done CommonFeatures.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Sort is successful"); //edit the first property MyProperties.SortEdit(); }
public static void EditProperty() { //finding the excle path for input Global.ExcelData.PopulateInCollection(CommonFeatures.ExcelPath, "Add Property"); //To skip the alert GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[5]/div/div[5]/a[1]"); Thread.Sleep(1500); //navigate to Owners>Properties GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[1]/div/div[2]/div[1]"); GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[1]/div/div[2]/div[1]/div/a[1]"); //Checking the right page Assert.AreEqual("Properties | Property Community", myDriver.Title); //CommonFeatures.test = CommonFeatures.extent.StartTest("In My Properties page"); //Searching property GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div/div/div/div[2]/div/form/div/input"); GenericMethods.TextBox(myDriver, "XPath", "//body/div[2]/section/div/div/div/div[2]/div/form/div/input", "PropIshanu" + Keys.Enter); //editing property GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div/div/div[3]/div/div/div[2]/div/div[3]/div/i"); Thread.Sleep(1500); GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div/div/div[3]/div/div/div[2]/div/div[3]/div/div/div[4]"); GenericMethods.ClearText(myDriver, "XPath", "//body/div[2]/section/div[3]/div[2]/form/div[4]/div//div/input"); Thread.Sleep(1500); GenericMethods.TextBox(myDriver, "XPath", "//body/div[2]/section/div[3]/div[2]/form/div[4]/div//div/input", "800"); GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div[3]/div[2]/form/div[8]/button"); //saving screenshot var ScreenshotPath = Global.SaveScreenShot.SaveScreenshot(myDriver, "Edit is successful", Global.CommonFeatures.ScreenshotPath); }
public void WhenIProvideCorrectUserNameAndPasswordAndPressSignIn() { //Passing username and password GenericMethods.TextBox(Global.GlobalDriver.driver, "XPath", "//*[@id='UserName']", Global.ExcelData.ReadData(2, "UserName")); GenericMethods.TextBox(Global.GlobalDriver.driver, "Id", "Password", Global.ExcelData.ReadData(2, "PassWord")); //clicking the signin button GenericMethods.ButtonClick(Global.GlobalDriver.driver, "XPath", "//*[@id='sign_in']/div[1]/div[4]/button"); }
public void ThenISuccesfullyLoginToHomePage() { //verification assertion Assert.AreEqual("Dashboard", GlobalDriver.driver.Title); CommonFeatures.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Successful Login"); //To skip the alert GenericMethods.ButtonClick(Global.GlobalDriver.driver, "XPath", "/html/body/div[5]/div/div[5]/a[1]"); //closing the browser CommonFeatures.Teardown(); }
public static void MyWatchlist() { //click on My Watchlist if (CommonFeatures.browser == "Chrome") { GenericMethods.SendKeysReturn(myDriver, "XPath", "//body/div[2]/section/div[5]/div/div/div/div[2]/div/a[2]"); } else { GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div[5]/div/div/div/div[2]/div/a[2]"); } //validation GenericMethods.ValidateTitle("Property Community | Watchlist", myDriver.Title, "My Watchlist Dashboard Tested Successfully", "My Watchlist Dashboard Test Failed"); }
public static void FinanceDetails() { //click on Finance Details if (CommonFeatures.browser == "Chrome") { GenericMethods.SendKeysReturn(myDriver, "XPath", "/html/body/div[2]/section/div[3]/div[1]/div[1]/div/div[2]/div/a[3]"); } else { GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[2]/section/div[3]/div[1]/div[1]/div/div[2]/div/a[3]"); } //validation GenericMethods.ValidateTitle("Properties | Property Community", myDriver.Title, "Finance Details Dashboard Tested Successfully", "Finance Details Dashboard Test Failed"); }
// The below method is the experiemental method and created by specialist - Don't try at home public static void ClickSection(string findBy, string byVal, string expectedTitle, string successMessage, string failMessage) { //click on My Quotes if (CommonFeatures.browser == "Chrome") { GenericMethods.SendKeysReturn(myDriver, findBy, byVal); } else { GenericMethods.ButtonClick(myDriver, findBy, byVal); } //validation GenericMethods.ValidateTitle(expectedTitle, myDriver.Title, successMessage, failMessage); }
public static void ClickLogin() { GenericMethods.ButtonClick(GlobalDefinition.driver, "XPath", "//*[@id='loginbutton']"); var ScreenshotPath = ScreenShot.SaveScreenshot(GlobalDefinition.driver, "Home Page"); try { Assert.AreEqual("(1) Facebook", GlobalDefinition.driver.Title); Console.WriteLine("Login Successful"); } catch { Console.WriteLine("Login Failure"); } }
public static void MyQuotes() { //click on My Quotes if (CommonFeatures.browser == "Chrome") { GenericMethods.SendKeysReturn(myDriver, "XPath", "//body/div[2]/section/div[8]/div/div/div/div[2]/div/a[3]"); } else { GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div[8]/div/div/div/div[2]/div/a[3]"); } //validation GenericMethods.ValidateTitle("My Quotes", myDriver.Title, "My Quotes Dashboard Tested Successfully", "My Quotes Dashboard Test Failed"); }
public static void MyJobs() { //click on My Jobs if (CommonFeatures.browser == "Chrome") { GenericMethods.SendKeysReturn(myDriver, "XPath", "//body/div[2]/section/div[8]/div/div/div/div[2]/div/a[2]"); } else { GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div[8]/div/div/div/div[2]/div/a[2]"); } //validation CommonFeatures.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "My Jobs Dashboard Tested Successfully"); }
public void GivenIHaveLoggedIntoTheHomepageByUsernameAndPassword() { CommonFeatures.Initialize(); CommonFeatures.test = CommonFeatures.extent.StartTest("Test - Property Owner Dashboard"); Pages.Login.LoginSteps(); //To skip the alert Thread.Sleep(1000); GenericMethods.ButtonClick(Global.GlobalDriver.driver, "XPath", "//body/div[5]/div//div[5]/a[1]"); Thread.Sleep(2500); // login validation Assert.AreEqual("Dashboard", GlobalDriver.driver.Title); CommonFeatures.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Successful Login"); }
public static void SortEdit() { //finding the excle path for input Global.ExcelData.PopulateInCollection(CommonFeatures.ExcelPath, "Add Property"); //editing property GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div/div/div[3]/div/div/div[2]/div/div[3]/div/i"); Thread.Sleep(1500); GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div/div/div[3]/div/div/div[2]/div/div[3]/div/div/div[4]"); GenericMethods.ClearText(myDriver, "XPath", "//body/div[2]/section/div[3]/div[2]/form/div[4]/div//div/input"); Thread.Sleep(1500); GenericMethods.TextBox(myDriver, "XPath", "//body/div[2]/section/div[3]/div[2]/form/div[4]/div//div/input", "800"); GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div[3]/div[2]/form/div[8]/button"); //Edit is successful CommonFeatures.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Edit is successful"); //saving screenshot var ScreenshotPath = Global.SaveScreenShot.SaveScreenshot(myDriver, "Edit is successful", Global.CommonFeatures.ScreenshotPath); }
public static void DeleteProperty() { //To skip the alert GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[5]/div/div[5]/a[1]"); Thread.Sleep(1500); //navigate to Owners>Properties GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[1]/div/div[2]/div[1]"); GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[1]/div/div[2]/div[1]/div/a[1]"); //Searching property GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div/div/div/div[2]/div/form/div/input"); GenericMethods.TextBox(myDriver, "XPath", "//body/div[2]/section/div/div/div/div[2]/div/form/div/input", "PropIshanu" + Keys.Enter); //Deleting property GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div/div/div[3]/div/div/div[2]/div/div[3]/div/i"); Thread.Sleep(1500); GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div/div/div[3]/div/div/div[2]/div/div[3]/div/div/div[5]"); GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div[4]/div/div[2]/div[7]/button"); }
public static void AddNewProperties() { //finding the excle path for input Global.ExcelData.PopulateInCollection(CommonFeatures.ExcelPath, "Add Property"); //To skip the alert GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[5]/div/div[5]/a[1]"); Thread.Sleep(1500); //loop for multiple properties getting added at single shot int loopNum = CommonFeatures.RowCount + 2; for (int rowNum = 2; rowNum < loopNum; rowNum++) { //navigate to Owners>Properties GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[1]/div/div[2]/div[1]"); GenericMethods.ButtonClick(myDriver, "XPath", "/html/body/div[1]/div/div[2]/div[1]/div/a[1]"); //Checking the right page Assert.AreEqual("Properties | Property Community", myDriver.Title); //CommonFeatures.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "In My Properties page"); //clicking add new properties Thread.Sleep(1000); GenericMethods.ButtonClick(myDriver, "XPath", "//body/div[2]/section/div/div/div[2]/div/div[2]/a[2]"); // Adding property details GenericMethods.TextBox(myDriver, "XPath", "//body/div[2]/section/form/fieldset/div/div/div/input", Global.ExcelData.ReadData(rowNum, "PropertyName")); GenericMethods.CheckLength(4, 30, Global.ExcelData.ReadData(rowNum, "PropertyName"), "Property Name"); GenericMethods.ButtonClick(myDriver, "XPath", "//fieldset/div/div[2]/div"); GenericMethods.ButtonClick(myDriver, "XPath", "//fieldset/div/div[2]/div"); GenericMethods.TextBox(myDriver, "XPath", "//body/div[2]/section/form/fieldset/div[3]/div/div[2]/div/div/input", Global.ExcelData.ReadData(rowNum, "Number")); GenericMethods.TextBox(myDriver, "XPath", "//body/div[2]/section/form/fieldset/div[3]/div/div[2]/div[2]/div/input", Global.ExcelData.ReadData(rowNum, "Street")); GenericMethods.TextBox(myDriver, "XPath", "//body/div[2]/section/form/fieldset/div[3]/div/div[3]/div/div[2]/div/input", Global.ExcelData.ReadData(rowNum, "City")); //postcode GenericMethods.TextBox(myDriver, "XPath", "//input[@placeholder='PostCode']", Global.ExcelData.ReadData(rowNum, "Postcode")); GenericMethods.ValidNumeric(Global.ExcelData.ReadData(rowNum, "Postcode"), "Postcode"); //Region GenericMethods.TextBox(myDriver, "Id", "region", Global.ExcelData.ReadData(rowNum, "Region")); //year built GenericMethods.TextBox(myDriver, "XPath", "//input[@placeholder = 'Year Built']", Global.ExcelData.ReadData(rowNum, "Yearbuilt")); GenericMethods.ValidYear(1900, Global.ExcelData.ReadData(rowNum, "Yearbuilt"), "Year Built"); //rent GenericMethods.TextBox(myDriver, "XPath", "//input[@placeholder='Rent Amount']", Global.ExcelData.ReadData(rowNum, "targetrent")); //bedroom , bathroom, carpark GenericMethods.TextBox(myDriver, "XPath", "//input[@placeholder='Number of Bedrooms']", Global.ExcelData.ReadData(rowNum, "bedroom")); GenericMethods.ValidNumeric(Global.ExcelData.ReadData(rowNum, "bedroom"), "Bedroom"); GenericMethods.TextBox(myDriver, "XPath", "//input[@placeholder='Number of Bathrooms']", Global.ExcelData.ReadData(rowNum, "bathroom")); GenericMethods.ValidNumeric(Global.ExcelData.ReadData(rowNum, "bathroom"), "Bathroom"); GenericMethods.TextBox(myDriver, "XPath", "//input[@placeholder='Number of car parks']", Global.ExcelData.ReadData(rowNum, "carpark")); GenericMethods.ValidNumeric(Global.ExcelData.ReadData(rowNum, "carpark"), "Carpark"); //description of the property GenericMethods.TextBox(myDriver, "XPath", "//textarea[@class='add-prop-desc']", Global.ExcelData.ReadData(rowNum, "description")); GenericMethods.CheckLength(10, 100, Global.ExcelData.ReadData(rowNum, "description"), "Description"); //picture of the property Thread.Sleep(2000); GenericMethods.TextBox(myDriver, "Id", "file-upload", CommonFeatures.PhotoPath); //navigating to financce page Thread.Sleep(2000); GenericMethods.ButtonClick(myDriver, "XPath", "//button[@class='ui teal button']"); Assert.AreEqual("Properties | Add New Property", myDriver.Title); //CommonFeatures.test.Log(RelevantCodes.ExtentReports.LogStatus.Info,"In Finance Page"); //entering details in finance page GenericMethods.TextBox(myDriver, "XPath", "//form/fieldset[2]/div/div/div/input", Global.ExcelData.ReadData(rowNum, "purchaseprice")); GenericMethods.TextBox(myDriver, "XPath", "//form/fieldset[2]/div/div[2]/div/input", Global.ExcelData.ReadData(rowNum, "mortgage")); GenericMethods.TextBox(myDriver, "XPath", "//form/fieldset[2]/div/div[3]/div/input", Global.ExcelData.ReadData(rowNum, "homevalue")); //navigating to tenant screen GenericMethods.ButtonClick(myDriver, "XPath", "//fieldset[2]/div[8]/button[3]"); Assert.AreEqual("Properties | Add New Property", myDriver.Title); //CommonFeatures.test.Log(RelevantCodes.ExtentReports.LogStatus.Info,"In Tenant Page"); //entering details in tenant page GenericMethods.TextBox(myDriver, "XPath", "//section/form/fieldset[3]/div/div/div/input", Global.ExcelData.ReadData(rowNum, "tenantmail")); GenericMethods.TextBox(myDriver, "Id", "fname", Global.ExcelData.ReadData(rowNum, "firstname")); GenericMethods.TextBox(myDriver, "Id", "lname", Global.ExcelData.ReadData(rowNum, "lastname")); GenericMethods.TextBox(myDriver, "Id", "ramount", Global.ExcelData.ReadData(rowNum, "rentamount")); GenericMethods.TextBox(myDriver, "Id", "sdate", Global.ExcelData.ReadData(rowNum, "sdate")); GenericMethods.TextBox(myDriver, "Id", "sdate", (Keys.Tab)); GenericMethods.TextBox(myDriver, "Id", "sdate", "0105AM"); GenericMethods.TextBox(myDriver, "Id", "edate", Global.ExcelData.ReadData(rowNum, "enddate")); GenericMethods.TextBox(myDriver, "Id", "edate", (Keys.Tab)); GenericMethods.TextBox(myDriver, "Id", "edate", "0105AM"); GenericMethods.TextBox(myDriver, "Id", "psdate", Global.ExcelData.ReadData(rowNum, "psdate")); GenericMethods.TextBox(myDriver, "Id", "psdate", (Keys.Tab)); GenericMethods.TextBox(myDriver, "Id", "psdate", "0105AM"); //save property GenericMethods.ButtonClick(myDriver, "Id", "saveProperty"); //Verification Thread.Sleep(500); Assert.AreEqual("Properties | Add New Property", Global.GlobalDriver.driver.Title); CommonFeatures.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Property Added Successfully"); } }