0

We have command npx playwright test tests/my-test.spec.js

But how to set data for this test by console?

For example i need to set variables for URL (google.com) and CountOfBlocks (12)

hardkoded
  • 18,915
  • 3
  • 52
  • 64
rd100
  • 1
  • 1
  • 1
  • Use environment variables or process.argv and a package to parse it: you can set `BASE_URL=http://www.google.com npx playwright test tests/my-test.spec.js` and then use it as `process.env.BASE_URL` - is that the sort of configuration you mean? – Benjamin Gruenbaum Jan 24 '22 at 21:00
  • Can i keep 3 env variables? If i set it in console, script use in code process.env.BASE_URL = console BASE_URL If i start script, script will find process.env.BASE_URL in local folder if it has And if no console and local .env in folder, script will be finding it in global .env? – rd100 Jan 25 '22 at 11:31
  • You can keep as many environment variables as you'd like (I think there is a 128kb limit on linux for example though for your use case that shouldn't be easily reachable) – Benjamin Gruenbaum Jan 25 '22 at 13:10

0 Answers0