public void EditAssetname() { //Click on Edit button GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(30, "Locator"), ExcelLib.ReadData(30, "Value")); //Change asset name GlobalDefinition.GetClear(GlobalDefinition.driver, ExcelLib.ReadData(23, "Locator"), ExcelLib.ReadData(23, "Value")); GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(23, "Locator"), ExcelLib.ReadData(23, "Value"), ExcelLib.ReadData(23, "Input")); //Click on save btn GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(31, "Locator"), ExcelLib.ReadData(31, "Value")); string Editasset = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(32, "Locator"), ExcelLib.ReadData(32, "Value")); if (Editasset == ExcelLib.ReadData(23, "Input")) { Base.test.Log(LogStatus.Pass, "Edit Asset successful"); } else { Base.test.Log(LogStatus.Fail, "Edit Asset unsuccessful"); } }
public void Update_dashboard() { //populate in collection ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "Settings"); //Click on Admin tab Global.GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value")); Thread.Sleep(2000); //Select Settings option under admin tab GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value")); Thread.Sleep(2000); //Click on Dashboard tab GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(37, "Locator"), ExcelLib.ReadData(37, "Value")); //Enter Text GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(38, "Locator"), ExcelLib.ReadData(38, "Value"), ExcelLib.ReadData(38, "Input")); //Click update button GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(39, "Locator"), ExcelLib.ReadData(39, "Value")); //Check if the dashboard header is updated string dashheader= GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(40, "Locator"), ExcelLib.ReadData(40, "Value")); if (dashheader == ExcelLib.ReadData(38, "Input")) { Base.test.Log(LogStatus.Pass, "Dashboard Header updated"); } else { Base.test.Log(LogStatus.Fail, "Dashboard Header not updated"); } }
public void Addnewasset_Invaliddata() { //Click on Add new asset GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(20, "Locator"), ExcelLib.ReadData(20, "Value")); //select asset type GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(21, "Locator"), ExcelLib.ReadData(21, "Value")); GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(22, "Locator"), ExcelLib.ReadData(22, "Value")); //Enter asset name // GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(23, "Locator"), ExcelLib.ReadData(23, "Value"), ExcelLib.ReadData(23, "Input")); for (int i = 2; i < 5; i++) { //enter data GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(23, "Locator"), ExcelLib.ReadData(23, "Value"), ExcelLib.ReadData(i, "InV_Asset name")); //Select room GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(24, "Locator"), ExcelLib.ReadData(24, "Value")); GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(25, "Locator"), ExcelLib.ReadData(25, "Value")); string selectedroom = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(25, "Locator"), ExcelLib.ReadData(25, "Value")); //click on save btn GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(26, "Locator"), ExcelLib.ReadData(26, "Value")); //Get text from validation error string error = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(33, "Locator"), ExcelLib.ReadData(33, "Value")); Base.test.Log(LogStatus.Pass, "Test Passed with alert message : " + i + error); } }
public void Addroom_Valid() { // Click on Add Room button GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value")); //Enter Room name GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value"), ExcelLib.ReadData(6, "Input")); //Click on Color picker GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value")); //Select the color IWebElement color = GlobalDefinition.driver.FindElement(By.XPath("//div[@class='k-hsv-gradient']")); color.GetCssValue("#804040"); Thread.Sleep(2000); color.Click(); // Click on apply button GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(9, "Locator"), ExcelLib.ReadData(9, "Value")); Thread.Sleep(1000); //Click on save button GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(10, "Locator"), ExcelLib.ReadData(10, "Value")); Thread.Sleep(2000); // Handle validation alert if occurs //bool isElementDisplayed = GlobalDefinition.driver.FindElement(By.XPath(".//*[@id='beehive-alert']/p")).Displayed; //if (isElementDisplayed == true) //{ // string alert = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(16, "Locator"), ExcelLib.ReadData(16, "Value")); // Base.test.Log(LogStatus.Error, "test failed " + alert); //} // return; Thread.Sleep(1000); // last page on pagination GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(34, "Locator"), ExcelLib.ReadData(34, "Value")); Thread.Sleep(1000); string xpath_start = ".//*[@id='Room-List']/tr["; string xpath_end = "]/td[2]"; int i = 1; while (GlobalDefinition.isElementPresent(xpath_start + i + xpath_end)) { // string Roomname = GlobalDefinition.GetTextValue(GlobalDefinition.driver,ExcelLib.ReadData(14,"Locator"),ExcelLib.ReadData(14,"Value")); string roomname = GlobalDefinition.driver.FindElement(By.XPath(".//*[@id='Room-List']/tr[" + i + "]/td[2]")).Text; if (roomname == ExcelLib.ReadData(6, "Input")) { Base.test.Log(LogStatus.Pass, "Room added successfully"); } else { Base.test.Log(LogStatus.Fail, "Add new room unsuccessfull"); } i++; } }
public void AddNewAsset_Validdata() { //Click on Add new asset GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(20, "Locator"), ExcelLib.ReadData(20, "Value")); //select asset type GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(21, "Locator"), ExcelLib.ReadData(21, "Value")); GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(22, "Locator"), ExcelLib.ReadData(22, "Value")); //Enter asset name GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(23, "Locator"), ExcelLib.ReadData(23, "Value"), ExcelLib.ReadData(23, "Input")); // for (int i = 2; i < 5; i++) //{ //enter data // GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(23, "Locator"), ExcelLib.ReadData(23, "Value"), ExcelLib.ReadData(i, "V_Asset name")); //Select room GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(24, "Locator"), ExcelLib.ReadData(24, "Value")); GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(25, "Locator"), ExcelLib.ReadData(25, "Value")); string roomname = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(25, "Locator"), ExcelLib.ReadData(25, "Value")); //click on save btn GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(26, "Locator"), ExcelLib.ReadData(26, "Value")); //} //Click last page button on pagination GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(35, "Locator"), ExcelLib.ReadData(35, "Value")); //Check if asset created string Xpath_start = ".//*[@id='AssetList']/tr["; string Xpath_end = "]/td[1]"; int l = 1; while (GlobalDefinition.isElementPresent(Xpath_start + l + Xpath_end)) { string Roomnamel = GlobalDefinition.driver.FindElement(By.XPath(".//*[@id='AssetList']/tr[" + l + "]/td[1]")).Text; if (Roomnamel == roomname) { Base.test.Log(LogStatus.Info, "Room name matched"); string Assetnamel = GlobalDefinition.driver.FindElement(By.XPath(".//*[@id='AssetList']/tr[" + l + "]/td[2]")).Text; if (Assetnamel == ExcelLib.ReadData(23, "Input")) { Base.test.Log(LogStatus.Pass, "Asset Created"); } } l++; } }
public void EditRoom_Duplicatedata() { //Click on Edit Button GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(15, "Locator"), ExcelLib.ReadData(15, "Value")); //Edit room name GlobalDefinition.GetClear(GlobalDefinition.driver, ExcelLib.ReadData(12, "Locator"), ExcelLib.ReadData(12, "Value")); GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(12, "Locator"), ExcelLib.ReadData(12, "Value"), ExcelLib.ReadData(12, "Input")); //Click on update btn GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(13, "Locator"), ExcelLib.ReadData(13, "Value")); //get alert text string alert = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(16, "Locator"), ExcelLib.ReadData(16, "Value")); Base.test.Log(LogStatus.Pass, "Test Passed with alert message :" + alert); }
public void AddRoom_Invalid() {// Click on Add Room button GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value")); //Enter Room name //GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value"), ExcelLib.ReadData(6, "Input")); for (int i = 2; i<5; i++) { // Enter room name GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value"), ExcelLib.ReadData(i, "InValid_Name")); //Click on Color picker GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value")); //Select the color IWebElement color = GlobalDefinition.driver.FindElement(By.XPath("//div[@class='k-hsv-gradient']")); color.GetCssValue("#804056"); color.Click(); // Click on apply button GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(9, "Locator"), ExcelLib.ReadData(9, "Value")); //Click on save button Global.GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(10, "Locator"), ExcelLib.ReadData(10, "Value")); string alert = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(16, "Locator"), ExcelLib.ReadData(16, "Value")); Base.test.Log(LogStatus.Pass,"invalid input "+i+ "gets " + alert); //Close the alert GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(17, "Locator"), ExcelLib.ReadData(17, "Value")); // Clear the textbox GlobalDefinition.GetClear(GlobalDefinition.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value")); } }
public void AddCompany() { //Populate in collectiion ExcelLib.PopulateInCollection(Base.ExcelPath, "Companies"); //click on admin tab GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value")); //Click on Companies option GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value")); //Click add new button GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "Value")); //enter text in company name GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value"), ExcelLib.ReadData(5, "Input")); //enter email address GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value"), ExcelLib.ReadData(6, "Input")); //enter address GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value"), ExcelLib.ReadData(7, "Input")); //click the 1st suggestion GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(8, "Locator"), ExcelLib.ReadData(8, "Value")); //eneter website GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(14, "Locator"), ExcelLib.ReadData(14, "Value"), ExcelLib.ReadData(14, "Input")); //click to browse logo GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(15, "Locator"), ExcelLib.ReadData(15, "Value")); //upload logo AutoItX3 auto = new AutoItX3(); auto.WinActivate("Open"); auto.Send(@"C:\Users\sonia\Desktop\Crate\experieco.png"); auto.Send("{ENTER}"); // Click on save button GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(16, "Locator"), ExcelLib.ReadData(16, "Value")); }
public void EditRoom_Validdata() { //Click on Edit Button GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(11, "Locator"), ExcelLib.ReadData(11, "Value")); //Edit room name GlobalDefinition.GetClear(GlobalDefinition.driver, ExcelLib.ReadData(12, "Locator"), ExcelLib.ReadData(12, "Value")); GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(12, "Locator"), ExcelLib.ReadData(12, "Value"), ExcelLib.ReadData(12, "Input")); //Click on update btn GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(13, "Locator"), ExcelLib.ReadData(13, "Value")); // Checking if record created in the table String editValidation = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(14, "Locator"), ExcelLib.ReadData(14, "Value")); if (editValidation == ExcelLib.ReadData(12, "Input")) { Base.test.Log(LogStatus.Pass, "Room name edited to: " + ExcelLib.ReadData(12, "Input") + " successfully"); } else { Base.test.Log(LogStatus.Fail, "Edit Room name failed"); } }
public void EditRoom_InvalidData() { //Click on Edit Button GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(15, "Locator"), ExcelLib.ReadData(15, "Value")); for (int i = 2; i < 5; i++) { // Clear text GlobalDefinition.GetClear(GlobalDefinition.driver, ExcelLib.ReadData(12, "Locator"), ExcelLib.ReadData(12, "Value")); //enter data GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(12, "Locator"), ExcelLib.ReadData(12, "Value"), ExcelLib.ReadData(i, "InValid_Name")); //Click on update btn GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(13, "Locator"), ExcelLib.ReadData(13, "Value")); //Get text from alert Thread.Sleep(1000); string alert = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(16, "Locator"), ExcelLib.ReadData(16, "Value")); Base.test.Log(LogStatus.Pass, "Test Passed with alert message : " + i + alert); //Close Alert GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(17, "Locator"), ExcelLib.ReadData(17, "Value")); } }
public void AddCompany() { //Populate in collectiion //check git hub ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "Companies"); //click on admin tab GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value")); //Click on Companies option WebDriverWait wait = new WebDriverWait(GlobalDefinition.driver, TimeSpan.FromSeconds(10)); var Company = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(ExcelLib.ReadData(3, "Value")))); Company.Click(); //GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value")); //Click add new button GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "Value")); //enter text in company name GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value"), ExcelLib.ReadData(5, "Input")); //enter email address GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value"), ExcelLib.ReadData(6, "Input")); //enter street number GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(9, "Locator"), ExcelLib.ReadData(9, "Value"), ExcelLib.ReadData(9, "Input")); //enter street name GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(10, "Locator"), ExcelLib.ReadData(10, "Value"), ExcelLib.ReadData(10, "Input")); //Enter Suburb GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(11, "Locator"), ExcelLib.ReadData(11, "Value"), ExcelLib.ReadData(11, "Input")); //Enter City GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(12, "Locator"), ExcelLib.ReadData(12, "Value"), ExcelLib.ReadData(12, "Input")); //Enter Postcode GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(13, "Locator"), ExcelLib.ReadData(13, "Value"), ExcelLib.ReadData(13, "Input")); //eneter website GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(14, "Locator"), ExcelLib.ReadData(14, "Value"), ExcelLib.ReadData(14, "Input")); //click to browse logo GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(15, "Locator"), ExcelLib.ReadData(15, "Value")); //upload logo AutoItX3 auto = new AutoItX3(); auto.WinActivate("Open"); auto.Send(@"C:\Users\sonia\Desktop\CRATE\experieco.png"); auto.Send("{ENTER}"); GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(16, "Locator"), ExcelLib.ReadData(16, "Value")); //Click on last page btn WebDriverWait wait1 = new WebDriverWait(GlobalDefinition.driver, TimeSpan.FromSeconds(10)); var lastpage = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(ExcelLib.ReadData(17, "Value")))); lastpage.Click(); //GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(17, "Locator"), ExcelLib.ReadData(17, "Value")); var element = GlobalDefinition.driver.FindElement(By.XPath(ExcelLib.ReadData(17, "Value"))); Actions actions1 = new Actions(GlobalDefinition.driver); actions1.MoveToElement(element).Click().Perform(); //hi there just testing git hub //Check if company added string xpath_start = ".//*[@id='companies']/tr["; string xpath_end = "]/td[1]"; int i = 1; while (GlobalDefinition.isElementPresent(xpath_start + i + xpath_end)) { string companyname = GlobalDefinition.driver.FindElement(By.XPath(".//*[@id='companies']/tr[" + i + "]/td[1]")).Text; if (companyname == ExcelLib.ReadData(5, "Input")) { Base.test.Log(LogStatus.Info, "Company name found"); string emailid = GlobalDefinition.driver.FindElement(By.XPath(".//*[@id='companies']/tr[" + i + "]/td[2]")).Text; if (emailid == ExcelLib.ReadData(6, "Input")) { Base.test.Log(LogStatus.Pass, "Company Created"); } } i++; } }