mirror of
https://github.com/aljazceru/claude-code-viewer.git
synced 2026-01-30 10:54:34 +01:00
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:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user