def check_event_exist_on_event_log_table(self, eventDescription, eventDateTime=None, position=1): isExisted = event._does_event_exist(eventDescription, eventDateTime, position) Assert.should_be_true(isExisted)
def _check_tree_node_selected(self, treeDiv, treeNode, delimiter="/"): buildXpath = self._build_tree_node_xpath(treeDiv, treeNode, delimiter) expectedNode = buildXpath + "[@class='jstree-clicked']" observedResult = Element( expectedNode).return_wait_for_element_visible_status(1) Assert.should_be_true(observedResult == True, "Tree node is not selected")
def check_event_exist_on_event_log_for_object(self, eventDescription, eventDateTime=None, position=1): isExisted = event._does_event_exist(eventDescription, eventDateTime, position) Assert.should_be_equal(isExisted, True)
def check_wo_history_information(self, woName, currentStatus): self._select_iframe(self.woHistoryIframe, self.woHistoryTbl) inputValues = woName + "," + currentStatus returnRow = self._get_table_row_map_with_header_on_wo_history_table( "Work Order,Current Status", inputValues) Assert.should_be_true(returnRow > 0) driver.unselect_frame()
def check_tree_node_check_box_not_exist_on_select_filter(self, path, delimiter="/"): self._select_iframe(self.uniqueIframe, self.locationTreeDiv) self.locationTreeDiv.mouse_over() isExisted = self.locationTreeDiv.does_tree_node_checkbox_exist(path, delimiter) Assert.should_be_equal(isExisted, False, "This tree node checkbox exists") driver.unselect_frame()
def check_number_of_event(self, eventDescription, eventDateTime=None, position=None, expectedValue=1): numberEvent = event._get_number_of_event(eventDescription, eventDateTime, position) Assert.should_be_equal_as_numbers(numberEvent, expectedValue)
def check_tree_node_not_exist_on_quareo_unmanaged(self, treePanel, treeNode, delimiter="/"): """tree_panel = From or To, tree_node with format as example Site/TM_MNE_236/Room1, the icon name to check""" checkNodeExist = self.does_tree_node_exist_on_quareo_unmanaged( treePanel, treeNode, delimiter) Assert.should_be_true(checkNodeExist == False)
def check_event_not_exist_on_event_notification_profiles_page( self, eventNames, delimiter=","): self._select_iframe(self.uniqueIframe, self.profileEventsTbl) listEventNames = eventNames.split(delimiter) for eventName in listEventNames: eventRow = self.profileEventsTbl._get_table_row_map_with_header( "Name", eventName, ",") Assert.should_be_true(eventRow == 0, eventName + " exists") driver.unselect_frame()
def check_tree_node_not_exist_on_patching(self, treePanel, treeNode, delimiter="/"): """tree_panel = From or To, tree_node with format as example Site/TM_MNE_236/Room1, the icon name to check""" checkNodeExist = self.does_tree_node_exist_on_patching( treePanel, treeNode, delimiter) Assert.should_be_true(checkNodeExist == False, treeNode + " exists on Patching window")
def compare_images(self, refImagePath, testImagePath): imgRef = Image.open(refImagePath) imgTest = Image.open(testImagePath) diff = ImageChops.difference(imgRef, imgTest) if diff.getbbox() is None: boolCheck = True else: boolCheck = False Assert.should_be_true(boolCheck, "Images are different")
def _check_event_exist_state_at_priority_event_settings( self, events, stateExist, delimiter=","): """"stateExist: True, False""" listEvents = events.split(delimiter) self._select_iframe(self.uniqueIframe, self.eventsTbl) for event in listEvents: eventRow = self.eventsTbl._get_table_row_map_with_header( "Name", event, ",") if stateExist: Assert.should_be_true(eventRow > 0, event + " does not exist") else: Assert.should_be_true(eventRow == 0, event + " exists") driver.unselect_frame()
def check_report_category_exist(self, checkedPage, reportCategory, reportDescription): """Use to check the Category and Description of the report. ... We have 3 arguments: ... - 'checkedPage': Page contain category report. ... - 'reportCategory': Report Category ... - 'reportDescription': Report Description""" self._select_iframe(self.uniqueIframe, self.selectReportTbl) columnName = checkedPage + "--Description" reportCat = reportCategory + "--" + reportDescription returnRow = self.selectReportTbl._get_table_row_map_with_header(columnName, reportCat, "--") Assert.should_be_true(returnRow > 0, "Category Report do not displays correctly.") driver.unselect_frame()
def check_data_row_in_excel_file(self, filePath, line, expectedValue, delimiter=","): with open(filePath, 'r') as file: csvFile = list(_csv.reader(file)) observedLine = csvFile[int(line) - 1] listExpectedValue = expectedValue.split(delimiter) lenexpectedValue = len(listExpectedValue) for i in range(lenexpectedValue): if observedLine[i] == " ": observedResult = "" else: observedResult = observedLine[i] Assert.should_be_equal(observedResult, listExpectedValue[i]) print(observedLine[i] + " = " + listExpectedValue[i])
def check_synchronize_switch_successfully(self, switchName=None, ipAdd=None, closeWindow=True): """Use to check the status of switch change to "Scheduled" in SNMP Status Window. ... We have 3 arguments: ... - 'switchName': name of switch ... - 'ipAdd': IP address of switch ... - 'closeWindow'""" self.snmpStatusIframe.wait_until_page_contains_element() driver.select_frame(self.snmpStatusIframe) self.snmpTaskStatusIframe.wait_until_page_contains_element() driver.select_frame(self.snmpTaskStatusIframe) self.snmpStatusTbl.wait_until_element_is_visible() switchStatus = switchName + "--" + ipAdd + "--" + "Scheduled" returnRow = self.snmpStatusTbl._get_table_row_map_with_header("Device--IP Address--Status", switchStatus, "--") Assert.should_be_true(returnRow > 0, "Switch synchronize successfully.") driver.unselect_frame() if closeWindow: self.close_snmp_status_window()
def _work_on_table_row_map_with_header(self, headers, values, check=False, row=None, delimiter=","): dynamicFinalRowXpath = self._build_row_xpath(headers, values, row, delimiter) isRowExisted = Element( dynamicFinalRowXpath).return_wait_for_element_visible_status( constants.SELENPY_DEFAULT_TIMEOUT) if check is not False: Assert.should_be_true(isRowExisted, dynamicFinalRowXpath + " is not existed") else: if isRowExisted: rowIndex = self._get_row_index(dynamicFinalRowXpath) else: rowIndex = 0 return rowIndex
def _check_layout_item_existing_state(self, pane, items, state, delimiter=","): """state: exist, not exist""" self._select_iframe(self.uniqueIframe, self.editLayoutHeaderFooterLeftDiv) paneXpath = self.define_layout_pane_xpath(pane) listItem = items.split(delimiter) for item in listItem: isEpandedItemExisted = "->" in item if isEpandedItemExisted: itemElement = self.return_expand_layout_item(paneXpath, item) else: itemElement = self.build_layout_item_element(paneXpath, "Source", item) if state == "exist": observedState = itemElement.is_element_present() Assert.should_be_true(observedState == True, item + " does not exist") else: observedState = itemElement.is_element_existed() Assert.should_be_true(observedState == False, item + " exists") driver.unselect_frame()
def _check_mpo_connection_type_state(self, frame, mpoConnectionType, isEnabled, mpoConnectionTab=None): ''''mpoConnectionType': Options: Mpo12_Mpo12, Mpo12_4xLC, Mpo12_6xLC, Mpo24_Mpo24, Mpo24_12xLC, Mpo24_3xMpo12, Mpo24_2xMpo12, Mpo12_6xLC_EB''' driver.select_frame(frame) self._select_mpo_connection_tab(mpoConnectionTab) if isEnabled: self.dynamicConnectionType.arguments = [ mpoConnectionType, mpoConnectionType ] elementEnabledExist = self.dynamicConnectionType.return_wait_for_element_visible_status( 3) Assert.should_be_true(elementEnabledExist) else: self.dynamicDisabledConnectionType.arguments = [ mpoConnectionType, mpoConnectionType ] elementDisabledExist = self.dynamicDisabledConnectionType.return_wait_for_element_visible_status( 3) Assert.should_be_true(elementDisabledExist) driver.unselect_frame()
def check_wo_information_on_wo_queue(self, columns, values, priority=None, scheduling=None, dateCreated=None, expectedDate=None, additionalInformation=None, inactivityAlert=None): self._select_iframe(workOrders.woQueueIframe, self.markCompleteBtn) returnRow = self.get_table_row_map_with_header_on_wo_queue_table( columns, values) Assert.should_be_true(returnRow > 0) ######### Expand WO ############# self.woQueueTbl._click_table_cell(returnRow, 1, "double") self._select_iframe(self.woQueueGridIframe, workOrders.priorityCbb) if priority is not None: priorityCbbValue = workOrders.priorityCbb.get_selected_list_label() Assert.should_be_equal(priorityCbbValue, priority) if scheduling is not None: schedulingCbbValue = workOrders.schedulingCbb.get_selected_list_label( ) Assert.should_be_equal(schedulingCbbValue, scheduling) if dateCreated is not None: SeleniumAssert.element_attribute_value_should_be( workOrders.dateCreatedTxt, "value", dateCreated) if expectedDate is not None: SeleniumAssert.element_attribute_value_should_be( workOrders.expectedDateTxt, "value", expectedDate) if inactivityAlert is not None: SeleniumAssert.element_attribute_value_should_be( workOrders.inactivityAlertTxt, "value", inactivityAlert) if additionalInformation is not None: SeleniumAssert.element_text_should_be( workOrders.additionalInformationTxt, additionalInformation) driver.unselect_frame()
def check_current_window_title_contain(self, titleContains): title = driver.get_title() Assert.should_contain(title, titleContains)
def _check_element_js_property(self, element, selectedProperty, expectedValue): observedValue = self._get_element_js_property(element, selectedProperty) Assert.should_be_equal(observedValue, expectedValue)