Problem Statement : In test.spec.ts I have a describe block inside which I have a test. In the same file, I have another describe block inside which I have a test that needs to call the test in first describe block and then proceed with it's rest of the steps.
test.spec.ts
test.describe("Describe block 1", async () => {
test("a test that creates a chart of a given type(assume that you can pass the type from an environment variable) and validate if it is created correctly", async()=>{
step1
step2
....
})
})
test.describe("Describe block 2, async () => {
test("a test that firstly need a new chart to proceed with it's other steps", async()=> {
call the test in first describe block and get a chart created and then proceed with other steps
step2
step3
....
})
})
Why I would need to do such a thing - There is a valid use case where in the first describe block there is a test that creates a chart of a given type and validates if the chart is created correctly. In one of the test in second describe block I need to again create a chart and then do some other validations basis the type of the chart. This will ensure that I am not touching any existing chart and have a valid sample to work with.
Is there a way to achieve the same in playwright efficiently. What other options do I have?
Thank you in advance!