Files
ComfyUI_frontend/tests-ui/globalSetup.ts
Chenlei Hu 57a4cb9036 Add default toast error handling for command execution (#1106)
* Error handling execute command

* Cleanup

* Add playwright test

* Mock i18n in jest test

* Reduce test func timeout
2024-10-04 16:28:08 -04:00

37 lines
896 B
TypeScript

module.exports = async function () {
global.ResizeObserver = class ResizeObserver {
observe() {}
unobserve() {}
disconnect() {}
}
require('reflect-metadata')
const { nop } = require('./utils/nopProxy')
global.enableWebGLCanvas = nop
HTMLCanvasElement.prototype.getContext = nop
localStorage['Comfy.Settings.Comfy.Logging.Enabled'] = 'false'
jest.mock('@/services/dialogService', () => {
return {
showLoadWorkflowWarning: jest.fn(),
showMissingModelsWarning: jest.fn(),
showSettingsDialog: jest.fn(),
showExecutionErrorDialog: jest.fn(),
showTemplateWorkflowsDialog: jest.fn(),
showPromptDialog: jest
.fn()
.mockImplementation((message, defaultValue) => {
return Promise.resolve(defaultValue)
})
}
})
jest.mock('vue-i18n', () => {
return {
useI18n: jest.fn()
}
})
}