コード例 #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
                selectedStopNumber = ActivityLogCommentStopNumber.SelectByRandomIndex("Activity Log Stop Number");
            }
            else
            {
                selectedStopNumber = stopNumber.ToString();
                ActivityLogCommentStopNumber.SelectByText(stopNumber.ToString(), "Activity Log Stop Number");
            }
            ScenarioContext.Current["CommentedOnStopNumber"] = selectedStopNumber;                     //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
            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}");
            Thread.Sleep(2000);       //Waiting for the API to process adding the comment. Otherwise we won't see it when we make an assertion.
            ActivityLogClose.Click(); //Close the Quick Activity Log popup
        }
コード例 #2
0
 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();
 }