Best Python code snippet using lettuce_webdriver_python
target_column_editor_viewer.py
Source:target_column_editor_viewer.py
...88 self.checkBox.setCheckState(QtCore.Qt.Unchecked)89 else:90 raise SystemError('Unknown state')91 tree_widget.setItemWidget(self, 1, self.checkBox)92 def uncheck_checkbox(self, state):93 if state:94 self.checkBox.setCheckState(QtCore.Qt.Unchecked)95 self.checkBox.setDisabled(True)96 self.setDisabled(True)97 else:98 self.checkBox.setDisabled(False)99 self.setDisabled(False)100 def check_check_box(self, state):101 if state:102 self.checkBox.setCheckState(QtCore.Qt.Checked)103class FromDbStateRow(QtWidgets.QTreeWidgetItem):104 def __init__(self, tree_widget: QtWidgets.QTreeWidget, column_property, parent=None, adapter=None):105 super().__init__(parent, [adapter.take_translate('TargetColumnsConfigEditor', 'fromDb'),])106 list_dict_to_comboBox = {'True': 'true', 'False': 'false'}107 self.checkBox = QtWidgets.QCheckBox()108 state = list(filter(lambda x: list_dict_to_comboBox[x] == column_property['fromDb'],109 list_dict_to_comboBox))[0]110 if state == 'True':111 self.checkBox.setCheckState(QtCore.Qt.Checked)112 elif state == 'False':113 self.checkBox.setCheckState(QtCore.Qt.Unchecked)114 else:115 raise SystemError('Unknown state')116 tree_widget.setItemWidget(self, 1, self.checkBox)117 def uncheck_checkbox(self, state):118 if state:119 self.checkBox.setCheckState(QtCore.Qt.Unchecked)120 self.checkBox.setDisabled(True)121 self.setDisabled(True)122 else:123 self.checkBox.setDisabled(False)124 self.setDisabled(False)125class IsAutoIncStateRow(QtWidgets.QTreeWidgetItem):126 def __init__(self, tree_widget: QtWidgets.QTreeWidget, column_property, parent=None, adapter=None):127 super().__init__(parent, [adapter.take_translate('TargetColumnsConfigEditor', 'isAutoInc'), ])128 list_dict_to_comboBox = {'True': 'true', 'False': 'false'}129 self.checkBox = QtWidgets.QCheckBox()130 state = list(filter(lambda x: list_dict_to_comboBox[x] == column_property['isAutoInc'],131 list_dict_to_comboBox))[0]132 if state == 'True':133 self.checkBox.setCheckState(QtCore.Qt.Checked)134 elif state == 'False':135 self.checkBox.setCheckState(QtCore.Qt.Unchecked)136 else:137 raise SystemError('Unknown state')138 tree_widget.setItemWidget(self, 1, self.checkBox)139 def uncheck_checkbox(self, state):140 if state:141 self.checkBox.setCheckState(QtCore.Qt.Unchecked)142 self.checkBox.setDisabled(True)143 self.setDisabled(True)144 else:145 self.checkBox.setDisabled(False)146 self.setDisabled(False)147class IsConcStateRow(QtWidgets.QTreeWidgetItem):148 def __init__(self, tree_widget: QtWidgets.QTreeWidget, column_property, parent=None, adapter=None):149 super().__init__(parent, [adapter.take_translate('TargetColumnsConfigEditor', 'isConc'), ])150 list_dict_to_comboBox = {'True': 'true', 'False': 'false'}151 self.checkBox = QtWidgets.QCheckBox()152 state = list(filter(lambda x: list_dict_to_comboBox[x] == column_property['isConc'],153 list_dict_to_comboBox))[0]154 if state == 'True':155 self.checkBox.setCheckState(QtCore.Qt.Checked)156 elif state == 'False':157 self.checkBox.setCheckState(QtCore.Qt.Unchecked)158 else:159 raise SystemError('Unknown state')160 tree_widget.setItemWidget(self, 1, self.checkBox)161 def uncheck_checkbox(self, state):162 if state:163 self.checkBox.setCheckState(QtCore.Qt.Unchecked)164 self.checkBox.setDisabled(True)165 self.setDisabled(True)166 else:167 self.checkBox.setDisabled(False)168 self.setDisabled(False)169class ColTypeRow(QtWidgets.QTreeWidgetItem):170 def __init__(self, tree_widget: QtWidgets.QTreeWidget, column_property, parent=None, adapter=None):171 super().__init__(parent, [adapter.take_translate('TargetColumnsConfigEditor', 'colType'), ])172 self.combo_box_colType = QtWidgets.QComboBox()173 list_dict_to_comboBox_colType = {'String': 'str', 'Integer': 'int'}174 list_in_comboBox_colType = ['String', 'Integer']175 self.combo_box_colType.addItems(list_in_comboBox_colType)176 if column_property['colType'] in ['str', 'int']:177 self.combo_box_colType.setCurrentIndex(178 list_in_comboBox_colType.index(179 list(filter(lambda x: list_dict_to_comboBox_colType[x] == column_property['colType'],180 list_dict_to_comboBox_colType))[0])181 )182 else:183 self.combo_box_colType.addItem(column_property['colType'])184 self.combo_box_colType.setCurrentText(column_property['colType'])185 tree_widget.setItemWidget(self, 1, self.combo_box_colType)186 def uncheck_checkbox(self, state):187 if state:188 self.combo_box_colType.setDisabled(True)189 self.setDisabled(True)190 else:191 self.combo_box_colType.setDisabled(False)192 self.setDisabled(False)193class IsUpdateCondionRow(QtWidgets.QTreeWidgetItem):194 def __init__(self, tree_widget: QtWidgets.QTreeWidget, column_property, parent=None, adapter=None):195 super().__init__(parent, [adapter.take_translate('TargetColumnsConfigEditor', 'isUpdateCondition'), ])196 list_dict_to_comboBox = {'True': 'true', 'False': 'false'}197 self.checkBox = QtWidgets.QCheckBox()198 state = list(filter(lambda x: list_dict_to_comboBox[x] == column_property['isUpdateCondition'],199 list_dict_to_comboBox))[0]200 if state == 'True':201 self.checkBox.setCheckState(QtCore.Qt.Checked)202 elif state == 'False':203 self.checkBox.setCheckState(QtCore.Qt.Unchecked)204 else:205 raise SystemError('Unknown state')206 tree_widget.setItemWidget(self, 1, self.checkBox)207 def uncheck_checkbox(self, state):208 if state:209 self.checkBox.setCheckState(QtCore.Qt.Unchecked)210 self.checkBox.setDisabled(True)211 self.setDisabled(True)212 else:213 self.checkBox.setDisabled(False)214 self.setDisabled(False)215class DefaultValueRow(QtWidgets.QTreeWidgetItem):216 def __init__(self, column_property: dict, parent: QtWidgets.QTreeWidget, parent_widget, adapter):217 super().__init__(parent_widget, ['', ])218 self.column_property = column_property219 self.checkBox_widget_for_defaultValue_check = QtWidgets.QCheckBox(adapter.take_translate('TargetColumnsConfigEditor', 'defaultValue'))220 self.line_edit_defeultValue = QtWidgets.QLineEdit()221 self.initialize()222 parent.setItemWidget(self, 0, self.checkBox_widget_for_defaultValue_check)223 parent.setItemWidget(self, 1, self.line_edit_defeultValue)224 self.checkBox_widget_for_defaultValue_check.stateChanged.connect(self.state_change)225 def uncheck_checkbox(self, state):226 if state:227 self.checkBox_widget_for_defaultValue_check.setCheckState(QtCore.Qt.Unchecked)228 self.checkBox_widget_for_defaultValue_check.setDisabled(True)229 self.line_edit_defeultValue.setDisabled(True)230 self.setDisabled(True)231 else:232 self.checkBox_widget_for_defaultValue_check.setDisabled(False)233 self.line_edit_defeultValue.setDisabled(False)234 self.setDisabled(False)235 def initialize(self):236 if self.column_property['defaultValue_mode'] != 'false':237 self.line_edit_defeultValue.setText(self.column_property['ifNull'])238 self.checkBox_widget_for_defaultValue_check.setCheckState(QtCore.Qt.Checked)239 else:240 self.checkBox_widget_for_defaultValue_check.setCheckState(QtCore.Qt.Unchecked)241 self.line_edit_defeultValue.setDisabled(True)242 def state_change(self):243 if self.checkBox_widget_for_defaultValue_check.isChecked():244 self.line_edit_defeultValue.setDisabled(False)245 else:246 self.line_edit_defeultValue.setDisabled(True)247class IfNullRow(QtWidgets.QTreeWidgetItem):248 def __init__(self, column_property: dict, parent: QtWidgets.QTreeWidget, parent_widget, adapter):249 super().__init__(parent_widget, ['', ])250 self.column_property = column_property251 self.checkBox_widget_for_ifNull_check = QtWidgets.QCheckBox(adapter.take_translate('TargetColumnsConfigEditor', 'ifNull'))252 self.line_edit_ifNull = QtWidgets.QLineEdit()253 self.initialize()254 parent.setItemWidget(self, 0, self.checkBox_widget_for_ifNull_check)255 parent.setItemWidget(self, 1, self.line_edit_ifNull)256 self.checkBox_widget_for_ifNull_check.stateChanged.connect(self.state_change)257 def uncheck_checkbox(self, state):258 if state:259 self.checkBox_widget_for_ifNull_check.setCheckState(QtCore.Qt.Unchecked)260 self.checkBox_widget_for_ifNull_check.setDisabled(True)261 self.line_edit_ifNull.setDisabled(True)262 self.setDisabled(True)263 else:264 self.checkBox_widget_for_ifNull_check.setDisabled(False)265 self.line_edit_ifNull.setDisabled(False)266 self.setDisabled(False)267 def initialize(self):268 if self.column_property['ifNull_mode'] != 'false':269 self.line_edit_ifNull.setText(self.column_property['ifNull'])270 self.checkBox_widget_for_ifNull_check.setCheckState(QtCore.Qt.Checked)271 else:...
tc_ID262212_GUI_subscription_manager_gui_live_filter_should_not_crash.py
Source:tc_ID262212_GUI_subscription_manager_gui_live_filter_should_not_crash.py
...32 self.open_subscription_manager()33 self.register_in_gui(username, password)34 self.click_all_available_subscriptions_tab()35 self.click_filters_button()36 self.uncheck_checkbox("filter-options-window", "match-system-checkbox")37 self.uncheck_checkbox("filter-options-window", "do-not-overlap-checkbox")38 self.uncheck_checkbox("filter-options-window", "match-installed-checkbox")39 #input garbage in the filter box40 self.input_text('filter-options-window','filter-subscriptions-text','testy1')41 self.click_filter_close_button()42 self.click_update_button()43 self.click_filters_button()44 #input garbage in the filter box 2nd time45 self.input_text('filter-options-window','filter-subscriptions-text','testy2')46 self.click_filter_close_button()47 self.click_update_button()48 self.check_window_exist('main-window')49 except Exception, e:50 logger.error("FAILED - ERROR Message:" + str(e))51 self.assert_(False, case_name)52 finally:...
tc_ID115139_GUI_list_available_pools.py
Source:tc_ID115139_GUI_list_available_pools.py
...14 self.open_subscription_manager()15 self.register_in_gui(username, password)16 self.click_all_available_subscriptions_tab()17 self.click_filters_button()18 self.uncheck_checkbox("filter-options-window", "match-installed-checkbox")19 self.uncheck_checkbox("filter-options-window", "match-system-checkbox")20 self.uncheck_checkbox("filter-options-window", "do-not-overlap-checkbox")21 self.click_filter_close_button()22 self.click_update_button()23 # check sub_listavailpools are all shown in gui24 productid = RHSMConstants().get_constant("productid")25 for item in self.sub_listavailpools(productid):26 print item27 if not self.check_content_in_all_subscription_table(item["SubscriptionName"]):28 raise FailException("Test Faild - Failed to list %s in all-subscription-table" % item["SubscriptionName"])29 self.assert_(True, case_name)30 except Exception, e:31 logger.error("Test Failed - ERROR Message:" + str(e))32 self.assert_(False, case_name)33 finally:34 self.capture_image(case_name)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!