Fixed 'Remove the unnecessary boolean literals' code smell.

This commit is contained in:
Akshay Joshi
2022-09-09 15:23:18 +05:30
parent ec47a2aa66
commit 3b95a416ca
21 changed files with 221 additions and 224 deletions

View File

@@ -93,5 +93,5 @@ class BrowserToolBarFeatureTest(BaseFeatureTest):
BrowserToolBarLocators.filter_data_button_css),
(By.XPATH, BrowserToolBarLocators.filter_box_css)),
'Filter dialogue did not open on clicking filter button.')
self.page.click_modal('Close', True)
self.page.click_modal('Close')
self.page.close_query_tool(prompt=False)

View File

@@ -97,7 +97,7 @@ class CheckFileManagerFeatureTest(BaseFeatureTest):
input_file_path_ele = \
self.page.find_by_xpath(QueryToolLocators.save_file_path_xpath)
input_file_path_ele.send_keys(self.XSS_FILE)
self.page.click_modal('Save', True)
self.page.click_modal('Save')
self.page.wait_for_query_tool_loading_indicator_to_disappear()
def _open_file_manager_and_check_xss_file(self):
@@ -136,7 +136,7 @@ class CheckFileManagerFeatureTest(BaseFeatureTest):
except (StaleElementReferenceException, TimeoutException):
retry_count += 1
self.page.click_modal('Cancel', True)
self.page.click_modal('Cancel')
self.page.wait_for_query_tool_loading_indicator_to_disappear()
filename = self.server_information['type'] + \
str(self.server_information['server_version'])
@@ -189,4 +189,4 @@ class CheckFileManagerFeatureTest(BaseFeatureTest):
raise RuntimeError("Unable to sort in descending order while "
"clicked on 'Name' column")
self.page.click_modal('Cancel', True)
self.page.click_modal('Cancel')

View File

@@ -137,4 +137,4 @@ class KeyboardShortcutFeatureTest(BaseFeatureTest):
maximize_button.click()
# save and close the preference dialog.
self.page.click_modal('Save', True)
self.page.click_modal('Save')

View File

@@ -154,7 +154,7 @@ class PGDataypeFeatureTest(BaseFeatureTest):
time.sleep(0.5)
# save and close the preference dialog.
self.page.click_modal('Save', react_dialog=True)
self.page.click_modal('Save')
break
except Exception:
retry -= 1

View File

@@ -317,9 +317,9 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
# save and close the preference dialog.
if path_already_set:
self.page.click_modal('Cancel', True)
self.page.click_modal('Cancel')
else:
self.page.click_modal('Save', True)
self.page.click_modal('Save')
self.page.wait_for_element_to_disappear(
lambda driver: driver.find_element(By.CSS_SELECTOR, ".ajs-modal")

View File

@@ -79,7 +79,7 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest):
def runTest(self):
self._open_maintenance_dialogue()
self.page.click_modal('OK', True)
self.page.click_modal('OK')
self.page.wait_for_element_to_disappear(
lambda driver: driver.find_element(
By.XPATH, NavMenuLocators.maintenance_operation), 10)

View File

@@ -303,7 +303,7 @@ class QueryToolJourneyTest(BaseFeatureTest):
# discard edits
self.page.execute_query('SELECT 1')
self.page.click_modal('Yes', True)
self.page.click_modal('Yes')
def _test_is_editable_columns_icons(self):
if self.driver_version < 2.8:
@@ -418,7 +418,7 @@ class QueryToolJourneyTest(BaseFeatureTest):
self.page.find_by_css_selector(
QueryToolLocators.btn_history_remove_all)
)
self.page.click_modal('Yes', True)
self.page.click_modal('Yes')
def _navigate_to_query_tool(self):
self.page.expand_database_node("Server", self.server['name'],
@@ -448,7 +448,7 @@ class QueryToolJourneyTest(BaseFeatureTest):
discard_changes_modal=False):
self.page.execute_query(query)
if discard_changes_modal:
self.page.click_modal('Yes', True)
self.page.click_modal('Yes')
# first column is rownum
enumerated_should_be_editable = enumerate(cols_should_be_editable, 2)

View File

@@ -155,4 +155,4 @@ class CopySQLFeatureTest(BaseFeatureTest):
maximize_button.click()
# save and close the preference dialog.
self.page.click_modal('Save', react_dialog=True)
self.page.click_modal('Save')

View File

@@ -90,7 +90,7 @@ class CheckDebuggerForXssFeatureTest(BaseFeatureTest):
click = True
while click:
try:
self.page.click_modal('OK', True)
self.page.click_modal('OK')
wait.until(EC.invisibility_of_element(
(By.XPATH, "//div[@class ='MuiDialogTitle-root']"
"//div[text()='Debugger Error']")

View File

@@ -24,7 +24,7 @@ class BrowserToolBarLocators():
filter_data_button_css = \
".wcFrameButton[title='Filtered Rows']:not(.disabled)"
filter_box_css = "//*[@id='0']/div[contains(text(), Data Filter')]"
filter_box_css = "//*[@id='0']/div[contains(text(), 'Data Filter')]"
class NavMenuLocators:

View File

@@ -81,7 +81,7 @@ class PgadminPage:
except TimeoutException:
pass
def click_modal(self, button_text, react_dialog=False):
def click_modal(self, button_text):
time.sleep(0.5)
# Find active dialog in case of multiple dialog
# & click on that dialog
@@ -222,7 +222,7 @@ class PgadminPage:
self.click_element(
self.find_by_css_selector(QueryToolLocators.btn_clear)
)
self.click_modal('Yes', True)
self.click_modal('Yes')
def execute_query(self, query):
self.fill_codemirror_area_with(query)
@@ -332,7 +332,7 @@ class PgadminPage:
delete_menu_item = self.find_by_partial_link_text("Remove Server")
self.click_element(delete_menu_item)
self.driver.switch_to.default_content()
self.click_modal('Yes', True)
self.click_modal('Yes')
time.sleep(1)
else:
print("%s Server is not removed", server_config['name'],
@@ -1262,5 +1262,5 @@ class PgadminPage:
return element_located_status
def clear_edit_box(self, edit_box_webelement):
while not edit_box_webelement.get_attribute("value") == "":
while edit_box_webelement.get_attribute("value") != "":
edit_box_webelement.send_keys(Keys.BACK_SPACE)