Example #1
0
        public void CreateAndVerify_BudgetEstimate_ViewPage(string testId, string testSummary)
        {
            const string projectCodeValue = PlanningProjectManager.CONST_TEST_PROJECT_CODE;

            int currentProjectId = Convert.ToInt32(DB.GetLastCreatedIdForTable(HintFieldLookup.Project_By_ProjectCode(projectCodeValue)));

            Current_BudgetEstimateName = Helpers.GetUniqueData("AutomatedBudget");

            string currentAutomationId = Current_BudgetEstimateName;

            var hintObject_BudgetEstimate = HintFieldLookup.BudgetEstimate(currentAutomationId);

            MasterworksScreen
            .Begin(testId, testSummary, BrowserType.Chrome, true)
            .OpenProject_ById(currentProjectId)
            .OpenListPage_By_Path(TreePath_UnderProject.BudgetEstimate)
            .OpenCreateRecordForm()
            .SetTextbox(BgtEst.BudgetEstimateName, currentAutomationId)        //.Wait(5)
            .SetComobobox_ByText(BgtEst.BudgetEstimateType, "Construction")    //.Wait(5)//.Wait_Till_TextToBePresentInElement(By.Id("xyz"), "xyz")
            .SetComobobox_ByText(BgtEst.MeasurementSystem, "IS System")
            .SaveForm_Successfully()
            .ExecuteCustom_Using_LastId(CONST_TableNames.BudgetEstimate, hintObject_BudgetEstimate.IdField, (id, listPageRef) =>
            {
                var viewPage = listPageRef.ViewRow_WithId_ByNavigationUrl(id);

                viewPage.BeginVerification((driver, viewVerifier) =>
                {
                    viewVerifier
                    .AssertTextbox(BgtEst.BudgetEstimateName, currentAutomationId)
                    .AssertDate("Date000", 2002, 10, 20)
                    .AssertDateTime("Date012", new DateTime(2016, 1, 29, 0, 0, 0))

                    ;
                });
            })
            .VerifyInDB_Using_LastId("Verify BudgetEstimate in DB", hintObject_BudgetEstimate, (rowVerifier, listPageRef) =>
                                     //.VerifyInDB_Using_LastId("Verify BudgetEstimate in DB", CONST_BudgetEstimate.TableName, "ID", CONST_BudgetEstimate.Form.BudgetEstimateName, currentAutomationId, (rowVerifier, listPageRef) =>
            {
                rowVerifier
                .Assert_Data(CONST_BudgetEstimate.Form.BudgetEstimateName, currentAutomationId)
                .Assert_Data(CONST_BudgetEstimate.Form.BudgetEstimateType, 1)
                ;
            })
            //.DB_Run_SelectStatement("Select * from Table1", (dataSet, listPageRef)=>
            //{
            //    //dataSet.Tables[0].Rows
            //})
            .End_Automation()
            ;
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="actionIfIdExists">string id, reference to list page</param>
        /// <returns></returns>
        public TSelf ExecuteCustom_Using_LastId(string tableName, string idFieldName, string hintFieldName, string hintFieldValue, EnumHintFieldSearchTechnique hintFieldSearchTechnique, Action <string, TSelf> actionIfIdExists)
        {
            string id = DBHelper.GetLastCreatedIdForTable(tableName, idFieldName, hintFieldName, hintFieldValue, hintFieldSearchTechnique);

            if (!string.IsNullOrEmpty(id))
            {
                actionIfIdExists.Invoke(id, this as TSelf);
            }
            else
            {
                throw new Exception(string.Format("Last ID not available for {0}.{1}", tableName, idFieldName));
            }

            return(this as TSelf);
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="idFieldName"></param>
        /// <param name="actionIfIdExists"></param>
        /// <returns></returns>
        public TSelf ExecuteCustom_Using_LastId(string tableName, string idFieldName, Action <string, TSelf> actionIfIdExists)
        {
            string id = DBHelper.GetLastCreatedIdForTable(tableName, idFieldName);

            if (!string.IsNullOrEmpty(id))
            {
                actionIfIdExists.Invoke(id, this as TSelf);
            }
            else
            {
                throw new Exception(string.Format("Last ID not available for {0}.{1}", tableName, idFieldName));
            }
            //else if (actionIf_NO_Id != null)
            //    actionIf_NO_Id.Invoke(this);

            return(this as TSelf);
        }