refactor(browser): make sessionName optional, add selector filter, deduplicate session setup
- sessionName is now optional in open/exec; skips session restore when omitted - add selector param to open: returns outerHTML or textContent of matched element - extract session restore logic into private setupSession() to remove duplication - replace per-exception instanceof checks with single HttpException base class check - embed label into InternalServerErrorException message instead of logging separately - update MCP tool schemas and HTTP DTOs to reflect optional sessionName and new selector - add integration tests: sessionless open/exec, selector, selector+readerMode
This commit is contained in:
+10
-1
@@ -1,6 +1,15 @@
|
||||
const mockElement = {
|
||||
outerHTML: '<div id="mock">mock content</div>',
|
||||
textContent: 'mock content',
|
||||
};
|
||||
|
||||
export class JSDOM {
|
||||
constructor(public html: string, public options?: any) {}
|
||||
get window() {
|
||||
return { document: {} };
|
||||
return {
|
||||
document: {
|
||||
querySelector: (_selector: string) => mockElement,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user