コード例 #1
0
        public void ATC3323_CRMInvestigationVerifyPenaltyUnitsAreNotLocked()
        {
            #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.InvestigationsOfficer);
            new LoginDialog().Login(user.Id, user.Password);

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

            InvestigationPenaltyINoticeSearchPage invPenaltyINoticeSearchPage = new InvestigationPenaltyINoticeSearchPage(driver);
            invPenaltyINoticeSearchPage.ClickNewPenaltyNoticeButton();

            // Create new case and validate Status and Substatus fields
            InvestigationPenaltyINoticePage invPenaltyINoticePage = new InvestigationPenaltyINoticePage(driver);
            invPenaltyINoticePage.ClickPageTitle();
            invPenaltyINoticePage.SetClientName(clientName);
            invPenaltyINoticePage.SetIssuedAgainstField("Person");
            invPenaltyINoticePage.ClickSaveButton();
            invPenaltyINoticePage.ClickPageTitle();

            // Verify Penalty Units, Per Unit Amount and Penalty Amount fields are not locked
            Assert.IsFalse(invPenaltyINoticePage.CheckPenaltyUnitsLocked(), "Penalty Units fields is not locked");
            Assert.IsFalse(invPenaltyINoticePage.CheckPerUnitAmountLocked(), "Per Unit Amount fields is not locked");
            Assert.IsFalse(invPenaltyINoticePage.CheckPenaltyAmountFieldLocked(), "Penalty Amount fields is not locked");

            // Confirm the Penalty Units, Per Unit Amount and Penalty Amount fields have no complex interdependent validations.
            StringAssert.Contains(invPenaltyINoticePage.GetPenaltyUnitsFieldText(), "--");
            StringAssert.Contains(invPenaltyINoticePage.GetPerUnitAmountFieldText(), "--");
            StringAssert.Contains(invPenaltyINoticePage.GetPenaltyAmountFieldText(), "--");

            invPenaltyINoticePage.SetPenaltyUnits("1000");
            invPenaltyINoticePage.SetPerUnitAmount("1234");
            invPenaltyINoticePage.SetPenaltyAmountFieldText("5678");

            invPenaltyINoticePage.ClickSaveButton();
            Thread.Sleep(500);

            StringAssert.Contains(invPenaltyINoticePage.GetPenaltyUnitsFieldText(), "1,000");
            StringAssert.Contains(invPenaltyINoticePage.GetPerUnitAmountFieldText(), "1,234");
            StringAssert.Contains(invPenaltyINoticePage.GetPenaltyAmountFieldText(), "5,678");

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