Skip to content

Commit 90c7baa

Browse files
committed
lots of stuff and test fixes
1 parent bb33f08 commit 90c7baa

File tree

95 files changed

+928
-830
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+928
-830
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"clean:deps": "rimraf packages/*/node_modules node_modules",
1414
"clean": "rimraf packages/*/build packages/*/dist packages/*/node_modules packages/*/tsconfig.tsbuildinfo node_modules",
1515
"clean:nuke": "git clean -fdx",
16+
"start": "cd packages/selenium-ide && npm start",
1617
"test": "jest",
1718
"test:e2e": "jest --testMatch \"**/packages/**/__tests__/**/*.e2e.js\"",
1819
"lint": "pnpm run lint:scripts",

packages/selenium-ide/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@seleniumhq/selenium-ide",
3-
"version": "4.0.0-alpha.47",
3+
"version": "4.0.0-alpha.48",
44
"private": true,
55
"description": "Selenium IDE electron app",
66
"author": "Todd <[email protected]>",
@@ -106,9 +106,9 @@
106106
"@seleniumhq/code-export-ruby-rspec": "^4.0.0-alpha.1",
107107
"side-code-export": "^4.0.0-alpha.11",
108108
"@seleniumhq/get-driver": "^4.0.0-alpha.1",
109-
"@seleniumhq/side-api": "^4.0.0-alpha.29",
109+
"@seleniumhq/side-api": "^4.0.0-alpha.30",
110110
"@seleniumhq/side-model": "^4.0.0-alpha.4",
111-
"@seleniumhq/side-runtime": "^4.0.0-alpha.27",
111+
"@seleniumhq/side-runtime": "^4.0.0-alpha.29",
112112
"dnd-core": "^16.0.1",
113113
"electron-chromedriver": "^25.3.0",
114114
"electron-log": "^4.4.8",

packages/selenium-ide/scripts/ide-runner.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ main()
3636

3737
async function main() {
3838
console.log('Starting webdriver backend')
39-
const {proc, success} = await startWebdriverBackend({ driver: 'chrome' })
39+
const { proc, success } = await startWebdriverBackend({ driver: 'chrome' })
4040
if (!success) {
4141
console.error('Failed to start webdriver backend')
4242
console.error(proc.error)
@@ -51,10 +51,7 @@ async function main() {
5151
'goog:chromeOptions': {
5252
// Here is the path to your Electron binary.
5353
binary: electronBinaryPath,
54-
args: [
55-
'app=' + pathToSeleniumIDE,
56-
`side-file=${sideFile}`,
57-
],
54+
args: ['app=' + pathToSeleniumIDE, `side-file=${sideFile}`],
5855
excludeSwitches: ['enable-logging'],
5956
},
6057
})
@@ -77,11 +74,6 @@ function startWebdriverBackend() {
7774
env: {},
7875
shell: false,
7976
})
80-
process.on('exit', () => {
81-
if (!proc.killed) {
82-
proc.kill()
83-
}
84-
})
8577
proc.stdout.on('data', (out) => {
8678
const outStr = `${out}`
8779
WebdriverDebugLog(outStr)

packages/selenium-ide/src/browser/windows/PlaybackWindow/preload/recorder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
ExpandedMutationObserver,
2525
} from 'browser/types'
2626
import initFindSelect from './find-select'
27-
import { PluginPreloadOutputShape } from '@seleniumhq/side-api'
27+
import { PluginPreloadOutputShape, RecordNewCommandInput } from '@seleniumhq/side-api'
2828

2929
export interface RecordingState {
3030
typeTarget: HTMLElement | null
@@ -110,7 +110,7 @@ export default class Recorder {
110110
insertBeforeLastCommand: boolean = false,
111111
actualFrameLocation?: string
112112
) {
113-
let newCommand = {
113+
let newCommand: RecordNewCommandInput = {
114114
command,
115115
target,
116116
value,

packages/selenium-ide/src/browser/windows/ProjectEditor/tabs/Tests/TestCommandEditor.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ const CommandEditor: FC<CommandEditorProps> = ({
3737
selectedCommandIndexes.length !== 1 ||
3838
!commands[correctedCommand.command]
3939
) {
40-
console.log(selectedCommandIndexes)
4140
return (
4241
<Stack className="p-4" spacing={1}>
4342
<Typography className="centered py-4" variant="body2">

packages/selenium-ide/src/main/session/controllers/Driver/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export default class DriverController extends BaseController {
142142

143143
async stopProcess(): Promise<null | string> {
144144
if (this.driverProcess) {
145-
const procKilled = this.driverProcess.kill(9)
145+
const procKilled = await this.driverProcess.kill(9)
146146
WebdriverDebugLog('Killed driver?', procKilled)
147147
}
148148
return null

packages/selenium-ide/src/main/session/controllers/Driver/start.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,14 @@ const getDriver = ({ browser, version }: BrowserInfo) =>
5959
export type StartDriver = (
6060
session: Session
6161
) => (info: BrowserInfo) => Promise<DriverStartSuccess | DriverStartFailure>
62+
6263
const startDriver: StartDriver = () => (info) =>
6364
new Promise((resolve) => {
6465
let initialized = false
6566
const args = ['--verbose', `--port=${port}`]
6667
const driverPath = getDriver(info)
6768
if (fs.existsSync(driverPath)) {
68-
const driver = spawn(driverPath.replace(/\s/g, '\ '), args, {
69+
const driver = spawn(driverPath.replace(/\s/g, ' '), args, {
6970
env: {},
7071
shell: false,
7172
})
@@ -77,6 +78,16 @@ const startDriver: StartDriver = () => (info) =>
7778
initialized = true
7879
WebdriverDebugLog('Driver has initialized!')
7980
resolve({ success: true, driver: driver })
81+
process.on('beforeExit', async () => {
82+
console.log('Exiting?');
83+
try {
84+
if (!driver.killed) {
85+
await driver.kill(9)
86+
}
87+
} catch (e) {
88+
console.warn('Failed ot kill driver', e)
89+
}
90+
})
8091
}
8192
})
8293
driver.stderr.on('data', (err: string) => {

packages/selenium-ide/src/main/session/controllers/Plugins/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ export default class PluginsController extends BaseController {
6060
ipcMain.on(key, handler)
6161
this.pluginHooks[index][key] = handler
6262
})
63+
if (plugin.hooks?.onLoad) {
64+
await plugin.hooks.onLoad(this.session.api)
65+
}
6366
}
6467

6568
async unload(plugin: PluginShape) {
@@ -69,6 +72,9 @@ export default class PluginsController extends BaseController {
6972
Object.entries(hooks).forEach(([key, handler]) => {
7073
ipcMain.off(key, handler)
7174
})
75+
if (plugin.hooks?.onUnload) {
76+
await plugin.hooks.onUnload(this.session.api)
77+
}
7278
}
7379
// This needs to build before commands
7480
priority = 3

packages/selenium-ide/src/main/session/controllers/Projects/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ export default class ProjectsController {
174174
let project: ProjectShape
175175
try {
176176
project = JSON.parse(fileContents)
177-
project.plugins = project.plugins.filter(
177+
project.plugins = project?.plugins?.filter(
178178
(plugin) => typeof plugin === 'string'
179-
)
179+
) ?? []
180180
return project
181181
} catch (e) {
182182
console.log((e as Error).message)

packages/selenium-ide/src/main/session/controllers/Recorder/index.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { CommandShape } from '@seleniumhq/side-model'
22
import { getActiveCommand, getActiveTest, getActiveCommandIndex } from '@seleniumhq/side-api/dist/helpers/getActiveData'
3-
import { LocatorFields, CoreSessionData } from '@seleniumhq/side-api'
3+
import { LocatorFields, CoreSessionData, RecordNewCommandInput } from '@seleniumhq/side-api'
44
import { randomInt, randomUUID } from 'crypto'
55
import { relative } from 'path'
66
import BaseController from '../Base'
@@ -61,15 +61,6 @@ const getLastActiveWindowHandleId = (session: CoreSessionData): string => {
6161

6262
return 'root'
6363
}
64-
export interface RecordNewCommandInput {
65-
command: string
66-
target: string | [string, string][]
67-
value: string | [string, string][]
68-
insertBeforeLastCommand?: boolean
69-
frameLocation?: string
70-
winHandleId?: string
71-
}
72-
7364
export default class RecorderController extends BaseController {
7465
windowIDs: number[] = []
7566

0 commit comments

Comments
 (0)