public void ATC3313_CRMInvestigationAddAndDeactivateCaseParty()
        {
            User user = this.environment.GetUser(SecurityRole.InvestigationOfficer);
            new LoginDialog().Login(user.Id, user.Password);
            string ClientName = "CLIENT CASE" + UICommon.GetRandomString(3);

            // Create Investigation Case
            HomePage homePage = new HomePage(driver);
            string HomeWindowInv = 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 Investigation case
            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickSaveButton();
            String investigationID = investigationCasePage.GetInvestigationCaseNumber();

            string InvWindow = driver.CurrentWindowHandle;

            IWebDriver ClientDriver = null;
            // Spawn a new window and open a Client record
            if (Properties.Settings.Default.BROWSER == BrowserType.Ie)
            {
                ClientDriver = new BrowserContext().WebDriver;
                this.environment = TestEnvironment.GetTestEnvironment();
            }

            ClientDriver.Navigate().GoToUrl(this.environment.Url);
            new LoginDialog().Login(user.Id, user.Password);

            // Create new Client Profile
            homePage = new HomePage(ClientDriver);
            string HomeWindowClient = ClientDriver.CurrentWindowHandle;
            homePage.HoverCRMRibbonTab();
            homePage.ClickClientServicesRibbonButton();
            homePage.HoverClientServicesRibbonTab();
            homePage.ClickClientsRibbonButton();

            ClientsSearchPage clientsSearchPage = new ClientsSearchPage(ClientDriver);
            Trace.Listeners.Add(new TextWriterTraceListener("TextWriterOutput.log", "myListener"));
            Trace.TraceInformation("Add Client Case Party start:" + DateTime.Now.ToString("ddMMyyyyhhmmssffff"));
            Trace.Flush();

            clientsSearchPage.ClickNewClientButton();

            ClientPage clientPage = new ClientPage(ClientDriver);
            clientPage.ClickPageTitle();
            clientPage.PopulateNewClient(ClientName);
            clientPage.ClickSaveCloseButton();
            string ClientWindow = ClientDriver.CurrentWindowHandle;

            // ADD the Client from the second open window as a Case Party to the Investigation Case
            driver.SwitchTo().Window(InvWindow);
            investigationCasePage = new InvestigationCasePage(driver);
            string BaseWindow = driver.CurrentWindowHandle;
            investigationCasePage.ClickAddCasePartyRecordButton();

            investigationCasePage.SwitchNewBrowserWithTitle(driver, BaseWindow, "Case Party");

            CasePartyPage casePartyPage = new CasePartyPage(driver);
            casePartyPage.ClickPageTitle();
            casePartyPage.ClickPartyType();
            Assert.IsTrue(casePartyPage.VerifyCasePartyTypeExists("Bond Contributor"), "Bond Contributor option not seen!!!");
            Assert.IsTrue(casePartyPage.VerifyCasePartyTypeExists("Tenant"), "Tenant option not seen!!!");
            Assert.IsTrue(casePartyPage.VerifyCasePartyTypeExists("Resident"), "Resident option not seen!!!");
            Assert.IsTrue(casePartyPage.VerifyCasePartyTypeExists("Agent"), "Agent option not seen!!!");
            Assert.IsTrue(casePartyPage.VerifyCasePartyTypeExists("Lessor"), "Lessor option not seen!!!");
            Assert.IsTrue(casePartyPage.VerifyCasePartyTypeExists("Rooming Accommodation Provider"), "Rooming Accommodation Provider option not seen!!!");
            Assert.IsTrue(casePartyPage.VerifyCasePartyTypeExists("Student Accommodation Provider"), "Student Accommodation Provider option not seen!!!");
            Assert.IsTrue(casePartyPage.VerifyCasePartyTypeExists("Moveable Dwelling Provider"), "Moveable Dwelling Provider option not seen!!!");
            Assert.IsTrue(casePartyPage.VerifyCasePartyTypeExists("Community Housing Organisation"), "Community Housing Organisation option not seen!!!");
            Assert.IsTrue(casePartyPage.VerifyCasePartyTypeExists("Owner"), "Owner option not seen!!!");
            Trace.Listeners.Add(new TextWriterTraceListener("TextWriterOutput.log", "myListener"));
            Trace.TraceInformation("Add Case Party end:" + DateTime.Now.ToString("ddMMyyyyhhmmssffff"));
            Trace.Flush();
            casePartyPage.ClickPageTitle();
            casePartyPage.SetClientName(ClientName);
            casePartyPage.ClickSaveCloseButton();

            driver = driver.SwitchTo().Window(BaseWindow);
            investigationCasePage.CheckForErrors();
            investigationCasePage.ClickSaveCloseButton();

            // Verify new Case Management Activity is shown in the Investigation Case which documents that the Case Party was added and by whom.

            investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationsCaseSearchPage.SetSearchRecord(investigationID);

            Table table = new Table(investigationsCaseSearchPage.GetSearchResultTable());
            table.ClickCellValue("Case Number", investigationID, "Case Number");
            driver = driver.SwitchTo().Window(BaseWindow);
            investigationCasePage.ClickPageTitle();
            table = new Table(investigationCasePage.GetActivitiesSearchResultTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Case party " + ClientName + " added to case " + investigationID, "Activity Status"), "Completed");
            InvWindow = driver.CurrentWindowHandle;

            //Client window
            ClientDriver = ClientDriver.SwitchTo().Window(ClientWindow);
            clientsSearchPage = new ClientsSearchPage(ClientDriver);
            clientsSearchPage.SetClientSearchText(ClientName);

            table = new Table(clientsSearchPage.GetSearchResultTable());
            table.ClickCellValue("Full Name", ClientName, "Full Name");

            clientPage = new ClientPage(ClientDriver);
            Thread.Sleep(3000);
            clientPage.ClickSeeRecordsAssociatedWithThisViewButton("Activities");
            clientPage.SwitchToFrame();
            clientPage.SetPageFilterList("All Activities", ClientDriver);
            clientPage.SetFilterOnList("All", ClientDriver);
            table = new Table(clientPage.GetActivitiesAssociatedViewTable(ClientDriver));
            StringAssert.Contains(table.GetCellValue("Subject", "Case party " + ClientName + " added to case " + investigationID, "Activity Status"), "Completed");
            ClientWindow = ClientDriver.CurrentWindowHandle;

            // DEACTIVATE the Case Party by opening the Case Party Associated View and running the Dialog.
            driver = driver.SwitchTo().Window(InvWindow);
            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickPageTitle();
            table = new Table(investigationCasePage.GetCasePartyTable());
            table.ClickCellContainsValueEnterRow("Client", ClientName, "Party Type");

            casePartyPage = new CasePartyPage(driver);
            casePartyPage.ClickPageTitle();
            casePartyPage.ClickSaveButton();
            casePartyPage.ClickStartDialog();
            table = new Table(casePartyPage.GetProcessSearchResultTable());
            table.ClickCell("Process Name", "INV: Deactivate case party", "Created On");
            BaseWindow = driver.CurrentWindowHandle;
            casePartyPage.ClickDialogAddButton();

            driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "INV:");

            INVPage INV = new INVPage(driver);
            INV.ClickNextButton();
            INV.ClickFinishButton();

            driver = driver.SwitchTo().Window(BaseWindow);
            casePartyPage.ClickSaveCloseButton();

            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickPageTitle();

            table = new Table(investigationCasePage.GetActivitiesSearchResultTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Case party " + ClientName + " removed from case " + investigationID, "Activity Status"), "Completed");

            // A new Case Management Activity is shown in the Client which documents that the Case Party was removed and by whom.

            ClientDriver = ClientDriver.SwitchTo().Window(ClientWindow);
            ClientDriver = ClientDriver.SwitchTo().Window(HomeWindowClient);
            homePage.HoverCRMRibbonTab();
            homePage.ClickClientServicesRibbonButton();
            homePage.HoverClientServicesRibbonTab();
            homePage.ClickClientsRibbonButton();

            clientsSearchPage = new ClientsSearchPage(ClientDriver);
            clientsSearchPage.SetClientSearchText(ClientName);

            table = new Table(clientsSearchPage.GetSearchResultTable());
            table.ClickCellValue("Full Name", ClientName, "Full Name");

            clientPage = new ClientPage(ClientDriver);
            clientPage.ClickPageTitle();
            clientPage.ClickSeeRecordsAssociatedWithThisViewButton("Activities");
            clientPage.SwitchToFrame();
            clientPage.SetPageFilterList("All Activities", ClientDriver);
            clientPage.SetFilterOnList("All", ClientDriver);
            table = new Table(clientPage.GetActivitiesAssociatedViewTable(ClientDriver));
            StringAssert.Contains(table.GetCellValue("Subject", "Case party " + ClientName + " removed from case " + investigationID, "Activity Status"), "Completed");
        }
        public void ATC3311_CRMInvestigationVerifyActionFollowupDateRemoval()
        {
            User user = this.environment.GetUser(SecurityRole.InvestigationsOfficer);
            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();

            // Create new case and validate Status and Substatus fields
            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickSaveButton();
            String caseNumber = investigationCasePage.GetInvestigationCaseNumber();
            investigationCasePage.ClickSaveCloseButton();

            // Search for the newly created Investigation Case
            investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationsCaseSearchPage.SetInvestigationSearchText(caseNumber);
            Table table = new Table(investigationsCaseSearchPage.GetSearchResultTable());
            table.ClickCellValue("Case Number", caseNumber, "Case Number");

            // Validate Action Date and Followup date fields are removed
            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickPageTitle();

            Assert.IsFalse(investigationCasePage.VerifyElementExists("#rta_action_date_c"), "Action Date Present with CssValue rta_action_date_c");
            Assert.IsFalse(investigationCasePage.VerifyElementExists("#rta_inv_action_dateid_c"), "Action Date Present with CssValue rta_inv_action_dateid_c");
            Assert.IsFalse(investigationCasePage.VerifyElementExists("#rta_investigation_action_dateid_c"), "Action Date Present with CssValue rta_investigation_action_dateid_c");
            Assert.IsFalse(investigationCasePage.VerifyElementExists("#action_date_c"), "Action Date Present with CssValue action_date_c");
            Assert.IsFalse(investigationCasePage.VerifyElementExists("#rta_action_dateid_c"), "Action Date Present with CssValue rta_action_dateid_c");

            Assert.IsFalse(investigationCasePage.VerifyElementExists("#rta_followup_date_c"), "Follow up date field present with CssValue: rta_followup_date_c");
            Assert.IsFalse(investigationCasePage.VerifyElementExists("#rta_inv_followup_dateid_c"), "Follow up date field present with CssValue: rta_inv_followup_dateid_c");
            Assert.IsFalse(investigationCasePage.VerifyElementExists("#rta_investigation_followup_dateid_c"), "Follow up date field present with CssValue: rta_investigation_followup_dateid_c");
            Assert.IsFalse(investigationCasePage.VerifyElementExists("#followup_date_c"), "Follow up date field present with CssValue: followup_date_c");
            Assert.IsFalse(investigationCasePage.VerifyElementExists("#rta_followup_dateid_c"), "Follow up date field present with CssValue: rta_followup_dateid_c");
        }
        public void ATC3312_CRMInvestigationCaseCloseAndReopen()
        {
            //There is only 1
            string InvestigationWindowHandle; // for driver
            string ClientWindowHandle; // for ClientDriver

            string ClientName = "CLIENT CASE" + UICommon.GetRandomString(3);

            User user = this.environment.GetUser(SecurityRole.InvestigationOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            // Create Investigation Case
            HomePage homePageInvestigation = new HomePage(driver);
            InvestigationWindowHandle = driver.CurrentWindowHandle;
            homePageInvestigation.HoverCRMRibbonTab();
            homePageInvestigation.ClickInvestigationsRibbonButton();
            homePageInvestigation.HoverInvestigationsRibbonTab();
            homePageInvestigation.ClickInvestigationsCasesRibbonButton();

            // Verify that Investigation Officer is able to record Phone call for Investigation Case
            InvestigationCaseSearchPage investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationsCaseSearchPage.ClickNewInvestigationCaseButton();

            // Create new Investigation case
            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickSaveButton();
            String investigationID = investigationCasePage.GetInvestigationCaseNumber();

            IWebDriver ClientDriver = null;
            // Spawn a new window and open a Client record
            if (Properties.Settings.Default.BROWSER == BrowserType.Ie)
            {
                ClientDriver = new BrowserContext().WebDriver;
                this.environment = TestEnvironment.GetTestEnvironment();
            }

            ClientDriver.Navigate().GoToUrl(this.environment.Url);
            new LoginDialog().Login(user.Id, user.Password);

            // Create new Client Profile
            HomePage homePageClient = new HomePage(ClientDriver);
            ClientWindowHandle = ClientDriver.CurrentWindowHandle;
            homePageClient.HoverCRMRibbonTab();
            homePageClient.ClickClientServicesRibbonButton();
            homePageClient.HoverClientServicesRibbonTab();
            homePageClient.ClickClientsRibbonButton();

            ClientsSearchPage clientsSearchPage = new ClientsSearchPage(ClientDriver);
            clientsSearchPage.ClickNewClientButton();

            ClientPage clientPage = new ClientPage(ClientDriver);
            clientPage.ClickPageTitle();
            clientPage.PopulateNewClient(ClientName);
            clientPage.ClickSaveCloseButton();
            Thread.Sleep(3000);
            clientsSearchPage = new ClientsSearchPage(ClientDriver);

            // ADD the Client from the second open window as a Case Party to the Investigation Case
            driver.SwitchTo().Window(InvestigationWindowHandle);
            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickAddCasePartyRecordButton();

            investigationCasePage.SwitchNewBrowserWithTitle(driver, InvestigationWindowHandle, "Case Party");

            CasePartyPage casePartyPage = new CasePartyPage(driver);
            casePartyPage.ClickPageTitle();
            casePartyPage.SetClientName(ClientName);
            casePartyPage.ClickSaveCloseButton();
            Thread.Sleep(3000);

            driver = driver.SwitchTo().Window(InvestigationWindowHandle);
            investigationCasePage.ClickSaveCloseButton();

            // Verify new Case Management Activity is shown in the Investigation Case which documents that the Case Party was added and by whom.
            investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationsCaseSearchPage.SetSearchRecord(investigationID);
            Table table = new Table(investigationsCaseSearchPage.GetSearchResultTable());
            table.ClickCellValue("Case Number", investigationID, "Case Number");

            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickPageTitle();
            table = new Table(investigationCasePage.GetActivitiesSearchResultTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Case party " + ClientName + " added to case " + investigationID, "Activity Status"), "Completed");
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Case party " + ClientName + " added to case " + investigationID, "Modified By"), "SRCRM5-TEAdmin Last Name");

            //Client window
            ClientDriver = ClientDriver.SwitchTo().Window(ClientWindowHandle);
            clientsSearchPage = new ClientsSearchPage(ClientDriver);
            clientsSearchPage.SetClientSearchText(ClientName);

            table = new Table(clientsSearchPage.GetSearchResultTable());
            table.ClickCellValue("Full Name", ClientName, "Full Name");

            clientPage = new ClientPage(ClientDriver);
            clientPage.ClickSeeRecordsAssociatedWithThisViewButton("Activities");

            clientPage.SwitchToFrame();

            clientPage.SetPageFilterList("All Activities", ClientDriver);
            clientPage.SetFilterOnList("All", ClientDriver);
            table = new Table(clientPage.GetActivitiesAssociatedViewTable(ClientDriver));
            StringAssert.Contains(table.GetCellValue("Subject", "Case party " + ClientName + " added to case " + investigationID, "Activity Status"), "Completed");
            StringAssert.Contains(table.GetCellValue("Subject", "Case party " + ClientName + " added to case " + investigationID, "Modified By"), "SRCRM5-TEAdmin Last Name");

            // Investigation Case window, SELECT Start Dialog and close the Investigation case
            driver.SwitchTo().Window(InvestigationWindowHandle);
            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickStartDialogButton();

            table = new Table(investigationCasePage.GetProcessSearchResultTable());
            table.ClickCell("Process Name", "INV: Close investigation case", "Created On");
            investigationCasePage.ClickDialogAddButton();

            driver = UICommon.SwitchToNewBrowserWithTitle(driver, InvestigationWindowHandle, "INV:");

            INVPage iNVPage = new INVPage(driver);
            iNVPage.ClickNextButton();
            iNVPage.ClickNextButton();
            iNVPage.ClickNextButton();
            iNVPage.ClickFinishButton();
            Thread.Sleep(3000);

            driver = driver.SwitchTo().Window(InvestigationWindowHandle);
            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickSaveCloseButton();

            // Investigation Case is shown as Inactive. A new Case Management Activity is shown in the Investigation Case which documents that the case was closed and by whom.
            investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationsCaseSearchPage.SetPageFilterList("All Investigation Cases");

            table = new Table(investigationsCaseSearchPage.GetHeaderSearchResultTable());
            table.ClickTableColumnHeader("Case Number");

            table = new Table(investigationsCaseSearchPage.GetSearchResultTable());
            table.ClickCellValue("Case Number", investigationID, "Case Number");

            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickPageTitle();
            StringAssert.Contains(investigationCasePage.GetStatus(), "Closed");
            table = new Table(investigationCasePage.GetActivitiesSearchResultTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", investigationID + " case closed: Act applies-Insufficient evidence", "Activity Status"), "Completed");
            StringAssert.Contains(table.GetCellContainsValue("Subject", investigationID + " case closed: Act applies-Insufficient evidence", "Modified By"), "IMSTestU03");

            // A new Case Management Activity is shown in the Client which documents that the case was closed and by whom.
            ClientDriver.SwitchTo().Window(ClientWindowHandle);
            homePageClient.HoverCRMRibbonTab();
            homePageClient.ClickClientServicesRibbonButton();
            homePageClient.HoverClientServicesRibbonTab();
            homePageClient.ClickClientsRibbonButton();

            clientsSearchPage = new ClientsSearchPage(ClientDriver);
            clientsSearchPage.SetClientSearchText(ClientName);

            table = new Table(clientsSearchPage.GetSearchResultTable());
            table.ClickCellValue("Full Name", ClientName, "Full Name");

            clientPage = new ClientPage(ClientDriver);
            clientPage.ClickSeeRecordsAssociatedWithThisViewButton("Activities");

            clientPage.SwitchToFrame();

            Thread.Sleep(1000);
            clientPage.SetPageFilterList("All Activities", ClientDriver);
            clientPage.SetFilterOnList("All", ClientDriver);
            table = new Table(clientPage.GetActivitiesAssociatedViewTable(ClientDriver));
            Console.WriteLine(table.GetRowCount());
            StringAssert.Contains(table.GetCellValue("Subject", investigationID + " case closed: Act applies-Insufficient evidence", "Activity Status"), "Completed");
            StringAssert.Contains(table.GetCellValue("Subject", investigationID + " case closed: Act applies-Insufficient evidence", "Modified By"), "IMSTestU03");

            // In the Investigation Case, SELECT Start Dialog and Re-Open the case
            driver.SwitchTo().Window(InvestigationWindowHandle);
            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickStartDialogButton();

            table = new Table(investigationCasePage.GetProcessSearchResultTable());
            table.ClickCell("Process Name", "INV: Re-open investigation case", "Created On");
            investigationCasePage.ClickDialogAddButton();

            driver = UICommon.SwitchToNewBrowserWithTitle(driver, InvestigationWindowHandle, "INV:");

            iNVPage = new INVPage(driver);
            iNVPage.ClickNextButton();
            iNVPage.ClickNextButton();
            iNVPage.ClickFinishButton();

            driver = driver.SwitchTo().Window(InvestigationWindowHandle);
            investigationCasePage = new InvestigationCasePage(driver);
            homePageInvestigation.HoverInvestigationsRibbonTab();
            homePageInvestigation.ClickInvestigationsCasesRibbonButton();
            investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationsCaseSearchPage.SetSearchRecord(investigationID);

            table = new Table(investigationsCaseSearchPage.GetSearchResultTable());
            table.ClickCellValue("Case Number", investigationID, "Case Number");

            // Investigation Case is shown as Active. A new Case Management Activity is shown in the Investigation Case which documents that the case was closed and by whom.
            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickPageTitle();
            StringAssert.Contains(investigationCasePage.GetStatus(), "Case finalisation");
            table = new Table(investigationCasePage.GetActivitiesSearchResultTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", investigationID + " case re-opened: Case finalisation - Case closed discussion", "Activity Status"), "Completed");
            StringAssert.Contains(table.GetCellContainsValue("Subject", investigationID + " case re-opened: Case finalisation - Case closed discussion", "Modified By"), "IMSTestU03");

            // A new Case Management Activity is shown in the Client which documents that the case was reopened and by whom.
            ClientDriver.SwitchTo().Window(ClientWindowHandle);
            homePageClient.HoverClientServicesRibbonTab();
            homePageClient.ClickClientsRibbonButton();
            clientsSearchPage = new ClientsSearchPage(ClientDriver);
            clientsSearchPage.SetClientSearchText(ClientName);

            table = new Table(clientsSearchPage.GetSearchResultTable());
            table.ClickCellValue("Full Name", ClientName, "Full Name");

            clientPage = new ClientPage(ClientDriver);
            clientPage.ClickSeeRecordsAssociatedWithThisViewButton("Activities");

            clientPage.SwitchToFrame();
            Thread.Sleep(1000);
            clientPage.SetPageFilterList("All Activities", ClientDriver);
            clientPage.SetFilterOnList("All", ClientDriver);
            table = new Table(clientPage.GetActivitiesAssociatedViewTable(ClientDriver));
            StringAssert.Contains(table.GetCellValue("Subject", investigationID + " case re-opened: Case finalisation - Case closed discussion", "Activity Status"), "Completed");
            StringAssert.Contains(table.GetCellValue("Subject", investigationID + " case re-opened: Case finalisation - Case closed discussion", "Modified By"), "IMSTestU03");
        }
        public void ATC6834_CRMInvestigationValidateDurationWithoutReceivedDateSet()
        {
            //Login in as role
            User user = this.environment.GetUser(SecurityRole.InvestigationsOfficer);

            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickInvestigationsRibbonButton();
            homePage.HoverInvestigationsRibbonTab();
            homePage.ClickInvestigationsCasesRibbonButton();

            // Create new investigation case
            InvestigationCaseSearchPage investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationCaseSearchPage.ClickNewInvestigationCaseButton();

            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            string BaseWindow = driver.CurrentWindowHandle;
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickSaveButton();

            string investigationID = investigationCasePage.GetInvestigationCaseNumber();

            // Now close the investigation case
            investigationCasePage.ClickStartDialogButton();
            Table table = new Table(investigationCasePage.GetProcessSearchResultTable());
            table.ClickCell("Process Name", "INV: Close investigation case", "Created On");
            BaseWindow = driver.CurrentWindowHandle; //Records the current window handle
            investigationCasePage.ClickDialogAddButton();

            driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "INV:");

            INVPage iNVPage = new INVPage(driver);
            iNVPage.ClickNextButton();
            iNVPage.ClickNextButton();
            iNVPage.SetDate(DateTime.Today.ToString("dd-MM-yyyy"));
            iNVPage.ClickNextButton();
            iNVPage.ClickFinishButton();

            driver = driver.SwitchTo().Window(BaseWindow);

            // Now Investigation case is closed.. Verify that this case is not seen in active Investigation case
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickSaveCloseButton();

            investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);

            investigationCaseSearchPage.SetPageFilterList("Inactive Investigation Cases");
            investigationCaseSearchPage.SetSearchRecord(investigationID);
            table = new Table(investigationCaseSearchPage.GetSearchResultTable());
            table.ClickCellValue("Case Number", investigationID, "Case Number");

            Thread.Sleep(100);

            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickPageTitle();

            // Verify the Duration field value...
            Assert.AreEqual(0, investigationCasePage.GetDurationDaysValue(), "Duration field showing wrong days");
        }
        public void ATC9200_CRMInvestigationClosingACaseWhichDoesNotHaveCasePartyShouldNotGiveError()
        {
            //Login in as role
            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();

            // Create new investigation case
            InvestigationCaseSearchPage investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationCaseSearchPage.ClickNewInvestigationCaseButton();

            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickSaveButton();
            string investigationID = investigationCasePage.GetInvestigationCaseNumber();
            investigationCasePage.ClickStartDialogButton();

            Table table = new Table(investigationCasePage.GetProcessSearchResultTable());
            table.ClickCell("Process Name", "INV: Close investigation case", "Created On");
            string BaseWindow = driver.CurrentWindowHandle; //Records the current window handle
            investigationCasePage.ClickDialogAddButton();

            driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "INV:");
            INVPage iNVPage = new INVPage(driver);
            iNVPage.ClickNextButton();
            iNVPage.ClickNextButton();
            iNVPage.ClickNextButton();

            iNVPage.ClickFinishButton();

            driver = driver.SwitchTo().Window(BaseWindow);

            investigationCasePage.ClickSaveCloseButton();

            investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);

            investigationCaseSearchPage.SetPageFilterList("Inactive Investigation Cases");

            table = new Table(investigationCaseSearchPage.GetHeaderSearchResultTable());
            table.ClickTableColumnHeader("Case Number");
            table.ClickTableColumnHeader("Case Number");

            table = new Table(investigationCaseSearchPage.GetSearchResultTable());
            table.ClickCellValue("Case Number", investigationID, "Case Number");

            Thread.Sleep(1000);

            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickStartDialogButton();

            table = new Table(investigationCasePage.GetProcessSearchResultTable());
            table.ClickCell("Process Name", "INV: Re-open investigation case", "Created On");
            string HomeWindow = driver.CurrentWindowHandle;

            investigationCasePage.ClickDialogAddButton();

            driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "INV:");

            iNVPage = new INVPage(driver);
            iNVPage.ClickNextButton();

            iNVPage.ClickNextButton();
            iNVPage.ClickFinishButton();

            driver = driver.SwitchTo().Window(HomeWindow);

            driver.Navigate().Refresh();
            Thread.Sleep(1000);
        }
        public void ATC4448_CRMInvestigationVerifyFilterOnInvestigatorName()
        {
            #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;

            //Login in as role
            User user = this.environment.GetUser(SecurityRole.Investigations);

            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            string HomeWindow = driver.CurrentWindowHandle;
            homePage.HoverCRMRibbonTab();
            homePage.ClickInvestigationsRibbonButton();
            homePage.HoverInvestigationsRibbonTab();
            homePage.ClickInvestigationsCasesRibbonButton();

            // Create investigation case 1 with Investigator as IMSTestU06"
            InvestigationCaseSearchPage investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            string BaseWindow = driver.CurrentWindowHandle;
            investigationCaseSearchPage.ClickNewInvestigationCaseButton();

            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            string user06 = "IMSTestU06";
            string user04 = "IMSTestU04";

            investigationCasePage.ClickPageTitle();
            Assert.IsTrue(investigationCasePage.GetInvestigatorSearchElementText(user06));
            investigationCasePage.ClickSaveButton();
            string investigationID1 = investigationCasePage.GetInvestigationCaseNumber();
            Console.WriteLine(investigationID1);
            investigationCasePage.ClickSaveCloseButton();

            // Create investigation case 2 with Investigator as IMSTestU06"
            driver = driver.SwitchTo().Window(BaseWindow);
            investigationCaseSearchPage.ClickNewInvestigationCaseButton();

            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickPageTitle();
            Assert.IsTrue(investigationCasePage.GetInvestigatorSearchElementText(user06));
            investigationCasePage.ClickSaveButton();
            string investigationID2 = investigationCasePage.GetInvestigationCaseNumber();
            Console.WriteLine(investigationID2);
            investigationCasePage.ClickSaveCloseButton();
            Thread.Sleep(1000);

            // Create one general case where owner = same common investigator from above point
            driver = driver.SwitchTo().Window(HomeWindow);
            homePage.HoverInvestigationsRibbonTab();
            homePage.ClickInvestigationsGeneralCasesRibbonButton();

            InvestigationGeneralCaseSearchPage investigationsGeneralCasesPage = new InvestigationGeneralCaseSearchPage(driver);
            investigationsGeneralCasesPage.ClickNewGeneralCaseButton();

            InvestigationGeneralCasePage investigationGeneralCasePage = new InvestigationGeneralCasePage(driver);
            investigationGeneralCasePage.ClickPageTitle();
            investigationGeneralCasePage.SetTitle("Client D");
            investigationGeneralCasePage.SetClientName(clientName);
            investigationGeneralCasePage.SetType("Enquiry");
            investigationGeneralCasePage.SetInvestigatorSearchElementText(user06);
            investigationGeneralCasePage.ClickSaveButton();

            string generalCaseID = investigationGeneralCasePage.GetGeneralCaseNumber();
            Console.WriteLine(generalCaseID);
            investigationGeneralCasePage.ClickSaveCloseButton();

            // Ensure an investigation master case exists with the same common {Investigator} as above
            driver = driver.SwitchTo().Window(HomeWindow);
            homePage.HoverInvestigationsRibbonTab();
            homePage.ClickInvestigationsMasterCasesRibbonButton();

            InvestigationMasterCaseSearchPage investigationMasterCasesSearchPage = new InvestigationMasterCaseSearchPage(driver);
            investigationMasterCasesSearchPage.ClickNewButton();

            InvestigationMasterCasePage investigationMasterCasePage = new InvestigationMasterCasePage(driver);
            investigationMasterCasePage.SetInvestigatorValue(user06);
            investigationMasterCasePage.ClickSaveButton();
            string masterCasrID = investigationMasterCasePage.GetInvestigationMasterCaseNumber();
            Console.WriteLine(masterCasrID);
            // Close the current window and login with Investigation Business Admin
            driver.Close();
            driver = null;

            this.TestSetup();

            user = this.environment.GetUser(SecurityRole.InvestigationsBusinessAdmin);
            new LoginDialog().Login(user.Id, user.Password);

            // Verify the Support Officers queue
            homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickInvestigationsRibbonButton();
            homePage.HoverInvestigationsRibbonTab();
            homePage.ClickInvestigationsCasesRibbonButton();

            // Ensure at least one other investigations case exists with a different {Investigator} but {Owner} = same common investigator as above
            investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationCaseSearchPage.ClickNewInvestigationCaseButton();

            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickPageTitle();

            Assert.IsTrue(investigationCasePage.GetInvestigatorSearchElementText(user04));
            investigationCasePage.ClickSaveButton();
            string investigationID3 = investigationCasePage.GetInvestigationCaseNumber();
            Console.WriteLine(investigationID3);
            investigationCasePage.ClickSaveCloseButton();

            investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationCaseSearchPage.SetSearchRecord("IMSTestU06");

            Table table = new Table(investigationCaseSearchPage.GetSearchResultTable());
            table.ClickCellContainsValue("Investigator", "IMSTestU06", "Investigator");

            // Verify that User oage is getting displayed
            UserPage investigationUserPage = new UserPage(driver);
            investigationUserPage.ClickPageTitle();
            StringAssert.Contains(investigationUserPage.GetFullName(), "IMSTestU06");

            //Navigate to client phone numbers
            homePage.HoverClientXRibbonTab(user06);
            homePage.ClickInvestigatorXCasesRibbonButton();

            // Verify the cases displayed for Investigation Business Admin
            investigationUserPage = new UserPage(driver);
            StringAssert.Contains(investigationUserPage.GetPageFilterList(), "Investigation Case Associated View");

            // Verify Investigation Case 1 is displayed
            investigationUserPage = new UserPage(driver);
            investigationUserPage.SetSearchRecord(investigationID1);
            table = new Table(investigationUserPage.GetSearchResultTable());
            StringAssert.Contains(table.GetCellContainsValue("Case Number", investigationID1, "Investigator"), user06);
            StringAssert.Contains(table.GetCellContainsValue("Case Number", investigationID1, "Owner"), user04);

            // Verify Investigation Case 2 is displayed
            investigationUserPage = new UserPage(driver);
            investigationUserPage.SetSearchRecord(investigationID2);
            table = new Table(investigationUserPage.GetSearchResultTable());
            StringAssert.Contains(table.GetCellContainsValue("Case Number", investigationID2, "Investigator"), user06);
            StringAssert.Contains(table.GetCellContainsValue("Case Number", investigationID2, "Owner"), user04);

            // Verify General case is not displayed
            investigationUserPage = new UserPage(driver);
            investigationUserPage.SetSearchRecord(generalCaseID);
            table = new Table(investigationUserPage.GetSearchResultTable());
            Assert.IsTrue(table.GetNoRecordsInTable(), "General case is DISPLAYED!!!!");

            // Verify Master case is not displayed
            investigationUserPage = new UserPage(driver);
            investigationUserPage.SetSearchRecord(masterCasrID);
            table = new Table(investigationUserPage.GetSearchResultTable());
            Assert.IsTrue(table.GetNoRecordsInTable(), "Master case is DISPLAYED!!!!");

            // Verify Master case is not displayed
            investigationUserPage = new UserPage(driver);
            investigationUserPage.SetSearchRecord(investigationID3);
            table = new Table(investigationUserPage.GetSearchResultTable());
            Assert.IsTrue(table.GetNoRecordsInTable(), "Investigation case with different Investigator is DISPLAYED!!!!");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC6622_CRMInvestigationValidateMandatoryTasksForPendingSubStatus()
        {
            //Login in as role
            User user = this.environment.GetUser(SecurityRole.InvestigationsOfficer);

            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickInvestigationsRibbonButton();
            homePage.HoverInvestigationsRibbonTab();
            homePage.ClickInvestigationsCasesRibbonButton();

            // Create new investigation case
            InvestigationCaseSearchPage investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationCaseSearchPage.ClickNewInvestigationCaseButton();

            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            string BaseWindow = driver.CurrentWindowHandle;
            investigationCasePage.ClickPageTitle();
            investigationCasePage.SetSubStatus("Case pending");
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickSaveButton();
            string investigationID = investigationCasePage.GetInvestigationCaseNumber();

            investigationCasePage.ClickSaveCloseButton();

            // Search for the Investigation Case ID
            investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationCaseSearchPage.SetSearchRecord(investigationID);

            Table table = new Table(investigationCaseSearchPage.GetSearchResultTable());
            table.ClickCellValue("Case Number", investigationID, "Case Number");

            driver = driver.SwitchTo().Window(BaseWindow);
            investigationCasePage.ClickPageTitle();
            investigationCasePage.SetPageFilterList("All Activities");
            Thread.Sleep(1000);
            table = new Table(investigationCasePage.GetActivitiesSearchResultTable());

            // Verify that we are having 2 completed and 2 open activities
            StringAssert.Contains(table.GetCellContainsValue("Subject", investigationID + ": Set future date", "Activity Status"), "Open");
            Assert.AreEqual( 1, table.GetRowCount() - 1 , "Additional tasks are created for Case pending status");
        }
        public void ATC3342_CRMInvestigationTestActivitiesCreatedBySelectingSubStatus()
        {
            InvestigationCaseSearchPage investigationCaseSearchPage;
            InvestigationCasePage investigationCasePage;
            string investigationID;

            //Login in as role
            User user = this.environment.GetUser(SecurityRole.Investigations);
            new LoginDialog().Login(user.Id, user.Password);

            string[] Status = new string[] { "New case", "Investigation current", "Investigation current" , "Investigation current", "Investigation current", "Investigation current", "Investigation current", "Case finalisation", "Case finalisation", "Case finalisation"};
            string[] SubStatus = new string[] { "Initial assessment", "Conducting background searches", "Requesting information from complainant(s)" ,"Requesting information from third parties", "Search warrant(s) required", "Allegations to be put to respondent(s)", "Seeking legal advice", "Case closed discussion", "Educating respondent(s)", "Prosecution required"};
            string[] Activities0 = { "Carry out initial assessment", "Allocate"};
            string[] Activities1 = { "Conduct respondent(s) background searches", "Conduct complainant(s) background searches", "Conduct relevant dispute searches", "Conduct relevant premises background searches" };
            string[] Activities2 = { "Send request for information to complainant(s)", "Receive response from complainant" };
            string[] Activities3 = { "Send request for information to third parties", "Receive response from third parties" };
            string[] Activities4 = {"Discuss with Manager", "Prepare warrant application(s)", "Receive approval of warrant(s)"};
            string[] Activities5 = { "Send letter of allegations to respondent", "Receive response from respondent" };
            string[] Activities6 = { "Discuss with SIO or Manager", "Prepare request for legal advice", "Receive legal advice" };
            string[] Activities7 = { "Conduct closure discussion", "Record closure discussion outcome" };
            string[] Activities8 = { "Send educative letter to respondent(s)" };
            string[] Activities9 = { "Prepare brief of evidence", "Seek legal endorsement", "Receive legal advice" };

            HomePage homePage = new HomePage(driver);
            String HomeWindow = driver.CurrentWindowHandle;

            for (int i = 0; i < Status.Length; i++)
            {

                homePage.HoverCRMRibbonTab();
                homePage.ClickInvestigationsRibbonButton();
                homePage.HoverInvestigationsRibbonTab();
                homePage.ClickInvestigationsCasesRibbonButton();

                investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
                String BaseWindow = driver.CurrentWindowHandle;
                investigationCaseSearchPage.ClickNewInvestigationCaseButton();

                investigationCasePage = new InvestigationCasePage(driver);
                investigationCasePage.ClickSaveButton();
                investigationID = investigationCasePage.GetInvestigationCaseNumber();
                investigationCasePage.ClickSaveCloseButton();

                // Search for the Investigation Case ID
                investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
                investigationCaseSearchPage.SetSearchRecord(investigationID);

                Table table = new Table(investigationCaseSearchPage.GetSearchResultTable());
                table.ClickCellValue("Case Number", investigationID, "Case Number");

                investigationCasePage = new InvestigationCasePage(driver);

                investigationCasePage.SetStatus(Status[i]);
                investigationCasePage.ClickPageTitle();
                investigationCasePage.SetSubStatus(SubStatus[i]);

                investigationCasePage.ClickSaveCloseButton();

                // Search for the Investigation Case ID
                investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
                investigationCaseSearchPage.SetSearchRecord(investigationID);

                table = new Table(investigationCaseSearchPage.GetSearchResultTable());
                table.ClickCellValue("Case Number", investigationID, "Case Number");

                // Verify the Activities created
                driver.Navigate().Refresh();
                Thread.Sleep(1000);

                investigationCasePage = new InvestigationCasePage(driver);
                investigationCasePage.SetPageFilterList("All Activities");
                Thread.Sleep(1000);
                table = new Table(investigationCasePage.GetActivitiesSearchResultTable());

                string[] ActivityArray = {""};
                switch (i)
                {
                    case 0:
                        ActivityArray = Activities0;
                        break;
                    case 1:
                        ActivityArray = Activities1;
                        break;
                    case 2:
                        ActivityArray = Activities2;
                        break;
                    case 3:
                        ActivityArray = Activities3;
                        break;
                    case 4:
                        ActivityArray = Activities4;
                        break;
                    case 5:
                        ActivityArray = Activities5;
                        break;
                    case 6:
                        ActivityArray = Activities6;
                        break;
                    case 7:
                        ActivityArray = Activities7;
                        break;
                    case 8:
                        ActivityArray = Activities8;
                        break;
                    case 9:
                        ActivityArray = Activities9;
                        break;
                }
                for (int j = 0; j < ActivityArray.Length; j++)
                {
                    StringAssert.Contains(table.GetCellContainsValue("Subject", investigationID + ": " + ActivityArray[j], "Activity Status"), "Open");
                }
                driver.SwitchTo().Window(HomeWindow);
            }
        }
        public void ATC3306_CRMInvestigationCaseReopenclosedcase()
        {
            //Login in as role
            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 investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            //investigationCaseSearchPage.ClickNewInvestigationCaseButton();
            investigationCaseSearchPage.SetPageFilterList("All Investigation Cases");
            Table table = new Table(investigationCaseSearchPage.GetSearchResultTable());
            table.SelectTableRow("Investigation Status", "Closed");

             InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickStartDialogButton();

            table = new Table(investigationCasePage.GetProcessSearchResultTable());
            table.ClickCell("Process Name", "INV: Re-open investigation case", "Created On");
            string BaseWindow = driver.CurrentWindowHandle; //Records the current window handle
            investigationCasePage.ClickDialogAddButton();

            driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "INV:");

            INVPage iNVPage = new INVPage(driver);
            iNVPage.ClickNextButton();
            iNVPage.ClickNextButton();
            iNVPage.ClickFinishButton();

            driver = driver.SwitchTo().Window(BaseWindow);
        }
        public void ATC3327_CRMInvestigationCloseCaseWithMultipleOpenCloseActions()
        {
            //Login in as role
            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();

            // Create new investigation case
            InvestigationCaseSearchPage investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationCaseSearchPage.ClickNewInvestigationCaseButton();

            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickSaveButton();
            string investigationID = investigationCasePage.GetInvestigationCaseNumber();
            investigationCasePage.ClickSaveCloseButton();

            // Search for the Investigation Case ID
            investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationCaseSearchPage.SetSearchRecord(investigationID);

            Table table = new Table(investigationCaseSearchPage.GetSearchResultTable());
            table.ClickCellValue("Case Number", investigationID, "Case Number");

            driver.Navigate().Refresh();
            Thread.Sleep(1000);

            investigationCasePage = new InvestigationCasePage(driver);
            string BaseWindow = driver.CurrentWindowHandle; //Records the current window handle
            investigationCasePage.SetPageFilterList("All Activities");
            Thread.Sleep(1000);
            table = new Table(investigationCasePage.GetActivitiesSearchResultTable());

            // Add 1st completed activity
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddTaskButton("Task");

            //Enter Request Party details
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            TaskPage taskPage = new TaskPage(driver);
            Thread.Sleep(100);
            taskPage.ClickPageTitle();
            taskPage.SetSelectSubjectValue("Relevant address added");
            taskPage.ClickSaveButton();
            taskPage.ClickMarkCompleteButton();

            driver = driver.SwitchTo().Window(BaseWindow);

            // Add 2nd completed activity
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            BaseWindow = driver.CurrentWindowHandle; //Records the current window handle
            investigationCasePage.ClickAddTaskButton("Task");

            //Enter Request Party details
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(100);
            taskPage = new TaskPage(driver);

            taskPage.ClickPageTitle();
            taskPage.SetSelectSubjectValue("Allocate to investigator");
            taskPage.ClickSaveButton();
            taskPage.ClickMarkCompleteButton();

            driver = driver.SwitchTo().Window(BaseWindow);

            investigationCasePage.ClickPageTitle();
            investigationCasePage.SetPageFilterList("All Activities");
            Thread.Sleep(1000);
            table = new Table(investigationCasePage.GetActivitiesSearchResultTable());

            // Verify that we are having 2 completed and 2 open activities
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Relevant address added", "Activity Status"), "Completed");
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Allocate to investigator", "Activity Status"), "Completed");
            StringAssert.Contains(table.GetCellContainsValue("Subject", investigationID + ": Scan documents", "Activity Status"), "Open");
            StringAssert.Contains(table.GetCellContainsValue("Subject", investigationID + ": Add parties", "Activity Status"), "Open");
            StringAssert.Contains(table.GetCellContainsValue("Subject", investigationID + ": Submit for initial assessment", "Activity Status"), "Open");

            Assert.AreEqual(5, table.GetRowCount()-1, "Additional activities seen");

            // Now try to close the case
            investigationCasePage.ClickStartDialogButton();
            table = new Table(investigationCasePage.GetProcessSearchResultTable());
            table.ClickCell("Process Name", "INV: Close investigation case", "Created On");
            BaseWindow = driver.CurrentWindowHandle; //Records the current window handle
            investigationCasePage.ClickDialogAddButton();

            driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "INV:");

            INVPage iNVPage = new INVPage(driver);
            iNVPage.ClickNextButton();
            iNVPage.ClickNextButton();
            iNVPage.ClickNextButton();
            iNVPage.ClickFinishButton();

            driver = driver.SwitchTo().Window(BaseWindow);

            // Now Investigation case is closed.. verify that this case is not seen in active Investigation case
            investigationCasePage.ClickSaveCloseButton();

            investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationCaseSearchPage.SetPageFilterList("Active Investigation Cases");

            investigationCaseSearchPage.SetSearchRecord(investigationID);

            StringAssert.Contains(driver.FindElement(By.ClassName("ms-crm-List-MessageText")).Text, "No Investigation Case records are available in this view.");
        }
        public void ATC3328_CRMInvestigationReopenCaseProvidingAReason()
        {
            //Login in as role
            //Login in as role
            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();

            // Create new investigation case
            InvestigationCaseSearchPage investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationCaseSearchPage.ClickNewInvestigationCaseButton();

            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickSaveButton();
            string investigationID = investigationCasePage.GetInvestigationCaseNumber();
            investigationCasePage.ClickStartDialogButton();

            Table table = new Table(investigationCasePage.GetProcessSearchResultTable());
            table.ClickCell("Process Name", "INV: Close investigation case", "Created On");
            string BaseWindow = driver.CurrentWindowHandle; //Records the current window handle
            investigationCasePage.ClickDialogAddButton();

            driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "INV:");
            INVPage iNVPage = new INVPage(driver);
            iNVPage.ClickNextButton();
            iNVPage.ClickNextButton();
            string todayDate = DateTime.Today.ToString("dd-MM-yyyy");
            iNVPage.SetDate(todayDate);
            iNVPage.ClickNextButton();
            iNVPage.ClickFinishButton();

            driver = driver.SwitchTo().Window(BaseWindow);

            investigationCasePage.ClickSaveCloseButton();
            investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationCaseSearchPage.SetPageFilterList("Inactive Investigation Cases");

            table = new Table(investigationCaseSearchPage.GetHeaderSearchResultTable());
            table.ClickTableColumnHeader("Case Number");
            table = new Table(investigationCaseSearchPage.GetSearchResultTable());
            table.ClickCellValue("Case Number", investigationID, "Case Number");

            investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickStartDialogButton();

            table = new Table(investigationCasePage.GetProcessSearchResultTable());
            table.ClickCell("Process Name", "INV: Re-open investigation case", "Created On");
            string BaseWindow1 = driver.CurrentWindowHandle;

            investigationCasePage.ClickDialogAddButton();

            driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "INV:");

            iNVPage = new INVPage(driver);
            iNVPage.ClickNextButton();
            String reason="Automation test";
            iNVPage.SetSubStatusReason(reason);
            iNVPage.ClickNextButton();
            iNVPage.ClickFinishButton();

            driver = driver.SwitchTo().Window(BaseWindow1);

            driver.Navigate().Refresh();
            investigationCasePage = new InvestigationCasePage(driver);
            table = new Table(investigationCasePage.GetActivitiesSearchResultTable());
            table.ClickCell("Subject", investigationID + " case re-opened: Case finalisation - Case closed discussion", "Subject");

            Thread.Sleep(1000);

            InvestigationCaseManagementActivity caseManagementActivity = new InvestigationCaseManagementActivity(driver);
            Assert.AreEqual(reason, caseManagementActivity.GetDescription());
        }
        public void ATC3316_CRMInvestigationVerifyRelatedActivitiesOwnerUpdation()
        {
            #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();

            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();

            //Email
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Email");
            Thread.Sleep(1000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(2000);
            EmailPage emailPage = new EmailPage(driver);
            emailPage.ClickPageTitle();
            emailPage.SetToValueText(clientName);
            Thread.Sleep(500);
            emailPage.SetSubjectValueText("Test 3316 Email");
            emailPage.ClickSaveCloseIMG();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            //Fax
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Fax");
            Thread.Sleep(1000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(2000);
            FaxPage faxPage = new FaxPage(driver);
            faxPage.ClickPageTitle();
            faxPage.SetSubjectValue("Test 3316 Fax");
            faxPage.ClickSaveCloseButton();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            //Letter
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Letter");
            Thread.Sleep(1000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(1000);
            LetterPage letterPage = new LetterPage(driver);
            letterPage.ClickPageTitle();
            letterPage.SetSubjectValue("Test 3316 Letter");
            letterPage.ClickSaveButton();
            letterPage.ClickSaveCloseButton();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            //Phone Call
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Phone Call");
            Thread.Sleep(1000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(2000);
            PhoneCallPage phoneCall = new PhoneCallPage(driver);
            Thread.Sleep(100);
            phoneCall.ClickPageTitle();
            phoneCall.SetSelectSubjectValue("Bond balance enquiry");
            phoneCall.SetSubject("Test 3316 Phone Call");
            Thread.Sleep(500);
            phoneCall.SetRecipient(clientName);
            phoneCall.ClickSaveCloseButton();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            // Client Management Activity
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Client Management Activity");
            Thread.Sleep(1000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(2000);
            ClientManagementActivityPage clientManagementActivityPage = new ClientManagementActivityPage(driver);
            clientManagementActivityPage.ClickPageTitle();
            clientManagementActivityPage.SetSubjectValue("Test 3316 Client Management Activity");
            clientManagementActivityPage.ClickSaveCloseButton();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            // Front Counter Contact
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Front Counter Contact");
            Thread.Sleep(2000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(1000);
            FrontCounterContactPage frontCounterContactPage = new FrontCounterContactPage(driver);
            frontCounterContactPage.SetSubjectValue("Test 3316 Front Counter Contact");
            frontCounterContactPage.ClickSaveCloseButton();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            // Task
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddTaskButton("Task");
            Thread.Sleep(1000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(500);
            TaskPage taskPage = new TaskPage(driver);
            taskPage.ClickPageTitle();
            taskPage.SetSelectSubjectValue("Bond existence");
            taskPage.ClickSaveCloseButton();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            // Recurring Appointment
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Appointment");
            Thread.Sleep(1000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(2000);
            AppointmentPage appointmentPage = new AppointmentPage(driver);
            string AppWindow = driver.CurrentWindowHandle;
            appointmentPage.ClickPageTitle();
            appointmentPage.SetStartRange(DateTime.Today.AddDays(1).ToString("dd/MM/yyyy"));
            appointmentPage.ClickPageTitle();
            appointmentPage.ClickRecurrenceButton();
            appointmentPage.ClickSetButton();
            driver = driver.SwitchTo().Window(AppWindow);
            appointmentPage = new AppointmentPage(driver);
            appointmentPage.ClickPageTitle();
            appointmentPage.SetSubjectValue("Test 3316 Recurring Appointment");
            appointmentPage.ClickSaveCloseButton();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            // Appointment
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Appointment");
            Thread.Sleep(1000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(2000);
            appointmentPage = new AppointmentPage(driver);
            appointmentPage.ClickPageTitle();
            appointmentPage.SetSubjectValue("Test 3316 Appointment");
            appointmentPage.ClickSaveCloseButton();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            // Change the owner value
            investigationCasePage.ClickPageTitle();
            investigationCasePage.SetOwnerValue("IMSTestU04");
            investigationCasePage.ClickSaveCloseButton();
            investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationsCaseSearchPage.SetSearchRecord(investigationID);
            Table table = new Table(investigationsCaseSearchPage.GetSearchResultTable());
            table.ClickCellValue("Case Number", investigationID, "Case Number");

            driver = driver.SwitchTo().Window(BaseWindow);
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickSeeRecordsAssociatedWithThisViewButton("Activities");
            Thread.Sleep(1000);

            investigationCasePage.SetActivitiesSearchText("Test 3316 Email");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3316 Email", "Owner"), "IMSTestU04");

            investigationCasePage.SetActivitiesSearchText("Test 3316 Fax");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3316 Fax", "Owner"), "IMSTestU04");

            investigationCasePage.SetActivitiesSearchText("Test 3316 Letter");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3316 Letter", "Owner"), "IMSTestU04");

            investigationCasePage.SetActivitiesSearchText("Test 3316 Phone Call");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3316 Phone Call", "Owner"), "IMSTestU04");

            investigationCasePage.SetActivitiesSearchText("Test 3316 Client Management Activity");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3316 Client Management Activity", "Owner"), "IMSTestU04");

            investigationCasePage.SetActivitiesSearchText("Test 3316 Front Counter Contact");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3316 Front Counter Contact", "Owner"), "IMSTestU04");

            investigationCasePage.SetActivitiesSearchText(investigationID + ": Bond existence");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", investigationID + ": Bond existence", "Owner"), "IMSTestU04");

            investigationCasePage.SetActivitiesSearchText("Test 3316 Appointment");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3316 Appointment", "Owner"), "IMSTestU04");

            investigationCasePage.SetActivitiesSearchText("Test 3316 Recurring Appointment");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3316 Recurring Appointment", "Owner"), "IMSTestU04");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC3341_CRMInvestigationNewCaseDefaultsToNewCaseStatus()
        {
            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();

            Trace.Listeners.Add(new TextWriterTraceListener("TextWriterOutput.log", "myListener"));
            Trace.TraceInformation("Create new investigation case start:" + DateTime.Now.ToString("ddMMyyyyhhmmssffff"));
            Trace.Flush();

            InvestigationCaseSearchPage investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationsCaseSearchPage.ClickNewInvestigationCaseButton();

            // Create new case and validate Status and Substatus fields
            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            Assert.AreEqual("New case", investigationCasePage.GetStatus());
            Assert.AreEqual("Creation", investigationCasePage.GetSubStatus());
            investigationCasePage.ClickSaveButton();
            String caseNumber=investigationCasePage.GetInvestigationCaseNumber();
            investigationCasePage.ClickSaveCloseButton();

            // Search for the newly created Investigation Case
            investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationsCaseSearchPage.SetInvestigationSearchText(caseNumber);
            Table table = new Table(investigationsCaseSearchPage.GetSearchResultTable());
            table.ClickCellValue("Case Number", caseNumber, "Case Number");

            // Validate the activity created for New Investigation case
            investigationCasePage = new InvestigationCasePage(driver);
            StringAssert.Contains(investigationCasePage.GetInvestigationCaseNumber(), caseNumber);
            table = new Table(investigationCasePage.GetActivitiesSearchResultTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", caseNumber+": Scan documents", "Activity Status"), "Open");
            StringAssert.Contains(table.GetCellContainsValue("Subject", caseNumber + ": Add parties", "Activity Status"), "Open");
            StringAssert.Contains(table.GetCellContainsValue("Subject", caseNumber + ": Submit for initial assessment", "Activity Status"), "Open");

            Trace.Listeners.Add(new TextWriterTraceListener("TextWriterOutput.log", "myListener"));
            Trace.TraceInformation("Create new investigation case end:" + DateTime.Now.ToString("ddMMyyyyhhmmssffff"));
            Trace.Flush();
        }
        public void ATC6827_CRMCheckInvestigatorField()
        {
            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);
            string user02 = "IMSTestU02";
            Assert.IsTrue(investigationCasePage.GetInvestigatorSearchElementText(user02));
            investigationCasePage.ClickSaveButton();
            string investigationCase = investigationCasePage.GetInvestigationCaseNumber();
            investigationCasePage.ClickSaveCloseButton();
            investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationsCaseSearchPage.SetInvestigationSearchText(investigationCase);

            Table table = new Table(investigationsCaseSearchPage.GetSearchResultTable());
            StringAssert.Contains(table.GetCellValue("Case Number", investigationCase, "Investigator"), user02);
        }
        public void ATC6707_CRMInvestigationNewCaseTasksInOutlook()
        {
            User user = this.environment.GetUser(SecurityRole.InvestigationsOfficer);
            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();

            // Create new case and validate Status and Substatus fields
            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickSaveButton();
            String caseNumber = investigationCasePage.GetInvestigationCaseNumber();
            investigationCasePage.ClickSaveCloseButton();

            // Search for the newly created Investigation Case
            investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationsCaseSearchPage.SetInvestigationSearchText(caseNumber);
            Table table = new Table(investigationsCaseSearchPage.GetSearchResultTable());
            table.ClickCellValue("Case Number", caseNumber, "Case Number");

            // Validate the activity created for New Investigation case
            investigationCasePage = new InvestigationCasePage(driver);
            StringAssert.Contains(investigationCasePage.GetInvestigationCaseNumber(), caseNumber);
            table = new Table(investigationCasePage.GetActivitiesSearchResultTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", caseNumber + ": Scan documents", "Activity Status"), "Open");
            StringAssert.Contains(table.GetCellContainsValue("Subject", caseNumber + ": Add parties", "Activity Status"), "Open");
            StringAssert.Contains(table.GetCellContainsValue("Subject", caseNumber + ": Submit for initial assessment", "Activity Status"), "Open");

            // Navigate to Outlook and verify the task  - Paul
        }
        public void ATC3367c_CRMSendemailfromCRMNewActivity()
        {
            #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()== "3367")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string investigationID = MyRange.Cells[MyRow, InvestigationSchema.GetColumnIndex(ColumnName.IN_ID)].Value.ToString();

            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.SetInvestigationSearchText(investigationID);
            Table table = new Table(investigationsCaseSearchPage.GetSearchResultTable());
            table.ClickCellValue("Case Number", investigationID, "Case Number");

            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            StringAssert.Contains(investigationCasePage.GetInvestigationCaseNumber(), investigationID);
            table = new Table(investigationCasePage.GetActivitiesSearchResultTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3367 CRM Email Creation RTA:", "Activity Status"), "Completed");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }