[UPD] selenium: disable enable_tour in same time of dark mode
This commit is contained in:
parent
a2a03fa30f
commit
e15f4f3f85
2 changed files with 24 additions and 19 deletions
|
|
@ -1231,26 +1231,31 @@ class SeleniumLib(object):
|
||||||
print(f"Bouton du statusbar avec le label '{status_label}' cliqué.")
|
print(f"Bouton du statusbar avec le label '{status_label}' cliqué.")
|
||||||
return status_button
|
return status_button
|
||||||
|
|
||||||
def odoo_profile_click_dark_mode(self, enable_dark_mode=False):
|
def odoo_profile_click(self, enable_dark_mode=False, enable_tour=False):
|
||||||
profile_button = self.click_with_mouse_move(
|
|
||||||
By.XPATH,
|
def toggle_data_menu(key, enable):
|
||||||
"//div[contains(@class, 'o_user_menu')]/button[contains(@class, 'py-1')]",
|
profile_button = self.click_with_mouse_move(
|
||||||
)
|
|
||||||
select_dark_element = self.get_element(
|
|
||||||
By.XPATH,
|
|
||||||
"//div[contains(@class, 'o_popover')]//span[@data-menu=\"color_scheme.switch\"]//input",
|
|
||||||
)
|
|
||||||
if select_dark_element.is_selected() != enable_dark_mode:
|
|
||||||
dark_mode_button = self.click_with_mouse_move(
|
|
||||||
By.XPATH,
|
|
||||||
"//div[contains(@class, 'o_popover')]//span[@data-menu=\"color_scheme.switch\"]//input",
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
# close it
|
|
||||||
self.click_with_mouse_move(
|
|
||||||
By.XPATH,
|
By.XPATH,
|
||||||
"//div[contains(@class, 'o_user_menu')]/button[contains(@class, 'py-1')]",
|
"//div[contains(@class, 'o_user_menu')]/button[contains(@class, 'py-1')]",
|
||||||
)
|
)
|
||||||
|
element = self.get_element(
|
||||||
|
By.XPATH,
|
||||||
|
f"//div[contains(@class, 'o_popover')]//span[@data-menu=\"{key}\"]//input",
|
||||||
|
)
|
||||||
|
if element.is_selected() != enable:
|
||||||
|
self.click_with_mouse_move(
|
||||||
|
By.XPATH,
|
||||||
|
f"//div[contains(@class, 'o_popover')]//span[@data-menu=\"{key}\"]//input",
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# close it
|
||||||
|
self.click_with_mouse_move(
|
||||||
|
By.XPATH,
|
||||||
|
"//div[contains(@class, 'o_user_menu')]/button[contains(@class, 'py-1')]",
|
||||||
|
)
|
||||||
|
|
||||||
|
toggle_data_menu("web_tour.tour_enabled", enable_tour)
|
||||||
|
toggle_data_menu("color_scheme.switch", enable_dark_mode)
|
||||||
|
|
||||||
def odoo_web_form_click_statusbar_button_status_floating(
|
def odoo_web_form_click_statusbar_button_status_floating(
|
||||||
self, status_label, timeout=10
|
self, status_label, timeout=10
|
||||||
|
|
|
||||||
|
|
@ -164,8 +164,8 @@ def run(
|
||||||
# selenium_tool.driver.quit()
|
# selenium_tool.driver.quit()
|
||||||
|
|
||||||
# Force use dark mode if enable
|
# Force use dark mode if enable
|
||||||
selenium_tool.odoo_profile_click_dark_mode(
|
selenium_tool.odoo_profile_click(
|
||||||
enable_dark_mode=not config.no_dark_mode
|
enable_dark_mode=not config.no_dark_mode, enable_tour=False
|
||||||
)
|
)
|
||||||
|
|
||||||
print("End web_login.py")
|
print("End web_login.py")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue