Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
2 changes: 2 additions & 0 deletions atest/01_Editor.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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()]
Expand Down
2 changes: 1 addition & 1 deletion atest/05_Features/Jump.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions atest/Keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Resource Variables.resource
Library ./logcheck.py
Library ./ports.py
Library ./config.py
Library ./firefox_log_to_stdout.py


*** Keywords ***
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions atest/Variables.resource
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
9 changes: 9 additions & 0 deletions atest/firefox_log_to_stdout.py
Original file line number Diff line number Diff line change
@@ -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
8 changes: 7 additions & 1 deletion scripts/atest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down