diff --git a/CHANGELOG.md b/CHANGELOG.md index 382b030..94bb4f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Selenium script to increase open software client interface and automated some actions. - FAQ about kill git-daemon - Support Ubuntu 23.10 +- ADD repo JayVora-SerpentCS_SerpentCS_Contributions ## Changed diff --git a/manifest/default.dev.xml b/manifest/default.dev.xml index c94ab8d..3225930 100644 --- a/manifest/default.dev.xml +++ b/manifest/default.dev.xml @@ -13,6 +13,7 @@ + @@ -143,6 +144,7 @@ + diff --git a/script/generate_config.sh b/script/generate_config.sh index 80a7ad6..cf22cc1 100755 --- a/script/generate_config.sh +++ b/script/generate_config.sh @@ -32,6 +32,7 @@ if [[ ${EL_MINIMAL_ADDONS} = "False" ]]; then printf "${EL_HOME}/addons/ERPLibre_erplibre-3D-printing-addons," >> ${EL_CONFIG_FILE} printf "${EL_HOME}/addons/ERPLibre_erplibre_addons," >> ${EL_CONFIG_FILE} printf "${EL_HOME}/addons/ERPLibre_erplibre_theme_addons," >> ${EL_CONFIG_FILE} + printf "${EL_HOME}/addons/JayVora-SerpentCS_SerpentCS_Contributions," >> ${EL_CONFIG_FILE} printf "${EL_HOME}/addons/MathBenTech_QuotationRevision," >> ${EL_CONFIG_FILE} printf "${EL_HOME}/addons/MathBenTech_development," >> ${EL_CONFIG_FILE} printf "${EL_HOME}/addons/MathBenTech_erplibre-family-management," >> ${EL_CONFIG_FILE} diff --git a/script/git/remote_code_generation_git_compare.py b/script/git/remote_code_generation_git_compare.py index 2296605..6f4e295 100755 --- a/script/git/remote_code_generation_git_compare.py +++ b/script/git/remote_code_generation_git_compare.py @@ -49,6 +49,9 @@ def get_config(): help="Don't show output of difference.", ) parser.add_argument("--git_gui", action="store_true", help="Open git gui.") + parser.add_argument( + "--git_cola", action="store_true", help="Open git cola." + ) parser.add_argument("--meld", action="store_true", help="Open meld.") parser.add_argument( "--clear", @@ -64,7 +67,7 @@ def main(): # path = tempfile.mkdtemp() path = tempfile.NamedTemporaryFile().name if os.path.exists(config.directory1) and os.path.exists(config.directory2): - if config.git_gui: + if config.git_gui or config.git_cola: shutil.copytree(config.directory1, path) shutil.copy2("./.gitignore", path) # repo = Repo(path) @@ -79,8 +82,9 @@ def main(): if not config.quiet: print(status) + cmd = "git cola" if config.git_cola else "git gui" try: - subprocess.call(f"cd {path};git gui", shell=True) + subprocess.call(f"cd {path};{cmd}", shell=True) except: pass if config.clear: diff --git a/script/open_terminal_code_generator.sh b/script/open_terminal_code_generator.sh index c62dd6e..257934d 100755 --- a/script/open_terminal_code_generator.sh +++ b/script/open_terminal_code_generator.sh @@ -2,6 +2,7 @@ # Open a new gnome-terminal with different path on new tab working_path=$(readlink -f .) paths=( + "${working_path}/" "${working_path}/" "${working_path}/addons/ERPLibre_erplibre_addons" "${working_path}/addons/TechnoLibre_odoo-code-generator" @@ -11,6 +12,7 @@ paths=( ) first_iteration=true +second_iteration=true if [[ "${OSTYPE}" == "linux-gnu" ]]; then cmd_before="cd " cmd_after_first=";gnome-terminal --tab -- bash -c 'source ./.venv/bin/activate;git status;bash';" @@ -20,6 +22,9 @@ if [[ "${OSTYPE}" == "linux-gnu" ]]; then if $first_iteration; then LONGCMD+="${cmd_before}${t}${cmd_after_first}" first_iteration=false + elif $second_iteration; then + LONGCMD+="${cmd_before}${t}${cmd_after_first}" + second_iteration=false else LONGCMD+="${cmd_before}${t}${cmd_after}" fi @@ -36,6 +41,9 @@ elif [[ "${OSTYPE}" == "darwin"* ]]; then if $first_iteration; then osascript_command+=" -e 'tell application \"System Events\" to keystroke \"t\" using {command down}' -e 'delay 0.1' -e 'do script \"cd ${t}; source ./.venv/bin/activate; git status\" in front window'" first_iteration=false + elif $second_iteration; then + osascript_command+=" -e 'tell application \"System Events\" to keystroke \"t\" using {command down}' -e 'delay 0.1' -e 'do script \"cd ${t}; source ./.venv/bin/activate; git status\" in front window'" + second_iteration=false else osascript_command+=" -e 'tell application \"System Events\" to keystroke \"t\" using {command down}' -e 'delay 0.1' -e 'do script \"cd ${t}; git status\" in front window'" fi diff --git a/script/selenium/install.md b/script/selenium/install.md index 448a05d..c44407f 100644 --- a/script/selenium/install.md +++ b/script/selenium/install.md @@ -1,3 +1,9 @@ +wget https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz +tar xvf geckodriver-v0.34.0-linux64.tar.gz +sudo mv ./.venv/geckodriver /usr/bin/geckdriver + +pip install selenium + sudo apt install libcairo2-dev python3-dev pkg-config libxt-dev libgirepository1.0-dev pip install pycairo PyGObject diff --git a/script/selenium/web_login.py b/script/selenium/web_login.py index f5d2ba6..9ee711e 100755 --- a/script/selenium/web_login.py +++ b/script/selenium/web_login.py @@ -1,44 +1,361 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +import argparse +import os +import sys +import time + from selenium import webdriver from selenium.webdriver.common.by import By +from selenium.webdriver.support import expected_conditions as EC +from selenium.webdriver.support.ui import WebDriverWait +from selenium.common.exceptions import NoSuchElementException +from selenium.webdriver.firefox.service import Service +from subprocess import getoutput -# Configuration pour lancer Firefox en mode de navigation privée -firefox_options = webdriver.FirefoxOptions() -firefox_options.add_argument("--private") -# Définissez la préférence pour les notifications de bureau -# 1 signifie "autoriser", 2 signifie "bloquer" -firefox_options.set_preference("permissions.default.desktop-notification", 1) - -# Créez une instance du navigateur Firefox avec les options de navigation privée -driver = webdriver.Firefox(options=firefox_options) - -# Ouvrez la page web -driver.get("http://127.0.0.1:8069/web") - -# Trouvez les éléments du formulaire -courriel_input = driver.find_element(By.NAME, "login") -mot_de_passe_input = driver.find_element(By.NAME, "password") -try: - connexion_button = driver.find_element( - By.XPATH, - "/html/body/div/div/div/form/div[3]/button" - # '//button[contains(text(), "Log in")]' +def get_config(): + parser = argparse.ArgumentParser( + formatter_class=argparse.RawDescriptionHelpFormatter, + description="""Selenium script to open web browser to ERPLibre.""", + epilog="""\ +""", ) -except Exception: - connexion_button = driver.find_element( - By.XPATH, - "/html/body/div/main/div/form/div[3]/button" - # '//button[contains(text(), "Connexion")]' + parser.add_argument( + "--open_me_devops", + action="store_true", + help="Open application devops and show entry me.", ) + parser.add_argument( + "--open_me_devops_auto", + action="store_true", + help="Open application devops and show entry me and run auto setup.", + ) + parser.add_argument( + "--open_me_devops_auto_force", + action="store_true", + help=( + "Open application devops and show entry me and run auto setup with" + " forcing argument." + ), + ) + parser.add_argument( + "--not_private_mode", + action="store_true", + help="Default is private mode.", + ) + parser.add_argument( + "--record_mode", + action="store_true", + help="Start recording (not finish to be implemented).", + ) + parser.add_argument( + "--not_dark_mode", + action="store_true", + help=( + "By default, will be in dark mode, because the main developer" + " like it!" + ), + ) + parser.add_argument( + "--firefox_binary_path", + help="Can specify firefox path to open selenium.", + ) + parser.add_argument( + "--gecko_binary_path", + help="Can specify firefox path to open selenium.", + ) + parser.add_argument( + "--url", + default="http://127.0.0.1:8069", + help="URL to open.", + ) + args = parser.parse_args() + if args.open_me_devops_auto_force: + args.open_me_devops_auto = True + args.open_me_devops = True + elif args.open_me_devops_auto: + args.open_me_devops = True + return args -# Remplissez le courriel et le mot de passe -courriel_input.send_keys("admin") -mot_de_passe_input.send_keys("admin") -# Cliquez sur le bouton "Connexion" -connexion_button.click() +def click(driver, xpath, time=5): + wait = WebDriverWait(driver, time) + button = wait.until( + EC.element_to_be_clickable( + ( + By.XPATH, + xpath, + ) + ) + ) + button.click() -# Fermez le navigateur -# driver.quit() + +def check_bot_chat_and_close(driver): + try: + xpath_button = "/html/body/div[3]/div[1]/span[2]/a[2]" + button = driver.find_element(By.XPATH, xpath_button) + click(driver, xpath_button) + except Exception: + print("element not found") + + +def run(config): + if config.record_mode: + new_path = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..") + ) + sys.path.append(new_path) + from script.selenium.selenium_video import VideoRecorder + + # Configuration pour lancer Firefox en mode de navigation privée + firefox_options = webdriver.FirefoxOptions() + if not config.not_private_mode: + firefox_options.add_argument("--private") + + # Définissez la préférence pour les notifications de bureau + # 1 signifie "autoriser", 2 signifie "bloquer" + firefox_options.set_preference( + "permissions.default.desktop-notification", 1 + ) + firefox_services = None + if config.firefox_binary_path: + firefox_services = Service(executable_path=config.firefox_binary_path) + if config.gecko_binary_path: + firefox_options.binary_location = config.gecko_binary_path + + # Créez une instance du navigateur Firefox avec les options de navigation privée + try: + driver = webdriver.Firefox( + options=firefox_options, service=firefox_services + ) + except Exception: + print( + "Cannot open Firefox profile, so will force firefox snap for" + " Ubuntu users." + ) + firefox_services = Service( + executable_path=getoutput( + "find /snap/firefox -name geckodriver" + ).split("\n")[-1] + ) + firefox_options.binary_location = getoutput( + "find /snap/firefox -name firefox" + ).split("\n")[-1] + driver = webdriver.Firefox( + options=firefox_options, service=firefox_services + ) + + # Ajout de l'enregistrement + if config.record_mode: + video_recorder = VideoRecorder(driver) + else: + video_recorder = None + + # Install DarkReader to help my eyes + # TODO do a script to check if it's the last version + if not config.not_dark_mode: + driver.install_addon( + "./script/selenium/darkreader-firefox.xpi", temporary=True + ) + driver.install_addon( + "./script/selenium/odoo_debug-4.0.xpi", temporary=True + ) + + if not config.not_private_mode and not config.not_dark_mode: + driver.get("about:addons") + # Enable Dark Reader into incognito + click(driver, "/html/body/div/div[1]/categories-box/button[2]") + click( + driver, + "/html/body/div/div[2]/div/addon-list/section[1]/addon-card/div/div/div/div/button", + ) + click( + driver, + "/html/body/div/div[2]/div/addon-list/section[1]/addon-card/div/addon-options/panel-list/panel-item[5]", + ) + click( + driver, + "/html/body/div/div[2]/div/addon-card/div/addon-details/named-deck/section/div[5]/div/label[1]/input", + ) + + # Enable Odoo_debug into incognito + # Back + click( + driver, "/html/body/div/div[2]/addon-page-header/div/div[2]/button" + ) + click( + driver, + "/html/body/div/div[2]/div/addon-list/section[1]/addon-card[2]/div/div/div/div/button", + ) + click( + driver, + "/html/body/div/div[2]/div/addon-list/section[1]/addon-card[2]/div/addon-options/panel-list/panel-item[5]", + ) + click( + driver, + "/html/body/div/div[2]/div/addon-card/div/addon-details/named-deck/section/div[5]/div/label[1]/input", + ) + + # Ouvrez la page web + driver.get(f"{config.url}/web") + + # Close tab opening by DarkReader + if config.not_private_mode and not config.not_dark_mode: + driver.switch_to.window(driver.window_handles[-1]) + driver.close() + driver.switch_to.window(driver.window_handles[0]) + + # Démarrer l'enregistrement + if config.record_mode: + video_recorder.start() + + # Trouvez les éléments du formulaire + courriel_input = driver.find_element(By.NAME, "login") + mot_de_passe_input = driver.find_element(By.NAME, "password") + try: + connexion_button = driver.find_element( + By.XPATH, + "/html/body/div/div/div/form/div[3]/button" + # '//button[contains(text(), "Log in")]' + ) + except Exception: + connexion_button = driver.find_element( + By.XPATH, + "/html/body/div/main/div/form/div[3]/button" + # '//button[contains(text(), "Connexion")]' + ) + + # Remplissez le courriel et le mot de passe + courriel_input.send_keys("admin") + mot_de_passe_input.send_keys("admin") + + # Cliquez sur le bouton "Connexion" + connexion_button.click() + + # Attendez que l'élément soit cliquable + # wait = WebDriverWait(driver, 5) + # menu_toggle = wait.until( + # EC.element_to_be_clickable((By.XPATH, "/html/body/header/nav/ul[1]/li/a")) + # ) + # + # # Cliquez sur l'élément + # menu_toggle.click() + # + # # Attendez que le lien soit cliquable + # menu_item = wait.until( + # EC.element_to_be_clickable( + # ( + # By.XPATH, + # "/html/body/header/nav/ul[1]/li/div/a[2]", + # ) + # ) + # ) + + # Open View + if config.open_me_devops: + click( + driver, + "/html/body/header/nav/div/div[1]/div[2]/div/div/div/ul/li[2]/a", + ) + click( + driver, + "/html/body/div[1]/main/div[2]/div/div/table/tbody/tr[1]/td[2]", + ) + # Remove chat bot if open, because will crash wizard div[4] (to div[5]) + check_bot_chat_and_close(driver) + if config.open_me_devops_auto: + click( + driver, + "/html/body/header/nav/div/div[1]/div[2]/div/div/div/ul/li[2]/a", + ) + click( + driver, + "/html/body/div[1]/main/div[2]/div/div/table/tbody/tr[1]/td[2]", + ) + + # CG self + # Bouton modifier + # click( + # driver, + # "/html/body/div[1]/main/div[1]/div[2]/div/div/div[1]/button[1]", + # ) + # Tab Code + # click( + # driver, + # "/html/body/div[1]/main/div[2]/div/div/div[7]/ul/li[2]/a", + # ) + # Bouton Plan + click( + driver, + "/html/body/div[1]/main/div[2]/div/div/div[1]/div/button[1]", + ) + + # Bouton autopoiesis + click( + driver, + "/html/body/div[4]/div/div/main/div/div/div[5]/table[2]/tbody/tr[2]/td[1]/button", + ) + + # Bouton devops regenerate + click( + driver, + "/html/body/div[4]/div/div/main/div/div/div[6]/table[2]/tbody/tr[2]/td/button", + ) + + if config.open_me_devops_auto_force: + # Disable «Stop Execution if Env Not Clean + # click( + # driver, + # "/html/body/div[1]/main/div[2]/div/div/div[7]/div/div[2]/div[6]/table[2]/tbody/tr[3]/td[2]/div/label", + # ) + # Option Force Generate + click( + driver, + "/html/body/div[4]/div/div/main/div/div/div[8]/table/tbody/tr[2]/td[1]/label", + ) + + # Gen + # click( + # driver, + # "/html/body/div[1]/main/div[2]/div/div/div[7]/div/div[2]/div[2]/table[1]/tbody/tr/td[1]/button", + # ) + + # Next state + click( + driver, + "/html/body/div[4]/div/div/footer/div/footer/div/button[1]", + ) + + # Check error + # click( + # driver, + # "/html/body/div[1]/main/div[2]/div/div/div[7]/ul/li[13]/a", + # ) + # click(driver, "/html/body/div[1]/main/div[2]/div/div/div[6]/div/div[14]/div/div[2]/table/tbody/tr[1]", time=60*2) + + # Arrêter l'enregistrement + if config.record_mode: + video_recorder.stop() + + # Open conversation chat + # conversation_button = driver.find_element(By.XPATH, '/html/body/header/nav/ul[3]/li[2]/a') + # conversation_button.click() + + # Close bot chat + # conversation_button = driver.find_element(By.XPATH, '/html/body/div[3]/div[1]/span[2]/a[2]') + # conversation_button.click() + + # Fermez le navigateur + # driver.quit() + + +def main(): + config = get_config() + run(config) + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/script/selenium/web_login_open_me_devops.py b/script/selenium/web_login_open_me_devops.py deleted file mode 100755 index 3c9b6e8..0000000 --- a/script/selenium/web_login_open_me_devops.py +++ /dev/null @@ -1,169 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -import os -import sys - -from selenium import webdriver -from selenium.webdriver.common.by import By -from selenium.webdriver.support import expected_conditions as EC -from selenium.webdriver.support.ui import WebDriverWait - -private_mode = True -record_mode = False -dark_reader_mode = True - - -def click(driver, xpath, time=5): - wait = WebDriverWait(driver, time) - button = wait.until( - EC.element_to_be_clickable( - ( - By.XPATH, - xpath, - ) - ) - ) - button.click() - - -if record_mode: - new_path = os.path.normpath( - os.path.join(os.path.dirname(__file__), "..", "..") - ) - sys.path.append(new_path) - from script.selenium.selenium_video import VideoRecorder - -# Configuration pour lancer Firefox en mode de navigation privée -firefox_options = webdriver.FirefoxOptions() -if private_mode: - firefox_options.add_argument("--private") - -# Définissez la préférence pour les notifications de bureau -# 1 signifie "autoriser", 2 signifie "bloquer" -firefox_options.set_preference("permissions.default.desktop-notification", 1) - -# Créez une instance du navigateur Firefox avec les options de navigation privée -driver = webdriver.Firefox(options=firefox_options) - -# Ajout de l'enregistrement -if record_mode: - video_recorder = VideoRecorder(driver) -else: - video_recorder = None - -# Install DarkReader to help my eyes -# TODO do a script to check if it's the last version -if dark_reader_mode: - driver.install_addon( - "./script/selenium/darkreader-firefox.xpi", temporary=True - ) - driver.install_addon( - "./script/selenium/odoo_debug-4.0.xpi", temporary=True - ) - -if private_mode and dark_reader_mode: - driver.get("about:addons") - # Enable Dark Reader into incognito - click(driver, "/html/body/div/div[1]/categories-box/button[2]") - click( - driver, - "/html/body/div/div[2]/div/addon-list/section[1]/addon-card/div/div/div/div/button", - ) - click( - driver, - "/html/body/div/div[2]/div/addon-list/section[1]/addon-card/div/addon-options/panel-list/panel-item[5]", - ) - click( - driver, - "/html/body/div/div[2]/div/addon-card/div/addon-details/named-deck/section/div[5]/div/label[1]/input", - ) - - # Enable Odoo_debug into incognito - # Back - click(driver, "/html/body/div/div[2]/addon-page-header/div/div[2]/button") - click( - driver, - "/html/body/div/div[2]/div/addon-list/section[1]/addon-card[2]/div/div/div/div/button", - ) - click( - driver, - "/html/body/div/div[2]/div/addon-list/section[1]/addon-card[2]/div/addon-options/panel-list/panel-item[5]", - ) - click( - driver, - "/html/body/div/div[2]/div/addon-card/div/addon-details/named-deck/section/div[5]/div/label[1]/input", - ) - -# Ouvrez la page web -driver.get("http://127.0.0.1:8069/web") - -# Close tab opening by DarkReader -if not private_mode and dark_reader_mode: - driver.switch_to.window(driver.window_handles[-1]) - driver.close() - driver.switch_to.window(driver.window_handles[0]) - -# Démarrer l'enregistrement -if record_mode: - video_recorder.start() - -# Trouvez les éléments du formulaire -courriel_input = driver.find_element(By.NAME, "login") -mot_de_passe_input = driver.find_element(By.NAME, "password") -try: - connexion_button = driver.find_element( - By.XPATH, - "/html/body/div/div/div/form/div[3]/button" - # '//button[contains(text(), "Log in")]' - ) -except Exception: - connexion_button = driver.find_element( - By.XPATH, - "/html/body/div/main/div/form/div[3]/button" - # '//button[contains(text(), "Connexion")]' - ) - -# Remplissez le courriel et le mot de passe -courriel_input.send_keys("admin") -mot_de_passe_input.send_keys("admin") - -# Cliquez sur le bouton "Connexion" -connexion_button.click() - -# Attendez que l'élément soit cliquable -wait = WebDriverWait(driver, 5) -# menu_toggle = wait.until( -# EC.element_to_be_clickable((By.XPATH, "/html/body/header/nav/ul[1]/li/a")) -# ) -# -# # Cliquez sur l'élément -# menu_toggle.click() -# -# # Attendez que le lien soit cliquable -# menu_item = wait.until( -# EC.element_to_be_clickable( -# ( -# By.XPATH, -# "/html/body/header/nav/ul[1]/li/div/a[2]", -# ) -# ) -# ) - -# Open View -click(driver, "/html/body/header/nav/div/div[1]/div[2]/div/div/div/ul/li[2]/a") -click(driver, "/html/body/div[1]/main/div[2]/div/div/table/tbody/tr[1]/td[2]") - -# Arrêter l'enregistrement -if record_mode: - video_recorder.stop() - -# Open conversation chat -# conversation_button = driver.find_element(By.XPATH, '/html/body/header/nav/ul[3]/li[2]/a') -# conversation_button.click() - -# Close bot chat -# conversation_button = driver.find_element(By.XPATH, '/html/body/div[3]/div[1]/span[2]/a[2]') -# conversation_button.click() - -# Fermez le navigateur -# driver.quit() diff --git a/script/selenium/web_login_open_me_devops_auto.py b/script/selenium/web_login_open_me_devops_auto.py deleted file mode 100755 index 23bcf6f..0000000 --- a/script/selenium/web_login_open_me_devops_auto.py +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -import os -import sys - -from selenium import webdriver -from selenium.webdriver.common.by import By -from selenium.webdriver.support import expected_conditions as EC -from selenium.webdriver.support.ui import WebDriverWait - -private_mode = True -record_mode = False -dark_reader_mode = True - - -def click(driver, xpath, time=5): - wait = WebDriverWait(driver, time) - button = wait.until( - EC.element_to_be_clickable( - ( - By.XPATH, - xpath, - ) - ) - ) - button.click() - - -if record_mode: - new_path = os.path.normpath( - os.path.join(os.path.dirname(__file__), "..", "..") - ) - sys.path.append(new_path) - from script.selenium.selenium_video import VideoRecorder - -# Configuration pour lancer Firefox en mode de navigation privée -firefox_options = webdriver.FirefoxOptions() -if private_mode: - firefox_options.add_argument("--private") - -# Définissez la préférence pour les notifications de bureau -# 1 signifie "autoriser", 2 signifie "bloquer" -firefox_options.set_preference("permissions.default.desktop-notification", 1) - -# Créez une instance du navigateur Firefox avec les options de navigation privée -driver = webdriver.Firefox(options=firefox_options) - -# Ajout de l'enregistrement -if record_mode: - video_recorder = VideoRecorder(driver) -else: - video_recorder = None - -# Install DarkReader to help my eyes -# TODO do a script to check if it's the last version -if dark_reader_mode: - driver.install_addon( - "./script/selenium/darkreader-firefox.xpi", temporary=True - ) - driver.install_addon( - "./script/selenium/odoo_debug-4.0.xpi", temporary=True - ) - -if private_mode and dark_reader_mode: - driver.get("about:addons") - click(driver, "/html/body/div/div[1]/categories-box/button[2]") - click( - driver, - "/html/body/div/div[2]/div/addon-list/section[1]/addon-card/div/div/div/div/button", - ) - click( - driver, - "/html/body/div/div[2]/div/addon-list/section[1]/addon-card/div/addon-options/panel-list/panel-item[5]", - ) - click( - driver, - "/html/body/div/div[2]/div/addon-card/div/addon-details/named-deck/section/div[5]/div/label[1]/input", - ) - - # Enable Odoo_debug into incognito - # Back - click(driver, "/html/body/div/div[2]/addon-page-header/div/div[2]/button") - click( - driver, - "/html/body/div/div[2]/div/addon-list/section[1]/addon-card[2]/div/div/div/div/button", - ) - click( - driver, - "/html/body/div/div[2]/div/addon-list/section[1]/addon-card[2]/div/addon-options/panel-list/panel-item[5]", - ) - click( - driver, - "/html/body/div/div[2]/div/addon-card/div/addon-details/named-deck/section/div[5]/div/label[1]/input", - ) - -# Ouvrez la page web -driver.get("http://127.0.0.1:8069/web") - -# Close tab opening by DarkReader -if not private_mode and dark_reader_mode: - driver.switch_to.window(driver.window_handles[-1]) - driver.close() - driver.switch_to.window(driver.window_handles[0]) - -# Démarrer l'enregistrement -if record_mode: - video_recorder.start() - -# Trouvez les éléments du formulaire -courriel_input = driver.find_element(By.NAME, "login") -mot_de_passe_input = driver.find_element(By.NAME, "password") -try: - connexion_button = driver.find_element( - By.XPATH, - "/html/body/div/div/div/form/div[3]/button" - # '//button[contains(text(), "Log in")]' - ) -except Exception: - connexion_button = driver.find_element( - By.XPATH, - "/html/body/div/main/div/form/div[3]/button" - # '//button[contains(text(), "Connexion")]' - ) - -# Remplissez le courriel et le mot de passe -courriel_input.send_keys("admin") -mot_de_passe_input.send_keys("admin") - -# Cliquez sur le bouton "Connexion" -connexion_button.click() - -# Open View -click(driver, "/html/body/header/nav/div/div[1]/div[2]/div/div/div/ul/li[2]/a") -click(driver, "/html/body/div[1]/main/div[2]/div/div/table/tbody/tr[1]/td[2]") -click(driver, "/html/body/header/nav/div/div[1]/div[2]/div/div/div/ul/li[2]/a") -click(driver, "/html/body/div[1]/main/div[2]/div/div/table/tbody/tr[1]/td[2]") - -# CG self -# Bouton modifier -click(driver, "/html/body/div[1]/main/div[1]/div[2]/div/div/div[1]/button[1]") -# Tab CG -click(driver, "/html/body/div[1]/main/div[2]/div/div/div[7]/ul/li[3]/a") -# Disable «Stop Execution if Env Not Clean -# click( -# driver, -# "/html/body/div[1]/main/div[2]/div/div/div[7]/div/div[3]/div[2]/table[2]/tbody/tr/td[1]/label", -# ) -# Gen -click( - driver, - "/html/body/div[1]/main/div[2]/div/div/div[7]/div/div[3]/div[2]/table[1]/tbody/tr[2]/td[1]/button", -) - -# Check error -click(driver, "/html/body/div[1]/main/div[2]/div/div/div[7]/ul/li[14]/a") -# click(driver, "/html/body/div[1]/main/div[2]/div/div/div[6]/div/div[14]/div/div[2]/table/tbody/tr[1]", time=60*2) - -# Arrêter l'enregistrement -if record_mode: - video_recorder.stop() - -# Open conversation chat -# conversation_button = driver.find_element(By.XPATH, '/html/body/header/nav/ul[3]/li[2]/a') -# conversation_button.click() - -# Close bot chat -# conversation_button = driver.find_element(By.XPATH, '/html/body/div[3]/div[1]/span[2]/a[2]') -# conversation_button.click() - -# Fermez le navigateur -# driver.quit() diff --git a/script/selenium/web_login_open_me_devops_auto_force.py b/script/selenium/web_login_open_me_devops_auto_force.py deleted file mode 100755 index 8dbb7cd..0000000 --- a/script/selenium/web_login_open_me_devops_auto_force.py +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -import os -import sys - -from selenium import webdriver -from selenium.webdriver.common.by import By -from selenium.webdriver.support import expected_conditions as EC -from selenium.webdriver.support.ui import WebDriverWait - -private_mode = True -record_mode = False -dark_reader_mode = True - - -def click(driver, xpath, time=5): - wait = WebDriverWait(driver, time) - button = wait.until( - EC.element_to_be_clickable( - ( - By.XPATH, - xpath, - ) - ) - ) - button.click() - - -if record_mode: - new_path = os.path.normpath( - os.path.join(os.path.dirname(__file__), "..", "..") - ) - sys.path.append(new_path) - from script.selenium.selenium_video import VideoRecorder - -# Configuration pour lancer Firefox en mode de navigation privée -firefox_options = webdriver.FirefoxOptions() -if private_mode: - firefox_options.add_argument("--private") - -# Définissez la préférence pour les notifications de bureau -# 1 signifie "autoriser", 2 signifie "bloquer" -firefox_options.set_preference("permissions.default.desktop-notification", 1) - -# Créez une instance du navigateur Firefox avec les options de navigation privée -driver = webdriver.Firefox(options=firefox_options) - -# Ajout de l'enregistrement -if record_mode: - video_recorder = VideoRecorder(driver) -else: - video_recorder = None - -# Install DarkReader to help my eyes -# TODO do a script to check if it's the last version -if dark_reader_mode: - driver.install_addon( - "./script/selenium/darkreader-firefox.xpi", temporary=True - ) - driver.install_addon( - "./script/selenium/odoo_debug-4.0.xpi", temporary=True - ) - -if private_mode and dark_reader_mode: - driver.get("about:addons") - click(driver, "/html/body/div/div[1]/categories-box/button[2]") - click( - driver, - "/html/body/div/div[2]/div/addon-list/section[1]/addon-card/div/div/div/div/button", - ) - click( - driver, - "/html/body/div/div[2]/div/addon-list/section[1]/addon-card/div/addon-options/panel-list/panel-item[5]", - ) - click( - driver, - "/html/body/div/div[2]/div/addon-card/div/addon-details/named-deck/section/div[5]/div/label[1]/input", - ) - - # Enable Odoo_debug into incognito - # Back - click(driver, "/html/body/div/div[2]/addon-page-header/div/div[2]/button") - click( - driver, - "/html/body/div/div[2]/div/addon-list/section[1]/addon-card[2]/div/div/div/div/button", - ) - click( - driver, - "/html/body/div/div[2]/div/addon-list/section[1]/addon-card[2]/div/addon-options/panel-list/panel-item[5]", - ) - click( - driver, - "/html/body/div/div[2]/div/addon-card/div/addon-details/named-deck/section/div[5]/div/label[1]/input", - ) - -# Ouvrez la page web -driver.get("http://127.0.0.1:8069/web") - -# Close tab opening by DarkReader -if not private_mode and dark_reader_mode: - driver.switch_to.window(driver.window_handles[-1]) - driver.close() - driver.switch_to.window(driver.window_handles[0]) - -# Démarrer l'enregistrement -if record_mode: - video_recorder.start() - -# Trouvez les éléments du formulaire -courriel_input = driver.find_element(By.NAME, "login") -mot_de_passe_input = driver.find_element(By.NAME, "password") -try: - connexion_button = driver.find_element( - By.XPATH, - "/html/body/div/div/div/form/div[3]/button" - # '//button[contains(text(), "Log in")]' - ) -except Exception: - connexion_button = driver.find_element( - By.XPATH, - "/html/body/div/main/div/form/div[3]/button" - # '//button[contains(text(), "Connexion")]' - ) - -# Remplissez le courriel et le mot de passe -courriel_input.send_keys("admin") -mot_de_passe_input.send_keys("admin") - -# Cliquez sur le bouton "Connexion" -connexion_button.click() - -# Open View -click(driver, "/html/body/header/nav/div/div[1]/div[2]/div/div/div/ul/li[2]/a") -click(driver, "/html/body/div[1]/main/div[2]/div/div/table/tbody/tr[1]/td[2]") -click(driver, "/html/body/header/nav/div/div[1]/div[2]/div/div/div/ul/li[2]/a") -click(driver, "/html/body/div[1]/main/div[2]/div/div/table/tbody/tr[1]/td[2]") - -# CG self -# Bouton modifier -click(driver, "/html/body/div[1]/main/div[1]/div[2]/div/div/div[1]/button[1]") -# Tab CG -click(driver, "/html/body/div[1]/main/div[2]/div/div/div[7]/ul/li[3]/a") -# Disable «Stop Execution if Env Not Clean -click( - driver, - "/html/body/div[1]/main/div[2]/div/div/div[7]/div/div[3]/div[2]/table[2]/tbody/tr/td[1]/label", -) -# Gen -click( - driver, - "/html/body/div[1]/main/div[2]/div/div/div[7]/div/div[3]/div[2]/table[1]/tbody/tr[2]/td[1]/button", -) - -# Check error -click(driver, "/html/body/div[1]/main/div[2]/div/div/div[7]/ul/li[14]/a") -# click(driver, "/html/body/div[1]/main/div[2]/div/div/div[6]/div/div[14]/div/div[2]/table/tbody/tr[1]", time=60*2) - -# Arrêter l'enregistrement -if record_mode: - video_recorder.stop() - -# Open conversation chat -# conversation_button = driver.find_element(By.XPATH, '/html/body/header/nav/ul[3]/li[2]/a') -# conversation_button.click() - -# Close bot chat -# conversation_button = driver.find_element(By.XPATH, '/html/body/div[3]/div[1]/span[2]/a[2]') -# conversation_button.click() - -# Fermez le navigateur -# driver.quit() diff --git a/source_repo_addons.csv b/source_repo_addons.csv index 05d77e7..986f6ea 100644 --- a/source_repo_addons.csv +++ b/source_repo_addons.csv @@ -135,3 +135,4 @@ https://github.com/ajepe/odoo-addons.git,addons,, https://github.com/OmniaGit/odooplm.git,addons,, https://github.com/MathBenTech/erplibre-family-management.git,addons,, https://github.com/ERPLibre/erplibre-3D-printing-addons.git,addons,, +https://github.com/JayVora-SerpentCS/SerpentCS_Contributions.git,addons,,