Exemple #1
0
        public static void FillInSRTicketFields(string srType, ModuleData data)
        {
            ServiceRequestIDs ID = new ServiceRequestIDs();

            log.Info("Selecting the requester: " + data.Requester);
            GeneralPage.ClickOnObject(ID.requester);
            GeneralPage.ClickOnObject(ID.GenerateRequesterXPath(data.Requester));

            log.Info("Sending summary text: " + data.Summary);
            GeneralPage.InputTextInTextbox(data.Summary, ID.Summary);

            log.Info("Selecting Today as Due Date");
            GeneralPage.ClickOnObject(ID.dueDateButton);
            GeneralPage.ClickOnObject(ID.todayDate);

            if (srType == "Move Request")
            {
                log.Info("Sending Employee Name: " + ((ServiceRequestData)data).EmployeeName);
                GeneralPage.InputTextInTextbox(((ServiceRequestData)data).EmployeeName, ID.employeeName);

                log.Info("Sending Employee Type: " + ((ServiceRequestData)data).EmployeeType);
                GeneralPage.InputTextInTextbox(((ServiceRequestData)data).EmployeeType, ID.employeeType);

                log.Info("Sending Position: " + ((ServiceRequestData)data).Position);
                GeneralPage.InputTextInTextbox(((ServiceRequestData)data).Position, ID.position);

                log.Info("Sending Current Phone Ext : " + ((ServiceRequestData)data).CurrentPhoneExt);
                GeneralPage.InputTextInTextbox(((ServiceRequestData)data).CurrentPhoneExt, ID.currentPhoneExt);

                log.Info("Sending New Phone Ext : " + ((ServiceRequestData)data).NewPhoneExt);
                GeneralPage.InputTextInTextbox(((ServiceRequestData)data).NewPhoneExt, ID.newPhoneExt);

                log.Info("Sending Current Cube or Office: " + ((ServiceRequestData)data).CurrentCubeOrOffice);
                GeneralPage.InputTextInTextbox(((ServiceRequestData)data).CurrentCubeOrOffice, ID.currentCubeOffice);

                log.Info("Sending New Cube or Office: " + ((ServiceRequestData)data).NewCubeOrOffice);
                GeneralPage.InputTextInTextbox(((ServiceRequestData)data).NewCubeOrOffice, ID.newCubeOffice);

                log.Info("Selecting Current Location: " + ((ServiceRequestData)data).CurrentLocation);
                GeneralPage.ClickOnObject(ID.currentLocationArrow);
                SelectHierarchyLocationField(((ServiceRequestData)data).CurrentLocation, ID, "CurrentLocation");

                log.Info("Selecting New Location: " + ((ServiceRequestData)data).NewLocation);
                GeneralPage.ClickOnObject(ID.newLocationArrow);
                SelectHierarchyLocationField(((ServiceRequestData)data).NewLocation, ID, "NewLocation");
            }
            else
            {
                switch (srType)
                {
                case "Access Request":
                    log.Info("Selecting System: " + ((ServiceRequestData)data).System);
                    GeneralPage.SelectOptionFromDropdown(ID.systemDropdown, ((ServiceRequestData)data).System);

                    log.Info("Selecting Access Level: " + ((ServiceRequestData)data).AccessLevel);
                    GeneralPage.SelectOptionFromDropdown(ID.accessLevelDropdown, ((ServiceRequestData)data).AccessLevel);

                    log.Info("Selecting Access Location: " + ((ServiceRequestData)data).AccessLocation);
                    GeneralPage.SelectOptionFromDropdown(ID.accessLocationDropdown, ((ServiceRequestData)data).AccessLocation);
                    break;

                case "General Request":
                    break;

                case "Hardware Request":
                    log.Info("Selecting Hardware Type: " + ((ServiceRequestData)data).HardwareType);
                    GeneralPage.SelectOptionFromDropdown(ID.hardwareTypeDropdown, ((ServiceRequestData)data).HardwareType);

                    log.Info("Selecting Operating System: " + ((ServiceRequestData)data).OperatingSystem);
                    GeneralPage.SelectOptionFromDropdown(ID.operatingSystemDropdown, ((ServiceRequestData)data).OperatingSystem);
                    break;

                case "Software Request":
                    log.Info("Selecting Requested Software: " + ((ServiceRequestData)data).RequestedSoftware);
                    GeneralPage.SelectOptionFromDropdown(ID.requestedSoftwareDropdown, ((ServiceRequestData)data).RequestedSoftware);

                    log.Info("Selecting Operating System: " + ((ServiceRequestData)data).OperatingSystem);
                    GeneralPage.SelectOptionFromDropdown(ID.operatingSystemDropdown, ((ServiceRequestData)data).OperatingSystem);
                    break;

                case "Training Request":
                    log.Info("Sending Course Name: " + ((ServiceRequestData)data).CourseName);
                    GeneralPage.InputTextInTextbox(((ServiceRequestData)data).CourseName, ID.coursenameTextbox);

                    log.Info("Sending Course Cost: " + ((ServiceRequestData)data).CourseCost);
                    GeneralPage.ClearTextbox(ID.courseCostTextbox);
                    GeneralPage.InputTextInTextbox(((ServiceRequestData)data).CourseCost, ID.courseCostTextbox);

                    log.Info("Selecting Program Type: " + ((ServiceRequestData)data).ProgramType);
                    GeneralPage.SelectOptionFromDropdown(ID.programTypeDropdown, ((ServiceRequestData)data).ProgramType);

                    log.Info("Selecting Training Level: " + ((ServiceRequestData)data).TrainingLevel);
                    GeneralPage.SelectOptionFromDropdown(ID.trainingLevelDropdown, ((ServiceRequestData)data).TrainingLevel);

                    log.Info("Selecting Today as Course Start Date");
                    GeneralPage.ClickOnObject(ID.courseStartDateButton);
                    GeneralPage.ClickOnObject(ID.courseStartTodayDate);

                    log.Info("Selecting Today as Course End Date");
                    GeneralPage.ClickOnObject(ID.courseEndDateButton);
                    GeneralPage.ClickOnObject(ID.courseEndTodayDate);
                    break;

                default:
                    log.Info("Incorrect Service Request Type: " + srType +
                             ". See the feature file for errors");
                    Assert.Fail("Incorrect Service Request Type: " + srType +
                                ". See the feature file for errors");
                    break;
                }

                log.Info("Selecting Impact: " + data.Impact);
                GeneralPage.SelectOptionFromDropdown(ID.impactDropdown, data.Impact);

                log.Info("Selecting Urgency: " + data.Urgency);
                GeneralPage.SelectOptionFromDropdown(ID.urgencyDropdown, data.Urgency);

                log.Info("Selecting Priority: " + data.Priority);
                GeneralPage.SelectOptionFromDropdown(ID.priorityDropdown, data.Priority);
            }
        }