So, first of all, you need to actually provide a working example of what you're trying to achieve.
What I understand from your question, is that you're trying to give the url for the tests from docker command in the terminal.
Since Playwright v1.13.0, there is a baseURL
option available. You can utilise that in this way probably
In your config.js
file, you can have this
import { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
use: {
baseURL: process.env.URL,
},
};
export default config;
In your command for running docker, you can then pass as
docker run --name playwright -it --rm --ipc=host --cap-add=SYS_ADMIN -u root -p 5900:5900 -URL=whateverURLyouwant -v $(pwd):/src -v /home/Automation/:/root/.m2 mcr.microsoft.com/playwright:bionic &
Also, one point I would like to mention is that, you should not use root
user for your executions. Using root
as user in docker is not a recommended practice. Instead use the pwuser
that is already created by the given image.