public void ATC3345_CRMInvestigationVerifyUserCantEditMasterCases() { string[] NoAccessUser = { "GeneralStaff", "IMS business systems support staff" }; User user = this.environment.GetUser(SecurityRole.GeneralStaff); bool lastIteration = false; for (int i = 0; i < 2; i++) { switch (i) { case 0: user = this.environment.GetUser(SecurityRole.GeneralStaff); break; case 1: user = this.environment.GetUser(SecurityRole.IMSBusinessSupportStaff); lastIteration = true; break; } new LoginDialog().Login(user.Id, user.Password); HomePage homePage = new HomePage(driver); string HomeWindow = driver.CurrentWindowHandle; // Case -1: Navigate to Investigation Master Case via Advanced Find and try to edit it. homePage.ClickAdvancedfindIMG(); Thread.Sleep(400); driver = UICommon.SwitchToNewBrowserWithTitle(driver, HomeWindow, "Advanced Find"); AdvancedFindPage advancedFindPage = new AdvancedFindPage(driver); Assert.IsFalse(advancedFindPage.VerifyLookForListItemPresent("Investigation Master Case"), "Investigation Master Case option present!!!"); advancedFindPage.CloseWindow(); driver = driver.SwitchTo().Window(HomeWindow); // Case -2: INVALID Navigate to Investigation Master Case via Home tiles and try to edit it. // Case -3 & 4: Navigate to Investigation Master Case via creating it through the home ribbon and try to edit it. homePage.HoverCRMRibbonTab(); Assert.IsFalse(homePage.VerifyInvestigationsRibbonButtonPresent(), "Investigation Ribbon button Present!!!!"); if (lastIteration == false) { driver.Quit(); driver = null; this.TestSetup(); } } }
public void ATC3326_CRMInvestigationUserAccessToRecordOutcomeOfAllegedOffence() { string[] allowedUserName = { "Investig ationsOfficer", "Investigations", "InvestigationsManager", "InvestigationsBusinessAdmin", "InvestigationsOfficer", "ESOForPES", "ExecutiveManagerForPES" }; string[] notAllowedUserName = { "GeneralStaff", "RBSOfficer","IMSBusinessSupportStaff" ,"ResearchOfficers","RecordKeepingOfficers"}; bool LastIteration = false; // CAN User user = this.environment.GetUser(SecurityRole.InvestigationOfficer); for (int i = 0; i < allowedUserName.Length; i++) { //Login in as role switch (i) { case 0: user = this.environment.GetUser(SecurityRole.InvestigationOfficer); break; case 1: user = this.environment.GetUser(SecurityRole.Investigations); break; case 2: user = this.environment.GetUser(SecurityRole.InvestigationsManager); break; case 3: user = this.environment.GetUser(SecurityRole.InvestigationsBusinessAdmin); break; case 4: user = this.environment.GetUser(SecurityRole.InvestigationsOfficer); break; case 5: user = this.environment.GetUser(SecurityRole.ESOForPES); break; case 6: user = this.environment.GetUser(SecurityRole.ExecutiveManagerForPES); LastIteration = true; break; } new LoginDialog().Login(user.Id, user.Password); HomePage homePage = new HomePage(driver); String HomeWindow = driver.CurrentWindowHandle; homePage.HoverCRMRibbonTab(); homePage.ClickInvestigationsRibbonButton(); homePage.HoverInvestigationsRibbonTab(); homePage.ClickInvestigationsCasesRibbonButton(); // Select the 'All Investigation Cases' view from the table InvestigationCaseSearchPage investigationCaseSearchPage = new InvestigationCaseSearchPage(driver); investigationCaseSearchPage.ClickNewInvestigationCaseButton(); InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver); investigationCasePage.ClickSaveButton(); string investigationID = investigationCasePage.GetInvestigationCaseNumber(); investigationCasePage.ClickSaveCloseButton(); driver = driver.SwitchTo().Window(HomeWindow); homePage.HoverCRMRibbonTab(); homePage.ClickInvestigationsRibbonButton(); homePage.HoverInvestigationsRibbonTab(); homePage.ClickRightScrollRibbonButton(); homePage.ClickAllegedOffencesButton(); AllegendOffensesSearchPage allegedOffencesSearchPage = new AllegendOffensesSearchPage(driver); allegedOffencesSearchPage.ClickNewAllegedOffenceButton(); AllegedOffencePage allegedOffencesPage = new AllegedOffencePage(driver); allegedOffencesPage.SetInvestigationCaseValue(investigationID); allegedOffencesPage.SetProvisionValue("RTRA 116(1)"); allegedOffencesPage.ClickSaveButton(); string allegedoffenceId = allegedOffencesPage.GetReferenceNumber(); allegedOffencesPage.ClickSaveCloseButton(); allegedOffencesSearchPage = new AllegendOffensesSearchPage(driver); allegedOffencesSearchPage.SetInvestigationSearchText(allegedoffenceId); Table table = new Table(allegedOffencesSearchPage.GetSearchResultTable()); Assert.AreEqual(1, table.GetRowCount(), "Allegend Offense creation failed!!!!!"); if (LastIteration == false) { driver.Quit(); driver = null; this.TestSetup(); } // CAN end } // CAN NOT -1 LastIteration = false; for (int i = 0; i <= 2; i++) { //Login in as role switch (i) { case 0: user = this.environment.GetUser(SecurityRole.GeneralStaff); break; case 1: user = this.environment.GetUser(SecurityRole.RBSOfficer); break; case 2: user = this.environment.GetUser(SecurityRole.IMSBusinessSupportStaff); LastIteration = true; break; } new LoginDialog().Login(user.Id, user.Password); HomePage homePage = new HomePage(driver); String HomeWindow = driver.CurrentWindowHandle; homePage.HoverCRMRibbonTab(); Assert.IsFalse(homePage.VerifyInvestigationsRibbonButtonPresent(),String.Format("Investigation Ribbon Button is seen for {0}",user.Id)); if (LastIteration == false) { driver.Quit(); driver = null; this.TestSetup(); } } // CAN NOT -2 LastIteration = false; for (int i = 3; i == 4; i++) { //Login in as role switch (i) { case 3: user = this.environment.GetUser(SecurityRole.ResearchOfficers); break; case 4: user = this.environment.GetUser(SecurityRole.RecordKeepingOfficers); LastIteration = true; break; } new LoginDialog().Login(user.Id, user.Password); HomePage homePage = new HomePage(driver); String HomeWindow = driver.CurrentWindowHandle; homePage.HoverCRMRibbonTab(); homePage.ClickInvestigationsRibbonButton(); homePage.HoverInvestigationsRibbonTab(); homePage.ClickInvestigationsCasesRibbonButton(); // Select the 'All Investigation Cases' view from the table InvestigationCaseSearchPage investigationCaseSearchPage = new InvestigationCaseSearchPage(driver); Assert.IsFalse(investigationCaseSearchPage.VerifyNewInvestigationCaseButtonPresent(), String.Format("New Investigation Case Button is seen for {0}", user.Id)); if (LastIteration == false) { driver.Quit(); driver = null; this.TestSetup(); } } }