public void TC_009_03_CreateNewShareSkill() { try { GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); test = extent.StartTest("Create New Share Skill Record"); // create an object for serviceLIsting page ServiceListing skillObj = new ServiceListing(); //click on the share skill button skillObj.ShareSkillBtnClick(); //enter all the details from the excel string title = GlobalDefinitions.ExcelLib.ReadData(2, "Title"); string desc = GlobalDefinitions.ExcelLib.ReadData(2, "Description"); skillObj.inputTitleDescription(title, desc); //enter category and sub category details skillObj.SelectCategSubcateg(GlobalDefinitions.ExcelLib.ReadData(2, "Category"), GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); // enter tags value skillObj.InputTags(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); //enter service type and location type skillObj.ServiceAndLocationTypeSelect(GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType"), GlobalDefinitions.ExcelLib.ReadData(2, "LocationType")); //enter yesterday as start date in Available days string date = GlobalDefinitions.ExcelLib.ReadData(2, "AvailableDays"); skillObj.StartDateSelect(date); //enter skill trade details skillObj.inputCreditTradeDetails(GlobalDefinitions.ExcelLib.ReadData(2, "credit")); //enter active status skillObj.ActiveBtnClick(); //click on save button skillObj.SaveBtnClick(); if (skillObj.ShareSkillPageTitle().Equals("ListingManagement")) { Base.test.Log(LogStatus.Pass, "New share skill record created sucessfully"); Assert.True(true); } else { Base.test.Log(LogStatus.Fail, "New Share skill record not saved"); Assert.Fail(); } } catch (Exception e) { Base.test.Log(LogStatus.Fail, e); Assert.Fail(); } }
public void TC_WorkSamplesUpload() { GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); test = extent.StartTest("Uploading File Test"); // create an object for serviceLIsting page ServiceListing skillObj = new ServiceListing(); //click on the share skill button skillObj.ShareSkillBtnClick(); //enter all the details from the excel Thread.Sleep(2000); string title = GlobalDefinitions.ExcelLib.ReadData(3, "Title"); string desc = GlobalDefinitions.ExcelLib.ReadData(3, "Description"); skillObj.inputTitleDescription(title, desc); //work samples file upload skillObj.WorkSamplesUploadClick(); //AutoIt - Handles windows that do not belong to browser AutoItX3 autoIt = new AutoItX3(); autoIt.WinActivate("Open"); //Activate - so that the next set of actions happen on this window Thread.Sleep(2000); autoIt.Send(@"C:\Users\sudha\Desktop\FileUploadTest.docx"); Thread.Sleep(2000); // autoIt.Send("{ENTER}"); // autoIt.MouseClick("Button1",0,0, 1, 0); autoIt.ControlClick("Open", "", "Button1"); //Check whether document uploaded property or not if (skillObj.IsWorkSamplesDocUpload()) { Base.test.Log(LogStatus.Pass, "Document uploaded successfully using AutoIt"); Assert.True(true); } else { test.Log(LogStatus.Fail, "Document not uploaded"); Assert.Fail(); } }
public void TC_009_02_skillPageTitleCheck() { test = extent.StartTest("Share skill page title check"); ServiceListing skillObj = new ServiceListing(); //click on the share skill button skillObj.ShareSkillBtnClick(); string expectedTitle = "ServiceListing"; //compare the page title if (expectedTitle.Equals(skillObj.ShareSkillPageTitle())) { Base.test.Log(LogStatus.Pass, "Page Title Test Passed"); Assert.Pass(); } else { Base.test.Log(LogStatus.Fail, "Page Title test Failed"); Assert.Fail(); } }
public void TC_CheckStartDate() { try { GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); test = extent.StartTest("Create New Share Skill Record"); // create an object for serviceLIsting page ServiceListing skillObj = new ServiceListing(); //click on the share skill button skillObj.ShareSkillBtnClick(); //enter all the details from the excel string title = GlobalDefinitions.ExcelLib.ReadData(4, "Title"); string desc = GlobalDefinitions.ExcelLib.ReadData(4, "Description"); skillObj.inputTitleDescription(title, desc); //enter category and sub category details skillObj.SelectCategSubcateg(GlobalDefinitions.ExcelLib.ReadData(4, "Category"), GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); // enter tags value skillObj.InputTags(GlobalDefinitions.ExcelLib.ReadData(4, "Tags")); //enter service type and location type skillObj.ServiceAndLocationTypeSelect(GlobalDefinitions.ExcelLib.ReadData(4, "ServiceType"), GlobalDefinitions.ExcelLib.ReadData(4, "LocationType")); //enter yesterday as start date in Available days DateTime date = DateTime.Today.AddDays(-1); skillObj.StartDateSelect(date.ToString("dd-MM-yyyy")); //enter skill trade details skillObj.inputCreditTradeDetails(GlobalDefinitions.ExcelLib.ReadData(4, "credit")); //enter active status skillObj.ActiveBtnClick(); //click on save button skillObj.SaveBtnClick(); Thread.Sleep(2000); if (skillObj.ShareSkillPageTitle().Equals("ServiceListing")) { if (skillObj.IsErrorDateMsg().Equals("Start Date cannot be set to a day in the past")) { Base.test.Log(LogStatus.Pass, "Test Passed- Past date not accepting as start date"); Assert.True(true); } else { Base.test.Log(LogStatus.Fail, "Test Failed - should return proper error message for past date"); Assert.Fail(); } } else { Base.test.Log(LogStatus.Fail, "Test Failed - Should not save the record with past date as start date"); Assert.Fail(); } } catch (Exception e) { Base.test.Log(LogStatus.Fail, e); Assert.Fail(); } }