示例#1
0
            public void PO_SearchTenantAfterAddingNewTenant()
            {
                // Creates a toggle for the given test, adds all log events under it
                test = extent.StartTest("Search the tenant after adding new tenant for a given property");
                test.AssignCategory("Add New Tenant");

                #region Delete the existing tenant of the given proeprty
                //Before adding new tenant, check whether the tenant already exist, if exist ,delete it
                ExcelLib.PopulateInCollection(Base.ExcelPath, "Add Tenant");
                String propertyName = ExcelLib.ReadData(2, "Property Name");
                String tenantEmail  = ExcelLib.ReadData(2, "Tenant Email");

                //go to my properties page from dashboard
                DashboardPage dashBoard = new DashboardPage();
                dashBoard.GoToMyPropertiesPage();

                //search the given property
                MyPropertiesPage myProperty = new MyPropertiesPage();
                myProperty.SearchAPropertySuccessfully(propertyName);

                //go to manage tenant page and delete the tenant which user want to add
                myProperty.GoToManageTenantPage();
                ManageTenantPage manageTenant = new ManageTenantPage();
                manageTenant.RemoveTenant(tenantEmail);

                //go back to my properties page and then go to add tenant page
                manageTenant.GoBackToProperties();
                myProperty.AddTenant();

                #endregion

                #region Add new tenant
                //Fill out the add tenant details form and go to liability details form
                AddTenantPage addTenant = new AddTenantPage();
                addTenant.AddTenantDetails();
                addTenant.NextToLiabilityDetails();
                //Add a new liability and go to sumamry form
                addTenant.ClickAddNewLiability();
                addTenant.AddLiabilityDetails();
                addTenant.SaveNewLiability();
                addTenant.NextToSummary();
                //Save the new tenant
                addTenant.Submit();
                #endregion

                //Search the given property under my properties page
                myProperty.SearchAPropertySuccessfully(propertyName);

                //Go to manage tenant page
                myProperty.GoToManageTenantPage();

                if (manageTenant.FindATenant(tenantEmail))
                {
                    Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Test passed, successfully find the new tenant under manage tenant page");
                }
                else
                {
                    Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Test failed, fail to find the new tenant under manage tenant page");
                }
            }
        public void GivenIAmAlreadyUnderTheLiabilitiesDetailsSection()
        {
            AddTenantPage addTenant = new AddTenantPage();

            addTenant.AddTenantDetails();
            addTenant.NextToLiabilityDetails();
        }
        public void GivenIHaveAddedANewLiability()
        {
            AddTenantPage addTenant = new AddTenantPage();

            addTenant.ClickAddNewLiability();
            addTenant.AddLiabilityDetails();
            addTenant.SaveNewLiability();
        }
        public void GivenIAmAlreadyUnderTheSummarySection()
        {
            AddTenantPage addTenant = new AddTenantPage();

            addTenant.AddTenantDetails();
            addTenant.NextToLiabilityDetails();
            addTenant.ClickAddNewLiability();
            addTenant.AddLiabilityDetails();
            addTenant.NextToSummary();
        }
        public void GivenIHaveAddedANewTenantForAGivenPropertyAndWentBackToMyPropertiesPage()
        {
            AddTenantPage addTenant = new AddTenantPage();

            addTenant.AddTenantDetails();
            addTenant.NextToLiabilityDetails();
            addTenant.ClickAddNewLiability();
            addTenant.AddLiabilityDetails();
            addTenant.NextToSummary();
            addTenant.Submit();
        }
        public void ThenAllTheInforamtionShouldBeTheSameAsWhatIEnteredInTenantDetailsAndLiabilitiesDetails()
        {
            test = extent.CreateTest("Add Tenant -- Check all the information under summary section");
            test.AssignCategory("Add Tenant Testing");

            AddTenantPage addTenant = new AddTenantPage();

            if (addTenant.ValidateDataInSummary())
            {
                Base.test.Log(AventStack.ExtentReports.Status.Pass, "test passed, successfully validate all the inforamtion in summary");
            }
            else
            {
                Base.test.Log(AventStack.ExtentReports.Status.Fail, "test failed, fail to validate all the inforamtion in summary");
            }
        }
        public void ThenIMNavigatedToTheSummary()
        {
            test = extent.CreateTest("Add Tenant -- Add liability details and go to summary section");
            test.AssignCategory("Add Tenant Testing");

            AddTenantPage addTenant = new AddTenantPage();

            if (addTenant.IsSubmitButtonDisplay())
            {
                Base.test.Log(AventStack.ExtentReports.Status.Pass, "Test passed, successfully navigate to the summary ");
            }
            else
            {
                Base.test.Log(AventStack.ExtentReports.Status.Fail, "Test failed, fail to navigate to the summary ");
            }
        }
        public void ThenThereShouldBeWarningMessageAndHeNextButtonShouldBeUnclickable()
        {
            // Creates a toggle for the given test, adds all log events under it
            test = extent.CreateTest("Add Tenant -- Add an existing tenant under tenant details section");
            test.AssignCategory("Add Tenant Testing");

            AddTenantPage addTenant = new AddTenantPage();

            if (addTenant.IsTenantAlreadyInThisPropertyWarningMessageDisplayed() & addTenant.IsNextButtonUnclickableUnderTenatDetails())
            {
                Base.test.Log(AventStack.ExtentReports.Status.Pass, "Test passed, successfully display the warning message and next button is unclickable");
            }
            else
            {
                Base.test.Log(AventStack.ExtentReports.Status.Fail, "Test failed, fail to display the warning message or next button is clickable");
            }
        }
        public void ThenIAmNavigatedToLiabilityDetails()
        {
            // Creates a toggle for the given test, adds all log events under it
            test = extent.CreateTest("Add Tenant -- Add tenant details and go to liabilities details");
            test.AssignCategory("Add Tenant Testing");

            // Create an class and object to call the method
            AddTenantPage addTenant = new AddTenantPage();

            if (addTenant.IsAddNewLiabilityButtonDisplay())
            {
                Base.test.Log(AventStack.ExtentReports.Status.Pass, "Test passed, successfully navigated to liability details ");
            }

            else
            {
                Base.test.Log(AventStack.ExtentReports.Status.Fail, "Test failed, fail to navigate to liability details ");
            }

            Thread.Sleep(6000);
        }
        public void ThenTheNewLiabilityShouldBeAddedSuccessfully()
        {
            test = extent.CreateTest("Add Tenant -- Add new liability details under liabilities details section");
            test.AssignCategory("Add Tenant Testing");

            //get the liability name and amount from excel file
            ExcelLib.PopulateInCollection(Base.ExcelPath, "Add Tenant");
            String liabilityName = ExcelLib.ReadData(2, "Liability Name");
            String amount        = ExcelLib.ReadData(2, "Amount");

            AddTenantPage addTenant = new AddTenantPage();

            if (addTenant.FindLiabilitySuccessfully(liabilityName, amount))
            {
                Base.test.Log(AventStack.ExtentReports.Status.Pass, "Test passed, successfully add new liability");
            }
            else
            {
                Base.test.Log(AventStack.ExtentReports.Status.Fail, "Test failed, fail to add new liability");
            }

            Thread.Sleep(6000);
        }
        public void WhenIEnterAnExistingTenantEmailOfThisProperty()
        {
            AddTenantPage addTenant = new AddTenantPage();

            addTenant.AddExistingTenantDetails();
        }
        public void WhenIClickNextButtonUnderTenantDetailsSection()
        {
            AddTenantPage addTenant = new AddTenantPage();

            addTenant.NextToLiabilityDetails();
        }
        public void WhenIEnterAllTheTenantDetailsWithValidDataUnderTenantDetailsSection()
        {
            AddTenantPage addTenant = new AddTenantPage();

            addTenant.AddTenantDetails();
        }
        public void WhenIClickSubmitButtonUnderSummary()
        {
            AddTenantPage addTenant = new AddTenantPage();

            addTenant.Submit();
        }
        public void WhenIEnterNewLiabilityDetail()
        {
            AddTenantPage addTenant = new AddTenantPage();

            addTenant.AddLiabilityDetails();
        }
        public void WhenIClickNextButtonUnderLiabilitiesDetails()
        {
            AddTenantPage addTenant = new AddTenantPage();

            addTenant.NextToSummary();
        }
        public void WhenIClickSaveNewLiabilityButton()
        {
            AddTenantPage addTenant = new AddTenantPage();

            addTenant.SaveNewLiability();
        }