Skip to content

Commit b7f643a

Browse files
committed
Stabilizations, testing buildout, etc
1 parent 07d5a57 commit b7f643a

Some content is hidden

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

62 files changed

+432
-144
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"test:e2e": "jest --testMatch \"**/packages/**/__tests__/**/*.e2e.js\"",
1616
"lint": "yarn lint:scripts",
1717
"lint:scripts": "eslint --ignore-pattern node_modules --ignore-pattern third-party --ignore-pattern dist --ignore-pattern build --ignore-pattern json --ext .ts,.tsx --ext .js packages/",
18-
"test:side-runner": "./node_modules/@seleniumhq/side-runner/dist/bin.js --timeout 200000 ./tests/examples/wait-for.side",
18+
"test:side-runner": "./node_modules/@seleniumhq/side-runner/dist/bin.js ./tests/examples/*.side",
1919
"typecheck": "tsc --noEmit --composite false",
2020
"watch": "run-p watch:ts watch:webpack",
2121
"watch:webpack": "lerna run --parallel --stream --scope @seleniumhq/selenium-ide --loglevel verbose watch",
@@ -70,6 +70,6 @@
7070
"stylelint-config-standard": "^25.0.0",
7171
"stylelint-prettier": "^2.0.0",
7272
"ts-jest": "^27.1.3",
73-
"typescript": "^4.6.2"
73+
"typescript": "^4.8.3"
7474
}
7575
}

packages/selenium-ide/package.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,11 @@
103103
"@mui/icons-material": "^5.5.0",
104104
"@mui/lab": "^5.0.0-alpha.72",
105105
"@mui/material": "^5.5.0",
106-
"@seleniumhq/code-export-csharp-commons": "3.17.4",
107-
"@seleniumhq/code-export-csharp-nunit": "3.17.4",
108-
"@seleniumhq/code-export-csharp-xunit": "3.17.4",
109-
"@seleniumhq/code-export-java-junit": "3.17.4",
110-
"@seleniumhq/code-export-javascript-mocha": "3.17.4",
111-
"@seleniumhq/code-export-python-pytest": "3.17.4",
112-
"@seleniumhq/code-export-ruby-rspec": "3.17.4",
113106
"@seleniumhq/get-driver": "^4.0.0-alpha.1",
114107
"@seleniumhq/side-api": "^4.0.0-alpha.2",
115108
"@seleniumhq/side-model": "^4.0.0-alpha.1",
116109
"@seleniumhq/side-plugin-example": "^4.0.0-alpha.1",
117-
"@seleniumhq/side-runtime": "^4.0.0-alpha.2",
110+
"@seleniumhq/side-runtime": "^4.0.0-alpha.4",
118111
"electron-chromedriver": "16.0.0",
119112
"electron-log": "4.4.6",
120113
"electron-store": "^8.0.0",

packages/selenium-ide/src/main/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
import 'v8-compile-cache'
22
import 'source-map-support/register'
33
import { app } from 'electron'
4+
import log from 'electron-log'
45
import store from './store'
56
import createSession from './session'
67
import installReactDevtools from './install-react-devtools'
8+
import { join } from 'path'
9+
10+
// Configure log file
11+
const logFile = new Date().toISOString() + '.main.log'
12+
log.transports.file.resolvePath = () => join(app.getPath('logs'), logFile)
13+
Object.assign(console, log.functions);
714

815
// Enable debugging - required for electron-chromedriver
916
app.commandLine.appendSwitch('remote-debugging-port', '8315')

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ export default class BaseController {
1111
async onProjectLoaded() {}
1212
async onProjectUnloaded() {}
1313
isController = true
14+
priority: number = 0
1415
session: Session
1516
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ export default class CommandsController extends BaseController {
2323
}),
2424
{}
2525
)
26+
console.log(this.customCommands)
2627
this.session.state.state.commands = {
2728
...Commands,
2829
...serializeCustomCommands(this.customCommands),
2930
}
3031
}
32+
// This needs to build after plugins
33+
priority = 5
3134
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export default class DriverController extends BaseController {
7979
setWindowSize: async (_executor, width, height) => {
8080
const window = this.session.windows.getLastPlaybackWindow()
8181
const pbWinCount = this.session.windows.playbackWindows.length
82+
console.log(pbWinCount, window);
8283
const b = await window.getBounds()
8384
const calcNewX = b.x + Math.floor(b.width / 2) - Math.floor(width / 2)
8485
const calcNewY =

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ export default class PluginsController extends BaseController {
2727
async onProjectLoaded() {
2828
const projectPath = this.session.projects.filepath as string
2929
const pluginPaths = await this.list()
30-
const plugins = loadPlugins(
31-
__non_webpack_require__,
30+
console.log('Plugin paths', pluginPaths)
31+
const plugins = await loadPlugins(
3232
projectPath,
33-
await this.session.projects.getActive()
33+
pluginPaths,
34+
__non_webpack_require__
3435
)
3536
plugins.forEach((plugin, index) => {
3637
const pluginPath = pluginPaths[index]
@@ -62,4 +63,6 @@ export default class PluginsController extends BaseController {
6263
ipcMain.off(key, handler)
6364
})
6465
}
66+
// This needs to build before commands
67+
priority = 3
6568
}

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ export default class ProjectsController {
2727
'onProjectLoaded' | 'onProjectUnloaded'
2828
>
2929
): Promise<void> {
30-
await Promise.all(
31-
Object.values(this.session)
32-
.filter((v) => v.isController)
33-
.map((v) => v[hookName]())
34-
)
30+
const controllers = Object.values(this.session)
31+
.filter((v) => v.isController)
32+
.sort((a: BaseController, b: BaseController) => a.priority - b.priority)
33+
for (let i = 0, ii = controllers.length; i !== ii; i++) {
34+
await controllers[i][hookName]()
35+
}
3536
}
3637

3738
async onProjectLoaded(
@@ -49,9 +50,9 @@ export default class ProjectsController {
4950
if (!this.loaded) return true
5051
const confirm = await this.doSaveChangesConfirm()
5152
if (confirm) {
53+
this.loaded = false
5254
await this.executeHook('onProjectUnloaded')
5355
delete this.filepath
54-
this.loaded = false
5556
}
5657
return confirm
5758
}

packages/side-cli/src/index.tsx

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,32 @@ import path from 'path'
2929
import React from 'react'
3030
import PlaybackComponent from './components/playback'
3131

32-
let projectPath = process.argv[2]
33-
if (projectPath.startsWith('.')) {
34-
projectPath = path.join(process.cwd(), projectPath)
35-
}
32+
const main = async () => {
33+
let projectPath = process.argv[2]
34+
if (projectPath.startsWith('.')) {
35+
projectPath = path.join(process.cwd(), projectPath)
36+
}
37+
38+
const project: ProjectShape = JSON.parse(
39+
fs.readFileSync(projectPath).toString()
40+
)
3641

37-
const project: ProjectShape = JSON.parse(
38-
fs.readFileSync(projectPath).toString()
39-
)
42+
const plugins = await loadPlugins(projectPath, project.plugins)
43+
const customCommands = getCustomCommands(plugins)
44+
const executor = new WebDriverExecutor({
45+
customCommands,
46+
})
4047

41-
const plugins = loadPlugins(require, projectPath, project)
42-
const customCommands = getCustomCommands(plugins)
43-
const executor = new WebDriverExecutor({
44-
customCommands,
45-
})
48+
const playback = new Playback({
49+
baseUrl: project.url,
50+
getTestByName: (name: string) =>
51+
project.tests.find((t) => t.name === name) as TestShape,
52+
logger: console,
53+
executor,
54+
variables: new Variables(),
55+
})
4656

47-
const playback = new Playback({
48-
baseUrl: project.url,
49-
getTestByName: (name: string) =>
50-
project.tests.find((t) => t.name === name) as TestShape,
51-
logger: console,
52-
executor,
53-
variables: new Variables(),
54-
})
57+
render(<PlaybackComponent project={project} playback={playback} />)
58+
}
5559

56-
render(<PlaybackComponent project={project} playback={playback} />)
60+
main()

packages/side-runner/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@seleniumhq/side-runner",
3-
"version": "4.0.0-alpha.13",
3+
"version": "4.0.0-alpha.14",
44
"description": "Run Selenium IDE projects in cli",
55
"repository": "https://github.com/SeleniumHQ/selenium-ide",
66
"scripts": {
@@ -24,7 +24,7 @@
2424
"private": false,
2525
"dependencies": {
2626
"@seleniumhq/side-model": "^4.0.0-alpha.1",
27-
"@seleniumhq/side-runtime": "^4.0.0-alpha.3",
27+
"@seleniumhq/side-runtime": "^4.0.0-alpha.4",
2828
"commander": "^9.4.0",
2929
"glob": "^7.2.0",
3030
"jest": "^27.5.1",

0 commit comments

Comments
 (0)