Exemplo n.º 1
0
    def _check_event_details(self,
                             eventDetails,
                             eventDescription,
                             eventDateTime=None,
                             position=1,
                             delimiter="/"):
        textDetailsList = eventDetails.split(delimiter)
        detailsXpath = self.detailsBridgeXpath.locator()
        eventPos = self._build_event_xpath(eventDescription, eventDateTime,
                                           position)
        self.secondIframe.wait_until_page_contains_element()
        self._select_iframe(self.secondIframe, self.eventLogTbl)
        self.selectItemCbb.wait_until_element_is_visible()
        self.selectItemCbb.select_from_list_by_label(1000)

        self._expand_events()

        for text in textDetailsList:
            subDetails = detailsXpath
            self.dynamicTextXpath.arguments = [text]
            strTextXpath = self.dynamicTextXpath.locator()
            detailsXpath = subDetails + strTextXpath

        fullDetailsXpath = eventPos.locator() + detailsXpath
        SeleniumAssert.element_should_be_visible(Element(fullDetailsXpath))
        driver.unselect_frame()
Exemplo n.º 2
0
 def check_object_exist_on_combo_box_filter(self, label, objects, delimiter=","):
     self._select_iframe(self.uniqueIframe, self.locationTreeDiv)
     listObject = objects.split(delimiter)
     for i in listObject:
         self.dynamicComboboxFilter.arguments = [label, i]
         SeleniumAssert.element_should_be_visible(self.dynamicComboboxFilter)
     driver.unselect_frame()
Exemplo n.º 3
0
 def check_task_list_information_on_patching_window(self, position, name,
                                                    taskType, treeFrom,
                                                    connectionType, treeTo):
     self.dynamicTaskListTable.arguments = [position]
     self.dynamicTaskName.arguments = [
         self.dynamicTaskListTable.locator(), name
     ]
     self.dynamicTaskType.arguments = [
         self.dynamicTaskListTable.locator(), taskType
     ]
     self.dynamicTaskTreeFrom.arguments = [
         self.dynamicTaskListTable.locator(), treeFrom
     ]
     self.dynamicTaskConnectType.arguments = [
         self.dynamicTaskListTable.locator(), connectionType
     ]
     self.dynamicTaskTreeTo.arguments = [
         self.dynamicTaskListTable.locator(), treeTo
     ]
     driver.select_frame(self.patchingIframe)
     self.dynamicTaskTreeTo.mouse_over()
     SeleniumAssert.element_should_be_visible(self.dynamicTaskName)
     SeleniumAssert.element_should_be_visible(self.dynamicTaskType)
     SeleniumAssert.element_should_be_visible(self.dynamicTaskTreeFrom)
     SeleniumAssert.element_should_be_visible(self.dynamicTaskConnectType)
     SeleniumAssert.element_should_be_visible(self.dynamicTaskTreeTo)
     driver.unselect_frame()
Exemplo n.º 4
0
 def check_object_state_on_multiple_select_filter(self, label, objects, containPosition="Available", delimiter=",", state="exist"):
     """state: exist, non-exist"""
     self._select_iframe(self.uniqueIframe, self.locationTreeDiv)
     self.dynamicLabelSelectFilter.arguments = [label]
     listObject = objects.split(delimiter)
     for i in listObject:
         self.dynamicObjectMultiSelect.arguments = [self.dynamicLabelSelectFilter.locator(), containPosition, i]
         if state == "exist":
             SeleniumAssert.element_should_be_visible(self.dynamicObjectMultiSelect)
         else:
             SeleniumAssert.element_should_not_be_visible(self.dynamicObjectMultiSelect)
     driver.unselect_frame() 
Exemplo n.º 5
0
 def check_port_status_on_patching_window(self, statusPanel, treeNode,
                                          status):
     if statusPanel == "From":
         self.click_tree_node_patching("From", treeNode)
         self.dynamicPortStatus.arguments = [
             self.statusFromDiv.locator(), status
         ]
     else:
         self.click_tree_node_patching("To", treeNode)
         self.dynamicPortStatus.arguments = [
             self.statusToDiv.locator(), status
         ]
     driver.select_frame(self.patchingIframe)
     SeleniumAssert.element_should_be_visible(self.dynamicPortStatus)
     driver.unselect_frame()
Exemplo n.º 6
0
    def _check_device_information_on_trace(self,
                                           objectXpath,
                                           deviceInformation,
                                           delimiter="->"):
        """'object_xpath' is xpath string of the object we want to check(ex: //div[@id='TraceMapDialog']//div[contains(@class,'MPOPairContent MpoPair') and contains(@style,'display: block')]//div[@class = 'TraceForFiberWrapper' and contains(@style,'display: block')]//div[@id='3' and contains(@class,'ObjectDetail')])
    ...    'device_information' is a list including all information of device (separate by ->)"""

        listInformation = deviceInformation.split(delimiter)
        temp = 1
        for information in listInformation:
            dynamicInformationXpath = self.element("dynamicInformationXpath")
            dynamicInformationXpath.arguments = [
                objectXpath, temp, information, information
            ]
            SeleniumAssert.element_should_be_visible(dynamicInformationXpath)
            temp += 1
Exemplo n.º 7
0
 def check_email_exist(self,
                       emailSubject,
                       details=None,
                       timeout=constants.SELENPY_EMAIL_RECEIVED_TIMEOUT,
                       delimiter=","):
     self.wait_until_email_received(emailSubject, timeout)
     if details is not None:
         detailsXpath = ""
         emailDetailslist = details.split(delimiter)
         for textDetails in emailDetailslist:
             self.dynamicEmailDetails.arguments = [textDetails]
             detailsXpath += self.dynamicEmailDetails.locator()
             fullEmailDetailsXpath = self.emailDetailsDiv.locator(
             ) + detailsXpath
         SeleniumAssert.element_should_be_visible(
             Element(fullEmailDetailsXpath))
 def _check_icon_object_on_connections_window(self,
                                              frame,
                                              treePanel,
                                              fromDivTree,
                                              toDivTree,
                                              treeNode,
                                              icon,
                                              delimiter="/"):
     self._does_frame_tree_node_exist(frame, treePanel, fromDivTree,
                                      toDivTree, treeNode, delimiter)
     nodeXpath = self._build_page_tree_node_xpath(treePanel, fromDivTree,
                                                  toDivTree, treeNode,
                                                  delimiter)
     driver.select_frame(frame)
     self.treeObjectIcon.arguments = [nodeXpath, icon]
     SeleniumAssert.element_should_be_visible(self.treeObjectIcon)
     driver.unselect_frame()
Exemplo n.º 9
0
 def check_event_report_exist (self, eventInformation, eventDetails, delimiter=","):
     self._select_iframe(self.uniqueIframe, self.reportContentTbl)
     self._wait_for_processing(3)
     textInformationList = eventInformation.split(delimiter)
     textDetailsList = eventDetails.split(delimiter)
     eventRowDiv = self.headEventReportRow.locator()
     infoXpath = ""
     detailsXpath = ""
     
     for textInfo in textInformationList:
         self.dynamicEventReportInfo.arguments = [textInfo]
         infoXpath += self.dynamicEventReportInfo.locator()
     fullInfoXpath = eventRowDiv + infoXpath
     
     for textDetails in textDetailsList:
         self.dynamicEventReportDetails.arguments = [textDetails]
         detailsXpath += self.dynamicEventReportDetails.locator()
     fullEventReportXpath = fullInfoXpath + detailsXpath
     SeleniumAssert.element_should_be_visible(Element(fullEventReportXpath))
     driver.unselect_frame()
 def _check_mpo_connection_type_information(self,
                                            frame,
                                            mpoConnectionTab=None,
                                            mpoConnectionType=None,
                                            mpoBranches=None,
                                            title=None):
     self.dynamicConnectionType.arguments = [
         mpoConnectionType, mpoConnectionType
     ]
     self.dynamicSelectedConnectionType.arguments = [mpoConnectionType]
     self.dynamicViewTab.arguments = [mpoConnectionTab + " Connection Type"]
     self._select_iframe(frame, self.dynamicViewTab)
     self._wait_for_processing()
     self._select_mpo_connection_tab(mpoConnectionTab)
     self._select_mpo_connection_type(mpoConnectionType)
     if (mpoConnectionTab is not None) and (mpoConnectionType is not None):
         SeleniumAssert.element_should_be_visible(
             self.dynamicConnectionType)
         SeleniumAssert.element_should_be_visible(
             self.dynamicSelectedConnectionType)
     if mpoBranches is not None:
         listMpoBranch = mpoBranches.split(",")
         for branch in listMpoBranch:
             self.dynamicMpoBranch.arguments = [branch]
             SeleniumAssert.element_should_be_visible(self.dynamicMpoBranch)
     if title is not None:
         self._check_title_attribute(self.dynamicConnectionType, title)
     driver.unselect_frame()
Exemplo n.º 11
0
    def _check_total_trace(self, divTraceXpath, totalTrace):
        """Use for check number of trace
    ...    - 'div_trace_xpath' define the page this keyword working( ex: on patching window, 'div_trace_xpath' is //div[@id='CurrentTraceResult'])
    ...    - 'total_trace' is number of trace
    ...    - 'close_trace_window': choosing yes or no"""

        traceMapXpath = self._define_trace_map_xpath(divTraceXpath)
        self._wait_first_object_on_trace(traceMapXpath)
        idLastObject = int(totalTrace) * 2 - 1
        idNotExistObject = int(totalTrace) * 2 + 1
        dynamicLastTraceObjectXpath = self.element("dynamicTraceObjectXpath")
        dynamicLastTraceObjectXpath.arguments = [
            traceMapXpath, str(idLastObject)
        ]
        dynamicNotExistTraceObjectXpath = self.element(
            "dynamicTraceObjectXpath")
        dynamicNotExistTraceObjectXpath.arguments = [
            traceMapXpath, str(idNotExistObject)
        ]
        SeleniumAssert.element_should_be_visible(dynamicLastTraceObjectXpath)
        SeleniumAssert.element_should_not_be_visible(
            dynamicNotExistTraceObjectXpath)
 def _check_icon_mpo_port_type_on_connections_window(
         self,
         frame,
         treePanel,
         fromDivTree,
         toDivTree,
         treeNode,
         portType,
         isExisted,
         delimiter="/"):
     self._does_frame_tree_node_exist(frame, treePanel, fromDivTree,
                                      toDivTree, treeNode, delimiter)
     nodeXpath = self._build_page_tree_node_xpath(treePanel, fromDivTree,
                                                  toDivTree, treeNode,
                                                  delimiter)
     driver.select_frame(frame)
     self.treePortTypeIcon.arguments = [nodeXpath, portType]
     if isExisted:
         SeleniumAssert.element_should_be_visible(self.treePortTypeIcon)
     else:
         SeleniumAssert.element_should_not_be_visible(self.treePortTypeIcon)
     driver.unselect_frame()
Exemplo n.º 13
0
    def _check_trace_object(self,
                            divTraceXpath,
                            indexObject,
                            mpoType=None,
                            objectPosition=None,
                            objectPath=None,
                            objectType=None,
                            portIcon=None,
                            connectionType=None,
                            scheduleIcon=None,
                            informationDevice=None):
        """This keyword is used for check all information of a object on trace window: position, object path, object detail, object type, object connection type, scheduled icon.
    ...     We have  9 arguments:
    ...    - 'divTraceXpath' define the page this keyword working( ex: on patching window, 'divTraceXpath' is //div[@id='divTrace'])
    ...    - 'indexObject': Provide the index of object we want to check
    ...    - 'objectPosition': enter position(ex: 1, MPO12-1)
    ...    - 'objectPath': enter object path(ex: Site/Building 01/Floor 01/Room 01/1:1 Rack 001/Panel 01/01)
    ...    - 'objectType': enter type of object - it's defined by a png file(ex: Generic Copper Panel)
    ...    - 'scheduleIcon': this argument is used on checking trace the object related to an uncompleted work order
    ...    - 'connectionType': enter the connection type between this object and next object
    ...    - 'informationDevice': enter information device(ex:01,Panel 01,1:1 Rack 001,Room 01,Floor 01,Building 01,Site)"""

        ##################################Define trace map##################################
        traceMapXpath = self._define_trace_map_xpath(divTraceXpath)
        self._wait_first_object_on_trace(traceMapXpath)

        ##################################Variables##################################
        idObject = int(indexObject) * 2 - 1
        self.dynamicObjectXpath.arguments = [traceMapXpath, str(idObject)]

        ##################################Click or move object##################################
        if objectPath is not None:
            if (traceMapXpath.__contains__("//div[@id='divTrace']")):
                self.dynamicObjectXpath.mouse_over()
            else:
                self.dynamicObjectXpath.click_visible_element()

        ##################################Check Object Position##################################
        #--------------------------For since--------------------------#
        if objectPosition is not None:
            dynamicObjectPositionXpath = self.element(
                "dynamicObjectPositionXpath")
            dynamicObjectPositionXpath.arguments = [
                traceMapXpath, str(idObject), objectPosition
            ]
            lengthSince = len(objectPosition)
            if (lengthSince == 5 and objectPosition[0:5] == "since"):
                currentTime = utils.get_current_date_time(
                    resultFormat="%Y-%m-%d")
                dynamicSinceNoSpace = self.element("dynamicSinceNoSpace")
                dynamicSinceNoSpace.arguments = [
                    traceMapXpath, str(idObject), currentTime
                ]
                doesSinceNoSpaceExist = dynamicSinceNoSpace.is_element_existed(
                )
                if (doesSinceNoSpaceExist == False):
                    dynamicSinceWithSpace = self.element(
                        "dynamicSinceWithSpace")
                    dynamicSinceWithSpace.arguments = [
                        traceMapXpath,
                        str(idObject), currentTime
                    ]
                    SeleniumAssert.element_should_be_visible(
                        dynamicSinceWithSpace)
            else:
                SeleniumAssert.element_should_be_visible(
                    dynamicObjectPositionXpath)

        ##################################Check MPO Type##################################
        if mpoType is not None:
            dynamicMpoTypeXpath = self.element("dynamicMpoTypeXpath")
            dynamicMpoTypeXpath.arguments = [
                traceMapXpath, str(idObject), mpoType
            ]
            SeleniumAssert.element_should_be_visible(dynamicMpoTypeXpath)

        ##################################Check Object Path Banner##################################
        if objectPath is not None:
            dynamicObjectPathXpath = self.element("dynamicObjectPathXpath")
            dynamicObjectPathXpath.arguments = [traceMapXpath, objectPath]
            SeleniumAssert.element_should_be_visible(dynamicObjectPathXpath)

        ##################################Check Object Type##################################
        if objectType is not None:
            dynamicObjectTypeXpath = self.element("dynamicObjectTypeXpath")
            dynamicObjectTypeXpath.arguments = [
                traceMapXpath, str(idObject), objectType
            ]
            SeleniumAssert.element_should_be_visible(dynamicObjectTypeXpath)

        ##################################Check Connection Type##################################
        if connectionType is not None:
            dynamicConnectionTypeXpath = self.element(
                "dynamicConnectionTypeXpath")
            dynamicConnectionTypeXpath.arguments = [
                traceMapXpath, str(indexObject), connectionType
            ]
            SeleniumAssert.element_should_be_visible(
                dynamicConnectionTypeXpath)

        ##################################Check Port Icon##################################
        if portIcon is not None:
            dynamicPortIconXpath = self.element("dynamicPortIconXpath")
            dynamicPortIconXpath.arguments = [
                traceMapXpath, str(idObject), portIcon
            ]
            SeleniumAssert.element_should_be_visible(dynamicPortIconXpath)

        ##################################Check Schedule Icon##################################
        if scheduleIcon is not None:
            self.dynamicScheduleIconXpath.arguments = [
                traceMapXpath, str(idObject), scheduleIcon
            ]
            SeleniumAssert.element_should_be_visible(
                self.dynamicScheduleIconXpath)

        ##################################Check Information Device##################################
        if informationDevice is not None:
            self._check_device_information_on_trace(
                self.dynamicObjectXpath.locator(), informationDevice)
 def check_geomap_options_link_displays(self):
     SeleniumAssert.element_should_be_visible(self.optionsLnk)