diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e46e0d86a..d7c9a9152 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -469,5 +469,13 @@ Adjust `loggingLevel` in the `Advanced Settings Editor` -> `Language Server` to For robot tests set: ```robot -Configure JupyterLab Plugin {"loggingConsole": "floating", "loggingLevel": "debug"} +Configure JupyterLab Plugin {"loggingLevel": "debug", "logAllCommunication": true} +``` + +The console output will be included in the `geckodriver.log` file for tests which were re-run after failing. + +To manually toggle writing of JavaScript browser console to `geckodriver.log` use: + +```bash +python scripts/atest.py --variable LOG_CONSOLE:1 ``` diff --git a/atest/01_Editor.robot b/atest/01_Editor.robot index 6803af416..93a86bbf4 100644 --- a/atest/01_Editor.robot +++ b/atest/01_Editor.robot @@ -42,8 +42,10 @@ JSX LaTeX [Tags] language:latex + Configure JupyterLab Plugin {"loggingLevel": "debug", "logAllCommunication": true} ${def} = Set Variable xpath:(//span[contains(@class, 'cm-atom')][contains(text(), 'foo')])[last()] Editor Shows Features for Language LaTeX example.tex Jump to Definition=${def} Rename=${def} + Reset Plugin Settings Less ${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable-2')][contains(text(), '@width')])[last()] diff --git a/atest/05_Features/Jump.robot b/atest/05_Features/Jump.robot index 0b2746d06..13cfc277f 100644 --- a/atest/05_Features/Jump.robot +++ b/atest/05_Features/Jump.robot @@ -89,7 +89,7 @@ Clean Up Folder With Spaces FOR ${file} IN @{files} Remove File ${NOTEBOOK DIR}${/}${FOLDER WITH SPACE}${/}${file} END - Remove Directory ${NOTEBOOK DIR}${/}${FOLDER WITH SPACE} recursive=True + Remove Directory ${NOTEBOOK DIR}${/}${FOLDER WITH SPACE} recursive=True Select Token Occurrence [Arguments] ${token} ${type}=variable ${which}=last diff --git a/atest/Keywords.resource b/atest/Keywords.resource index c57ca2923..f89a51f55 100644 --- a/atest/Keywords.resource +++ b/atest/Keywords.resource @@ -8,6 +8,7 @@ Resource Variables.resource Library ./logcheck.py Library ./ports.py Library ./config.py +Library ./firefox_log_to_stdout.py *** Keywords *** @@ -122,10 +123,12 @@ Open JupyterLab Should Not Be Equal As Strings ${geckodriver} None ... geckodriver not found, do you need to install firefox-geckodriver? ${service args} = Create List --log debug + ${profile_path} = Create Firefox Profile Logging To Stdout enable_logging=${LOG_CONSOLE} Create WebDriver Firefox ... executable_path=${geckodriver} ... service_log_path=${GECKODRIVER LOG} ... service_args=${service args} + ... firefox_profile=${profile_path} Wait Until Keyword Succeeds 3x 5s Wait For Splash Close JupyterLab diff --git a/atest/Variables.resource b/atest/Variables.resource index 942cc6357..5024e9627 100644 --- a/atest/Variables.resource +++ b/atest/Variables.resource @@ -17,6 +17,7 @@ ${VIRTUALDOCS DIR} ${NOTEBOOK DIR}${/}.virtual_documents ${SCREENSHOTS DIR} ${OUTPUT DIR}${/}screenshots # override with `python scripts/atest.py --variable HEADLESS:0` ${HEADLESS} 1 +${LOG_CONSOLE} 0 ${CMD PALETTE INPUT} css:#command-palette .lm-CommandPalette-input ${CMD PALETTE ITEM ACTIVE} css:#command-palette .lm-CommandPalette-item.lm-mod-active ${JLAB XP TOP} //div[@id='jp-top-panel'] diff --git a/atest/firefox_log_to_stdout.py b/atest/firefox_log_to_stdout.py new file mode 100644 index 000000000..50b0fd00c --- /dev/null +++ b/atest/firefox_log_to_stdout.py @@ -0,0 +1,9 @@ +from selenium.webdriver.firefox.firefox_profile import FirefoxProfile + + +def create_firefox_profile_logging_to_stdout(enable_logging=True): + """Returns path to new profile logging to stdout (hence `geckodriver.log`)""" + profile = FirefoxProfile() + profile.set_preference("devtools.console.stdout.content", bool(enable_logging)) + profile.update_preferences() + return profile.path diff --git a/scripts/atest.py b/scripts/atest.py index 5c25dbd35..f3025a4fb 100644 --- a/scripts/atest.py +++ b/scripts/atest.py @@ -85,7 +85,13 @@ def atest(attempt, extra_args): if attempt != 1: previous = OUT / f"{get_stem(attempt - 1, extra_args)}.robot.xml" if previous.exists(): - extra_args += ["--rerunfailed", str(previous)] + # only intercept `console.log` in re-runs to prevent substantial overhead + extra_args += [ + "--rerunfailed", + str(previous), + "--variable", + "LOG_CONSOLE:1", + ] out_dir = OUT / stem