I have a number of common tests which I’d like to be able define once and use many times, in various combinations in order to test different workflows. Ideally I’d put these in a library and import them where I want to use them.
// library.js
test('test1', async(){ await test.step('1', async()=>{}); await test.step('2', async()=>{}); await test.step('3', async()=>{}); })
test('test2', async(){ await test.step('1', async()=>{}); await test.step('2', async()=>{}); })
test('test3', async(){ await test.step('1', async()=>{}); await test.step('2', async()=>{}); await test.step('3', async()=>{}); await test.step('4', async()=>{}); })
export test1, test2, test3;
I’d then like to import and use them in various combinations…
// workflow.js
import {test1, test3} from 'library'
test.describe.serial('workflow1', ()=>{
test.beforeAll('', async({browser})=>{
page = await browser.newPage();
await page.goto('/'); })
test1();
test3();
})
Is there a way to do this that does not rely upon custom fixtures or page objects?