Skip to content

Commit 25164e8

Browse files
toddtarsiOzBobMarvelCoder
authored
Selenium IDE: Running v4 without v3 (#1258)
* verify not editable tests disabled (#1151) changed to : 'verify not editable' = has been disabled rather than what the original said hasn't been disabled * [v4] Attempting to run v3 inside of v4 * chromedriver install via electron-chromedriver * move renderer out into a separate package in addition, this adds electron-tabs to the frontend * remove unused chromedriver install script * making selenium ide v3 work with install stuff it is slow as hell though, so there is that * remove nodeIntegration, and instead lay boilerplate towards a channel system I would feel really bad if someone used selenium-ide, and some zero day in electron / chrome let them leverage the full NodeJS api. So the plan would be to swap that out for a channel system to leverage enhanced permissions. * selenium ide v3 renders and some code cleanup * first time rendering v3 in electron the ipc layer is one directional and everything is kinda hacky right now loading and saving side files is the only part that really works next step is to make it so electron can talk into webview via ipc and then get recording working like it used to * working bi-directional api and it feels pretty good to work with :D * voraciously cleaning up this stuff * progress on side extension polyfill I am starting to handle the tabs.onUpdated event It isnt a lot, but it sets the boilerplate * v4 an almost insignificant amount of docs event linked to corresponding chrome api * extending type enforcement through the api wah wah wee wah * making types slightly more consistent and bug squashing yay types! * trying to move to webdriver stuff * trying to get playback to use webdriver * Breaking everything to be "cleaner" Goodbye type completion, goodbye anything working. This is kind of a bad idea, but the nice thing is that it aligns the whole package around its true function at this point: providing a polyfill for the webextension api that integrates with electron. If we have that, we have v3 and can start making v4 changes. * oh my sweet types, how I have missed you * oh boy things work again * [v4] save what i have * Replacing a polyfill with an api * selenium ide v4 but without the polyfill * wiring in rpc style broadcastng to keep browser windows in sync, overengineering * 0 linter errors, server and client have shared state now * fully typing runtime, commons, and adding to model * configurable driver and startup ux * getting electron driver working again * A basic spark, fun with panels * style and building better * PLAYBACK!!! :D :D :D * re-running playback multiple times works * latest code shape * repairing build command * clean watch and build commands * consistentizing build and watch commands just a bit more * passing types in side-migrate * module file for unescape * atomic and stable build and watch commands * cleaning up last ts complaints * Changed casing (#1330) * Fix stale frontend (#1329) * drop unneeded loggers for now some of these should perhaps be console.debug, but w/e * fix stale frontend we were not memoizing on enough things which caused a prev version of test and command to be cached, causing things like test or command updates to not reflect * thin down command list panel less room there is more room for playback windows * hide panels less aggressively if a new playback window is opened, hiding panels feels weird and somewhat unseemly. This hides panels only if all windows are unfocused, which means you are not using the app atm * reduce build memory requirements * webpack rapid build * fix invalid capitalization * playback progress and re-collapsing ux * latest everything * fixed recurring playback * addl ux work * add record placeholder function * typing side recorder postprocessor * recorder is mostly typed * recording is so much closer * commands are piping whoo! * getting better every day :3 * updating mui, collapsing components * tabs layer perhaps? * suite editor system * project editing tab * recording concats steps now * tuning some scrolling stuff * save and load controls * rebuild driver between projects * typed argument fields * resolve type errors * renaming things, wip towards select control * select element :D :D * inspect elements option in all playback windows Co-authored-by: OzBob <[email protected]> Co-authored-by: Harsh <[email protected]>
1 parent 822f04b commit 25164e8

File tree

299 files changed

+13134
-5235
lines changed

Some content is hidden

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

299 files changed

+13134
-5235
lines changed

.eslintignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# No wasted processing
2+
**/node_modules
3+
**/dist
4+
**/.yarn
5+
**/tsconfig.tsbuildinfo
6+
**/gen
7+
**/trace

.eslintrc.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,27 @@ module.exports = {
2626
files: ['**/*.ts', '**/*.tsx'],
2727
parser: '@typescript-eslint/parser',
2828
rules: {
29+
'import/no-unresolved': 'error',
2930
'@typescript-eslint/array-type': ['error', { default: 'array' }],
3031
'@typescript-eslint/ban-types': 'error',
3132
'@typescript-eslint/no-unused-vars': [
3233
'error',
3334
{ argsIgnorePattern: '^_' },
3435
],
35-
'@typescript-eslint/interface-name-prefix': ['error', 'never'],
3636
'no-dupe-class-members': 'off',
3737
'no-unused-vars': 'off',
3838
'no-inner-declarations': 0, // for typescript namespace
3939
},
4040
},
4141
],
42-
plugins: ['@typescript-eslint', 'jest', 'react', 'prettier', 'no-only-tests'],
42+
plugins: [
43+
'@typescript-eslint',
44+
'import',
45+
'jest',
46+
'react',
47+
'prettier',
48+
'no-only-tests',
49+
],
4350
rules: {
4451
'prettier/prettier': 'error',
4552
'react/prop-types': [0],
@@ -71,6 +78,13 @@ module.exports = {
7178
},
7279
},
7380
],
81+
'node/no-missing-require': [
82+
'error',
83+
{
84+
allowModules: ['electron'],
85+
tryExtensions: ['.js', '.jsx', '.json', '.ts', '.tsx', '.node'],
86+
},
87+
],
7488
'node/no-missing-import': [
7589
'error',
7690
{
@@ -80,8 +94,18 @@ module.exports = {
8094
],
8195
},
8296
settings: {
97+
'import/parsers': {
98+
'@typescript-eslint/parser': ['.ts', '.tsx'],
99+
},
100+
'import/resolver': {
101+
typescript: {
102+
alwaysTryTypes: true,
103+
package: ['./tsconfig.json', './packages/*/tsconfig.json'],
104+
},
105+
},
83106
react: {
84107
version: 'detect',
85108
},
86109
},
110+
root: true,
87111
}

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
web-ext-artifacts
1+
eb-ext-artifacts
22
node_modules
33
_MACOSX/
44
.DS_Store
@@ -18,7 +18,9 @@ tsconfig.tsbuildinfo
1818
tsconfig.build.tsbuildinfo
1919
files
2020
drivers
21-
bazel-*
21+
*.d.ts.map
22+
*.d.ts
23+
!packages/side-migrate/src/types.d.ts
2224

2325
# auto-generated docs
2426
docs/api/arguments.md

babel.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ const path = require('path')
44
module.exports = {
55
babelrcRoots: fs
66
.readdirSync(path.join(__dirname, 'packages'))
7-
.map(dirname => path.join(__dirname, 'packages', dirname))
8-
.filter(dirpath => {
7+
.map((dirname) => path.join(__dirname, 'packages', dirname))
8+
.filter((dirpath) => {
99
const stats = fs.statSync(dirpath)
1010

1111
return stats.isDirectory()
@@ -21,7 +21,7 @@ module.exports = {
2121
'@babel/preset-env',
2222
{
2323
targets: {
24-
node: '8',
24+
node: '14',
2525
},
2626
},
2727
],

dump.rdb

1.85 KB
Binary file not shown.

package.json

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,20 @@
55
"private": true,
66
"scripts": {
77
"start": "cd packages/selenium-ide && yarn start",
8-
"build": "lerna run build",
8+
"build": "yarn build:ts && yarn build:ide",
9+
"build:ide:fast": "lerna run --scope @seleniumhq/selenium-ide --loglevel verbose build:webpack",
10+
"build:ide": "lerna run --scope @seleniumhq/selenium-ide --loglevel verbose build:webpack",
11+
"build:ts": "tsc --build --verbose",
12+
"clean": "lerna run clean --loglevel verbose",
13+
"clean:nuke": "git clean -fdx",
914
"test": "jest",
1015
"test:e2e": "jest --testMatch \"**/packages/**/__tests__/**/*.e2e.js\"",
1116
"lint": "yarn lint:scripts",
1217
"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/",
1318
"typecheck": "tsc --noEmit --composite false",
14-
"watch": "lerna run --no-bail --parallel watch",
19+
"watch": "yarn watch:ts & yarn watch:webpack",
20+
"watch:webpack": "lerna run --parallel --stream --scope @seleniumhq/selenium-ide --loglevel verbose watch",
21+
"watch:ts": "tsc --build --verbose --watch",
1522
"preinstall": "node ./scripts/check-yarn.js",
1623
"download-drivers": "cd packages/webdriver-testkit && yarn download-drivers"
1724
},
@@ -61,37 +68,31 @@
6168
"@testing-library/jest-dom": "^4.2.1",
6269
"@types/fs-extra": "^8.0.0",
6370
"@types/jest": "^24.0.21",
64-
"@types/mocha": "8.0.0",
65-
"@types/node": "^12.12.3",
66-
"@types/node-fetch": "^2.5.2",
67-
"@types/selenium-webdriver": "^4.0.9",
68-
"@types/tar": "^4.0.3",
69-
"@types/unzipper": "^0.10.0",
70-
"@typescript-eslint/eslint-plugin": "^2.6.0",
71-
"@typescript-eslint/parser": "^2.6.0",
72-
"babel-eslint": "^10.0.3",
71+
"@types/node": "^15.12.1",
72+
"@types/selenium-webdriver": "^4.0.16",
73+
"@typescript-eslint/eslint-plugin": "^4.28.1",
74+
"@typescript-eslint/parser": "^4.28.1",
75+
"babel-eslint": "^10.1.0",
7376
"babel-jest": "^24.9.0",
74-
"electron": "^9.4.0",
75-
"electron-builder": "^21.2.0",
76-
"eslint": "^6.5.0",
77-
"eslint-config-prettier": "^6.3.0",
78-
"eslint-plugin-jest": "^23.0.2",
79-
"eslint-plugin-no-only-tests": "^2.3.1",
80-
"eslint-plugin-node": "^10.0.0",
81-
"eslint-plugin-prettier": "^3.1.1",
82-
"eslint-plugin-react": "^7.14.3",
83-
"fs-extra": "^8.1.0",
77+
"eslint": "^8.5.0",
78+
"eslint-config-prettier": "^8.3.0",
79+
"eslint-import-resolver-typescript": "^2.5.0",
80+
"eslint-plugin-import": "^2.25.3",
81+
"eslint-plugin-jest": "^25.3.2",
82+
"eslint-plugin-no-only-tests": "^2.6.0",
83+
"eslint-plugin-node": "^11.1.0",
84+
"eslint-plugin-prettier": "^4.0.0",
85+
"eslint-plugin-react": "^7.28.0",
8486
"identity-obj-proxy": "^3.0.0",
8587
"jest": "^24.9.0",
8688
"jest-cli": "26.1.0",
8789
"lerna": "^3.16.4",
88-
"nock": "^11.6.0",
89-
"prettier": "^1.17.0",
90+
"prettier": "^2.3.2",
9091
"stylelint": "^11.0.0",
9192
"stylelint-config-prettier": "^6.0.0",
9293
"stylelint-config-standard": "^19.0.0",
9394
"stylelint-prettier": "^1.0.6",
9495
"ts-jest": "^24.1.0",
95-
"typescript": "^3.6.3"
96+
"typescript": "^4.5.4"
9697
}
9798
}

packages/browser-info/__tests__/chrome.spec.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import { Chrome } from '../src/chrome'
2222
import { sh, makeError } from '../src/sh'
2323

2424
const { getBrowserInfo, ChromeChannel } = Chrome
25-
const mockSh = (sh as unknown) as jest.Mock<any, any>
26-
const mockPlatform = (os.platform as unknown) as jest.Mock<any, any>
25+
const mockSh = sh as unknown as jest.Mock<any, any>
26+
const mockPlatform = os.platform as unknown as jest.Mock<any, any>
2727

2828
describe('chrome browser info', () => {
2929
describe('macOS', () => {
@@ -51,11 +51,12 @@ describe('chrome browser info', () => {
5151
try {
5252
await getBrowserInfo(ChromeChannel.stable)
5353
} catch (err) {
54+
// @ts-expect-error
5455
expect(err.message).toBe('Unable to find Chrome installation')
5556
}
5657
})
5758
it('should get all chrome info', async () => {
58-
mockSh.mockImplementation(binary => {
59+
mockSh.mockImplementation((binary) => {
5960
if (binary.includes('Canary')) {
6061
return Promise.resolve({
6162
stdout: 'Google Chrome 79.0.3915.0 canary\n',
@@ -96,7 +97,7 @@ describe('chrome browser info', () => {
9697
mockSh.mockReset()
9798
})
9899
it('should get partial chrome info if some installations do not exist', async () => {
99-
mockSh.mockImplementation(binary => {
100+
mockSh.mockImplementation((binary) => {
100101
if (binary.includes('Canary')) {
101102
return Promise.resolve({
102103
stdout: 'Google Chrome 79.0.3915.0 canary\n',
@@ -153,6 +154,7 @@ describe('chrome browser info', () => {
153154
try {
154155
await getBrowserInfo(ChromeChannel.stable)
155156
} catch (err) {
157+
// @ts-expect-error
156158
expect(err.message).toBe('Unable to find Chrome installation')
157159
}
158160
})
@@ -161,11 +163,12 @@ describe('chrome browser info', () => {
161163
try {
162164
await getBrowserInfo(ChromeChannel.canary)
163165
} catch (err) {
166+
// @ts-expect-error
164167
expect(err.message).toBe('Unsupported channel canary')
165168
}
166169
})
167170
it('should get all chrome info', async () => {
168-
mockSh.mockImplementation(binary => {
171+
mockSh.mockImplementation((binary) => {
169172
if (binary.includes('beta')) {
170173
return Promise.resolve({
171174
stdout: 'Google Chrome 75.0.3770.75 beta\n',
@@ -193,7 +196,7 @@ describe('chrome browser info', () => {
193196
mockSh.mockReset()
194197
})
195198
it('should get partial chrome info if some installations do not exist', async () => {
196-
mockSh.mockImplementation(binary => {
199+
mockSh.mockImplementation((binary) => {
197200
if (binary.includes('beta')) {
198201
return Promise.reject(makeError('error', 1, '', ''))
199202
} else {

packages/browser-info/__tests__/sh.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ describe('sh', () => {
4242
'console.log(`out`);console.error(`err`);process.exit(1);',
4343
])
4444
} catch (err) {
45+
// @ts-expect-error
4546
expect(err.stdout).toBe('out\n')
47+
// @ts-expect-error
4648
expect(err.stderr).toBe('err\n')
49+
// @ts-expect-error
4750
expect(err.code).toBe(1)
4851
}
4952
})
@@ -52,6 +55,7 @@ describe('sh', () => {
5255
try {
5356
await sh('command-that-does-not-exist')
5457
} catch (err) {
58+
// @ts-expect-error
5559
expect(err.code).toBe(1)
5660
}
5761
})

packages/browser-info/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"build": "tsc",
1111
"clean": "rm -rf dist tsconfig.tsbuildinfo",
1212
"prepublishOnly": "yarn clean && yarn build",
13-
"watch": "yarn build -w"
13+
"watch": "tsc --watch"
1414
},
1515
"main": "dist/index.js",
1616
"types": "dist/index.d.ts",

packages/browser-info/tsconfig.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
4-
"baseUrl": ".",
4+
"baseUrl": "./src",
55
"rootDir": "src",
66
"outDir": "dist",
7-
"target": "es5",
8-
"module": "commonjs",
9-
"strict": true,
10-
"esModuleInterop": true,
117
"skipLibCheck": true,
128
"forceConsistentCasingInFileNames": true
139
},
14-
"include": [
15-
"src"
16-
],
10+
"include": ["src/**/*.ts"],
1711
"exclude": [
1812
"**/__mocks__",
1913
"**/__tests__"

packages/get-driver/__tests__/download-driver.spec.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ describe('download-driver', () => {
4242
const cp = spawn(chromedriver, ['--version'])
4343
let stdout = ''
4444
let processExit: () => {}
45-
const p = new Promise(res => {
45+
const p = new Promise((res) => {
4646
processExit = res as () => {}
4747
})
48-
cp.stdout.on('data', data => {
48+
cp.stdout.on('data', (data) => {
4949
stdout += data
5050
})
51-
cp.on('close', code => {
51+
cp.on('close', (code) => {
5252
expect(code).toBe(0)
5353
processExit()
5454
})
@@ -68,13 +68,13 @@ describe('download-driver', () => {
6868
const cp = spawn(chromedriver, ['--version'])
6969
let stdout = ''
7070
let processExit: () => {}
71-
const p = new Promise(res => {
71+
const p = new Promise((res) => {
7272
processExit = res as () => {}
7373
})
74-
cp.stdout.on('data', data => {
74+
cp.stdout.on('data', (data) => {
7575
stdout += data
7676
})
77-
cp.on('close', code => {
77+
cp.on('close', (code) => {
7878
expect(code).toBe(0)
7979
processExit()
8080
})
@@ -94,13 +94,13 @@ describe('download-driver', () => {
9494
const cp = spawn(geckodriver, ['--version'])
9595
let stdout = ''
9696
let processExit: () => {}
97-
const p = new Promise(res => {
97+
const p = new Promise((res) => {
9898
processExit = res as () => {}
9999
})
100-
cp.stdout.on('data', data => {
100+
cp.stdout.on('data', (data) => {
101101
stdout += data
102102
})
103-
cp.on('close', code => {
103+
cp.on('close', (code) => {
104104
expect(code).toBe(0)
105105
processExit()
106106
})
@@ -119,6 +119,7 @@ describe('download-driver', () => {
119119
version: '6.0.9',
120120
})
121121
} catch (err) {
122+
// @ts-expect-error
122123
expect(err.message).toBe('Failed to download driver')
123124
}
124125
})

packages/get-driver/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"build": "tsc",
1111
"clean": "rm -rf dist tsconfig.tsbuildinfo",
1212
"prepublishOnly": "yarn clean && yarn build",
13-
"watch": "yarn build -w"
13+
"watch": "tsc --watch"
1414
},
1515
"main": "dist/index.js",
1616
"types": "dist/index.d.ts",

packages/get-driver/src/resolve-driver.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function resolveDriverUrl({
3030
}) {
3131
switch (browser) {
3232
case 'electron': {
33-
return `https://github.com/electron/electron/releases/download/v${version}/chromedriver-v${version}-${platform}-${arch}.zip`
33+
throw new Error('Installation of electron browser handled by electron-chromedriver package');
3434
}
3535
case 'chrome': {
3636
return `https://chromedriver.storage.googleapis.com/${await getChromedriverVersion(
@@ -63,13 +63,13 @@ export function resolveDriverName({
6363
}`
6464
}
6565

66-
export type Browser = 'electron' | 'chrome' | 'firefox'
66+
export type Browser = 'chrome' | 'electron' | 'firefox'
6767

6868
export type Platform = NodeJS.Platform
6969

7070
const DriverNames: BrowserToDriver = {
71-
electron: 'chromedriver',
7271
chrome: 'chromedriver',
72+
electron: 'chromedriver',
7373
firefox: 'geckodriver',
7474
}
7575

0 commit comments

Comments
 (0)