Commit Graph

9506 Commits

Author SHA1 Message Date
Renovate Bot cf7a133cc6 chore(): update dependency lint-staged to v12.4.2 2022-05-25 11:57:29 +00:00
Renovate Bot 75da9aa6a2 chore(doctor): update dependency appium-adb to v9.6.0 2022-05-22 12:48:01 +00:00
Renovate Bot 92b17d6c2e chore(gulp-plugins): update babel monorepo to v7.18.0 2022-05-20 14:59:10 -07:00
Christopher Hiller b1b363f09f test(appium): increase e2e test timeout 2022-05-20 14:08:52 -07:00
Christopher Hiller e0f14b5931 chore(appium,base-plugin,types): cli args changes for plugins
This changes how plugins handle CLI args:

- The `cliArgs` instance prop of a `Plugin` will never be `undefined`. If there are no args, the prop will be an empty object.
- The `cliArgs` instance prop of a `Plugin` will now contain default values, if any were provided by the `Plugin`'s schema.

This differs from how the same property is handled in drivers.  To that end, I split `AppiumDriver#getCliArgsForExtension()` (previously `assignCliArgsToExtension()`) into two separate methods for clarity.

This change also contains a few associated improvements to tests and types.
2022-05-20 14:08:52 -07:00
Christopher Hiller 55504514a9 chore(fake-plugin): remove now-invalid constructor 2022-05-20 14:08:52 -07:00
Christopher Hiller f4c0b5b9b4 chore(appium,base-plugin,types): plugin name is derived from manifest
This PR changes the shape of plugin classes as well as how CLI args get assigned.

- The `pluginName` static property has been removed.  `name` is now assigned via the `BasePlugin` constructor, and is derived from the plugin name in the manifest.  This means that an implementor only needs to provide a `pluginName` in the manifest, and the data is not duplicated.  The value in this map (the plugin name) is used to instantiate the plugin, instead of passing static `pluginName` property into the constructor.
- CLI args are now passed in through the constructor instead of assigned to the plugin instance after the fact.

Implementation details:

`getActivePlugins()` and `getActiveDrivers()` now return a `Map` of an extension _class_ to an extension name.  The key is _not_ an instance, and is effectively a singleton, so we are not at risk of a memory leak.

This change does not otherwise affect drivers.
2022-05-20 14:08:52 -07:00
neilnaveen 7e2412499a chore: Set permissions for GitHub actions
Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much.

- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

[Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)

Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com>
2022-05-18 11:58:51 -07:00
Renovate Bot c0f71ef3ff chore(doctor): update dependency appium-adb to v9.5.0 2022-05-18 13:44:07 +00:00
Renovate Bot 45285429d6 chore(gulp-plugins): update babel monorepo to v7.17.12 2022-05-17 21:31:08 +00:00
Renovate Bot db2a4fe60b chore(): update dependency @types/node to v16.11.36 2022-05-17 11:21:50 +00:00
Renovate Bot 48b465f0fe chore(gulp-plugins): update dependency del to v6.1.0 2022-05-16 11:54:26 -07:00
Renovate Bot 11975dafd9 chore(appium): update dependency yaml to v2.1.0 2022-05-16 11:54:08 -07:00
Renovate Bot cffaa2dcc9 chore(images-plugin): update dependency lru-cache to v7.10.1 2022-05-16 11:53:54 -07:00
Renovate Bot 8c956e9f09 chore(gulp-plugins): update dependency yargs to v17.5.1 2022-05-16 11:53:37 -07:00
Renovate Bot 5a149d35fc chore(support): update dependency glob to v8.0.3 2022-05-16 11:53:12 -07:00
Renovate Bot b359f29df5 chore(): update dependency @types/node to v16.11.35 2022-05-13 13:02:20 +00:00
Christopher Hiller 5f28ce81df chore(appium): renamed postinstall.js to autoinstall-extensions.js
...just so we're clear about what it does.  Added some more explanation
in docstrings.
2022-05-12 14:47:51 -07:00
Christopher Hiller 936427f1d1 test(appium): bump exec time of cli e2e tests to avoid flake 2022-05-12 14:47:51 -07:00
Christopher Hiller 3e2c05d8a2 fix(appium): fix extension autoinstall postinstall script
Resolves #16924

Because the `postinstall` script of `appium` needs functions in `@appium/support`, that module must be compiled _before_ its `postinstall` script runs.  Prior to this PR, only the monorepo root would run a `postinstall` script to build the subpackages.  Now, each package has a `prepare` script which runs its own build; this happens prior to any `postinstall`.  This way, the `postinstall` script in `appium` can run successfully.
2022-05-12 14:47:51 -07:00
Christopher Hiller 9f551e274f chore(gulp-plugins): remove unneeded dependencies
These two deps are devDependencies of the monorepo root.  Since we do not use TS in any "production" capacity, typings should not be production dependencies anyway.
2022-05-12 14:07:18 -07:00
Christopher Hiller 147d1d1d34 test(images-plugin): avoid call to deprecated reset() method 2022-05-12 14:07:07 -07:00
Christopher Hiller 2289b45272 fix(types,base-plugin): fix static prop types for plugins
This change modifies the type of `BasePlugin.newMethodMap`, adds a
parameter to the `MethodMap` type, and updates the base plugin TS
config for better incremental builds.
2022-05-12 14:06:55 -07:00
Christopher Hiller 59b885aa66 chore(base-driver): guard against null sessions if proxy used weirdly 2022-05-12 12:32:57 -07:00
Christopher Hiller d5ca3007b3 chore(types): restore example comment for newMethodMap in PluginStatic 2022-05-12 12:32:57 -07:00
Christopher Hiller 0676cd27c3 chore(appium,support,opencv,docutils): assorted type fixes
- 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
2022-05-12 12:32:57 -07:00
Christopher Hiller e5b21b5674 chore(base-driver): enable type checks
and a bunch of associated fixes

# Conflicts:
#	packages/base-driver/lib/basedriver/core.js
#	packages/base-driver/lib/basedriver/desired-caps.js
#	packages/base-driver/lib/basedriver/helpers.js
#	packages/base-driver/lib/express/server.js
2022-05-12 12:32:57 -07:00
Christopher Hiller 5ba245c819 chore(appium,types): move DriverType, PluginType etc. into @appium/types
- Also split out types into more files, since they were getting hefty
- The `Plugin` type conflicts with the [Plugin API](https://developer.mozilla.org/en-US/docs/Web/API/Plugin), which is detailed in TypeScript's DOM library.  This changes makes `@appium/types` _avoid_ this library entirely, and only use the basic JS/Node.js types.

# Conflicts:
#	packages/appium/types/extension.ts
#	packages/types/lib/index.ts
2022-05-12 12:32:57 -07:00
Christopher Hiller 5e96a6d2a7 feat(base-plugin): prepare for use by plugins
This adds the requisite TS setup for base-plugin
2022-05-12 12:32:57 -07:00
Christopher Hiller 48f1d99087 feat(appium): appium now expects extensions to use peer dependencies
The peer dependency value is stored in the `extensions.yaml` manifest for each extension as `appiumVersion` (if present).

If the peer dependency is _not_ present, the user will be warned, but Appium will still try to load the extension (I have a feeling that most of the time, this will be fine).  When warned, the user will receive information about available extension upgrades, if any.

This required some refactors in the `lib/extension/` dir.  Extension validation was previously a synchronous process, but because we now (potentially) display information to the user about upgrades (which is async), validation must also be async.  This means that the `ExtensionConfig` constructor (and the constructors of its subclasses) cannot run validation.  Validation must happen after the config object is instantiated, which is handled in `loadExtensions()` of `lib/extension/index.js`.  The constructor signatures have changed accordingly.

While extensions now soft-require a `peerDependencies.appium` field, in the monorepo, the value of this dependency is `file:../appium`.  This is treated as a special case, and acts as if the dependency is just the current version of `appium` (as in its `package.json`).  This is handled in `Manifest#addExtension()`.

To further support this, `appium` now exports `@appium/base-driver` as `driver`, `@appium/base-plugin` as `plugin`, and `@appium/support` as `support`.  `tsconfig.json` files have changed in these affected packages.

In addition, a new reusable TS config file has been added for use with basic plugins.

# Conflicts:
#	.eslintrc
#	packages/appium/lib/extension/extension-config.js
#	packages/appium/lib/extension/index.js
#	packages/appium/lib/extension/manifest.js
#	packages/appium/test/unit/extension/manifest.spec.js
#	packages/appium/test/unit/extension/mocks.js
2022-05-12 12:32:57 -07:00
Renovate Bot 5835a8ab7e chore(appium): update dependency @sidvind/better-ajv-errors to v2 2022-05-10 17:56:16 -07:00
Renovate Bot a1dff640b1 chore(test-support): update dependency sinon to v14 2022-05-10 17:55:55 -07:00
Christopher Hiller 133db5355f chore: reformat everything
this reformats all `.js`, `.ts`, and `.d.ts` files.
2022-05-09 19:09:50 -07:00
renovate[bot] 68feafb5d3 chore(doctor): update dependency appium-adb to v9.2.3 (#16917)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-05-09 01:32:07 +09:00
renovate[bot] 3d2db4538e chore(images-plugin): update dependency lru-cache to v7.9.0 (#16780)
* chore(images-plugin): update dependency lru-cache to v7.9.0

* Update cache properties

* Only set max size

* Set max cache size

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Mykola Mokhnach <mokhnach@gmail.com>
2022-05-07 15:39:15 +02:00
Renovate Bot b0d5d3e4e7 chore(support): update dependency bplist-parser to v0.3.2 2022-05-05 15:20:14 -07:00
Christopher Hiller 4198253cf9 chore(appium): simplify types
`import` in jsdoc types previously using relative paths to reference the `types` folder can now be referenced via `appium/types`; e.g., `import('../types').Foo`, `import('./types').Foo`, `import('../../../types/bar').Foo` are now just `import('appium/types').Foo`

Also add some missing descriptions
2022-05-04 18:11:42 -07:00
Renovate Bot 7797a4f685 chore(support): update dependency bplist-creator to v0.1.1 2022-05-04 13:58:26 +00:00
Renovate Bot 8f926e9bc0 chore(execute-driver-plugin): update dependency webdriverio to v7.19.7 2022-05-04 11:52:40 +00:00
Christopher Hiller 5928026f9c Publish
- @appium/eslint-config-appium@6.0.0
 - @appium/gulp-plugins@7.0.0
@appium/eslint-config-appium@6.0.0 @appium/gulp-plugins@7.0.0
2022-05-03 15:02:23 -07:00
Christopher Hiller 878bb6a44f feat(eslint-config-appium,gulp-plugins): add prettier
BREAKING CHANGE:

`@appium/eslint-config-appium` now requires peer dependency `eslint-config-prettier`.  Because `@appium/gulp-plugins` always uses the latest development version of `@appium/eslint-config-appium`, the dependency needs to be added there, too.

In addition, this disables some rules, so _may_ cause code which previously passed lint checks _not_ to pass lint checks.
2022-05-03 14:57:14 -07:00
Jonathan Lipps 59dd30ba20 Publish
- appium@2.0.0-beta.35
 - @appium/doctor@1.16.19
 - @appium/eslint-config-appium@5.1.1
 - @appium/gulp-plugins@6.0.10
@appium/doctor@1.16.19 @appium/eslint-config-appium@5.1.1 @appium/gulp-plugins@6.0.10 appium@2.0.0-beta.35
2022-05-03 13:42:56 -07:00
Christopher Hiller 6480679bfb chore(appium): lint again 2022-05-03 13:34:10 -07:00
Christopher Hiller c2753107c6 test(appium): e2e helpers now log executed child process commands 2022-05-03 13:12:31 -07:00
Christopher Hiller a794ade7b0 chore(appium): lint 2022-05-03 13:09:17 -07:00
Christopher Hiller 5e24fbac5c chore(ci): add Node v18 to matrix; remove Node v17 2022-05-03 12:50:20 -07:00
Renovate Bot 8caf18f542 chore(gulp-plugins): update dependency mocha to v10 2022-05-03 12:21:06 -07:00
Christopher Hiller 93e05a8269 fix(eslint-config-appium): revert prettier-related change
This reverts commits b34b75a80e,  88a6655253 and d89203f96c which, as a whole, was breaking.

This will fix the publish of v5.1.0, which should have been a major release.

After v5.1.1 has been released, this PR should be reverted in prep for v6.
2022-05-03 12:19:13 -07:00
Christopher Hiller 5cc22325f2 chore(appium): refactor some variable/parameter names for clarity
renamed parameters named `ext` to `installSpec`, since these correspond to the values of `installSpec` in the manifest
2022-05-03 12:13:44 -07:00
Christopher Hiller a2b07f6150 test(appium): replace all occurrences of 'driver'/'plugin' literals w/ constants 2022-05-03 12:04:15 -07:00