Saves adding this to each test:
const manifest = JSON.parse(
readFileSync(path.resolve(process.cwd(), 'html/_assets/vite/.vite/manifest.json'), 'utf8'),
),
corePath = `html/_assets/vite/${manifest['app/sites/site_package/Resources/Private/JavaScript/core.js'].file}`;
await page.setContentAndScriptTag(
`
...
`,
corePath,
);
viteAsset function would live in src/utils.ts and be imported and simplify the code:
import {viteAsset} from '`@liquidlight/playwright-framework/utils`;
await page.setContentAndScriptTag(
`
...
`,
viteAsset('app/sites/site_package/Resources/Private/JavaScript/core.js')
);
Saves adding this to each test:
viteAssetfunction would live insrc/utils.tsand be imported and simplify the code: