public void ATC3343_CRMAlterCloseReopenFrontCounterActivity() { #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.ToString(); string FrontCounterActivity1 = "TC 3343 Front Counter Activity 1" + UICommon.GetRandomString(3); string FrontCounterActivity2 = "TC 3343 Front Counter Activity 2" + UICommon.GetRandomString(3); User user = this.environment.GetUser(SecurityRole.Investigations); new LoginDialog().Login(user.Id, user.Password); HomePage homePage = new HomePage(driver); String HomeWindow = driver.CurrentWindowHandle; homePage.ClickCreateIMG(); homePage.ClickFrontCounterContactActivityRibbonButton(); FrontCounterContactPage frontCounterContactPage = new FrontCounterContactPage(driver); frontCounterContactPage.ClickPageTitle(); // Assign a Client and fill in all possisble fields. frontCounterContactPage.SetSelectSubjectValue("Bond existence"); frontCounterContactPage.SetSubjectValue(FrontCounterActivity1); frontCounterContactPage.SetClientName(ClientName); frontCounterContactPage.ClickSaveCloseButton(); driver = driver.SwitchTo().Window(HomeWindow); homePage.ClickCreateIMG(); homePage.ClickFrontCounterContactActivityRibbonButton(); frontCounterContactPage = new FrontCounterContactPage(driver); frontCounterContactPage.ClickPageTitle(); // Assign a Client and fill in all possisble fields. frontCounterContactPage.SetSelectSubjectValue("Bond existence"); frontCounterContactPage.SetSubjectValue(FrontCounterActivity2); frontCounterContactPage.SetClientName(ClientName); frontCounterContactPage.ClickSaveCloseButton(); driver.Quit(); driver = null; this.TestSetup(); user = this.environment.GetUser(SecurityRole.SystemAdministrator); new LoginDialog().Login(user.Id, user.Password); homePage = new HomePage(driver); 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.PopulateNewClient("Test"); clientPage.ClickSaveButton(); string ClientID = clientPage.GetClientID(); clientPage.ClickSaveCloseButton(); driver = driver.SwitchTo().Window(HomeWindow); homePage.HoverCRMRibbonTab(); homePage.ClickClientServicesRibbonButton(); homePage.HoverClientServicesRibbonTab(); homePage.ClickClientActivitiesRibbonButton(); // Open an existing Front Counter Contact activity (not created by your test user) from the list. ActivitiesSearchPage activitiesSearchPage = new ActivitiesSearchPage(driver); string BaseWindow = driver.CurrentWindowHandle; activitiesSearchPage.SetTenancyRequestSearchText(FrontCounterActivity1); Table table = new Table(activitiesSearchPage.GetSearchResultTable()); table.ClickCellValue("Activity Type", "Front Counter Contact", "Subject"); frontCounterContactPage = new FrontCounterContactPage(driver); // Modify an aspect of the activity - add a client and change the description and then save the Activity. frontCounterContactPage.SetClientName("TEST"); frontCounterContactPage.SetDescription("Modify Front Counter Activity"); frontCounterContactPage.ClickSaveButton(); frontCounterContactPage.ClickPageTitle(); // Activity saves without error. StringAssert.Contains(frontCounterContactPage.GetClientName(), "TEST"); StringAssert.Contains(frontCounterContactPage.GetDescription(), "Modify Front Counter Activity"); frontCounterContactPage.ClickSaveCloseButton(); // Open another Front Counter Contact which has not been created by your test user. driver = driver.SwitchTo().Window(BaseWindow); activitiesSearchPage = new ActivitiesSearchPage(driver); activitiesSearchPage.SetTenancyRequestSearchText(FrontCounterActivity2); table = new Table(activitiesSearchPage.GetSearchResultTable()); table.ClickCellValue("Activity Type", "Front Counter Contact", "Subject"); frontCounterContactPage = new FrontCounterContactPage(driver); // Close the Front Counter Contact.Activity Closes without any error frontCounterContactPage.ClickPageTitle(); Thread.Sleep(500); frontCounterContactPage.ClickCloseFrontCounterContactButton(); Thread.Sleep(500); frontCounterContactPage.ClickDialogAddButton(); Thread.Sleep(1000); // Ensure that the Activity does not allow editing. frontCounterContactPage.ClickPageTitle(); Assert.IsTrue(UICommon.VerifyElementLocked("subject", driver), "Subject Field is NOT locked!!!"); Assert.IsTrue(UICommon.VerifyElementLocked("customers", driver), "customers Field is NOT locked!!!"); Assert.IsTrue(UICommon.VerifyElementLocked("actualend", driver), "actualend Field is NOT locked!!!"); Assert.IsTrue(UICommon.VerifyElementLocked("actualdurationminutes", driver), "Actual Duration Field is NOT locked!!!"); Assert.IsTrue(UICommon.VerifyElementLocked("regardingobjectid", driver), "Regarding Field is NOT locked!!!"); Assert.IsTrue(UICommon.VerifyElementLocked("rta_assistive_service_usedid", driver), "Assistive Service Field is NOT locked!!!"); Assert.IsTrue(UICommon.VerifyElementLocked("description", driver), "Description Field is NOT locked!!!"); // Reopen the Front Counter Contact through the Dialog. frontCounterContactPage.ClickStartDialogButton(); table = new Table(frontCounterContactPage.GetProcessSearchResultTable()); table.ClickCell("Process Name", "Re-open Front Counter Contact activity", "Created On"); BaseWindow = driver.CurrentWindowHandle; frontCounterContactPage.ClickDialogAddButton(); driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "Re-open Front Counter Contact activity"); ReOpenCall reOpenActivity = new ReOpenCall(driver); reOpenActivity.ClickNextButton(); reOpenActivity.ClickFinishButton(); driver = driver.SwitchTo().Window(HomeWindow); homePage.HoverClientServicesRibbonTab(); homePage.ClickClientActivitiesRibbonButton(); // Open an existing Front Counter Contact activity (not created by your test user) from the list. activitiesSearchPage = new ActivitiesSearchPage(driver); activitiesSearchPage.SetTenancyRequestSearchText(FrontCounterActivity2); table = new Table(activitiesSearchPage.GetSearchResultTable()); table.ClickCellValue("Activity Type", "Front Counter Contact", "Subject"); frontCounterContactPage = new FrontCounterContactPage(driver); frontCounterContactPage.ClickPageTitle(); // Ensure that the Activity allows editing. Assert.IsFalse(UICommon.VerifyElementLocked("subject", driver), "Subject Field is locked!!!"); Assert.IsFalse(UICommon.VerifyElementLocked("customers", driver), "customers Field is locked!!!"); Assert.IsFalse(UICommon.VerifyElementLocked("actualend", driver), "actualend Field is locked!!!"); Assert.IsFalse(UICommon.VerifyElementLocked("actualdurationminutes", driver), "Actual Duration Field is locked!!!"); Assert.IsFalse(UICommon.VerifyElementLocked("regardingobjectid", driver), "Regarding Field is locked!!!"); Assert.IsFalse(UICommon.VerifyElementLocked("rta_assistive_service_usedid", driver), "Assistive Service Field is locked!!!"); Assert.IsFalse(UICommon.VerifyElementLocked("description", driver), "Description Field is locked!!!"); frontCounterContactPage.SetDescription("Description updated after reopening activity"); frontCounterContactPage.ClickPageTitle(); StringAssert.Contains(frontCounterContactPage.GetDescription(), "Description updated after reopening activity"); }