File tree Expand file tree Collapse file tree 2 files changed +0
-28
lines changed Expand file tree Collapse file tree 2 files changed +0
-28
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import { EnhancerRegistry } from '../../../src/lib/registries'
77import { PAGES } from '../../har-index'
88
99vi . stubGlobal ( 'defineContentScript' , vi . fn ( ) )
10-
1110vi . mock ( '../../../src/overtype/overtype' , ( ) => {
1211 const mockConstructor = vi . fn ( ) . mockImplementation ( ( ) => [
1312 {
@@ -28,17 +27,12 @@ vi.mock('../../../src/overtype/overtype', () => {
2827} )
2928
3029const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) )
31-
3230async function loadHtmlFromHar ( key : keyof typeof PAGES ) : Promise < string > {
3331 const url = PAGES [ key ]
3432 const harPath = path . join ( __dirname , '../../har' , `${ key } .har` )
3533 const harContent = await fs . readFile ( harPath , 'utf-8' )
3634 const harData = JSON . parse ( harContent )
37-
3835 const mainEntry = harData . log . entries . find ( ( entry : any ) => entry . request . url === url )
39- if ( ! mainEntry ) {
40- throw new Error ( `No HTML content found in HAR file: ${ key } .har` )
41- }
4236 return mainEntry . response . content . text
4337}
4438
Original file line number Diff line number Diff line change @@ -28,25 +28,3 @@ Object.assign(globalThis, {
2828 Text : dom . Text ,
2929 window : dom . window ,
3030} )
31-
32- // Mock querySelector methods properly
33- const originalQuerySelector = dom . document . querySelector . bind ( dom . document )
34- const originalQuerySelectorAll = dom . document . querySelectorAll . bind ( dom . document )
35-
36- dom . document . querySelector = ( selector : string ) => {
37- try {
38- return originalQuerySelector ( selector )
39- } catch ( _e ) {
40- return null
41- }
42- }
43-
44- dom . document . querySelectorAll = ( ( selector : string ) => {
45- try {
46- return originalQuerySelectorAll ( selector )
47- } catch ( _e ) {
48- // Return an empty NodeList-like object instead of array
49- const emptyNodeList = document . createDocumentFragment ( ) . childNodes
50- return emptyNodeList as unknown as NodeListOf < Element >
51- }
52- } ) as typeof dom . document . querySelectorAll
You can’t perform that action at this time.
0 commit comments