public void ATC3309_CRMInvestigationVerifyOfficerCanRecordPhoneCalls() { #region Start Up Excel MyBook = MyApp.Workbooks.Open(DatasourceDir + @"\Investigations.xlsx", 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); MySheet = (Excel.Worksheet)MyBook.Sheets[Properties.Settings.Default.ENVIRONMENT.ToString()]; MyRange = MySheet.UsedRange; //Get specific row for the data int testDataRows = MyRange.Rows.Count; int MyRow = 0; for (int i = 2; i <= testDataRows; i++) { if (MyRange.Cells[i, 1].Value.ToString() == "ClientTestData") { MyRow = i; break; } } #endregion string clientName = MyRange.Cells[MyRow, InvestigationSchema.GetColumnIndex(ColumnName.CLIENT_NAME)].Value; User user = this.environment.GetUser(SecurityRole.InvestigationOfficer); new LoginDialog().Login(user.Id, user.Password); // Create Investigation Case HomePage homePage = new HomePage(driver); string HomeWindow = driver.CurrentWindowHandle; homePage.HoverCRMRibbonTab(); homePage.ClickInvestigationsRibbonButton(); homePage.HoverInvestigationsRibbonTab(); homePage.ClickInvestigationsCasesRibbonButton(); // Verify that Investigation Officer is able to record Phone call for Investigation Case InvestigationCaseSearchPage investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver); investigationsCaseSearchPage.ClickNewInvestigationCaseButton(); // Create new case InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver); string BaseWindow = driver.CurrentWindowHandle; investigationCasePage.ClickSaveButton(); String investigationID = investigationCasePage.GetInvestigationCaseNumber(); //Phone Call investigationCasePage.ClickPageTitle(); investigationCasePage.ClickActivitiesAddButton(); investigationCasePage.ClickAddActivity("Phone Call"); driver = investigationCasePage.SwitchNewBrowserWithTitle(driver, BaseWindow, "Phone Call"); PhoneCallPage phoneCall = new PhoneCallPage(driver); phoneCall.ClickPageTitle(); phoneCall.SetSelectSubjectValue("Bond balance enquiry"); phoneCall.SetSubject("Test 3309 Phone Call"); phoneCall.SetRecipient(clientName); phoneCall.ClickSaveCloseButton(); driver = driver.SwitchTo().Window(BaseWindow); investigationCasePage.CheckForErrors(); investigationCasePage.ClickPageTitle(); Table table = new Table(investigationCasePage.GetActivitiesSearchResultTable()); StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3309 Phone Call", "Owner"), "IMSTestU03"); table.ClickCellValue("Subject", "Test 3309 Phone Call", "Subject"); phoneCall = new PhoneCallPage(driver); phoneCall.SwitchFrame(); StringAssert.Contains(phoneCall.GetSelectSubjectValue(), "Bond balance enquiry"); StringAssert.Contains(phoneCall.GetSubjectValue(), "Test 3309 Phone Call"); StringAssert.Contains(phoneCall.GetRecipientValue(), clientName); StringAssert.Contains(phoneCall.GetSenderValue(), user.Id); // Verify that Investigation Officer is able to record Phone call for Client driver = driver.SwitchTo().Window(HomeWindow); homePage.HoverCRMRibbonTab(); homePage.ClickClientServicesRibbonButton(); homePage.HoverClientServicesRibbonTab(); homePage.ClickClientsRibbonButton(); ClientsSearchPage clientsSearchPage = new ClientsSearchPage(driver); clientsSearchPage.ClickNewClientButton(); ClientPage clientPage = new ClientPage(driver); BaseWindow = driver.CurrentWindowHandle; clientPage.ClickPageTitle(); clientPage.PopulateNewClient("Client Phone Record"); clientPage.ClickSaveButton(); clientPage.ClickActivitiesAddButton(); clientPage.ClickAddActivity("Phone Call"); Thread.Sleep(3000); driver = clientPage.SwitchNewBrowser(driver, BaseWindow, "Phone Call"); phoneCall = new PhoneCallPage(driver); phoneCall.ClickPageTitle(); phoneCall.SetSelectSubjectValue("Bond balance enquiry"); phoneCall.SetSubject("Test 3309 Client Phone Call"); phoneCall.SetRecipient(clientName); phoneCall.ClickSaveCloseButton(); driver = driver.SwitchTo().Window(BaseWindow); phoneCall.CheckForErrors(); clientPage.ClickPageTitle(); table = new Table(clientPage.GetActivitiesTable()); StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3309 Client Phone Call", "Owner"), "IMSTestU03"); table.ClickCellValue("Subject", "Test 3309 Client Phone Call", "Subject"); phoneCall = new PhoneCallPage(driver); StringAssert.Contains(phoneCall.GetSelectSubjectValue(), "Bond balance enquiry"); StringAssert.Contains(phoneCall.GetSubjectValue(), "Test 3309 Client Phone Call"); StringAssert.Contains(phoneCall.GetRecipientValue(), clientName); StringAssert.Contains(phoneCall.GetSenderValue(), user.Id); // Verify that Investigation Officer is able to record Phone call for General Case homePage.HoverCRMRibbonTab(); homePage.ClickInvestigationsRibbonButton(); homePage.HoverInvestigationsRibbonTab(); homePage.ClickInvestigationsGeneralCasesRibbonButton(); InvestigationGeneralCaseSearchPage invGeneralCaseSearchPage = new InvestigationGeneralCaseSearchPage(driver); invGeneralCaseSearchPage.ClickNewGeneralCaseButton(); InvestigationGeneralCasePage investigationGeneralCasePage = new InvestigationGeneralCasePage(driver); BaseWindow = driver.CurrentWindowHandle; investigationGeneralCasePage.ClickPageTitle(); investigationGeneralCasePage.SetTitle("New General Case"); investigationGeneralCasePage.SetClientName(clientName); investigationGeneralCasePage.SetType("Complaint"); investigationGeneralCasePage.ClickSaveButton(); investigationGeneralCasePage.ClickActivitiesAddButton(); investigationGeneralCasePage.ClickAddActivity("Phone Call"); driver = investigationGeneralCasePage.SwitchNewBrowserWithTitle(driver, BaseWindow, "Phone Call"); phoneCall = new PhoneCallPage(driver); phoneCall.ClickPageTitle(); phoneCall.SetSelectSubjectValue("Bond balance enquiry"); phoneCall.SetSubject("Test 3309 General Case Phone Call"); phoneCall.SetRecipient(clientName); phoneCall.ClickSaveCloseButton(); driver = driver.SwitchTo().Window(BaseWindow); phoneCall.CheckForErrors(); investigationGeneralCasePage.ClickPageTitle(); table = new Table(investigationGeneralCasePage.GetActivitiesTable()); StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3309 General Case Phone Call", "Owner"), "IMSTestU03"); table.ClickCellValue("Subject", "Test 3309 General Case Phone Call", "Subject"); phoneCall = new PhoneCallPage(driver); StringAssert.Contains(phoneCall.GetSelectSubjectValue(), "Bond balance enquiry"); StringAssert.Contains(phoneCall.GetSubjectValue(), "Test 3309 General Case Phone Call"); StringAssert.Contains(phoneCall.GetRecipientValue(), clientName); StringAssert.Contains(phoneCall.GetSenderValue(), user.Id); #region Shut down Excel MyBook.Save(); MyBook.Close(); MyApp.Quit(); #endregion }