* return the same value of getSession
* chore: update docs and implementation
* remove event stuff
* add type in return
* add AppiumSessionCapabilities type
* update the syntax
* rename
* add test in e2e
* remove unnecessary type
* use fake driver name
* feat: add /appium/sessions, /session/:sessionId/appium/capabilities and deprecated marks will be removed in the future
* add a dymmy implementation
* move entire deprecated endpoints in bottom of each section
* define GET_APPIUM_SESSION_CAPABILITIES and add it to isAppiumDriverCommand
* adds _COMMAND
* remove unnecessary method definition
* move deprecated endpoints
* add temporary implementation
* Revert "feat(appium): Add session signature to all logs (#20202)"
This reverts commit b3f8a47c2d.
* Revert "feat(logger): Add the 'debug' level to the default logger (#20203)"
This reverts commit 7fd9d5f626.
- `core` module is now TS
- `constants` module is now TS
- export missing `W3C_ELEMENT_KEY`
- `JWProxy.command` returns `Promise<unknown>`. deal with it
- updated some type tests
* feat(base): add get computed role and label in W3C v2
* add command names
* chore: add type
* chore: use `?` instead of `| null`
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
* Revert "chore: use `?` instead of `| null`"
This reverts commit 62af5e80ac.
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
These arose when attempting to generate docs
- Errors now all have optional params in constructors; normalized param name
- Validate `METHOD_MAP` against an actual `MethodMap`
- Set `cliArgs = {}` as default in `server()`
- Rename `SessionCommands` to `ISessionCommands`
- The "context" in `IFindCommands` is now a generic of any type
- Made various props in `ExternalDriver` optional; `ExternalDriver` now accepts generic `Constraints`
- `proxyCommand` accepts a generic return value
- Removed unnecessary second generic type param from `DriverClass`
- `@appium/test-support` now exports the e2e setup for plugins, and e2e/unit suites for drivers from base-driver. it also generates declarations.
- `appium` exports this as `appium/test`.
- The `capability.spec.js` unit test for basedriver now avoids spying on the "global" logger, due to test flake. It now spies directly on the function which calls the global logger. (@mykola_mokhnach)
- removed homebrew ansi-stripping code from `test-support` and replaced with `@colors/colors`
- type fixes and refactors for `@appium/test-support`
- type fixes for `appium`
- simplify `lib/index.js` of `@appium/base-driver`
- Some types in `appium` were renamed
- Others avoid errors
- Some are minor tweaks to `tsconfig.json` files
# Conflicts:
# packages/appium/lib/extension/extension-config.js
# packages/appium/types/extension-manifest.ts
# packages/appium/types/extension.ts
# packages/base-driver/lib/jsonwp-proxy/proxy.js
# packages/support/lib/logging.js
# packages/support/test/unit/logger/logger-force.spec.js
This was not as easy as the other two. The main issue involves the `BaseDriver` class and is threefold:
1. `BaseDriver` and a valid external subclass thereof (a `Driver`) are not the same, because the former is essentially _abstract_. There is no notion of an abstract class in JS nor in TS for JS.
2. Splitting `BaseDriver` into several modules and "mixing in" some modules is just not well-understood by TS.
3. `AppiumDriver` inherits _most_ of `BaseDriver`, but overrides some functions with differing signatures. This is unsupported by TS.
To work around these problems, I had to:
1. Move the `Driver` interface into `@appium/types`, since other packages may depend on it. We do not want circular dependencies, which is likely to occur otherwise. Further, there is no way to tell TS for JS that a class _implements_ an interface or type.
2. Refactor the mixins (in `basedriver/commands/`) into "mixin classes", as understood by typescript. These are dynamic classes returned by functions which accept a class parameter, and _extend_ that class. The result is marginally better, but the implementation is ... well, see for yourself. It is not possible to use declaration merging to just "trick" TS into thinking that `BaseDriver` has all of these extra methods; classes cannot be merged, and even if you could, you can't use declaration merging to "add" methods afaict.
3. `BaseDriver` is now an empty class which inherits from all mixins applied to `DriverCore`. Due to syntactic restrictions, it must be a `class` statement in order to use the `@implements` tag, which causes TS to check that the result fully implements `Driver`. `AppiumDriver` _also_ inherits from `DriverCore`, since it does not override `BaseDriver` "properly". `BaseDriverCore` itself is pretty small, containing only those functions which `AppiumDriver` defines as differing.
Otherwise:
- `BaseDriver` does not inherit from `Protocol`, which is just an empty class. `Protocol` was removed.
- All of the error classes are exported from `protocol/errors`, because TS cannot see them otherwise.
- Exported missing `GET_STATUS_COMMAND` from `protocol/index`
- Re-exported `normalizeBasePath` from `server` instead of `protocol`, since that's where it's defined
- Removed `index.d.ts`
- Mixins use `@implements` as well. Note that `@implements` does not support `import('..')` syntax.
chore(base-driver): attempted to make types for mixins less awful
fixed a couple issues in the types in `driver.js`
core(base-driver): add capabilities types
- also move the bluebird config into the index
- fix references to `DriverOpts`
- add `assignServer()` to `BaseDriverCore`, used by `AppiumDriver`
chore(base-driver): fix more types
add missing reference to `@appium/types` in `tsconfig.json`
fix(base-driver): ensure getLogEvents is async
fix(base-driver): add some more type checks and fix logCustomEvent to be async
chore(base-driver): reformat