Commit Graph

138 Commits

Author SHA1 Message Date
Mykola Mokhnach 275790ec01 fix(base-driver): Update the web socket upgrade behavior (#20142) 2024-05-24 19:57:54 +02:00
renovate[bot] a722f48f14 chore(deps): update definitelytyped (#20070) 2024-05-09 08:10:30 +02:00
Mykola Mokhnach 4e8c91c8f6 feat(base-driver): Add env variables to control applications cache (#20042) 2024-04-29 22:48:01 +02:00
Mykola Mokhnach 3423fd9206 feat(base-driver): Add the original app link argument to configureApp callbacks (#20035) 2024-04-24 18:01:14 +02:00
Mykola Mokhnach 77d2ef74bb chore(bass-driver): Improve capability deprecation warning (#20019) 2024-04-19 20:21:51 +02:00
Mykola Mokhnach 8cf3efdbed feat(base-driver): Add onDownload handler to the configureApp helper (#20015) 2024-04-19 13:21:24 +02:00
Kazuaki Matsuo 9f655f6f85 fix: do not print deprecation errors for non-provided caps (#19986) 2024-04-10 09:14:47 -07:00
Mykola Mokhnach d5af68ecdd chore(base-driver): Drop the obsolete es6-error import (#19974) 2024-04-06 10:20:30 +02:00
renovate[bot] 2448fa0145 fix(docutils): update dependency typescript to v5.4.2 (#19876)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Mykola Mokhnach <mokhnach@gmail.com>
2024-03-13 08:25:33 +01:00
Mykola Mokhnach 7de3c1d57a chore(support): Deprecate AppiumLogger.errorAndThrow() (#19577) 2023-12-27 10:59:15 +01:00
Jonathan Lipps f88d68f295 test(appium): wrap bluebird config in error handling for tests 2023-12-21 12:32:15 -08:00
Jonathan Lipps 2b21e66891 feat: add webdriver bidi support 2023-12-21 12:32:15 -08:00
Jonathan Lipps b53c0b9674 chore: run prettier on some files (#19403)
Working on these files for the bidi implementation
And want a clean PR to review without all this junk
2023-11-10 15:27:13 +00:00
Kazuaki Matsuo b83bd04265 chore(base-driver): remove mobileRotation as no references (#19379)
* chore(base-driver): remove mobileRotation as no references

* docs: remove unused endpoint

* test: fix test
2023-11-06 23:12:11 -08:00
Mykola Mokhnach de02ed87fc fix: Use pathToRegexp to match websocket endpoints (#19162) 2023-09-15 19:09:10 +02:00
Mykola Mokhnach 5926919177 feat(base-driver): Add server support of TLS and SPDY protocols (#19105) 2023-09-08 08:02:56 +02:00
Mykola Mokhnach 7722767d80 chore(base-driver): Tune the log message for non-recognised capabilities (#19098) 2023-08-31 20:46:14 +02:00
renovate[bot] 72a806bec7 fix(images-plugin): update dependency lru-cache to v10 (#19050) 2023-08-25 10:42:28 +02:00
Mykola Mokhnach 315a5e6cc7 fix(base-driver): Avoid RangeError while caching the response data (#19043) 2023-08-23 19:20:55 +02:00
hijack-x abcf0d451f fix(base-driver): fix the LRUCache.dispose callback param order (#19037) 2023-08-23 14:12:24 +02:00
Mykola Mokhnach 53bfc68eee fix(base-driver): Fix possible NPE while cleaning up the state listener (#19020) 2023-08-21 13:56:55 +02:00
Mykola Mokhnach 2f69e6db2a chore(base-driver): Improve bad parameters error message (#19002) 2023-08-19 08:27:31 +02:00
Mykola Mokhnach ed8e83c76c fix(base-driver): Respect basic auth credentials if provided (#19000) 2023-08-18 18:46:03 +02:00
renovate[bot] aaf31a577c fix(support): update dependency glob to v10 (#18490) 2023-08-02 22:34:34 +02:00
Mykola Mokhnach de5b55ae90 fix(base-driver): Tune responses caching logic (#18922) 2023-08-01 08:09:13 +02:00
Bipin Kumar Chaurasia ead861077a docs(appium): add correct doc path for redirecting potentially insecure features with security.md file (#18911) 2023-07-27 12:50:43 -07:00
Mykola Mokhnach 75650a6b74 fix(base-driver): Use proper cached headers for app download (#18874) 2023-07-14 19:59:12 +02:00
Christopher Hiller 2b351705d4 fix(base-driver): pass thru all type args to ExternalDriver
- `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
2023-07-03 13:10:51 -07:00
Christopher Hiller d6cca5175c fix(types): separate the type of opts from initialOpts
A thing we know about the `opts` object passed in to a driver constructor is that it does _not_ contain caps.  This value is retained in `this.initialOpts`.  Upon session creation, it _does_ contain caps.

This adds a new type, `InitialOpts`, which is the first parameter to a driver.  In the future, it may accept a type argument, as currently any extension-specific options (defined via schema in `package.json`) are not typed.

Because `DriverOpts` is a superset of `InitialOpts`, this should not be a breaking change.
2023-07-03 13:10:51 -07:00
Christopher Hiller 3d614d6d41 fix(base-driver): allow subclass to define shape of settings object
The mixin approach prevented subclasses of BaseDriver from narrowing the type of `this.settings`.  Now, that's possible.

Also:
- removed an unused type argument from BD constructor
- and did some typedef aliasing
- remove unneeded type assertion from log mixin
2023-07-03 13:10:51 -07:00
Christopher Hiller 81bc527be6 fix(types): various fixes for reality
- because BaseDriver implements `findElOrEls` (technically), any subclasses must not inherit an interface containing a non-identical `findElOrEls` -- not even narrowing.  so to avoid this, we will need to make it as broad as possible; no more generic `Ctx`
- likewise with `getLog`
- fix return type of `setGeoLocation`
- fix return type of `getPerformanceData`
- fix return type of `removeApp`
- fix return type of `hideKeyboard`
- fix return type of `getSystemBars`
- fix signature of various `touch*` methods
- fix return type of `setNetworkConnection`

alternatively, the deprecated methods mentioned here should be removed.
2023-06-14 16:21:51 -07:00
Christopher Hiller 54a4a8da03 fix(base-driver): update def of findElOrEls and findElOrElsWithProcessing
- adds some types to the `Proxy` class
- make `isErrorType()` a proper type guard
2023-06-14 16:21:51 -07:00
Mykola Mokhnach 4f564ef7ad fix(base-driver): Ignore unknown script arguments (#18575) 2023-04-27 22:40:20 +02:00
Christopher Hiller 6245022be9 fix(basedriver): allow arbitrary session data to be returned by getSession
This removes the implementation of `ISessionCommands` and moves the methods into the class proper (see previous changeset for reasoning).
2023-04-14 12:23:54 -07:00
Christopher Hiller 4974403661 fix: backwards-compatible fixes for TS v5.x
These will be issues when we upgrade
2023-03-27 17:07:51 -07:00
Christopher Hiller deb631b456 fix(basedriver): convert main driver implementation to typescript
This seems to fix the bug in #18379.  There must be some sort of bug in TypeScript w/r/t `@implements` or maybe even it was not treating `@typedef` as a proper alias.  Perhaps it's user error--omitting optional type args in alias-style typedefs may end up making a new type entirely.  idk, but this was easier to deal with.

Closes #18379.
2023-03-27 17:07:51 -07:00
Christopher Hiller 3c9fa7ba73 fix(appium,types,base-driver,fake-driver,driver-test-support): normalize constraint defaults
Another handful of fixes.

- remove second "extra" parameter from `Capabilities`, `NSCapabilities` `W3CCapabilities`. we were not using it anywhere to my knowledge. it was an escape hatch anyway.
- never assign `BaseDriverCapConstraints` as the default constraints, because this is confusing as hell. instead, drivers should use the `*DriverCaps` types which automatically pulls the base constraints in. applied across several workspaces
- renamed `DeviceSettings` => `IDeviceSettings` because `DeviceSettings` is a class.
- the session ID param of `Core`'s `sessionExists()` is actually optional (per the implementation)
- allow some modicum of type narrowing at the class level around settings and values returned by `ISessionHandler`'s methods. also, not all values in the raw settings object are of the same type `T`, so fix that
- `server`, `serverHost`, `serverPort` and `serverPath` are not members of `Core` (using `AppiumDriver` as a litmus test--it interacts with `Driver` types but does not have these properties itself)
- changed a few types to interfaces where possible
- moved a lost comment
- further dumbed-down the logdef stuff
- `Driver.driverData` is _always_ defined, since `Core` makes it an empty array.
- `DriverOpts` no longer contains "partial" caps; this it not quite right as the caps are not assigned until a session is created, but there's a conflict between some props which are _both_ server args and defined in constraints.  anyway, this is what `initialOpts` is for
- fix some type disagreements in basedriver's "capabilities" module
2023-03-27 17:07:51 -07:00
Christopher Hiller 0dcd5fa371 fix(base-driver,base-plugin,types): update PluginCommand and DriverCommand types
The first arg of `PluginCommand` is a `NextPluginCallback` which now returns `Promise<unknown>` instead of `Promise<void>`, which was incorrect.

We use `unknown` rather than `any` because it forces us to be explicit about the return value of `await next()` if we are to call it.

Added a type `DriverCommandToPluginCommand` which essentially converts a `DriverCommand` to a `PluginCommand`.  It's probably best used as a type guard or decorator, but it can "fill in the blanks" when overloading commands in a plugin.

Also normalized some of the `TArgs`/`TReturn` stuff.
2023-03-27 14:23:25 -07:00
Christopher Hiller d303527c3d fix(base-driver): misc type fixes
- `PostProcessOptions` moved into `@appium/types`
- `shutdownUnexpectedly` cannot be marked `@protected` as anything used this way is inaccessible in mixins
- suppress a `@typescript-eslint` warning. this probably needs to happen in a few other files
2023-03-23 12:15:51 -07:00
Christopher Hiller 51a8f2fc34 fix(base-driver): fix timeout mixin to use proper context types 2023-03-23 12:15:51 -07:00
Christopher Hiller c56dc98d13 chore(base-driver): fix description of mixin function to refer to BaseDriver 2023-03-23 12:15:51 -07:00
Christopher Hiller 309fe4c964 chore: lint everything 2023-03-22 16:25:22 -07:00
Christopher Hiller 34891f5657 fix(base-driver,types): fix websocket-related types on AppiumServer 2023-03-22 16:25:22 -07:00
Mykola Mokhnach d3e91222c8 chore(base-driver): Check if a valid Error instance is thrown (#18369) 2023-03-22 07:20:32 +01:00
Mykola Mokhnach d4654138ee chore(base-driver): Update HTTP caching logic and align it with the standard (#18348) 2023-03-16 07:30:11 +01:00
Christopher Hiller 58b4790b1d chore: lint all the typescript 2023-03-06 15:21:58 -08:00
Christopher Hiller be86627595 fix(base-driver): use new mixin strategy
also fix a broken type in fake-driver
2023-03-02 15:47:24 -08:00
Christopher Hiller 1b70551055 fix(base-driver): remove needless static prop breaking the build 2023-03-02 15:01:13 -08:00
Christopher Hiller 45b026de67 chore(base-plugin): better type handling in executeMethod 2023-03-02 15:01:13 -08:00
Christopher Hiller 0f196bad4a chore(types,base-driver): move/remove generics and constraints in Driver
These types were "wrong" in that it is exceedingly difficult to successfully implement `getLog()`, `getLogTypes()`, `supportLogTypes`, etc., in a third-party driver because you'd need to implement _all of it_ or _none of it_.  It's especially bad because it does this without prescribing where the logs should be stored (which is by design).  Oops.

This also moves some generics in the "find" mixins.  This may change again later, but it's unclear that any given driver must declare what a "context" is, and that there can only be one per driver.
2023-02-27 14:15:11 -08:00