diff --git a/packages/selenium-ide/src/browser/I18N/util.ts b/packages/selenium-ide/src/browser/I18N/util.ts index 923450f4f..a595fb42d 100644 --- a/packages/selenium-ide/src/browser/I18N/util.ts +++ b/packages/selenium-ide/src/browser/I18N/util.ts @@ -41,8 +41,10 @@ const flattenOneLevel = ( if (value && typeof value === 'object') { flattenOneLevel(keyPath, getValue, target, value as T) } else { - // @ts-expect-error our shape traversal kinda sucks :( - acc[keyPath] = getValue(keyPath, value) + if (typeof value !== 'function') { + // @ts-expect-error our shape traversal kinda sucks :( + acc[keyPath] = getValue(keyPath, value) + } } return acc }, target as T) diff --git a/packages/selenium-ide/src/browser/I18N/zh/index.ts b/packages/selenium-ide/src/browser/I18N/zh/index.ts index ef247102d..77669d172 100644 --- a/packages/selenium-ide/src/browser/I18N/zh/index.ts +++ b/packages/selenium-ide/src/browser/I18N/zh/index.ts @@ -1,6 +1,5 @@ import type { LanguageMap } from '../en/index' import commandMap from '@seleniumhq/side-model/dist/I18N/zh/Commands' -import { transformNestedObject } from '../util' // 窗口顶部菜单 const windowTab = { @@ -202,7 +201,7 @@ const testCore = { playFromStart: '从头开始回放', } -export const backend: LanguageMap = { +export const language: LanguageMap = { windowTab, electronMenuTree, fileMenuTree, @@ -222,4 +221,4 @@ export const backend: LanguageMap = { commandMap, } -export const frontend = transformNestedObject((_k, v) => v, backend) +export default language diff --git a/packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Suites/SuitesDrawer.tsx b/packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Suites/SuitesDrawer.tsx index 9783b97e4..a4a3aa890 100644 --- a/packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Suites/SuitesDrawer.tsx +++ b/packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Suites/SuitesDrawer.tsx @@ -8,6 +8,7 @@ import { context } from 'browser/contexts/suites' import SuitesToolbar from './Toolbar' import { FormattedMessage } from 'react-intl' import languageMap from 'browser/I18N/keys' +import { QuestionMark } from '@mui/icons-material' const { state: { setActiveSuite: setSelected }, @@ -21,27 +22,32 @@ const SuitesDrawer: FC = () => { const suites = useContext(context) return ( - + + } + > + + + {suites .slice() .sort((a, b) => a.name.localeCompare(b.name)) .map(({ id, name }) => ( - } - > - { - window.sideAPI.menus.open('suiteManager', [id]) - }} - rename={rename} - selected={id === activeSuiteID} - setSelected={setSelected} - /> - + { + window.sideAPI.menus.open('suiteManager', [id]) + }} + rename={rename} + selected={id === activeSuiteID} + setSelected={setSelected} + /> ))} diff --git a/packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Tests/TestsDrawer.tsx b/packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Tests/TestsDrawer.tsx index 3f9f9ab65..37f635846 100644 --- a/packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Tests/TestsDrawer.tsx +++ b/packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Tests/TestsDrawer.tsx @@ -15,7 +15,7 @@ import { context as testsContext } from 'browser/contexts/tests' import { context as testResultsContext } from 'browser/contexts/playback-test-results' import { FormattedMessage, useIntl } from 'react-intl' import languageMap from 'browser/I18N/keys' -import { QuestionAnswer } from '@mui/icons-material' +import { QuestionMark } from '@mui/icons-material' const { state: { setActiveTest: setSelected, setActiveSuite }, @@ -65,7 +65,10 @@ const TestsDrawer: FC = () => { } > - + @@ -87,7 +90,9 @@ const TestsDrawer: FC = () => { sx={{ bottom: 0 }} value={safeSuiteID} > - + + + {suites.map((s) => ( {s.name} diff --git a/packages/selenium-ide/src/main/api/classes/EventListener.ts b/packages/selenium-ide/src/main/api/classes/EventListener.ts index 2846fd68c..a86140ad6 100644 --- a/packages/selenium-ide/src/main/api/classes/EventListener.ts +++ b/packages/selenium-ide/src/main/api/classes/EventListener.ts @@ -68,7 +68,7 @@ const baseListener = ( } } -const responsePaths = ['recorder.onRequestelementAt'] +const responsePaths = ['recorder.onRequestElementAt'] const wrappedListener = ( path: string, session: Session, @@ -115,6 +115,7 @@ const wrappedListener = ( resolve(null) } } catch (e) { + console.error(e) // Sender has expired removeListener(event) } diff --git a/packages/selenium-ide/src/main/session/controllers/Projects/index.ts b/packages/selenium-ide/src/main/session/controllers/Projects/index.ts index 40c1bb750..dd4e6a7c3 100644 --- a/packages/selenium-ide/src/main/session/controllers/Projects/index.ts +++ b/packages/selenium-ide/src/main/session/controllers/Projects/index.ts @@ -132,7 +132,8 @@ export default class ProjectsController { } } await this.onProjectLoaded(loadedProject, filepath) - return await this.session.state.get() + const state = await this.session.state.get() + return JSON.parse(JSON.stringify(state)) } return null } else { @@ -148,7 +149,8 @@ export default class ProjectsController { async select(useArgs = false): Promise { // When we're opened with a side file in the path - let argsFilepath = process.argv.find((arg) => arg.startsWith('--side-file=')) || '' + let argsFilepath = + process.argv.find((arg) => arg.startsWith('--side-file=')) || '' if (this.filepath) { await this.load(this.filepath) } else if (useArgs && argsFilepath) { @@ -174,9 +176,8 @@ export default class ProjectsController { let project: ProjectShape try { project = JSON.parse(fileContents) - project.plugins = project?.plugins?.filter( - (plugin) => typeof plugin === 'string' - ) ?? [] + project.plugins = + project?.plugins?.filter((plugin) => typeof plugin === 'string') ?? [] return project } catch (e) { console.log((e as Error).message) diff --git a/packages/selenium-ide/src/main/session/controllers/System/index.ts b/packages/selenium-ide/src/main/session/controllers/System/index.ts index 762ce1775..c74eaa70e 100644 --- a/packages/selenium-ide/src/main/session/controllers/System/index.ts +++ b/packages/selenium-ide/src/main/session/controllers/System/index.ts @@ -64,7 +64,9 @@ export default class SystemController extends BaseController { // lang DNE, stay en } finally { if (frontend) { - return flattenNestedObject(this.languageMap) + // React intl uses a flat dict so we convert it here + const frontendMap = flattenNestedObject(this.languageMap) + return frontendMap } return this.languageMap }