Ejemplo n.º 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}");
        }
 public void CreateActivityLogCommentForGivenStopNumber(int routeId, int stopNumber, string commentValue, string commentCategory, bool commentIsInternal)
 {
     OpenActivityLogForGivenRouteIdAndStopNumber(routeId, stopNumber);
     ActivityLogAddComment.Click();
     ScenarioContext.Current["ExpectedComment"] = commentValue;                                                    //Save for use later
     EnterDetailsForActivityLogComment(commentValue, commentCategory, commentIsInternal);
     ActivityLogSaveComment.Click();                                                                               //Click Save
     driver.WaitUntilElementIsPresent(By.ClassName("comment-table"), 30);                                          //Wait until the Comments table loads
     ActivityLogTable.Displayed.Should().BeTrue("Activity Log Comment should have saved, but it failed to save."); //Verify comment saved successfully
     Debug.WriteLine($"Created an activity Log for stop index {stopNumber} for RouteId {routeId}");
     ActivityLogClose.Click();
 }