Пример #1
0
        public void CreateQuickActivityLogCommentForRandomRouteAndGivenStopNumber(int?stopNumber, string commentCategory, bool commentIsInternal)
        {
            OpenQuickActivityLogModal();
            //Select a random option from the Route select list and then save off the Route Id selected
            var selectedRouteId = ActivityLogCommentRouteNumber.SelectByRandomIndex("Activity Log Route Number");

            //Save off the route number for assertions later
            ScenarioContext.Current["CommentedOnRouteNumber"] = ActivityLogCommentRouteNumber.GetSelectedOptionText();
            ScenarioContext.Current["CommentedOnRouteId"]     = selectedRouteId; //Save off the route id for assertions later
            var selectedStopNumber = "";

            if (stopNumber == null)
            {
                //Assuming we randomly select a stop number if the param is null
                ActivityLogCommentStopNumber.SelectByRandomIndex("Activity Log Stop Number");
            }
            else
            {
                selectedStopNumber = stopNumber.ToString();
                ActivityLogCommentStopNumber.SelectByText(stopNumber.ToString(), "Activity Log Stop Number");
            }
            ScenarioContext.Current["CommentedOnStopNumber"] = ActivityLogCommentStopNumber.GetSelectedOptionText(); //Save off the stop number for assertion later
            ActivityLogCommentCategory.SelectByText(commentCategory, "Activity Log Comment Category");               //Select a category for the comment
            var commentValue = $"Attempting to make Quick Activity Log comment on {DateTime.Now.ToString("MM/dd/yy HH:mm:ss")} for route id: {selectedRouteId} stop number: {selectedStopNumber}.";

            ScenarioContext.Current["ExpectedComment"]         = commentValue;    //Save off expected comment
            ScenarioContext.Current["ExpectedCommentCategory"] = commentCategory; //Save off expected comment category
            ActivityLogComment.EnterText(commentValue, "Activity Log Comment");
            ActivityLogSaveComment.Click();
            driver.WaitUntilElementIsPresent(By.ClassName("comment-table"), 30);
            Debug.WriteLine($"Created activity log comment for stop number {stopNumber}");
        }
 private void EnterDetailsForActivityLogComment(string comment, string commentCategory, bool commentIsInternal)
 {
     ActivityLogComment.EnterText(comment, "Activity Log Comment");
     ActivityLogCommentCategory.SelectByText(commentCategory, "Activity Log Comment Category");
     if (commentIsInternal)
     {
         ActivityLogCommentIsInteral.Check();
     }
     else
     {
         ActivityLogCommentIsInteral.UnCheck();
     }
 }