Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimenting with REPL driver #1711

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"lint": "pnpm run lint:scripts",
"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/",
"test:ide": "npm-run-bg -s 'http-server -p 8080 ./tests/static::Available on::8080' 'node ./packages/selenium-ide/scripts/ide-runner.js -t 15000 ./tests/examples/*.side'",
"test:side-runner": "npm-run-bg -s 'http-server -p 8080 ./tests/static::Available on::8080' 'node ./packages/side-runner/dist/bin.js -t 15000 ./tests/examples/*.side'",
"test:side-runner": "npm-run-bg -s 'http-server -p 8080 ./tests/static::Available on::8080' 'node ./packages/side-runner/dist/bin.js -c \"browserName=firefox\" -t 15000 ./tests/examples/*.side'",
"test:side-runner:ci": "npm-run-bg -s 'http-server -p 8080 ./tests/static::Available on::8080' 'node ./packages/side-runner/dist/bin.js -c \"goog:chromeOptions.args=[headless,no-sandbox] browserName=chrome\" -t 15000 ./tests/examples/*.side'",
"typecheck": "tsc --noEmit --composite false",
"watch": "run-p watch:ts watch:webpack",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default class RecorderController extends BaseController {
if (session.state.status !== 'recording') {
return null
}
const commands = []
const commands: CommandShape[] = []
if (
getLastActiveWindowHandleId(session) != cmd.winHandleId
) {
Expand Down
5 changes: 3 additions & 2 deletions packages/side-api/src/types/base.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ProjectShape } from '@seleniumhq/side-model'
import { CommandShape, ProjectShape } from '@seleniumhq/side-model'
import { Chrome } from '@seleniumhq/browser-info'
import { Browser } from '@seleniumhq/get-driver'
import { StateShape } from '../models/state'
Expand Down Expand Up @@ -78,7 +78,8 @@ export type EventListenerParams<LISTENER extends BaseListener<any>> =

export type LocatorFields = 'target' | 'value'

export interface RecordNewCommandInput {
export interface RecordNewCommandInput
extends Omit<CommandShape, 'id' | 'target' | 'value'> {
command: string
target: string | [string, string][]
value: string | [string, string][]
Expand Down
33 changes: 33 additions & 0 deletions packages/side-executor-runtime/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
load("@npm//@babel/cli:index.bzl", "babel")
load("@npm//jest-cli:index.bzl", "jest_test")

babel(
name = "build",
args = [
'--root-mode upward -d dist src --extensions ".js,.jsx,.ts,.tsx" --source-maps true'
]
)

filegroup(
name = "test_lib",
srcs = glob([
"**/*.js"
]),
)

jest_test(
name = "test",
args = [
"--no-cache",
"--no-watchman",
"--ci",
"--colors",
"--config",
"babel.config.js",
"--updateSnapshot"
],
data = [
":test_lib",
"//:babel.config.js"
]
)
16 changes: 16 additions & 0 deletions packages/side-executor-runtime/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
testEnvironment: 'jsdom',
testEnvironmentOptions: {
url: 'http://localhost/index.html',
},
moduleNameMapper: {
'^.+\\.(css|scss)$': 'identity-obj-proxy',
},
setupFilesAfterEnv: ['./scripts/jest/test.config.js'],
testMatch: ['**/packages/**/__test?(s)__/**/*.spec.[jt]s?(x)'],
testPathIgnorePatterns: ['/node_modules/'],
transform: {
'^.+\\.jsx?$': 'babel-jest',
'^.+\\.tsx?$': 'ts-jest',
},
}
37 changes: 37 additions & 0 deletions packages/side-executor-runtime/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@seleniumhq/side-executor-runtime",
"version": "4.0.0-alpha.1",
"private": false,
"description": "Selenium IDE playback and execution",
"author": "Tomer <[email protected]>",
"homepage": "http://github.com/SeleniumHQ/selenium-ide",
"license": "Apache-2.0",
"scripts": {
"build": "tsc",
"clean": "rm -rf dist tsconfig.tsbuildinfo node_modules",
"watch": "tsc --watch"
},
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"repository": {
"type": "git",
"url": "git+https://github.com/SeleniumHQ/selenium-ide.git"
},
"bugs": {
"url": "https://github.com/SeleniumHQ/selenium-ide/issues"
},
"devDependencies": {
"@seleniumhq/side-testkit": "^4.0.0-alpha.1",
"@seleniumhq/webdriver-testkit": "^4.0.0-alpha.1"
},
"dependencies": {
"@seleniumhq/side-commons": "^4.0.0-alpha.1",
"@seleniumhq/side-model": "^4.0.0-alpha.4",
"@types/selenium-webdriver": "^4.1.15",
"selenium-webdriver": "^4.11.1"
},
"gitHead": "507c7c802f34196e6ee4800bf5c0b36553d41369"
}
26 changes: 26 additions & 0 deletions packages/side-executor-runtime/src/errors/assertion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

export default class AssertionError extends Error {
constructor(...argv: string[]) {
super(argv.join(' '))

if (Error.captureStackTrace) {
Error.captureStackTrace(this, AssertionError)
}
}
}
19 changes: 19 additions & 0 deletions packages/side-executor-runtime/src/errors/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

export { default as AssertionError } from './assertion'
export { default as VerificationError } from './verification'
26 changes: 26 additions & 0 deletions packages/side-executor-runtime/src/errors/verification.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

export default class VerificationError extends Error {
constructor(...argv: string[]) {
super(argv.join(' '))

if (Error.captureStackTrace) {
Error.captureStackTrace(this, VerificationError)
}
}
}
21 changes: 21 additions & 0 deletions packages/side-executor-runtime/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

export { default as Variables } from './variables'
export { default as WebDriverExecutor } from './webdriver'

export * from './types'
Loading
Loading