I am following this how-to to test UI for my Panel app. I have to mention that my code leaves and runs in an Ubuntu machine, and I’m connecting to that server via SSH using my Windows laptop.
All is good as long as I’m running tests headless. But When I run a headed test, I get the following error.
playwright._impl._errors.TargetClosedError: Target page, context or browser has been closed
Looks like you launched a headed browser without having a XServer running. Set either 'headless: true' or use 'xvfb-run <your-playwright-app>' before running Playwright.
Then I installed xvfb and ran the following command which means I just added xvfb-runner to the begining of my command.
xvfb-run pytest myapp/tests/test_frontend.py --headed --slowmo 1000
This way, the tests run, but no browser showing on the display. What am I missing? What setting do I need to provide in order to see the browser? Ultimately, I like to be able to to use codegen to write UserStory tests.
xvfb-run -a playwright codegen --target python my_app_url
But again, when I run this command, it just waits. I get no error, but no browser shows either. While this process is running, from another terminal, I run a ps -aux | grep xvfb
command. Not only I can see xvfb-run command,
pts/20 S+ 09:59 0:00 /bin/sh /usr/bin/xvfb-run -a playwright codegen --target python my_app_url
I also see the X server process:
Xvfb :99 -screen 0 1280x1024x24 -nolisten tcp -auth /tmp/xvfb-run.
Then I learned that I need to install and configure Xming on my windows to allow the graphic to show on my pc. I did all of that. No luck yet.
Apparently, I have everything to run this. How can I direct the browser to my laptop screen?
I’ve done a lot of research, but no luck. I hope this community can help me with this.