public void ATC4440_CRMClientPhoneDelete() { //Login as CRM default user. User user = this.environment.GetUser(SecurityRole.GeneralStaff); new LoginDialog().Login(user.Id, user.Password); /* Person Client is needed with following fields populated: - Personal Mobile - Personal Preferred Contact Number - Work Preferred Contact Number - Fax*/ string clientName = "CLIENT PHONEDEL" + UICommon.GetRandomString(3); HomePage homePage = new HomePage(driver); string HomeWindow = driver.CurrentWindowHandle; homePage.HoverCRMRibbonTab(); homePage.ClickClientServicesRibbonButton(); homePage.HoverClientServicesRibbonTab(); homePage.ClickClientsRibbonButton(); ClientsSearchPage clientsSearchPage = new ClientsSearchPage(driver); clientsSearchPage.ClickNewClientButton(); ClientPage clientPage = new ClientPage(driver); clientPage.ClickPageTitle(); Thread.Sleep(1000); clientPage.SetFamilyName(clientName); clientPage.ClickSaveButton(); //Navigate to client phone numbers driver = driver.SwitchTo().Window(HomeWindow); homePage.HoverClientXRibbonTab(clientName); homePage.ClickClientXPhoneNumbersRibbonButton(); //Add new phone numbers clientPage = new ClientPage(driver); string BaseWindow = driver.CurrentWindowHandle; clientPage.ClickAddNewClientPhoneImage(); //Enter payment reference details driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "Client Phone Number"); //Assert availability list ClientPhoneNumberPage clientPhoneNumberPage = new ClientPhoneNumberPage(driver); //Create Fixed Line Number clientPhoneNumberPage.SetTypeListValue("Fixed Line"); clientPhoneNumberPage.SetAreaCodeValue("07"); clientPhoneNumberPage.SetPhoneNumberValue("11111111"); clientPhoneNumberPage.ClickSaveButton(); //Assert new phone number has saved string FixedLineNumber = clientPhoneNumberPage.GetPhoneNumber(); clientPhoneNumberPage.ClickNewButton(); clientPhoneNumberPage.ClickPageTitle(); clientPhoneNumberPage.SetClientNameList(clientName); clientPhoneNumberPage.SetTypeListValue("Mobile"); clientPhoneNumberPage.SetPhoneNumberValue("0422222222"); clientPhoneNumberPage.ClickSaveButton(); //Assert new phone number has saved string MobileNumber = clientPhoneNumberPage.GetPhoneNumber(); clientPhoneNumberPage.ClickNewButton(); clientPhoneNumberPage.ClickPageTitle(); clientPhoneNumberPage.SetClientNameList(clientName); clientPhoneNumberPage.SetTypeListValue("Fax"); clientPhoneNumberPage.SetAreaCodeValue("07"); clientPhoneNumberPage.SetPhoneNumberValue("33333333"); clientPhoneNumberPage.ClickSaveButton(); //Assert new phone number has saved string FaxNumber = clientPhoneNumberPage.GetPhoneNumber(); clientPhoneNumberPage.ClickNewButton(); clientPhoneNumberPage.ClickPageTitle(); clientPhoneNumberPage.SetClientNameList(clientName); clientPhoneNumberPage.SetTypeListValue("Pager"); clientPhoneNumberPage.SetAreaCodeValue("07"); clientPhoneNumberPage.SetPhoneNumberValue("44444444"); clientPhoneNumberPage.ClickSaveButton(); //Assert new phone number has saved string PagerNumber = clientPhoneNumberPage.GetPhoneNumber(); clientPhoneNumberPage.ClickSaveCloseButton(); clientPhoneNumberPage.ClickSaveCloseButton(); clientPhoneNumberPage.ClickSaveCloseButton(); clientPhoneNumberPage.ClickSaveCloseButton(); // Verify that Activities table is not showing any activity driver = driver.SwitchTo().Window(HomeWindow); homePage.ClickClientXRibbonTab(clientName); clientPage = new ClientPage(driver); clientPage.ClickPageTitle(); Table table = new Table(UICommon.GetSearchResultTable(driver)); Assert.IsTrue(table.GetNoRecordsInTable(), "Client Phone Number Updation Activity Getting displayed !!!!!"); // Update the Personal Mobile, Personal Preferred Contact Number, Work Preferred Contact Number and Fax and save the record clientPage.SetMobileNumber(MobileNumber); clientPage.SetPersonalPreferredMobileNumber(FixedLineNumber); clientPage.SetWorkPreferredNumber(PagerNumber); clientPage.SetFaxNumber(FaxNumber); clientPage.ClickSaveButton(); string clientId = clientPage.GetClientID(); clientPage.ClickSaveCloseButton(); //Clients Services > Clients Double click on the prepared record clientsSearchPage = new ClientsSearchPage(driver); clientsSearchPage.SetClientSearchText(clientId); table = new Table(clientsSearchPage.GetSearchResultTable()); table.ClickCellValue("RTA Client Id", clientId, "Full Name"); clientPage = new ClientPage(driver); clientPage.ClickPageTitle(); Thread.Sleep(500); string date = DateTime.Today.ToString("d/MM/yyyy"); string time = DateTime.Now.ToString("h:mm tt"); /*Clear the following fields and save record: - Personal Mobile - Personal Preferred Contact Number - Work Preferred Contact Number - Fax*/ clientPage.ClearMobileNumber(); clientPage.ClickPageTitle(); clientPage.ClearPersonalPreferredMobileNumber(); clientPage.ClickPageTitle(); clientPage.ClearWorkPreferredNumber(); clientPage.ClickPageTitle(); clientPage.ClearFaxNumber(); clientPage.ClickSaveCloseButton(); clientsSearchPage = new ClientsSearchPage(driver); clientsSearchPage.SetClientSearchText(clientId); table = new Table(clientsSearchPage.GetSearchResultTable()); table.ClickCellValue("RTA Client Id", clientId, "Full Name"); clientPage = new ClientPage(driver); clientPage.ClickPageTitle(); //Inspect resultant entry in Activity sub grid. Table headerTable = new Table(clientPage.GetActivitiesHeaderTable()); headerTable.ClickTableColumnHeader("Actual End"); Thread.Sleep(2000); Table activitiesTable = new Table(clientPage.GetActivitiesTable()); Assert.IsTrue(activitiesTable.MatchingCellFound("Subject", "Client Profile Phone Number updated"), "Client Phone Number Updation Activity NOT displayed !!!!!"); activitiesTable.ClickCellValue("Subject", "Client Profile Phone Number updated", "Subject"); //Client Management Activity is created as a note to users that the phone numbers were changed (includes current value of each field and a note referring the user to audit history). ClientManagementActivityPage activityPage = new ClientManagementActivityPage(driver); activityPage.ClickPageTitle(); StringAssert.Contains(activityPage.GetDescription(), "Personal Mobile: [no value]"); StringAssert.Contains(activityPage.GetDescription(), "Personal Preferred Contact Number: [no value]"); StringAssert.Contains(activityPage.GetDescription(),"Work Preferred Contact Number: [no value]"); StringAssert.Contains(activityPage.GetDescription(), "Fax: [no value]"); StringAssert.Contains(activityPage.GetDescription(), "Note: the current values are displayed above. Refer to Audit History against the Client record for more information."); homePage.HoverCRMRibbonTab(); homePage.ClickClientServicesRibbonButton(); homePage.HoverClientServicesRibbonTab(); homePage.ClickClientsRibbonButton(); clientsSearchPage = new ClientsSearchPage(driver); clientsSearchPage.SetPageFilterList("Active Clients"); clientsSearchPage.SetClientSearchText(clientId); Table clientTable = new Table(clientsSearchPage.GetSearchResultTable()); IWebElement clientCell = clientTable.GetCellElementContainsValue("RTA Client Id", clientId, "Full Name"); UICommon.DoubleClickElement(clientCell, driver); Thread.Sleep(5000); clientPage = new ClientPage(driver, "Clients Quick"); /*Select the [Audit History] option from the entity navigation menu in the global ribbon. *Inspect audit history relating to deletions made in this test*/ homePage.HoverClientRibbonTab(clientName); homePage.ClickClientXAuditRibbonButton(); clientPage = new ClientPage(driver, "Clients Quick"); Thread.Sleep(2000); /*Audit history shows: - What was deleted - Who deleted it - When it was deleted - What previous value was*/ Table auditTable = new Table(clientPage.GetAuditHistoryTable()); StringAssert.Contains(auditTable.GetCellValue("Event", "Update", "Changed Field"), "Fax"); StringAssert.Contains(auditTable.GetCellValue("Event", "Update", "Changed Field"), "Mobile"); StringAssert.Contains(auditTable.GetCellValue("Event", "Update", "Changed Field"), "Personal Preferred Contact Number"); StringAssert.Contains(auditTable.GetCellValue("Event", "Update", "Changed Field"), "Work Preferred Contact Number"); StringAssert.Contains(auditTable.GetCellValue("Event", "Update", "Old Value"), "+61 7 3333 3333"); StringAssert.Contains(auditTable.GetCellValue("Event", "Update", "Old Value"), "+61 422 222 222"); StringAssert.Contains(auditTable.GetCellValue("Event", "Update", "Old Value"), "+61 7 3333 3333"); StringAssert.Contains(auditTable.GetCellValue("Event", "Update", "Old Value"), "+61 7 1111 1111"); StringAssert.Contains(auditTable.GetCellValue("Event", "Update", "Old Value"), "+61 7 4444 4444"); Assert.AreEqual(String.Empty, auditTable.GetCellValue("Event", "Update", "New Value").Trim()); Assert.AreEqual(user.Id.ToLower() + " user", auditTable.GetCellValue("Event", "Update", "Changed By").ToLower()); Assert.AreEqual(date + " " + time, auditTable.GetCellValue("Event", "Update", "Changed Date")); }
public void ATC4444_CRMClientEmailDelete() { //Login as CRM default user. User user = this.environment.GetUser(SecurityRole.GeneralStaff); new LoginDialog().Login(user.Id, user.Password); /*Data preparation step Organisation Client is needed with following fields populated: - Email 1 - Email 2*/ string clientName = "CLIENTEMAILDEL" + UICommon.GetRandomString(3); HomePage homePage = new HomePage(driver); string HomeWindow = driver.CurrentWindowHandle; homePage.HoverCRMRibbonTab(); homePage.ClickClientServicesRibbonButton(); homePage.HoverClientServicesRibbonTab(); homePage.ClickClientsRibbonButton(); ClientsSearchPage clientsSearchPage = new ClientsSearchPage(driver); clientsSearchPage.ClickNewClientButton(); ClientPage clientPage = new ClientPage(driver); clientPage.ClickPageTitle(); clientPage.SetClientType("Organisation"); clientPage.SetOrganizationName(clientName); clientPage.ClickSaveButton(); string email1 = clientName + "*****@*****.**"; string email2 = clientName + "*****@*****.**"; clientPage.SetEmail1ID(clientName + "*****@*****.**"); clientPage.SetEmail2ID(clientName + "*****@*****.**"); clientPage.ClickSaveButton(); Assert.AreEqual(email1, clientPage.GetEmail1ID(),"Validate the email id1 is set correctly"); Assert.AreEqual(email2, clientPage.GetEmail2ID(),"Validate the email id2 is set correctly"); string clientID = clientPage.GetClientID(); clientPage.ClickSaveCloseButton(); clientsSearchPage = new ClientsSearchPage(driver); clientsSearchPage.SetClientSearchText(clientID); Table clientTable = new Table(clientsSearchPage.GetSearchResultTable()); clientTable.ClickCellValue("RTA Client Id", clientID, "Full Name"); //Clear the following fields and save record:- Email 1- Email 2 clientPage = new ClientPage(driver); clientPage.ClearEmail1Id(); clientPage.ClearEmail2Id(); string date = DateTime.Today.ToString("d/MM/yyyy"); string time = DateTime.Now.ToString("h:mm tt"); clientPage.ClickSaveCloseButton(); clientsSearchPage = new ClientsSearchPage(driver); clientsSearchPage.SetClientSearchText(clientID); clientTable = new Table(clientsSearchPage.GetSearchResultTable()); clientTable.ClickCellValue("RTA Client Id", clientID, "Full Name"); clientPage = new ClientPage(driver); clientPage.ClickPageTitle(); //Inspect resultant entry in Activity sub grid. Table headerTable = new Table(clientPage.GetActivitiesHeaderTable()); headerTable.ClickTableColumnHeader("Actual End"); Thread.Sleep(2000); Table activitiesTable = new Table(clientPage.GetActivitiesTable()); //Client Management Activity is created as a note to users that the email address fields were changed (includes current value of each field and a note referring the user to audit history). Assert.IsTrue(activitiesTable.MatchingCellFound("Subject", "Client E-mail Address updated"), "Client Management Activity for Email field updation Created!!!"); activitiesTable.ClickCellValue("Subject", "Client E-mail Address updated", "Subject"); ClientManagementActivityPage activityPage = new ClientManagementActivityPage(driver); activityPage.ClickPageTitle(); StringAssert.Contains(activityPage.GetDescription(), "Email Address (primary): [no value]"); StringAssert.Contains(activityPage.GetDescription(), "Email Address (secondary): [no value]"); StringAssert.Contains(activityPage.GetDescription(), "Note: the current values are displayed above. Refer to Audit History against the Client record for more information."); //Select the [Audit History] option from the entity navigation menu in the global ribbon. Inspect audit history relating to deletions made in this test. homePage.HoverClientServicesRibbonTab(); homePage.ClickClientsRibbonButton(); clientsSearchPage = new ClientsSearchPage(driver); clientsSearchPage.SetClientSearchText(clientID); clientTable = new Table(clientsSearchPage.GetSearchResultTable()); clientTable.ClickCellValue("RTA Client Id", clientID, "Full Name"); clientPage = new ClientPage(driver); clientPage.ClickPageTitle(); homePage.HoverClientRibbonTab(clientName); homePage.ClickClientXAuditRibbonButton(); clientPage = new ClientPage(driver); Thread.Sleep(2000); /*Audit history shows: - What was deleted - Who deleted it - When it was deleted - What previous value was*/ clientPage = new ClientPage(driver); Table auditTable = new Table(clientPage.GetAuditHistoryTable()); StringAssert.Contains(auditTable.GetCellValue("Event", "Update", "Changed Field"), "Email Address (primary)"); StringAssert.Contains(auditTable.GetCellValue("Event", "Update", "Changed Field"), "Email Address (secondary)"); Assert.AreEqual(email1+System.Environment.NewLine+email2, auditTable.GetCellValue("Event", "Update", "Old Value")); Assert.AreEqual(String.Empty,auditTable.GetCellValue("Event", "Update", "New Value").Trim()); Assert.AreEqual(user.Id.ToLower() + " user", auditTable.GetCellValue("Event", "Update", "Changed By").ToLower()); Assert.AreEqual( date + " " +time, auditTable.GetCellValue("Event", "Update", "Changed Date")); }
public void ATC9361_CRMRegisterDocumentIntoInvestigationCase() { User user = this.environment.GetUser(SecurityRole.Investigations); new LoginDialog().Login(user.Id, user.Password); HomePage homePage = new HomePage(driver); homePage.HoverCRMRibbonTab(); homePage.ClickInvestigationsRibbonButton(); homePage.HoverInvestigationsRibbonTab(); homePage.ClickInvestigationsCasesRibbonButton(); InvestigationCaseSearchPage investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver); investigationsCaseSearchPage.ClickNewInvestigationCaseButton(); InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver); investigationCasePage.ClickSaveButton(); var investigationCase = investigationCasePage.GetInvestigationCaseNumber(); homePage.HoverClientRibbonTab(investigationCase.ToUpperInvariant()); Thread.Sleep(500); driver.FindElement(By.XPath("//a[@title='Documents' and @id='Node_navDocument']")).Click(); var directoryName = UICommon.GetAlertMessage(driver).Split(new[]{"/"}, StringSplitOptions.RemoveEmptyEntries).Last(); var baseWindow = driver.CurrentWindowHandle; //Records the current window handle var gridFrame = driver.SwitchTo().DefaultContent().SwitchTo().Frame("contentIFrame1").SwitchTo().Frame("areaDocumentFrame").SwitchTo().Frame("gridIframe"); var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30)); wait.Until(ExpectedConditions.ElementIsVisible(By.Id("mnuNewButton"))); gridFrame.FindElement(By.Id("mnuNewButton")).Click(); Thread.Sleep(1000); gridFrame.FindElement(By.XPath("//span[contains(text(), 'Investigation Case Document')]")).Click(); Thread.Sleep(3000); SwitchWindow(baseWindow); var a = new Actions(driver); var fileUpload = driver.SwitchTo().Frame("spPageFrame").FindElement(By.Id("ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_InputFile")); a.DoubleClick(fileUpload).Build().Perform(); Thread.Sleep(2000); var myFile = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "inv_case_doc.txt"); if (File.Exists(myFile)) File.Delete(myFile); var sw = new StreamWriter(myFile); sw.WriteLine("Hello world!"); sw.Flush(); sw.Close(); var ai = new AutoItX3(); var winTitle = "Choose File to Upload"; int found = ai.WinWait(winTitle, "", Properties.Settings.Default.SHORT_WAIT_SECONDS); if (found == 1) { ai.WinActivate(winTitle); ai.Send(myFile); ai.Send("{ENTER}"); ai.WinWaitClose(winTitle); } else { throw new Exception("Unable to locate open file dialog"); } wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30)); wait.Until(ExpectedConditions.ElementIsVisible(By.Id("ctl00_PlaceHolderMain_ctl03_RptControls_btnOK"))); driver.FindElement(By.Id("ctl00_PlaceHolderMain_ctl03_RptControls_btnOK")).Click(); wait.Until(ExpectedConditions.ElementIsVisible(By.Id("Ribbon.DocLibListForm.Edit.Commit.Publish-Large"))); driver.FindElement(By.Id("Ribbon.DocLibListForm.Edit.Commit.Publish-Large")).Click(); gridFrame = driver.SwitchTo().DefaultContent().SwitchTo().Frame("contentIFrame1").SwitchTo().Frame("areaDocumentFrame").SwitchTo().Frame("gridIframe"); var table = gridFrame.FindElement(By.XPath("//div[@id='divDataArea']/div/table")); // verify document is in the table if (!table.IsTextInTable("inv_case_doc.txt")) throw new Exception("Unable to locate file in CRM"); gridFrame.FindElement(By.Id("openSharepointButton")).Click(); Thread.Sleep(5000); SwitchWindow(baseWindow); var spTable = driver.FindElement(By.Id("onetidDoclibViewTbl0")); // verify document is in the table if (!spTable.IsTextInTable("inv_case_doc.txt")) throw new Exception("Unable to locate file in Sharepoint"); driver = driver.SwitchTo().Window(baseWindow); }