Commit Graph

9741 Commits

Author SHA1 Message Date
Christopher Hiller 58b4790b1d chore: lint all the typescript 2023-03-06 15:21:58 -08:00
Christopher Hiller 63eddb670f docs(eslint-config-appium): update some stuff in README.md 2023-03-06 15:21:58 -08:00
Christopher Hiller b7d86c0d04 chore(eslint-config-appium): fix broken keywords 2023-03-06 15:21:58 -08:00
Christopher Hiller dfe02ca98c feat(eslint-config-appium-ts): create new pkg @appium/eslint-config-appium-ts
This adds a new package which consumers having TS sources can use.  This does not affect current users of `@appium/eslint-config-appium`.

Due to the nature of TS, it can be a little more bold with fixes (e.g., changing let to const). I changed the following rules from the recommended settings:

no-empty-function: Reduced to a warning. It's likely we want the functions, but perhaps they should not be empty.
no-empty-interface: Disabled; we use these to merge mixin interfaces with driver classes.
no-explicit-any: Disabled; while transitioning from an untyped codebase to a typed one, we still need to use any in places. Eventually these should all be replaced.
no-non-null-assertion: Disabled; This allows us to continue use of the ! operator, which is handy when working with untyped or loosely-typed code (especially in tests).
no-var-requires: Reduced to a warning. Occasionally we may need to use require() instead of import.
Since the configuration extends our shared config, the following rules have been disabled:

import/no-unresolved: The eslint-plugin-import module cannot resolve TS modules.
no-unused-vars: This rule conflicts with typescript-eslint's rule, so it must be disabled per the documentation.
promise/no-native: In our TS-based packages, I haven't needed Bluebird, so it doesn't make sense to require it.
require-await: TS is much more aware of the return values of functions; this is not needed to avoid ambiguity (in TS code).
2023-03-06 15:21:58 -08:00
renovate[bot] 10e6815a39 chore(docutils): update dependency mkdocs-material to v9.1.1 2023-03-06 14:01:53 -08:00
Christopher Hiller cd76622aa9 fix(typedoc-plugin-appium): replace void responses with 'null'
The main thrust of this was to resolve #18269.

Implementation-wise, we have to modify an `IntrinsicType` of which both `void` and `undefined` become.  To make it `null`, we must create a new `LiteralType` (`null` is not an "intrinsic" type; I don't know why).  I would think that TypeDoc wouldn't go around creating new `LiteralType`s every time it sees `null`, but I don't see it doing anything else. Anyway, if there is a "type cache" somewhere, I'm not sure how to get at it.

Additionally, the new reflections created for parameters and the call signature were not being "registered" properly with TypeDoc.  So this adds a `static create` to both `CommandData` and `ExecMethodData` which wraps the constructor for each, respectively, then performs the registration.  This keeps a `Context` object _out_ of `CommandData`/`ExecMethodData` instances (it would only be used once at time of instantiation anyway).

Un-memoized a couple methods in `BaseCommandData` since not necessary
2023-03-06 13:18:23 -08:00
Christopher Hiller 296cb2436c chore: add auto-labeler workflow
This will automatically label PRs. We can update it to further automatically label issues at a later time, if necessary.

I have added labels for each package.
2023-03-06 13:12:32 -08:00
renovate[bot] 01bff49297 fix(images-plugin): update dependency lru-cache to v7.18.3 2023-03-06 13:34:00 +00:00
renovate[bot] 48c331157f fix(images-plugin): update dependency lru-cache to v7.18.2 2023-03-05 12:47:18 +00:00
Kazuaki Matsuo 9f8daf385b docs(appium): update migration guide in Japanese (#18297)
* docs(appium): update migration gude in js

* Update migrating-1-to-2.md
2023-03-05 17:00:32 +09:00
renovate[bot] 7bae977ca9 chore(deps): update dependency @types/node to v18.14.6 2023-03-04 12:04:54 +00:00
renovate[bot] 4ed745a95f fix(docutils): update dependency lilconfig to v2.1.0 2023-03-04 06:38:14 +00:00
renovate[bot] 85e4bd8925 fix(support): update dependency pngjs to v7 2023-03-03 11:38:15 -08:00
Christopher Hiller cce27fcf88 chore(docutils): review updates
- Use `util.pluralize()` from `@appium/support` instead of `pluralize` directly
- Write some more docstrings
2023-03-03 11:36:00 -08:00
Christopher Hiller b30b2cfb84 feat(docutils): better path validation
This adds up-front checking of user-provided custom paths to avoid doing a bunch of work and then failing later ("fail fast")
2023-03-03 11:36:00 -08:00
Christopher Hiller 9ccbab5dc0 fix(appium,support): fs.readPackageJsonFrom() returns proper type
This function always returns a `NormalizedPackageJson`, so let's be explicit about that.
2023-03-03 11:36:00 -08:00
Christopher Hiller 760bb5b8f3 chore(appium): skip auto-install of extensions if monorepo detected 2023-03-03 10:51:52 -08:00
renovate[bot] cb14faae33 chore(deps): update dependency @types/node to v18.14.5 2023-03-03 12:08:20 +00:00
Mykola Mokhnach 2a6a13ac89 fix(support): Improve error description on image load (#18284)
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
2023-03-03 06:06:52 +01:00
Christopher Hiller 4b43af0709 chore: fix dupe in clean script 2023-03-02 15:49:33 -08:00
Christopher Hiller 504415d0cd chore: build must pass on local npm install 2023-03-02 15:49:33 -08:00
Christopher Hiller 75defa7b48 chore: add prepack script
sometimes (when?) the smoke tests can pack the workspaces before they have actually been built, which will of course cause an error. this adds a prepack script to avoid the problem

removes pack-all script, which I added for reasons
2023-03-02 15:49:33 -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 080eb8aa1b chore(opencv): increase timeout for unit test
this can take awhile when exercising many cores
2023-03-02 15:01:13 -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 d262271b26 chore(appium): InnerDriver is actually an ExternalDriver
While `findMatchingDriver()` returns a `MatchedDriver`--which is a wrapper around `DriverClass`--the instance of `DriverClass`' constructor is a `Driver`.  But in the case of `AppiumDriver`, we know `InnerDriver` is actually an `ExternalDriver`; this is why we can assign to `server`, `serverHost`, etc.
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 843b797750 chore(driver-test-support): fix broken types in some e2e tests 2023-03-02 15:01:13 -08:00
Christopher Hiller b4c1403c22 fix(fake-driver): fix a broken type 2023-03-02 15:01:13 -08:00
Christopher Hiller e2aa3d3b32 fix(types): type fixes & improvements
moved method-map/execute-method-map-related stuff into its own file, and made the types more expressive.  changed some default parameters to hopefully avoid errors about conflicting constraints
2023-03-02 15:01:13 -08:00
Christopher Hiller b151e4c9bf chore: add dummy test script 2023-03-02 15:01:13 -08:00
Christopher Hiller 5684c4e286 fix(types): callback to implicitWaitForCondition accepts args 2023-03-02 15:01:13 -08:00
Christopher Hiller 189e39d03c fix(docutils): use material theme 2023-03-02 15:00:50 -08:00
renovate[bot] 694f9c6a63 chore(deps): update dependency @types/node to v18.14.4 2023-03-02 15:00:57 +00:00
Christopher Hiller f80f4cb2bc feat(docutils): allow "%s" as version number in commit msg arg 2023-03-01 16:32:00 -08:00
Mykola Mokhnach 908041c525 chore: Remove obsolete jpeg-js version override (#18278) 2023-03-01 22:43:21 +01:00
Christopher Hiller 18c0b4b230 chore(docutils): remove monkeypatching of typedoc 2023-03-01 13:19:39 -08:00
Mykola Mokhnach 4e2423d0f0 docs: Update install driver from github command 2023-03-01 20:36:02 +01:00
renovate[bot] ed1d3aae61 fix(images-plugin): update dependency lru-cache to v7.18.1 2023-03-01 17:36:54 +00:00
renovate[bot] d1d5ecef87 fix(images-plugin): update dependency lru-cache to v7.17.2 2023-03-01 12:30:17 +00:00
Kazuaki Matsuo b88f6e3e86 docs: update Copyright in LCIENSE
from JS foundation to openjs foundation
2023-02-28 13:30:25 -08:00
renovate[bot] 471a4b57e6 fix(types): update dependency type-fest to v3.6.1 2023-02-28 05:28:06 +00:00
Christopher Hiller feebf72eb4 chore(fake-driver): avoid public class field assignment
This changes the `fake-driver` implementation to use declaration merging instead of other alternatives to mixins.

History:

The original code simply assigned the mixin methods to `FakeDriver.prototype` after the `class` definition. In TS, this doesn't fly; you need to be explicit about what class members exist.

To get around this, we've tried multiple different approaches:

1. Use a "mixin pattern" as explained in the official TypeScript documentation, which involves _class factories_.  This is tedious and difficult to reason about; each mixin must be passed to the next in-line, and we must be explicit about the base class and which _previous_ mixins any given mixin expects.
2. Use public class fields (a recent addition to JS).  Basically, these do not work the way you want them to; if a subclass overrides a public field, a method in the superclass which refers to this public field _will use the field as defined in the superclass_--not the subclass. This is different than how methods and accessors work.  This inhibits use of inheritance.
3. Add a method _for each method in each mixin_ to the base class, which simply calls `Function.prototype.apply` on the mixin with the context as the base class' `this`.  This is too verbose.

There may be a better way to do this, but where we've landed is using _declaration merging_ in TypeScript.  It allows us to add (but not remove, and I'm not sure about "modify") properties to the "FakeDriver interface", which seems to be the implicit TS interface created by the `class` keyword.  Since the declaration merging syntax is not expressible in JavaScript, this requires a `.ts` file.  To avoid creating _n_ extra files, it was easier to just make the mixins `.ts` files (you may note that we can mix-and-match JS and TS in our projects at will).

The implementation of each mixin uses `Object.assign()` to put new methods on the prototype, which are previously defined in the merged declaration above.  Finally, a `satisfies` clause (which is a transient type-check; it does not change any types but it _will_ generate a compiler error) ensures the props being added to the prototype match what we've defined.

You'll also note that each method has a `this` parameter, which is not a "real" parameter--it's just an annotation for TS which tells the method what the  context is.  If we hate that, an alternative is to use `FakeDriver.prototype.method = <method>` instead of the `Object.assign` call.  This feels marginally more tedious, but I could go either way.
2023-02-27 14:15:11 -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
renovate[bot] 431092dc87 fix(docutils): update dependency typedoc to v0.23.26 2023-02-27 20:25:05 +00:00
renovate[bot] 935c70683f chore(docutils): update dependency mkdocs-material to v9.0.15 2023-02-27 15:06:51 +00:00
renovate[bot] f8099dafa7 chore(deps): update dependency @types/node to v18.14.2 2023-02-27 10:31:03 +00:00
Kazuaki Matsuo 25c9728f07 docs: update readme (#18251)
* docs: update readme

* Update README.md
2023-02-26 17:24:49 -08:00
renovate[bot] ba6b312244 chore(deps): update dependency eslint to v8.35.0 2023-02-26 13:02:12 +00:00
renovate[bot] 188ed161e4 fix(support): update dependency jimp to v0.22.7 2023-02-25 09:50:30 +00:00