feat(e2e): enhance end-to-end testing setup with new scripts and capture cases

- Updated package.json to include new E2E scripts for execution and snapshot capturing.
- Added new capture cases for the "new-project-modal" and "start-new-chat" functionalities in the E2E tests.
- Increased wait times in session detail captures to ensure elements are fully loaded before interactions.
- Introduced new shell scripts for starting the server and capturing snapshots, improving the E2E testing workflow.
- Updated NewChatModal and SessionsTab components to include data-testid attributes for better test targeting.
This commit is contained in:
d-kimsuon
2025-10-18 16:56:08 +09:00
parent 3e598eadbb
commit 1e62eeb856
13 changed files with 117 additions and 61 deletions

View File

@@ -26,34 +26,38 @@ export const defineCapture = (options: {
) => {
await withPlaywright(
async ({ context, cleanUp }) => {
const page = await context.newPage();
await page.goto(href);
try {
const page = await context.newPage();
await page.goto(href);
await page.waitForLoadState("domcontentloaded");
await page.waitForTimeout(1000);
await page.waitForLoadState("domcontentloaded");
await page.waitForTimeout(1000);
if (testCase) {
await testCase.setup(page);
if (testCase) {
await testCase.setup(page);
}
await page.waitForTimeout(1000);
const picturePath = testCase
? resolve(
"e2e",
"snapshots",
...paths,
testCase.name,
`${device.name}.png`,
)
: resolve("e2e", "snapshots", ...paths, `${device.name}.png`);
await page.screenshot({
path: picturePath,
fullPage: true,
});
console.log(`[captured] ${picturePath}`);
} finally {
await cleanUp();
}
const picturePath = testCase
? resolve(
"e2e",
"snapshots",
...paths,
testCase.name,
`${device.name}.png`,
)
: resolve("e2e", "snapshots", ...paths, `${device.name}.png`);
await page.screenshot({
path: picturePath,
fullPage: true,
});
console.log(`[captured] ${picturePath}`);
await cleanUp();
},
{
contextOptions: {