Rayrun
← Back to Discord Forum

Change .env variable value and pass to a test

tenacious_beagle_27655posted in #help-playwright
Open in Discord
tenacious_beagle_27655

I have a variable in .env file which has value true. I would like to change the value to false before running a spefic test suite. Any ideas ?

This thread is trying to answer question "How can I change the value of a variable in a .env file before running a specific test suite?"

1 reply

If you're using dotenv in js or something similar, just set your env var in global setup.

process.env.MY_BOOL=true

Otherwise if you're using CI, just write your new env var to file, like:

echo MY_BOOL=true > .env

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].