Most probably the issue was in the parsing of the command itself, I changed the command line (in the docker-compose file) in a next way and it is working perfectly
sh -c "xvfb-run -a -s '-screen 0 1920x1080x24' npx playwright test tests/mailfence/test-scenario.spec.ts --headed"
I also added screen resolution but it is not necessary