ReLaXed icon indicating copy to clipboard operation
ReLaXed copied to clipboard

Tests failing on arch

Open Superd22 opened this issue 7 years ago • 15 comments

running npm test on master currently results on all behavior tests failing on the pixel diff step on my machine running arch.

This seems to be a font issue, see attached screenshots for the bibliography test.

Diff

diff

Expected

expected

Last_test_result

last_test_result

Superd22 avatar Jun 12 '18 10:06 Superd22

Damn. The tests use the "Times New Roman" (not sure why, but this is the default chrome font on my machine and on travis). We should enforce the font in the tests, to something like Helvetica to make sure all machines have it. Will fix soon.

Zulko avatar Jun 12 '18 10:06 Zulko

@Zulko see https://www.cssfontstack.com/Times-New-Roman

DanielRuf avatar Jun 12 '18 10:06 DanielRuf

?

Zulko avatar Jun 12 '18 10:06 Zulko

For the needed CSS rules to set the right font (including the fallback fonts).

DanielRuf avatar Jun 12 '18 10:06 DanielRuf

Since the tests are only run on Chrome, just setting body {font-family: Georgia} (or any other web-safe font) should be enough, right ? Edit: maybe with a fixed font size too.

Zulko avatar Jun 12 '18 11:06 Zulko

Georgia is (almost) the same, we just need to add the fallback fonts. These are all websafe fonts in general.

https://www.cssfontstack.com/Georgia

DanielRuf avatar Jun 12 '18 11:06 DanielRuf

Keep an eye on the usage stats (the 99.xx% values).

DanielRuf avatar Jun 12 '18 11:06 DanielRuf

We can't use fallback fonts in our case, because we want the tests to generate the same image on all machines. A priori, the Helvetica solution I propose in my first comment should work.

Zulko avatar Jun 12 '18 11:06 Zulko

same

But not equal ;-) We still accept 1% difference in the tests afaik. See https://github.com/RelaxedJS/ReLaXed/blob/master/test/test.js#L62

DanielRuf avatar Jun 12 '18 11:06 DanielRuf

Helvetica is a non free font which is not bundled with many systems.

DanielRuf avatar Jun 12 '18 11:06 DanielRuf

7% Windows https://www.cssfontstack.com/Helvetica

DanielRuf avatar Jun 12 '18 11:06 DanielRuf

oh wow. georgia it is then

Zulko avatar Jun 12 '18 11:06 Zulko

After lots of tries, i believe the right solution it to enforce the font in the tests, while making sure that the font is supported everywhere. From what i understand Chrome provides some fonts, or at least defaults to some fonts, which are either Times New Roman or Arial. I have enforced all fonts to Arial in tests, but even then I noticed problems in some cases (chinese characters). So that might be an open issue for some time.

This is also a strong reminder that the same source may produce different results on different people's machines if the CSS specs are not precise enough... which is unfortunate.

Zulko avatar Jun 16 '18 09:06 Zulko

Should the issue be renamed accordingly ?

Superd22 avatar Jun 16 '18 12:06 Superd22

Could you first test if the tests now pass on your machine ? If yes, then we can close this one and maybe reopen a more general one later.

Zulko avatar Jun 16 '18 12:06 Zulko