Reputation: 121
does playwright have the support/ features to handle multiple test data for various scenarios and for multiple environments. Could someone point me to the right approach for handling such scenarios.
scenarios:
Test will be executed in multiple environments ( Acceptance, prod etc). test will have multiple scenarios which will require different set of test data. I dont see a proper approach that i can used from the documentation ( or may be i am looking at the wrong place).
thanks in advance. Allen K
Upvotes: 0
Views: 1717
Reputation: 2183
At first you have playwright.config.ts file where you can set projects and their variables. In ex
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
or in your case it can projects with different environment. Or you can create a Json structure of data that will need for particular test like.
{
"tcs":[]
{
"name": tc1,
"field1": value,
"field2": value,
},
{
"name": tc2,
"field1": value,
"field2": value,
}
}
Then just import this file in your suit and use all the data for particular test in foreach loop.
Upvotes: 0