Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforcing fonts for galata #11682

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

schmidi314
Copy link
Contributor

Trying to make fonts consistent over different Linux systems, including the github test.

Testing the github galata tests...
--> This commit should not affect the github workflow.

References

See discussion in #11615

Code changes

  • Only in galata tests

User-facing changes

None

Backwards-incompatible changes

None

@jupyterlab-probot
Copy link

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions
Copy link
Contributor

Benchmark report

The execution time (in milliseconds) are grouped by test file, test type and browser.
For each case, the following values are computed: min <- [1st quartile - median - 3rd quartile] -> max.

The mean relative comparison is computed with 95% confidence.

Results table
Test file large_code_notebook large_md_notebook
open
chromium
actual 4108 <- [4244 - 4277 - 4308] -> 4463 2829 <- [2889 - 2910 - 2935] -> 3092
expected 4104 <- [4208 - 4231 - 4267] -> 4355 2843 <- [2880 - 2905 - 2922] -> 3057
Mean relative change 1.0% ± 0.3% 0.4% ± 0.3%
switch-from
chromium
actual 550 <- [623 - 669 - 790] -> 883 435 <- [458 - 471 - 485] -> 640
expected 543 <- [620 - 662 - 819] -> 904 426 <- [456 - 466 - 475] -> 626
Mean relative change -2.0% ± 3.9% 2.4% ± 1.9%
switch-to
chromium
actual 304 <- [342 - 358 - 366] -> 526 232 <- [257 - 269 - 277] -> 309
expected 305 <- [335 - 347 - 363] -> 470 232 <- [260 - 271 - 279] -> 301
Mean relative change 1.8% ± 2.1% -0.7% ± 1.6%
close
chromium
actual 534 <- [575 - 607 - 947] -> 1101 436 <- [457 - 464 - 475] -> 537
expected 535 <- [568 - 604 - 935] -> 987 428 <- [453 - 461 - 472] -> 528
Mean relative change 2.7% ± 7.2% 1.0% ± 0.9%

Changes are computed with expected as reference.

@schmidi314
Copy link
Contributor Author

LGTM

Well, unfortunately most of my tests still fail. My feeling is that we should do this when there is at least one other person that has problems with local UI tests. Otherwise this PR would be only about fixing my local dev environment issues.

@krassowski
Copy link
Member

Well, unfortunately most of my tests still fail. My feeling is that we should do this when there is at least one other person that has problems with local UI tests. Otherwise this PR would be only about fixing my local dev environment issues.

I do. My super inefficient workflow was to open a PR on my own fork to get the CI to kick in, download artifacts and then cleanly push the correct screenshot in the PR to this repo. Having majority of the tests pass locally would be super useful for good developer experience; the final 20% may not be worth the effort, but if we can get 80% to pass that would be a big step forward.

What things still cause problems on your setup?

@schmidi314
Copy link
Contributor Author

schmidi314 commented Dec 15, 2021

@krassowski that sounds familiar to me. Only that I have polluted the tests on the main repo (sorry) ... so let's get on with this.

  1. the commit a7f5c5d should fix the collapsible-headings test. @krassowski can you confirm this locally?

  2. the commit d306bdc shows something interesting. It definitely improves the contextmenu test. However:
    antialias
    Is this antialiasing?
    @fcollonval just to be sure, can you check the font of ui elements on your system?
    Update: a default pixelmatch threshold of 0.3 in playwright-config.ts helps. But this is potentially dangerous. A simple check (add whitespace between ** and 3 in test "Execute Code cell") shows that differences are still detected with 0.3 threshold.

  3. Now I have still lots of fails with italics
    italic

I don't understand that one, though. Chrome tells me it's rendering DejaVu Sans Mono.

@fcollonval
Copy link
Member

I guess I'm lucky. Running on stock Debian 11, running the 158 tests on 4 workers:

  12 failed
    [jupyterlab] › test/jupyterlab/general.test.ts:8:3 › General Tests › Launch Screen =============
    [jupyterlab] › test/jupyterlab/general.test.ts:13:3 › General Tests › Enter Simple Mode ========
    [jupyterlab] › test/jupyterlab/general.test.ts:28:3 › General Tests › Toggle Dark theme ========
    [jupyterlab] › test/jupyterlab/notebook-toolbar.test.ts:78:3 › Notebook Toolbar › Run cell =====
    [jupyterlab] › test/jupyterlab/sidebars.test.ts:60:3 › Sidebars › Capture File Browser on right 
    [jupyterlab] › test/jupyterlab/terminal.test.ts:21:5 › Terminal › Theme › Light theme terminal inherit 
    [jupyterlab] › test/jupyterlab/terminal.test.ts:33:5 › Terminal › Theme › Light theme terminal light 
    [jupyterlab] › test/jupyterlab/terminal.test.ts:43:5 › Terminal › Theme › Light theme terminal dark 
    [jupyterlab] › test/jupyterlab/terminal.test.ts:53:5 › Terminal › Theme › Dark theme terminal inherit 
    [jupyterlab] › test/jupyterlab/terminal.test.ts:66:5 › Terminal › Theme › Dark theme terminal light 
    [jupyterlab] › test/jupyterlab/terminal.test.ts:77:5 › Terminal › Theme › Dark theme terminal dark 
    [jupyterlab] › test/jupyterlab/toc.test.ts:217:3 › Table of Contents › Open context menu =======
  2 flaky
    [jupyterlab] › test/jupyterlab/debugger.test.ts:33:3 › Debugger Tests › Start debug session ====
    [jupyterlab] › test/jupyterlab/notebook-create.test.ts:41:3 › Notebook Create › Create a Code cell 
  144 passed (9m)

Terminal related tests are expected to fail. The general tests and the sidebar one are failing because I'm using nb_conda_kernels and so all my environments show up in the launcher (we could mock kernelspec endpoint to improve that one).

Regarding the font for menu, here are the details:

image

Regarding the discrepancy on the font, I don't know if it could come from anti-aliasing. But I'm a bit afraid of using higher threshold (the default seems to be 0.2). The small discrepancy like the difference between triangle icon showing collapsed/expanded may not be catch. But it is a risk we need to evaluate against dev' comfort.

@fcollonval
Copy link
Member

@schmidi314 in your screencast with font diff, was the test ran twice? If so was the diff identical in the two attempts?

@schmidi314
Copy link
Contributor Author

schmidi314 commented Dec 15, 2021

in your screencast with font diff, was the test ran twice? If so was the diff identical in the two attempts?

Just re-ran it twice manually. Yes they are the same.

As for the font: Thanks, @fcollonval , that matches with my config.

@schmidi314
Copy link
Contributor Author

But I'm a bit afraid of using higher threshold (the default seems to be 0.2).

Yes, I know what you mean. But with many of my tests failing with minor font issues (the italics stuff I mean), I'm gaining more confidence with the 0.3 threshold.

@schmidi314
Copy link
Contributor Author

@fcollonval can you please check fc-list | grep 'Menlo\|Consolas'

@fcollonval
Copy link
Member

fc-list | grep 'Menlo|Consolas'

This returns no match

@fcollonval
Copy link
Member

fcollonval commented Dec 15, 2021

@krassowski @jtpio would you mind running galata test on this PR locally and report the test results? If possible could you test it a second time not specifying the snapshot threshold in galata/src/playwright-config.ts?

@schmidi314
Copy link
Contributor Author

Another observation:

completer

Shouldn't the result be like "actual", rather than "expected"?

@jtpio
Copy link
Member

jtpio commented Feb 4, 2022

I was going through PRs added to the 3.2.x milestone and found this one.

Is it still relevant, and if so should it be bumped to 3.3.x or 4.0? Thanks!

@fcollonval fcollonval modified the milestones: 3.2.x, 4.0 Feb 4, 2022
@fcollonval
Copy link
Member

Moving to 4.0, it is a maintenance PR for dev comfort (but it will be a good one to get...).

Instead of fighting with the OS fonts, another path could be to override the theme font (removing the system-ui one) for the UI tests.

@schmidi314
Copy link
Contributor Author

How shall we proceed here? For me this PR makes testing a little easier. But I haven't managed to get the italics issue under control. So it would be interesting how it works for the other devs to choose which commits to keep.

@jtpio jtpio modified the milestones: 4.0.0, 4.0.x May 15, 2023
@krassowski krassowski modified the milestones: 4.0.x, 4.2.0 Feb 22, 2024
@krassowski
Copy link
Member

Apologies that no one responded here @schmidi314. I would suggest to keep the part changing fonts but not the part relaxing threshold and merge this after resolving conflicts. If it helps even a bit then it's good to go - does not need to be perfect.

@krassowski
Copy link
Member

@fcollonval would your docker image PR supersede this PR?

@fcollonval
Copy link
Member

@fcollonval would your docker image PR supersede this PR?

Yes it will

@krassowski krassowski modified the milestones: 4.2.0, 4.3.0 May 7, 2024
@JasonWeill
Copy link
Contributor

@fcollonval If #15916 supersedes this, and you're planning to merge this in during the next month, would you prefer to close this PR and tag #15916 with the 4.3.0 milestone?

@krassowski krassowski modified the milestones: 4.3.0, 4.4.0 Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants