Rayrun
← Back to Discord Forum

How to store and reuse value within test steps

Hi there, im making use of a generated email address for every step. This generated email is used into multiple tests so I dont want to write a new const for every tests.

Question: Is there a way to write a common step (lets say create email address) and use that step over different testcases and test steps?

This thread is trying to answer question "Is there a way to write a common step to create an email address and use that step across different test cases and test steps?"

1 reply
dirvinautomation_16636

In one of the Global Setup examples, they recommend passing values through the env like this:

const generatedEmail = generateRandomEmail()
process.env.EMAIL_ADDRESS = generatedEmail

Related Discord Threads

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 luc@ray.run.