tnicola / cypress-parallel

Reduce up to 40% your Cypress suite execution time parallelizing the test run on the same machine.
MIT License
560 stars 117 forks source link

Can we pass unique arguments to each thread? #171

Open nimiyajoseph opened 10 months ago

nimiyajoseph commented 10 months ago

Hi,

Can we pass unique arguments to each thread? For eg: I am going to pass t as 2, I want the first thread to use CredentialsA and second thread to use CredentialsB. Is it possible?

danielclarify commented 10 months ago

That can be handled on the Cypress side. Because the environment variable is set to CYPRESS_THREAD, anything prepended with CYPRESS_ can be accessed like so: Cypress.env('THREAD'). For example, you can do something like the following

if (Cypress.env('THREAD')) {
  email = `user_${Cypress.env('THREAD')}@example.com`
}