Testcafe: Docker image / SW WebGL support

Created on 11 Feb 2018  路  6Comments  路  Source: DevExpress/testcafe

Are you requesting a feature or reporting a bug?

bug?

What is the current behavior?

WebGL is disabled by default (in chromium and firefox browsers in testcafe docker)

What is the expected behavior?

WebGL is enabled by default or there is possibility to enable/disable it

How would you reproduce the current behavior (if this is a bug)?

Run following test with docker command:
docker run -v c:\MyPath\Tests:/tests -it testcafe/testcafe "chromium --no-sandbox" /tests/test1.ts -S -s /tests/screenshots

fixture(`Getting Started`)
        .page(`https://browserleaks.com/webgl`);

test('My first test', async t => {
    await t.takeScreenshot();
});

See created screenshot:
image

I tried real app with WebGL component (mapbox-gl) also and it fails with WebGL init js error.

As there is not chrome://settings etc. available within testcafe fixtures, there is no posibility to control webgl settings.

Thank you for any help.

Specify your

  • operating system: Windows 10 + Docker version 17.12.0-ce, build c97c6d6
  • testcafe version: 0.18.6
  • node.js version: used from testcafes docker container
docker enhancement

Most helpful comment

Hi @sommcz! Thank you for your research! I've found a way to enable WebGL in Firefox. I'll update Dockerfile and dev build on Docker Hub.

All 6 comments

After some experiments, there is no sw gl renderers in the docker image (osmesa or swiftshader).

WebGL works with osmesa installed!
image

Simple step to install osmesa in dockerfile:

RUN apk --no-cache add mesa-osmesa && \
  ln -s /usr/lib/libOSMesa.so.8 /usr/lib/chromium/libosmesa.so

After that, following command run testcafe with WebGL support:
/opt/testcafe/docker/testcafe-docker.sh 'chromium --no-sandbox --use-gl=osmesa' /tests/test1.ts

Please add official support for sw renderers to docker image.
Thank you

Hi @sommcz! Thank you for your research! I've found a way to enable WebGL in Firefox. I'll update Dockerfile and dev build on Docker Hub.

I didn't test it, but it will be nice to add support for swiftshader too. So developers can choose which one to use.

Alpine package: https://pkgs.alpinelinux.org/contents?branch=edge&name=mesa-gles&arch=x86_64&repo=main

Library: /usr/lib/libGLESv2.so.2
Link path for Chromium: /usr/lib/chromium/swiftshader/libGLESv2.so

usage: --use-gl=swiftshader

I've also found that testcafe 'chrome --headless --use-gl=swiftshader' test.js works out of the box without any .so linking.

This issues seems to be fixed at least from the Testcafe Docker image 1.8.6 on. It worked out of the box for us after upgrading from 1.7.0. Important: I am talking about the Docker image, not just the Testcafe version.

@mhoennig Thank you for pointing this out.

Was this page helpful?
0 / 5 - 0 ratings