Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f40598161c | ||
|
|
0ddedec0c4 | ||
|
|
def3474b05 | ||
|
|
1b9c1e96a3 | ||
|
|
e60e840316 | ||
|
|
6505d7921a | ||
|
|
def655cb39 | ||
|
|
1828501c66 | ||
|
|
6a08c95fc9 | ||
|
|
a156bc5bf5 | ||
|
|
dbc3b668a0 | ||
|
|
69bbb5370e | ||
|
|
ea00626091 | ||
|
|
1e86537e94 | ||
|
|
93c271ec5d | ||
|
|
0363aab8ba | ||
|
|
dd421b397b | ||
|
|
8ee7d07af4 | ||
|
|
1c19a8dbba | ||
|
|
1ed646cc8f | ||
|
|
d4ce2a82d9 | ||
|
|
40def9dbdb | ||
|
|
b3f8a47c2d | ||
|
|
5b043cc1ab | ||
|
|
3fbc4f1fe0 | ||
|
|
7492c3357e | ||
|
|
7fd9d5f626 | ||
|
|
5f25351c9d | ||
|
|
339acd345f | ||
|
|
21316e94d0 | ||
|
|
43fcc17b31 | ||
|
|
b1a4045bbd | ||
|
|
d2a8edbb7a | ||
|
|
6d67177e2f | ||
|
|
db62358dba | ||
|
|
4fd6893146 | ||
|
|
8915934270 | ||
|
|
ae7f74a014 | ||
|
|
ea9cf8d910 | ||
|
|
70449cd077 | ||
|
|
65c47acf59 | ||
|
|
96a7a3f23b | ||
|
|
c8f997973c | ||
|
|
bea47aacca | ||
|
|
10e5b37211 | ||
|
|
459f0a34b2 | ||
|
|
4c15dc6e5d | ||
|
|
848eb00afb | ||
|
|
de8b1c97dc | ||
|
|
092ebb2a69 | ||
|
|
dddc4aa8c0 | ||
|
|
425d3eac1d | ||
|
|
57b0406a33 | ||
|
|
e3e1757c56 | ||
|
|
17e271afff | ||
|
|
7718cd01d1 | ||
|
|
a4138c6ec9 | ||
|
|
24a039b432 | ||
|
|
5ca62f8bfa | ||
|
|
d5369f8b08 | ||
|
|
33be2ee45d | ||
|
|
e3dcd66714 | ||
|
|
e80b6826ef | ||
|
|
275790ec01 | ||
|
|
82406f1775 | ||
|
|
a015f835dd | ||
|
|
27ff9a00ef | ||
|
|
a876f112b5 | ||
|
|
56f72c0af7 | ||
|
|
8c97ac5800 | ||
|
|
70650921d8 | ||
|
|
465495ef2a | ||
|
|
440708c876 | ||
|
|
c805155863 | ||
|
|
95be7dd477 | ||
|
|
2b2fb185a6 | ||
|
|
f21e09fe72 | ||
|
|
11510cb1a5 | ||
|
|
f764c38c29 | ||
|
|
5e51f6c5f2 | ||
|
|
4b20eca627 | ||
|
|
b34ce3cff0 | ||
|
|
6f602d3e50 | ||
|
|
2ad91655c2 | ||
|
|
1b4f36cebe | ||
|
|
a8d36b0a98 | ||
|
|
0598a81d09 | ||
|
|
e972d668fe | ||
|
|
3b43be1732 | ||
|
|
deb9548369 | ||
|
|
2cbf3af759 | ||
|
|
233dbd22ff | ||
|
|
807183925c | ||
|
|
38a506bbcd | ||
|
|
5e67a15299 | ||
|
|
a722f48f14 | ||
|
|
db9fd98e7d | ||
|
|
22f40f094e | ||
|
|
3dd72b2d0c | ||
|
|
2acf262482 | ||
|
|
e961a9b9c5 | ||
|
|
b5fd5b6d2c | ||
|
|
fd63e9bdbd | ||
|
|
eb6e0f82b3 | ||
|
|
f6f51c4b9e | ||
|
|
690bebe4bc | ||
|
|
0492fe49dc | ||
|
|
8526cc0333 | ||
|
|
1bde482ac8 | ||
|
|
4d634642c8 | ||
|
|
06fc841c6a | ||
|
|
a52ac2139e | ||
|
|
3d438eb6a8 | ||
|
|
21ba471eb7 | ||
|
|
395dc225e4 | ||
|
|
448e94ee50 | ||
|
|
f8d1fb7df7 | ||
|
|
fe16faaacb | ||
|
|
0211174300 | ||
|
|
bfa8cbf7ea | ||
|
|
36f9cd54ba | ||
|
|
4e8c91c8f6 | ||
|
|
05aedb20eb | ||
|
|
f645b50d9d | ||
|
|
799b743d72 | ||
|
|
3423fd9206 | ||
|
|
cf3910fdab | ||
|
|
6344d14665 | ||
|
|
2c2141c8c3 | ||
|
|
9d8d43c89a | ||
|
|
9ad20ff1c2 | ||
|
|
de7e10187c | ||
|
|
77d2ef74bb | ||
|
|
2350c4cd2a | ||
|
|
77a27ab16c | ||
|
|
8cf3efdbed | ||
|
|
80542b1046 | ||
|
|
270fd42a20 | ||
|
|
2205d1d41e | ||
|
|
6738e3d9ee | ||
|
|
732cc586c2 | ||
|
|
407706cf5e | ||
|
|
72f32848b6 | ||
|
|
572037a0e2 | ||
|
|
d7cf013401 | ||
|
|
eb5ec8940a | ||
|
|
9f655f6f85 | ||
|
|
38ef95fe09 | ||
|
|
4d48010a30 | ||
|
|
b4b20e05fd | ||
|
|
5be7f5d319 | ||
|
|
d44e66977c | ||
|
|
1f368828e6 | ||
|
|
b8368bb666 | ||
|
|
d55f13b2ed | ||
|
|
5899c2db93 | ||
|
|
1be08eca81 | ||
|
|
d5af68ecdd | ||
|
|
59ef09d955 | ||
|
|
ee8425a001 | ||
|
|
3936cb43dc | ||
|
|
f88bd3cb88 | ||
|
|
665219b7e0 | ||
|
|
b8f2dd8508 | ||
|
|
b139a2d313 | ||
|
|
26ab0ef759 | ||
|
|
85d06086dd | ||
|
|
a6d49c1ac8 | ||
|
|
dde504d501 | ||
|
|
9a0c059c3a | ||
|
|
c928a75f4a | ||
|
|
b4369473ee | ||
|
|
66626d26e5 | ||
|
|
7cb1621e80 | ||
|
|
03f8dc9b18 | ||
|
|
63d7550d02 | ||
|
|
a74132cc96 | ||
|
|
5f9aa955f1 | ||
|
|
de057fa8b0 | ||
|
|
cf792279b1 | ||
|
|
2687fa47a0 | ||
|
|
984e54a7ae | ||
|
|
cf17ec7a80 | ||
|
|
17e0dc03f4 | ||
|
|
caa4e586b1 | ||
|
|
7fc7446612 | ||
|
|
111b05c922 | ||
|
|
bd6ab81c94 | ||
|
|
3ce4f96e0b | ||
|
|
471e95504c | ||
|
|
47765747b6 | ||
|
|
2448fa0145 | ||
|
|
e7df8823e8 | ||
|
|
b126df6234 | ||
|
|
0e6c3eede2 | ||
|
|
3da17b6ecd | ||
|
|
636d6b3802 | ||
|
|
97c8ab5384 | ||
|
|
79378e4c20 | ||
|
|
df07665509 | ||
|
|
68456b8aea | ||
|
|
8529e360be | ||
|
|
91bb539420 | ||
|
|
3f6c61a084 | ||
|
|
82b024c77e | ||
|
|
7f7939dc62 | ||
|
|
8eb4e888f6 | ||
|
|
7516d4135a | ||
|
|
c4ef218006 | ||
|
|
917084ccca | ||
|
|
c905be032f | ||
|
|
e1ccdd2d48 | ||
|
|
dcf58168d6 | ||
|
|
7bee9ccc89 | ||
|
|
e4ae2772ac | ||
|
|
ef673786f4 | ||
|
|
98017937f7 | ||
|
|
26ded7a4cc | ||
|
|
d1705e2818 | ||
|
|
32677efe87 | ||
|
|
1fd29c7012 | ||
|
|
0d5a0a5727 | ||
|
|
f59e84e24c | ||
|
|
39cb9069a6 | ||
|
|
e808f14bf6 | ||
|
|
f837a6a9ea | ||
|
|
1c6b3216ab | ||
|
|
d49289b0ae | ||
|
|
7a23f11aab | ||
|
|
f4055bced2 | ||
|
|
ed8a91e721 | ||
|
|
f890d15de9 | ||
|
|
e04e4e902a | ||
|
|
b25e0fd576 | ||
|
|
6c034aa84a | ||
|
|
e21785a5e4 | ||
|
|
bd7b42007d | ||
|
|
28f0926bf8 | ||
|
|
d722ecc292 | ||
|
|
670a77b021 | ||
|
|
0755246be7 | ||
|
|
41cb869453 | ||
|
|
ea8c74b372 | ||
|
|
50d6181187 | ||
|
|
a059b12cb4 | ||
|
|
d25a0fca9b | ||
|
|
0db8dc7790 | ||
|
|
f92640a824 |
@@ -61,8 +61,8 @@ body:
|
||||
value: |
|
||||
- Operating system:
|
||||
- Appium server version (output of `appium --version`):
|
||||
- Appium driver(s) and their version(s):
|
||||
- Appium plugin(s) and their version(s):
|
||||
- Appium driver(s) and their version(s) (`appium driver list`):
|
||||
- Appium plugin(s) and their version(s) (`appium plugin list`):
|
||||
- Node.js version (output of `node --version`):
|
||||
- `npm` version (output of `npm --version`):
|
||||
- Last component(s) version which did _not_ exhibit the problem:
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: ❓ Question
|
||||
url: https://discuss.appium.io/
|
||||
about: Please use the Appium forum for questions
|
||||
@@ -48,16 +48,6 @@ labels:
|
||||
matcher:
|
||||
files: ['packages/base-driver/**']
|
||||
|
||||
- label: '@appium/eslint-config-appium'
|
||||
sync: true
|
||||
matcher:
|
||||
files: ['packages/eslint-config-appium/**']
|
||||
|
||||
- label: '@appium/eslint-config-appium-ts'
|
||||
sync: true
|
||||
matcher:
|
||||
files: ['packages/eslint-config-appium-ts/**']
|
||||
|
||||
- label: '@appium/base-plugin'
|
||||
sync: true
|
||||
matcher:
|
||||
@@ -78,6 +68,16 @@ labels:
|
||||
matcher:
|
||||
files: ['packages/driver-test-support/**']
|
||||
|
||||
- label: '@appium/eslint-config-appium'
|
||||
sync: true
|
||||
matcher:
|
||||
files: ['packages/eslint-config-appium/**']
|
||||
|
||||
- label: '@appium/eslint-config-appium-ts'
|
||||
sync: true
|
||||
matcher:
|
||||
files: ['packages/eslint-config-appium-ts/**']
|
||||
|
||||
- label: '@appium/execute-driver-plugin'
|
||||
sync: true
|
||||
matcher:
|
||||
@@ -98,6 +98,11 @@ labels:
|
||||
matcher:
|
||||
files: ['packages/images-plugin/**']
|
||||
|
||||
- label: '@appium/logger'
|
||||
sync: true
|
||||
matcher:
|
||||
files: ['packages/logger/**']
|
||||
|
||||
- label: '@appium/opencv'
|
||||
sync: true
|
||||
matcher:
|
||||
@@ -123,6 +128,11 @@ labels:
|
||||
matcher:
|
||||
files: ['packages/support/**']
|
||||
|
||||
- label: '@appium/strongbox'
|
||||
sync: true
|
||||
matcher:
|
||||
files: ['packages/strongbox/**']
|
||||
|
||||
- label: '@appium/test-support'
|
||||
sync: true
|
||||
matcher:
|
||||
@@ -142,8 +152,3 @@ labels:
|
||||
sync: true
|
||||
matcher:
|
||||
files: ['packages/universal-xml-plugin/**']
|
||||
|
||||
- label: '@appium/strongbox'
|
||||
sync: true
|
||||
matcher:
|
||||
files: ['packages/strongbox/**']
|
||||
|
||||
@@ -53,11 +53,11 @@ jobs:
|
||||
prepare_matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
versions: ${{ steps.generate-matrix.outputs.versions }}
|
||||
versions: ${{ steps.generate-matrix.outputs.active }}
|
||||
steps:
|
||||
- name: Select 2 most recent LTS versions of Node.js
|
||||
- name: Select all active LTS versions of Node.js
|
||||
id: generate-matrix
|
||||
run: echo "versions=$(curl -s https://endoflife.date/api/nodejs.json | jq -c '[[.[] | select(.lts != false)][:2] | .[].cycle | tonumber]')" >> "$GITHUB_OUTPUT"
|
||||
uses: msimerson/node-lts-versions@v1
|
||||
|
||||
test:
|
||||
needs:
|
||||
|
||||
@@ -12,11 +12,11 @@ jobs:
|
||||
prepare_matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
versions: ${{ steps.generate-matrix.outputs.versions }}
|
||||
versions: ${{ steps.generate-matrix.outputs.active }}
|
||||
steps:
|
||||
- name: Select 2 most recent LTS versions of Node.js
|
||||
- name: Select all active LTS versions of Node.js
|
||||
id: generate-matrix
|
||||
run: echo "versions=$(curl -s https://endoflife.date/api/nodejs.json | jq -c '[[.[] | select(.lts != false)][:2] | .[].cycle | tonumber]')" >> "$GITHUB_OUTPUT"
|
||||
uses: msimerson/node-lts-versions@v1
|
||||
|
||||
check:
|
||||
needs:
|
||||
|
||||
@@ -37,6 +37,9 @@ certificate.key
|
||||
*.pdb
|
||||
.vs
|
||||
|
||||
#vscode
|
||||
.history
|
||||
|
||||
old
|
||||
.tern-project
|
||||
coverage
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = (wallaby) => {
|
||||
return {
|
||||
compilers: {
|
||||
'**/*.js': wallaby.compilers.typeScript({
|
||||
allowJs: true,
|
||||
allowSyntheticDefaultImports: true,
|
||||
resolveJsonModule: true,
|
||||
isolatedModules: true,
|
||||
}),
|
||||
'**/*.ts?(x)': wallaby.compilers.typeScript(),
|
||||
},
|
||||
debug: true,
|
||||
env: {
|
||||
type: 'node',
|
||||
},
|
||||
files: [
|
||||
'./packages/*/build/**/*',
|
||||
'./packages/*/lib/**/*.js',
|
||||
'./packages/*/lib/**/*.ts',
|
||||
'./packages/*/test/**/*helper*.js',
|
||||
'./packages/*/test/**/*helper*.ts',
|
||||
'./packages/*/test/**/*mock*.js',
|
||||
'./packages/*/test/**/*mock*.ts',
|
||||
'./packages/*/package.json',
|
||||
'./packages/*/tsconfig*.json',
|
||||
'./packages/*/test/**/fixture?(s)/**/*',
|
||||
{
|
||||
binary: true,
|
||||
pattern: './packages/support/test/unit/assets/sample_binary.plist',
|
||||
},
|
||||
{
|
||||
instrument: false,
|
||||
pattern: './packages/support/test/unit/assets/sample_text.plist',
|
||||
},
|
||||
{
|
||||
instrument: false,
|
||||
pattern: './packages/base-driver/static/**/*',
|
||||
},
|
||||
{
|
||||
instrument: false,
|
||||
pattern: './packages/*/test/**/__snapshots__/**/*',
|
||||
},
|
||||
'!./packages/*/test/**/*-specs.js',
|
||||
'!./packages/*/test/**/*.e2e.spec.js',
|
||||
'!./packages/*/test/**/*.e2e.spec.ts',
|
||||
'!**/local_appium_home/**',
|
||||
],
|
||||
testFramework: 'mocha',
|
||||
tests: [
|
||||
'./packages/*/test/unit/**/*.spec.js',
|
||||
'./packages/*/test/unit/**/*.spec.ts',
|
||||
'!**/local_appium_home/**',
|
||||
],
|
||||
workers: {
|
||||
// restart: true,
|
||||
},
|
||||
setup(wallaby) {
|
||||
// copied out of `./test/setup.js`
|
||||
|
||||
const chai = require('chai');
|
||||
const chaiAsPromised = require('chai-as-promised');
|
||||
const sinonChai = require('sinon-chai');
|
||||
|
||||
// The `chai` global is set if a test needs something special.
|
||||
// Most tests won't need this.
|
||||
global.chai = chai.use(chaiAsPromised).use(sinonChai);
|
||||
|
||||
// `should()` is only necessary when working with some `null` or `undefined` values.
|
||||
global.should = chai.should();
|
||||
|
||||
const mocha = wallaby.testFramework;
|
||||
mocha.timeout(10000);
|
||||
},
|
||||
runMode: 'onsave',
|
||||
};
|
||||
};
|
||||
@@ -4,7 +4,7 @@ Appium contains many different modules and supports a variety of drivers, plugin
|
||||
|
||||
## Main Appium Module
|
||||
|
||||
* ### [Appium 2.0 Changelog](packages/appium/CHANGELOG.md)
|
||||
* ### [Appium 2 Changelog](packages/appium/CHANGELOG.md)
|
||||
* [Appium 1.x Changelog](https://github.com/appium/appium/blob/1.x/CHANGELOG.md)
|
||||
|
||||
## Appium Drivers / Clients / Plugins
|
||||
@@ -23,6 +23,7 @@ Appium contains many different modules and supports a variety of drivers, plugin
|
||||
* [fake-driver](packages/fake-driver/CHANGELOG.md)
|
||||
* [fake-plugin](packages/fake-plugin/CHANGELOG.md)
|
||||
* [images-plugin](packages/images-plugin/CHANGELOG.md)
|
||||
* [logger](packages/logger/CHANGELOG.md)
|
||||
* [opencv](packages/opencv/CHANGELOG.md)
|
||||
* [plugin-test-support](packages/plugin-test-support/CHANGELOG.md)
|
||||
* [relaxed-caps-plugin](packages/relaxed-caps-plugin/CHANGELOG.md)
|
||||
@@ -31,6 +32,5 @@ Appium contains many different modules and supports a variety of drivers, plugin
|
||||
* [support](packages/support/CHANGELOG.md)
|
||||
* [test-support](packages/test-support/CHANGELOG.md)
|
||||
* [tsconfig](packages/tsconfig/CHANGELOG.md)
|
||||
* [typedoc-plugin-appium](packages/typedoc-plugin-appium/CHANGELOG.md)
|
||||
* [types](packages/types/CHANGELOG.md)
|
||||
* [universal-xml-plugin](packages/universal-xml-plugin/CHANGELOG.md)
|
||||
|
||||
@@ -15,12 +15,8 @@ The project is officially led by a Technical Committee (TC), currently
|
||||
consisting of:
|
||||
|
||||
* [@jlipps](https://github.com/jlipps)
|
||||
* [@bootstraponline](https://github.com/bootstraponline)
|
||||
* [@penguinho](https://github.com/penguinho)
|
||||
* [@dandoveralba](https://github.com/dandoveralba)
|
||||
* [@mykola-mokhnach](https://github.com/mykola-mokhnach)
|
||||
* [@imurchie](https://github.com/imurchie)
|
||||
* [@TikhomirovSergey](https://github.com/TikhomirovSergey)
|
||||
* [@eglitise](https://github.com/eglitise)
|
||||
* [@KazuCocoa](https://github.com/KazuCocoa)
|
||||
|
||||
They all represent different companies and different types of contribution to
|
||||
@@ -31,7 +27,7 @@ changes to the project's governance processes.
|
||||
|
||||
* Membership in the TC is granted by unanimous vote of current TC members.
|
||||
* TC members can step down at any time.
|
||||
* No more than 1/3 of TC members may belong to the same company.
|
||||
* No more than 1/3 (or 2, whichever is higher) of TC members may belong to the same company.
|
||||
* Changes to project governance require unanimous vote of the TC.
|
||||
|
||||
### Project Committers
|
||||
@@ -50,55 +46,105 @@ and so on.
|
||||
* Any committer can decide to close a PR or issue if they determine the change doesn't suit the project.
|
||||
* Appium has a large ecosystem of repositories. Some are 'core' in the sense of being central subpackages with a lot of traffic like `appium/appium` or `appium/appium-ios-driver`. Others are 'peripheral' in the sense of receiving few changes, being maintained by 1 person or no one, etc..., like `appium/ruby_lib` or `appium/appium_thor` For 'core' repos, committers should not merge their own code straightaway. Like all contributors they should open a PR and get a +1 from another committer. For 'peripheral' repos for which they are the sole maintainer or for which they have a good understanding, it is obtuse to insist on another contributor's +1 and this rule should be relaxed in that case. In sum: use good judgment and don't ram code through without a review when you can help it.
|
||||
|
||||
The current committers are (in addition to the TC members above):
|
||||
The current committers are (along with their primary areas(s) of ownership or maintenance):
|
||||
|
||||
* [@hugs](https://github.com/hugs)
|
||||
* [@filmaj](https://github.com/filmaj)
|
||||
* [@aluedeke](https://github.com/aluedeke)
|
||||
* [@sebv](https://github.com/sebv)
|
||||
* [@vgrigoruk](https://github.com/vgrigoruk)
|
||||
* [@DylanLacey](https://github.com/DylanLacey)
|
||||
* [@maudineormsby](https://github.com/maudineormsby)
|
||||
* [@titusfortner](https://github.com/titusfortner)
|
||||
* [@bayandin](https://github.com/bayandin)
|
||||
* [@jdeff](https://github.com/jdeff)
|
||||
* [@moizjv](https://github.com/moizjv)
|
||||
* [@gempesaw](https://github.com/gempesaw)
|
||||
* [@Jonahss](https://github.com/Jonahss)
|
||||
* [@JamieEdge](https://github.com/JamieEdge)
|
||||
* [@saikrishna321](https://github.com/saikrishna321)
|
||||
* [@sravanmedarapu](https://github.com/sravanmedarapu)
|
||||
* [@peepa](https://github.com/peepa)
|
||||
* [@scottdixon](https://github.com/scottdixon)
|
||||
* [@drpy](https://github.com/drpy)
|
||||
* [@Astro03](https://github.com/Astro03)
|
||||
* [@sbonebrake](https://github.com/sbonebrake)
|
||||
* [@SrinivasanTarget](https://github.com/SrinivasanTarget)
|
||||
* [@triager](https://github.com/triager)
|
||||
* [@ddkjin](https://github.com/ddkjin)
|
||||
* [@stuartbrussell-intuit](https://github.com/stuartbrussell-intuit)
|
||||
* [@vmaxim](https://github.com/vmaxim)
|
||||
* [@Dan-Maor](https://github.com/Dan-Maor)
|
||||
* [@laolubenson](https://github.com/laolubenson)
|
||||
* [@Dor-bl](https://github.com/Dor-bl)
|
||||
* [@boneskull](https://github.com/boneskull)
|
||||
* [@mwakizaka](https://github.com/mwakizaka)
|
||||
* [@rerorero](https://github.com/rerorero)
|
||||
* [@tomriddly](https://github.com/tomriddly)
|
||||
* [@eglitise](https://github.com/eglitise)
|
||||
* [@dan-maor](https://github.com/Dan-Maor) - XCUITest driver and iOS internals
|
||||
* [@dor-bl](https://github.com/Dor-bl) - DotNet client
|
||||
* [@eglitise](https://github.com/eglitise) - Appium server, Inspector
|
||||
* [@jlipps](https://github.com/jlipps) - Appium server, Inspector
|
||||
* [@kazucocoa](https://github.com/KazuCocoa) - all Appium projects
|
||||
* [@laolubenson](https://github.com/laolubenson) - DotNet client
|
||||
* [@mwakizaka](https://github.com/mwakizaka) - XCUITest driver
|
||||
* [@mykola-mokhnach](https://github.com/mykola-mokhnach) - all Appium projects
|
||||
* [@rerorero](https://github.com/rerorero) - XCUITest/UIA2 driver
|
||||
* [@saikrishna321](https://github.com/saikrishna321) - Java client
|
||||
* [@srinivasantarget](https://github.com/SrinivasanTarget) - Java client
|
||||
* [@tomriddly](https://github.com/tomriddly) - appium-ios-device
|
||||
* [@valfirst](https://github.com/valfirst) - Java client
|
||||
|
||||
### Contributors
|
||||
See [Emeritus Contributors](#emeritus-contributors) below for a list of people who formerly made
|
||||
significant contributions to the project but are no longer actively committing.
|
||||
|
||||
### Other Contributors
|
||||
|
||||
Other, less formal, kinds of contribution are outlined in our
|
||||
[CONTRIBUTING](/CONTRIBUTING.md) doc.
|
||||
[CONTRIBUTING](/CONTRIBUTING.md) doc. We also very much appreciate those who spend their valuable
|
||||
time assisting with the [Appium forums](https://discuss.appium.io). Current high-level forum
|
||||
contributors and mods include:
|
||||
|
||||
* [aleksei](https://discuss.appium.io/u/aleksei/summary)
|
||||
* [wreed](https://discuss.appium.io/u/wreed/summary)
|
||||
|
||||
### Sponsorship
|
||||
|
||||
The Appium project welcomes sponsorship of various organizations. Specific
|
||||
details are not yet available but in general we will accept monetary donations,
|
||||
contribution of code, contribution of dedicated committers, or donations of
|
||||
other goods or service (internet hosting, etc...). To begin the conversation,
|
||||
reach out to one of the TC members.
|
||||
The Appium project welcomes the sponsorship of individuals and organizations. There are two types
|
||||
of sponsorship: those related to contributions of Appium maintenance and leadership, and those
|
||||
related to contributions of funds. Both are extremely important to the ongoing health of the
|
||||
project. Financial sponsorship is mediated through our [OpenCollective page](https://opencollective.com/appium).
|
||||
Sponsorship tiers and benefits are described below:
|
||||
|
||||
- **Development Partners**: The primary need of any open source project is for sustained maintenance and contributorship. Companies that officially sponsor such development with dedicated employee time are recognized as Development Partners, and receive the same benefits as the highest tier of financial sponsorship. To be considered a Development Partner, a company must devote at least 50% of a full-time employee's time to Appium maintenance. This means that the contributors designated by the company must have been appointed as "committers" in good standing of one or more core Appium repositories. (See above for a description of how to become a committer).
|
||||
- **Strategic Partners**: Representing the highest tier of ongoing financial support for the project, Strategic Partners are what make our compensation scheme for contributors possible, and we thank them for their significant investment into the project! More than financial contribution, Strategic Partners help elevate Appium's position in the industry through marketing and evangelism efforts, and partner with the Appium team to help make Appium better. Along with the Development Partners, Strategic Partners have their logos displayed prominently on our website, and have the ability to link to their Appium-related products in a few relevant places in our documentation.
|
||||
- **Gold, Silver, and Bronze Sponsors**: these sponsorship levels correspond to different amounts of recurring financial contribution that generously support our contributor compensation scheme. Sponsors at these levels also have the opportunity to display their logo on our website.
|
||||
- **Backers**: individuals who benefit from the Appium project can also donate on a one-time or recurring basis, at any amount, and will be recognized as Backers for their contribution!
|
||||
|
||||
To become a sponsor at one of these levels, follow the process indicated at the [OpenCollective
|
||||
page](https://opencollective.com/appium).
|
||||
|
||||
### Compensation Scheme
|
||||
|
||||
With funds received through sponsorship, the Appium project wants to incentivize contributions of
|
||||
code, documentation efforts, maintenance, and project leadership. We have developed a scheme
|
||||
(inspired by one developed at the [WebdriverIO](https://github.com/webdriverio/webdriverio)
|
||||
project) for disbursing funds on a monthly basis to those who contribute to the project, as well as
|
||||
some other "upstream" open source projects.
|
||||
|
||||
Each month, 15% of sponsorship funds received will be donated to upstream projects, based on the
|
||||
discretion of the current TC. At this point, no attempt will be made to formalize quantitative
|
||||
notions of relevance. If you manage a project upstream of Appium and would like to be considered as
|
||||
part of this donation group, give us a shout!
|
||||
|
||||
Of the remaining 85% of sponsorship funds, 70% (roughly 60% of the original total) will go to
|
||||
project Committers (i.e., those in a role of maintenance), and 30% (roughly 25% of the original
|
||||
total) will go to Contributors (i.e., those making one-off or periodic contributions). The way that
|
||||
Committers and Contributors are paid for their efforts differs.
|
||||
|
||||
For Committers, each Committer will keep a monthly time sheet of hours contributed to the project.
|
||||
At the end of each month, the hours tracked from all Committers will be totalled, and then the
|
||||
Committer-allocated funds will be disbursed (via OpenCollective) on a pro rata basis. Within this
|
||||
scheme, Committers agree not to submit hours worked as part of their employment with a Development
|
||||
Partner (since this is part of the "sponsorship" contribution of the Development Partner).
|
||||
|
||||
For Contributors, when they make contributions which are successfully merged into the project,
|
||||
a Committer can discretionarily assign a "value tier" to the contribution. The "value tiers" and
|
||||
corresponding payouts are as follows:
|
||||
|
||||
- XS: a trivial change (e.g. a typo change or applying of an automatically suggested security
|
||||
patch). \$0.
|
||||
- S: a small but useful change. \$25.
|
||||
- M: a medium-small or slightly more complex change. \$50.
|
||||
- L: a very valuable or sizable change. \$100.
|
||||
- XL: a massive change or set of changes. \$500.
|
||||
|
||||
At the end of each month, Committers will total up the number of changes receiving potential
|
||||
payout. If the total amount of funds allocated for Contributor payout exceeds the total amount to
|
||||
be paid, then each Contributor will receive an OpenCollective link to claim their funds. If not
|
||||
enough funds exist to cover all payouts, then the payout amounts will be scaled down in a pro rata
|
||||
fashion.
|
||||
|
||||
The scope for Committer or Contributor payouts is work completed within any "core" Appium
|
||||
repository (i.e., those officially maintained by the Appium team, residing within the Appium
|
||||
organization on GitHub, under `https://github.com/appium`).
|
||||
|
||||
Some disclaimers: Payments will happen exclusively via OpenCollective. Recipients of funds are
|
||||
responsible for maintaining their OpenCollective account in a fashion where funds can be disbursed,
|
||||
and are responsible for any and all tax, financial, or legal consequences of receiving money in
|
||||
this way. Receipt of funds from this scheme holds the Appium project and the OpenJS Foundation free
|
||||
of any claim or obligation. While this document exists to clearly and publicly lay out the terms
|
||||
under which payments are generally made, the TC retains the right to grant or withhold funding on
|
||||
a discretionary of special basis. Basically, this scheme is run at the project's discretion, and is
|
||||
not a public service. Making contributions to the project under this scheme does not obligate the
|
||||
project to pay you for such work, or otherwise compensate you in any way.
|
||||
|
||||
### Raising Issues Related to Governance
|
||||
|
||||
@@ -106,3 +152,35 @@ This governance model necessarily leaves many situations unspecified. If
|
||||
questions arise as to how a given situation should proceed according to the
|
||||
overall goals of the project, the best thing to do is to open a GitHub issue
|
||||
and ping the TC members.
|
||||
|
||||
### Emeritus Contributors
|
||||
|
||||
* [@aluedeke](https://github.com/aluedeke)
|
||||
* [@astro03](https://github.com/Astro03)
|
||||
* [@bayandin](https://github.com/bayandin)
|
||||
* [@boneskull](https://github.com/boneskull)
|
||||
* [@bootstraponline](https://github.com/bootstraponline)
|
||||
* [@dandoveralba](https://github.com/dandoveralba)
|
||||
* [@ddkjin](https://github.com/ddkjin)
|
||||
* [@drpy](https://github.com/drpy)
|
||||
* [@dylanLacey](https://github.com/DylanLacey)
|
||||
* [@filmaj](https://github.com/filmaj)
|
||||
* [@gempesaw](https://github.com/gempesaw)
|
||||
* [@hugs](https://github.com/hugs)
|
||||
* [@imurchie](https://github.com/imurchie)
|
||||
* [@jamieEdge](https://github.com/JamieEdge)
|
||||
* [@jdeff](https://github.com/jdeff)
|
||||
* [@jonahss](https://github.com/Jonahss)
|
||||
* [@maudineormsby](https://github.com/maudineormsby)
|
||||
* [@moizjv](https://github.com/moizjv)
|
||||
* [@peepa](https://github.com/peepa)
|
||||
* [@penguinho](https://github.com/penguinho)
|
||||
* [@sbonebrake](https://github.com/sbonebrake)
|
||||
* [@scottdixon](https://github.com/scottdixon)
|
||||
* [@sebv](https://github.com/sebv)
|
||||
* [@sravanmedarapu](https://github.com/sravanmedarapu)
|
||||
* [@stuartbrussell-intuit](https://github.com/stuartbrussell-intuit)
|
||||
* [@tikhomirovSergey](https://github.com/TikhomirovSergey)
|
||||
* [@titusfortner](https://github.com/titusfortner)
|
||||
* [@vgrigoruk](https://github.com/vgrigoruk)
|
||||
* [@vmaxim](https://github.com/vmaxim)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="https://appium.io/">
|
||||
<img alt="Appium" src="https://raw.githubusercontent.com/appium/appium/master/packages/appium/docs/assets/images/appium-logo-horiz.png" width="500">
|
||||
<img alt="Appium" src="https://raw.githubusercontent.com/appium/appium/master/packages/appium/docs/overrides/assets/images/appium-logo-horiz.png" width="500">
|
||||
</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
@@ -178,8 +178,46 @@ cross-platform native app automation, for mobile and beyond!
|
||||
If you are looking for a more comprehensive description of what this is all about, please read our
|
||||
documentation on [How Does Appium Work?](https://appium.io/docs/en/latest/intro/appium/).
|
||||
|
||||
## Sponsors
|
||||
|
||||
Appium has a [Sponsorship Program](GOVERNANCE.md#sponsorship)! If you or your company uses Appium
|
||||
and wants to give back financially to the project, we use these funds to [encourage development and
|
||||
contributions](GOVERNANCE.md#compensation-scheme), as well as support other open source projects we
|
||||
rely on. [Become a sponsor](https://opencollective.com/appium) via our OpenCollective page.
|
||||
|
||||
### Development and Strategic Partners
|
||||
|
||||
Appium is incredibly grateful to our Development and Strategic Partners for their sustained
|
||||
contribution of project development and leadership!
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.headspin.io/solutions/appium-mobile-test-automation"><img src="packages/appium/docs/overrides/assets/images/sponsor-logo-headspin.png"
|
||||
width="275" alt="HeadSpin" /></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.browserstack.com/browserstack-appium?utm_campaigncode=701OW00000AoUTQYA3&utm_medium=partnered&utm_source=appium">
|
||||
<picture>
|
||||
<source srcset="packages/appium/docs/overrides/assets/images/sponsor-logo-browserstack-dark.png" media="(prefers-color-scheme: dark)"/>
|
||||
<source srcset="packages/appium/docs/overrides/assets/images/sponsor-logo-browserstack-light.png" media="(prefers-color-scheme: light)"/>
|
||||
<img src="packages/appium/docs/overrides/assets/images/sponsor-logo-browserstack-dark.png" width="300" alt="Browserstack"/>
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://saucelabs.com/resources/blog/appium-strategic-partner"><img src="packages/appium/docs/overrides/assets/images/sponsor-logo-sauce.png"
|
||||
width="300" alt="Sauce Labs" /></a>
|
||||
</p>
|
||||
|
||||
### Other Sponsors
|
||||
|
||||
A full list of sponsors is available at our [Sponsors page](SPONSORS.md).
|
||||
|
||||
## License
|
||||
|
||||
[Apache-2.0](./LICENSE)
|
||||
|
||||
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fappium%2Fappium?ref=badge_large)
|
||||
|
||||
`@appium/logger` package is under [ISC](./packages/logger/LICENSE) License.
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
# Sponsors & Backers
|
||||
|
||||
Appium is an Apache-2 licensed open source project whose development is made possible entirely by
|
||||
donations of time and money by individuals and companies who benefit from our software and our
|
||||
mission. If you'd like to join this amazing group and help ensure Appium's continued development
|
||||
and maintenance, you can contribute via [Appium's OpenCollective
|
||||
Hub](https://opencollective.com/appium).
|
||||
|
||||
## Development Partners
|
||||
|
||||
We are very grateful for the support of our Development Partners, who donate Appium development and
|
||||
maintenance as part of their employees' core job duties!
|
||||
|
||||
<a href="https://www.headspin.io/solutions/appium-mobile-test-automation" target="_blank"><img
|
||||
src="packages/appium/docs/overrides/assets/images/sponsor-logo-headspin.png" width="250"/></a>
|
||||
|
||||
## Strategic Partners
|
||||
|
||||
We are very grateful for the financial and marketing support of our exclusive Strategic Partners,
|
||||
who contribute a significant ongoing investment of funds to help the project attract and reward
|
||||
contributors!
|
||||
|
||||
<a href="https://www.browserstack.com/browserstack-appium?utm_campaigncode=701OW00000AoUTQYA3&utm_medium=partnered&utm_source=appium">
|
||||
<picture>
|
||||
<source srcset="packages/appium/docs/overrides/assets/images/sponsor-logo-browserstack-dark.png" media="(prefers-color-scheme: dark)"/>
|
||||
<source srcset="packages/appium/docs/overrides/assets/images/sponsor-logo-browserstack-light.png" media="(prefers-color-scheme: light)"/>
|
||||
<img src="packages/appium/docs/overrides/assets/images/sponsor-logo-browserstack-dark.png" width="250" alt="Browserstack"/>
|
||||
</picture>
|
||||
</a>
|
||||
<a style="padding-left: 1em" href="https://saucelabs.com/resources/blog/appium-strategic-partner" target="_blank"><img src="packages/appium/docs/overrides/assets/images/sponsor-logo-sauce.png" width="250"/></a>
|
||||
|
||||
## Gold Sponsors
|
||||
|
||||
<a href="https://opencollective.com/appium" target="_blank"><img src="https://opencollective.com/appium/tiers/gold-sponsor.svg?avatarHeight=100&button=false"/></a>
|
||||
|
||||
[Become a Gold Sponsor](https://opencollective.com/appium/contribute/gold-sponsor-72877/checkout?interval=month&amount=500&contributeAs=me)
|
||||
|
||||
## Silver Sponsors
|
||||
|
||||
<a href="https://opencollective.com/appium" target="_blank"><img src="https://opencollective.com/appium/tiers/silver-sponsor.svg?avatarHeight=80&button=false"/></a>
|
||||
|
||||
[Become a Silver Sponsor](https://opencollective.com/appium/contribute/silver-sponsor-72876/checkout?interval=month&amount=250&contributeAs=me)
|
||||
|
||||
## Bronze Sponsors
|
||||
|
||||
<a href="https://opencollective.com/appium" target="_blank"><img src="https://opencollective.com/appium/tiers/sponsors.svg?avatarHeight=60&button=false"/></a>
|
||||
|
||||
[Become a Bronze Sponsor](https://opencollective.com/appium/contribute/sponsors-70690/checkout?interval=month&amount=100&contributeAs=me)
|
||||
@@ -59,9 +59,10 @@
|
||||
"start": "appium",
|
||||
"sync-pkgs": "run-p sync-pkgs:*",
|
||||
"sync-pkgs:appium-readme": "sync-monorepo-packages --force --no-package-json --packages=packages/appium README.md",
|
||||
"sync-pkgs:common-fields": "sync-monorepo-packages --fields=author,license,bugs,homepage,engines",
|
||||
"sync-pkgs:common-fields:default": "sync-monorepo-packages --packages=\"!packages/logger\" --fields=author,license,bugs,homepage,engines",
|
||||
"sync-pkgs:common-fields:logger": "sync-monorepo-packages --packages=\"packages/logger\" --fields=author,bugs,homepage,engines",
|
||||
"sync-pkgs:keywords": "sync-monorepo-packages --field=keywords --packages=\"packages/*\" --packages=\"!packages/eslint-config-appium\" --packages=\"!packages/types\" --packages=\"!packages/eslint-config-appium-ts\" ",
|
||||
"sync-pkgs:license": "sync-monorepo-packages --force --no-package-json LICENSE",
|
||||
"sync-pkgs:license": "sync-monorepo-packages --force --no-package-json --packages=\"!packages/logger\" LICENSE",
|
||||
"test": "run-s test:quick",
|
||||
"test:ci": "run-s test:smoke test:unit test:types test:e2e",
|
||||
"test:e2e": "lerna run --concurrency=2 test:e2e",
|
||||
@@ -81,60 +82,60 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@colors/colors": "1.6.0",
|
||||
"@tsconfig/node14": "14.1.0",
|
||||
"@types/chai": "4.3.11",
|
||||
"@tsconfig/node14": "14.1.2",
|
||||
"@types/chai": "4.3.16",
|
||||
"@types/chai-as-promised": "7.1.8",
|
||||
"@types/diff": "5.0.9",
|
||||
"@types/diff": "5.2.1",
|
||||
"@types/mocha": "10.0.6",
|
||||
"@types/node": "20.11.17",
|
||||
"@types/semver": "7.5.7",
|
||||
"@types/node": "20.14.2",
|
||||
"@types/semver": "7.5.8",
|
||||
"@types/sinon": "17.0.3",
|
||||
"@types/sinon-chai": "3.2.12",
|
||||
"@types/source-map-support": "0.5.10",
|
||||
"@types/teen_process": "2.0.4",
|
||||
"@types/ws": "8.5.10",
|
||||
"@types/yargs": "17.0.32",
|
||||
"@typescript-eslint/eslint-plugin": "6.21.0",
|
||||
"@typescript-eslint/parser": "6.21.0",
|
||||
"@typescript-eslint/eslint-plugin": "7.12.0",
|
||||
"@typescript-eslint/parser": "7.12.0",
|
||||
"asyncbox": "3.0.0",
|
||||
"chai": "4.4.1",
|
||||
"chai-as-promised": "7.1.1",
|
||||
"chai-webdriverio-async": "2.8.0",
|
||||
"chai-as-promised": "7.1.2",
|
||||
"chai-webdriverio-async": "3.0.0",
|
||||
"conventional-changelog-conventionalcommits": "7.0.2",
|
||||
"cpy-cli": "5.0.0",
|
||||
"eslint": "8.56.0",
|
||||
"eslint": "8.57.0",
|
||||
"eslint-config-prettier": "9.1.0",
|
||||
"eslint-find-rules": "4.1.0",
|
||||
"eslint-import-resolver-typescript": "3.6.1",
|
||||
"eslint-plugin-import": "2.29.1",
|
||||
"eslint-plugin-mocha": "10.2.0",
|
||||
"eslint-plugin-promise": "6.1.1",
|
||||
"eslint-plugin-mocha": "10.4.3",
|
||||
"eslint-plugin-promise": "6.2.0",
|
||||
"fancy-log": "2.0.0",
|
||||
"finalhandler": "1.2.0",
|
||||
"get-port": "5.1.1",
|
||||
"json-schema-to-typescript": "13.1.2",
|
||||
"lerna": "8.1.2",
|
||||
"json-schema-to-typescript": "14.0.5",
|
||||
"lerna": "8.1.3",
|
||||
"log-symbols": "4.1.0",
|
||||
"midnight-smoker": "8.0.0",
|
||||
"mjpeg-consumer": "2.0.0",
|
||||
"mjpeg-server": "0.3.1",
|
||||
"mocha": "10.3.0",
|
||||
"mocha": "10.4.0",
|
||||
"mocha-chai-jest-snapshot": "1.1.4",
|
||||
"npm-run-all2": "6.1.2",
|
||||
"prettier": "3.2.5",
|
||||
"npm-run-all2": "6.2.0",
|
||||
"prettier": "3.3.1",
|
||||
"rewiremock": "3.14.5",
|
||||
"rimraf": "5.0.5",
|
||||
"rimraf": "5.0.7",
|
||||
"serve-static": "1.15.0",
|
||||
"sinon": "17.0.1",
|
||||
"sinon": "18.0.0",
|
||||
"sinon-chai": "3.7.0",
|
||||
"sync-monorepo-packages": "1.0.2",
|
||||
"through2": "4.0.2",
|
||||
"ts-node": "10.9.2",
|
||||
"tsd": "0.30.4",
|
||||
"typescript": "5.2.2",
|
||||
"tsd": "0.31.0",
|
||||
"typescript": "5.4.5",
|
||||
"validate.js": "0.13.1",
|
||||
"webdriverio": "8.31.1",
|
||||
"ws": "8.16.0",
|
||||
"webdriverio": "8.38.2",
|
||||
"ws": "8.17.0",
|
||||
"yaml-js": "0.3.1"
|
||||
},
|
||||
"engines": {
|
||||
@@ -146,10 +147,10 @@
|
||||
},
|
||||
"overrides": {
|
||||
"@sidvind/better-ajv-errors": {
|
||||
"ajv": "8.12.0"
|
||||
"ajv": "8.16.0"
|
||||
},
|
||||
"ajv-formats": {
|
||||
"ajv": "8.12.0"
|
||||
"ajv": "8.16.0"
|
||||
},
|
||||
"http-cache-semantics": "4.1.1"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,149 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [2.10.0](https://github.com/appium/appium/compare/appium@2.9.0...appium@2.10.0) (2024-06-10)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **appium:** Add a possibility to print logs in json format ([#20224](https://github.com/appium/appium/issues/20224)) ([1e86537](https://github.com/appium/appium/commit/1e86537e944f6beb7dbe72b35c267ae1dd9ebd36))
|
||||
* **appium:** Add session signature to all logs ([#20202](https://github.com/appium/appium/issues/20202)) ([#20214](https://github.com/appium/appium/issues/20214)) ([0363aab](https://github.com/appium/appium/commit/0363aab8ba4fe0ec49845db2f493001aa873578b)), closes [#20222](https://github.com/appium/appium/issues/20222)
|
||||
* **logger:** Add the debug level to the default logger ([#20219](https://github.com/appium/appium/issues/20219)) ([8ee7d07](https://github.com/appium/appium/commit/8ee7d07af4e2375d2eb7c23badaaac34685bc59c))
|
||||
* **support:** Move SecureValuesPreprocessor to @appum/logger ([#20228](https://github.com/appium/appium/issues/20228)) ([dbc3b66](https://github.com/appium/appium/commit/dbc3b668a0a7a815d23f1cae4207d435fc09034d))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **docutils:** update dependency lilconfig to v3.1.2 ([1828501](https://github.com/appium/appium/commit/1828501c66d0c5f8f295c67cd12d6691f8020780))
|
||||
* **docutils:** update dependency yaml to v2.4.5 ([6a08c95](https://github.com/appium/appium/commit/6a08c95fc9bda5cf39b8a6d98e5394658355a38e))
|
||||
* **types:** update dependency type-fest to v4.20.0 ([#20227](https://github.com/appium/appium/issues/20227)) ([ea00626](https://github.com/appium/appium/commit/ea00626091e3ce87f6e3ed7a61003295272835e3))
|
||||
|
||||
|
||||
|
||||
## [2.9.0](https://github.com/appium/appium/compare/appium@2.8.0...appium@2.9.0) (2024-06-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **appium:** Add session signature to all logs ([#20202](https://github.com/appium/appium/issues/20202)) ([b3f8a47](https://github.com/appium/appium/commit/b3f8a47c2d3fa029bdb5592d7130c6d1664e53b5))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **appium:** Revert changes in 20203 and 20202 ([#20209](https://github.com/appium/appium/issues/20209)) ([40def9d](https://github.com/appium/appium/commit/40def9dbdbde64706111900967d66735257b7404)), closes [#20202](https://github.com/appium/appium/issues/20202) [#20203](https://github.com/appium/appium/issues/20203)
|
||||
|
||||
|
||||
|
||||
## [2.8.0](https://github.com/appium/appium/compare/appium@2.7.0...appium@2.8.0) (2024-06-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **logger:** Add the 'debug' level to the default logger ([#20203](https://github.com/appium/appium/issues/20203)) ([7fd9d5f](https://github.com/appium/appium/commit/7fd9d5f6261b385c234580c2bfee4d576905458b))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add logger dependencies in package.json ([#20205](https://github.com/appium/appium/issues/20205)) ([3fbc4f1](https://github.com/appium/appium/commit/3fbc4f1fe07eadf9c7a2ef8fc9f4ba78dc3486a3))
|
||||
|
||||
|
||||
|
||||
## [2.7.0](https://github.com/appium/appium/compare/appium@2.6.0...appium@2.7.0) (2024-06-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **appium:** Replace npmlog with the local fork ([#20190](https://github.com/appium/appium/issues/20190)) ([8915934](https://github.com/appium/appium/commit/8915934270243bfb46c4d104a098ce1cc481b0ff))
|
||||
* **base-driver:** Make addition of search query params to cache optional ([#20195](https://github.com/appium/appium/issues/20195)) ([21316e9](https://github.com/appium/appium/commit/21316e94d05b2f97aa0349a82da229713e92446c))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **appium:** ensure ws close code is valid ([#20178](https://github.com/appium/appium/issues/20178)) ([65c47ac](https://github.com/appium/appium/commit/65c47acf5954bbf1947e896ef79c81a9b3c712a5))
|
||||
* **appium:** update dependency ajv to v8.16.0 ([ae7f74a](https://github.com/appium/appium/commit/ae7f74a0144d233653443622a84d49b1cb4e6222))
|
||||
* **docutils:** update dependency yaml to v2.4.3 ([848eb00](https://github.com/appium/appium/commit/848eb00afbd1cab76a6a1c3d0f4a2a0b1acee0d0))
|
||||
* **execute-driver-plugin:** update dependency webdriverio to v8.38.2 ([c8f9979](https://github.com/appium/appium/commit/c8f997973cc21673f95d02c92d43a2981b8713b8))
|
||||
* **support:** update dependency teen_process to v2.1.4 ([96a7a3f](https://github.com/appium/appium/commit/96a7a3f23bead7c1d18700550138cd2d70ce5e3c))
|
||||
* **types:** update dependency type-fest to v4.19.0 ([#20193](https://github.com/appium/appium/issues/20193)) ([db62358](https://github.com/appium/appium/commit/db62358dbac25de2a75fdc7493338d98b1422c84))
|
||||
|
||||
|
||||
|
||||
## [2.6.0](https://github.com/appium/appium/compare/appium@2.5.4...appium@2.6.0) (2024-05-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **appium:** Add --show-debug-info CLI argument ([#20108](https://github.com/appium/appium/issues/20108)) ([6f602d3](https://github.com/appium/appium/commit/6f602d3e501dbd9d44f6e7ba220f45ff1d4dfde8))
|
||||
* **appium:** prepare setup subcommand as shortcut for drivers/plugins installation ([#20102](https://github.com/appium/appium/issues/20102)) ([2b2fb18](https://github.com/appium/appium/commit/2b2fb185a6bc882717e4aa0580b0136bf5ae2942))
|
||||
* **base-driver:** Add env variables to control applications cache ([#20042](https://github.com/appium/appium/issues/20042)) ([4e8c91c](https://github.com/appium/appium/commit/4e8c91c8f647e545344d5b49282628413e1ccb19))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **appium:** Do not crash the process if there was an exception in a winston transport ([#20065](https://github.com/appium/appium/issues/20065)) ([0492fe4](https://github.com/appium/appium/commit/0492fe49dc34b3ef345a988bf56e49daf8dfcffe))
|
||||
* **appium:** update dependency ajv to v8.13.0 ([448e94e](https://github.com/appium/appium/commit/448e94ee50fa127ae93e657a3958726aa13e7df8))
|
||||
* **appium:** update dependency ajv to v8.14.0 ([e3dcd66](https://github.com/appium/appium/commit/e3dcd66714be603a8acbb3364f538c60772e76bd))
|
||||
* **appium:** update dependency ws to v8.17.0 ([395dc22](https://github.com/appium/appium/commit/395dc225e4d7f47dc55134fba9fb9306cabf7e19))
|
||||
* **docutils:** update dependency yaml to v2.4.2 ([0211174](https://github.com/appium/appium/commit/0211174300cf91c1cad2364d8ce3de7100139f5c))
|
||||
* **execute-driver-plugin:** update dependency webdriverio to v8.37.0 ([27ff9a0](https://github.com/appium/appium/commit/27ff9a00ef65a66aea8da8e3be5ffebb6d8c65e1))
|
||||
* **execute-driver-plugin:** update dependency webdriverio to v8.38.0 ([e80b682](https://github.com/appium/appium/commit/e80b6826efbe14ecfa6c0ff1f6aceb4db99b82d8))
|
||||
* **support:** update dependency axios to v1.7.1 ([11510cb](https://github.com/appium/appium/commit/11510cb1a5d50a20ced884e5404d0be1e04ff142))
|
||||
* **support:** update dependency axios to v1.7.2 ([a876f11](https://github.com/appium/appium/commit/a876f112b51dd25f70094b9e75330b9558050e42))
|
||||
* **support:** update dependency semver to v7.6.1 ([b5fd5b6](https://github.com/appium/appium/commit/b5fd5b6d2c585be8391b80ac67207da610e8ea64))
|
||||
* **support:** update dependency semver to v7.6.2 ([1b4f36c](https://github.com/appium/appium/commit/1b4f36cebe7aaf99976f24346b2d1325b79fc55c))
|
||||
* **support:** update dependency teen_process to v2.1.3 ([b34ce3c](https://github.com/appium/appium/commit/b34ce3cff0279be5bb5dcb9228f7e058d27a5e72))
|
||||
* **types:** update dependency type-fest to v4.18.2 ([#20103](https://github.com/appium/appium/issues/20103)) ([3b43be1](https://github.com/appium/appium/commit/3b43be17321f2ca16bac0abedabf9ef8cffa098a))
|
||||
* **types:** update dependency type-fest to v4.18.3 ([#20149](https://github.com/appium/appium/issues/20149)) ([d5369f8](https://github.com/appium/appium/commit/d5369f8b08e7439282c5a211e684b154cc9f0051))
|
||||
|
||||
|
||||
|
||||
## [2.5.4](https://github.com/appium/appium/compare/appium@2.5.3...appium@2.5.4) (2024-04-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **execute-driver-plugin:** update dependency webdriverio to v8.36.1 ([9ad20ff](https://github.com/appium/appium/commit/9ad20ff1c266923f3efe50bfe2ae4b1ab8ecb20a))
|
||||
|
||||
|
||||
|
||||
## [2.5.3](https://github.com/appium/appium/compare/appium@2.5.2...appium@2.5.3) (2024-04-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **execute-driver-plugin:** update dependency webdriverio to v8.36.0 ([#19998](https://github.com/appium/appium/issues/19998)) ([72f3284](https://github.com/appium/appium/commit/72f32848b68e6ef8c047f700ffd0be7d68c49aba))
|
||||
|
||||
|
||||
|
||||
## [2.5.2](https://github.com/appium/appium/compare/appium@2.5.1...appium@2.5.2) (2024-04-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **appium:** make --log-filters work ([#19825](https://github.com/appium/appium/issues/19825)) ([0d5a0a5](https://github.com/appium/appium/commit/0d5a0a572787d913412bbfd70835e5ba8f94334c))
|
||||
* **appium:** update definitelytyped ([2687fa4](https://github.com/appium/appium/commit/2687fa47a0c2f11983e5ccb2ee17eaae9279469d))
|
||||
* **appium:** update definitelytyped ([68456b8](https://github.com/appium/appium/commit/68456b8aea3c6ae7225814748fb36d9d4117cc9f))
|
||||
* **appium:** update dependency ajv-formats to v3 ([#19957](https://github.com/appium/appium/issues/19957)) ([59ef09d](https://github.com/appium/appium/commit/59ef09d9558f1a6a9f4ee3d81d4cb0b7218706b4))
|
||||
* **appium:** update dependency winston to v3.12.0 ([8eb4e88](https://github.com/appium/appium/commit/8eb4e888f624acfc1d42977eeda2d4c1ae139efc))
|
||||
* **appium:** update dependency winston to v3.13.0 ([03f8dc9](https://github.com/appium/appium/commit/03f8dc9b18f226975f025ceda7e1d907de8b45d5))
|
||||
* **docutils:** update dependency lilconfig to v3.1.0 ([f92640a](https://github.com/appium/appium/commit/f92640a824644545b680e23c7f3ec7f51de9df98))
|
||||
* **docutils:** update dependency lilconfig to v3.1.1 ([e04e4e9](https://github.com/appium/appium/commit/e04e4e902a212cf17ca79b3edc0b7545a1af507b))
|
||||
* **docutils:** update dependency typescript to v5.4.2 ([#19876](https://github.com/appium/appium/issues/19876)) ([2448fa0](https://github.com/appium/appium/commit/2448fa0145620657ccc72b5637f1b7737fe52580))
|
||||
* **docutils:** update dependency yaml to v2.4.0 ([26ded7a](https://github.com/appium/appium/commit/26ded7a4cce1fa9bca28521e4b60cad0edacbe96))
|
||||
* **docutils:** update dependency yaml to v2.4.1 ([636d6b3](https://github.com/appium/appium/commit/636d6b3802268ec6532f9f3a958f304c6760d172))
|
||||
* **execute-driver-plugin:** update dependency webdriverio to v8.32.0 ([d25a0fc](https://github.com/appium/appium/commit/d25a0fca9b3a94880525fd956068f59427a40b26))
|
||||
* **execute-driver-plugin:** update dependency webdriverio to v8.32.1 ([ea8c74b](https://github.com/appium/appium/commit/ea8c74b372e73e88cf0303aa17db943014416e64))
|
||||
* **execute-driver-plugin:** update dependency webdriverio to v8.32.2 ([#19807](https://github.com/appium/appium/issues/19807)) ([6c034aa](https://github.com/appium/appium/commit/6c034aa84af573d36fa934c71d3d4ff328772553))
|
||||
* **execute-driver-plugin:** update dependency webdriverio to v8.32.3 ([f837a6a](https://github.com/appium/appium/commit/f837a6a9eaf34914ffdbfddcc3cb2f7e7427bc63))
|
||||
* **execute-driver-plugin:** update dependency webdriverio to v8.32.4 ([7516d41](https://github.com/appium/appium/commit/7516d4135a1eec37ba298f407254d825961795af))
|
||||
* **execute-driver-plugin:** update dependency webdriverio to v8.33.1 ([#19877](https://github.com/appium/appium/issues/19877)) ([0e6c3ee](https://github.com/appium/appium/commit/0e6c3eede250193fad390387ec494918367176d9))
|
||||
* **execute-driver-plugin:** update dependency webdriverio to v8.34.1 ([7fc7446](https://github.com/appium/appium/commit/7fc7446612f3257fa421dfec006d02730df10f59))
|
||||
* **execute-driver-plugin:** update dependency webdriverio to v8.35.1 ([63d7550](https://github.com/appium/appium/commit/63d7550d02f049a5c3bea5d27e7e8385d7698a4f))
|
||||
* **support:** update dependency @types/semver to v7.5.8 ([d1705e2](https://github.com/appium/appium/commit/d1705e2818d435b4c37cb70753af1de5427378e2))
|
||||
* **support:** update dependency axios to v1.6.8 ([bd6ab81](https://github.com/appium/appium/commit/bd6ab81c9408ab0f90fc25fc112f9257ec2973ad))
|
||||
|
||||
|
||||
|
||||
## [2.5.1](https://github.com/appium/appium/compare/appium@2.5.0...appium@2.5.1) (2024-02-13)
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="https://appium.io/">
|
||||
<img alt="Appium" src="https://raw.githubusercontent.com/appium/appium/master/packages/appium/docs/assets/images/appium-logo-horiz.png" width="500">
|
||||
<img alt="Appium" src="https://raw.githubusercontent.com/appium/appium/master/packages/appium/docs/overrides/assets/images/appium-logo-horiz.png" width="500">
|
||||
</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
@@ -178,8 +178,46 @@ cross-platform native app automation, for mobile and beyond!
|
||||
If you are looking for a more comprehensive description of what this is all about, please read our
|
||||
documentation on [How Does Appium Work?](https://appium.io/docs/en/latest/intro/appium/).
|
||||
|
||||
## Sponsors
|
||||
|
||||
Appium has a [Sponsorship Program](GOVERNANCE.md#sponsorship)! If you or your company uses Appium
|
||||
and wants to give back financially to the project, we use these funds to [encourage development and
|
||||
contributions](GOVERNANCE.md#compensation-scheme), as well as support other open source projects we
|
||||
rely on. [Become a sponsor](https://opencollective.com/appium) via our OpenCollective page.
|
||||
|
||||
### Development and Strategic Partners
|
||||
|
||||
Appium is incredibly grateful to our Development and Strategic Partners for their sustained
|
||||
contribution of project development and leadership!
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.headspin.io/solutions/appium-mobile-test-automation"><img src="packages/appium/docs/overrides/assets/images/sponsor-logo-headspin.png"
|
||||
width="275" alt="HeadSpin" /></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.browserstack.com/browserstack-appium?utm_campaigncode=701OW00000AoUTQYA3&utm_medium=partnered&utm_source=appium">
|
||||
<picture>
|
||||
<source srcset="packages/appium/docs/overrides/assets/images/sponsor-logo-browserstack-dark.png" media="(prefers-color-scheme: dark)"/>
|
||||
<source srcset="packages/appium/docs/overrides/assets/images/sponsor-logo-browserstack-light.png" media="(prefers-color-scheme: light)"/>
|
||||
<img src="packages/appium/docs/overrides/assets/images/sponsor-logo-browserstack-dark.png" width="300" alt="Browserstack"/>
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://saucelabs.com/resources/blog/appium-strategic-partner"><img src="packages/appium/docs/overrides/assets/images/sponsor-logo-sauce.png"
|
||||
width="300" alt="Sauce Labs" /></a>
|
||||
</p>
|
||||
|
||||
### Other Sponsors
|
||||
|
||||
A full list of sponsors is available at our [Sponsors page](SPONSORS.md).
|
||||
|
||||
## License
|
||||
|
||||
[Apache-2.0](./LICENSE)
|
||||
|
||||
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fappium%2Fappium?ref=badge_large)
|
||||
|
||||
`@appium/logger` package is under [ISC](./packages/logger/LICENSE) License.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
en/latest
|
||||
en/assets
|
||||
ja/assets
|
||||
zh/assets
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
.md-source__fact--version {
|
||||
display: none;
|
||||
}
|
||||
.md-source__fact:nth-child(1n + 2):before {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
@@ -8,8 +8,12 @@ copyright: Copyright © 2012 OpenJS Foundation - <a href="#__consent">Change
|
||||
theme:
|
||||
logo: assets/images/appium-logo-white.png
|
||||
favicon: assets/images/appium-logo.png
|
||||
custom_dir: overrides
|
||||
|
||||
plugins:
|
||||
blog:
|
||||
enabled: true
|
||||
post_excerpt: required
|
||||
redirects:
|
||||
redirect_maps:
|
||||
'intro/requirements.md': 'quickstart/requirements.md'
|
||||
@@ -34,7 +38,7 @@ extra:
|
||||
link: https://twitter.com/AppiumDevs
|
||||
alternate:
|
||||
- name: English
|
||||
link: /docs/en/
|
||||
link: /docs/en/
|
||||
lang: en
|
||||
- name: 日本
|
||||
link: /docs/ja/
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
authors:
|
||||
jlipps:
|
||||
name: "Jonathan Lipps"
|
||||
description: "Appium project lead. Learn more about Jonathan at https://jlipps.com"
|
||||
avatar: "https://gravatar.com/avatar/fdaadd825d92709bcf7fe76dffa12c40681c6108c67bcddf19478b2d00e3794b.jpg"
|
||||
slug: "jlipps"
|
||||
url: "https://jlipps.com"
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# Appium Blog
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
authors:
|
||||
- jlipps
|
||||
date: 2024-06-10
|
||||
---
|
||||
|
||||
# Announcing BrowserStack as Appium's Strategic Partner
|
||||
|
||||
We have another exciting announcement for you! As part of our recently-announced [sponsorship and
|
||||
contributor compensation
|
||||
program](https://appium.io/docs/en/latest/blog/2024/05/14/announcing-appiums-sponsorship-program/),
|
||||
we are obviously in need of significant funding to support giving back to our contributor
|
||||
community. We are therefore extremely happy to announce one of our brand new exclusive Strategic Partners: <a
|
||||
href="https://www.browserstack.com/browserstack-appium?utm_campaigncode=701OW00000AoUTQYA3&utm_medium=partnered&utm_source=appium">BrowserStack</a>!
|
||||
|
||||
<!-- more -->
|
||||
|
||||
<div style="text-align:center;width:100%">
|
||||
<a href="https://www.browserstack.com/browserstack-appium?utm_campaigncode=701OW00000AoUTQYA3&utm_medium=partnered&utm_source=appium">
|
||||
<img src="/docs/en/latest/assets/images/sponsor-logo-browserstack-dark.png#only-dark" width="300" />
|
||||
<img src="/docs/en/latest/assets/images/sponsor-logo-browserstack-light.png#only-light" width="300" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
BrowserStack has long been recognized in the industry as having extensive support for Appium,
|
||||
allowing you to run functional and visual regression tests for your native and hybrid apps at scale
|
||||
across a variety of devices and platforms.
|
||||
|
||||
As a token of this collaboration, BrowserStack is extending a special premium access of
|
||||
BrowserStack App Automate product to Appium users. Discover more about this special offer at
|
||||
[browserstack.com](https://www.browserstack.com/browserstack-appium?utm_campaigncode=701OW00000AoUTQYA3&utm_medium=partnered&utm_source=appium&utm_term=partannouncement)
|
||||
|
||||
With the decision to come on board as Strategic Partner, BrowserStack is making a huge investment
|
||||
in Appium and the Appium community. BrowserStack is very interested in supporting the development
|
||||
of the Appium contributor base, and is proud to be a key part of our contributor compensation
|
||||
scheme. Without Strategic Partners like BrowserStack, we would not be able to maintain such
|
||||
a program! We welcome them with gratitude!
|
||||
|
||||
**About BrowserStack**
|
||||
|
||||
<em>BrowserStack is the world’s leading software testing platform powering over two million tests every
|
||||
day across 19 global data centers. BrowserStack helps Tesco, Shell, NVIDIA, Discovery, Wells Fargo,
|
||||
and over 50,000 customers deliver quality software at speed by moving testing to their Cloud.
|
||||
BrowserStack’s platform provides instant access to 20,000+ real mobile devices on a highly reliable
|
||||
cloud infrastructure that effortlessly scales as testing needs grow. With BrowserStack, Dev and QA
|
||||
teams can move fast while delivering an amazing experience for every customer.</em>
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
authors:
|
||||
- jlipps
|
||||
date: 2024-06-06
|
||||
---
|
||||
|
||||
# Announcing HeadSpin as Appium's Development Partner
|
||||
|
||||
Recently, we announced a new [sponsorship and contributor compensation program](https://appium.io/docs/en/latest/blog/2024/05/14/announcing-appiums-sponsorship-program/) for the Appium
|
||||
project. As part of this program, we felt it was important to have a place to recognize those
|
||||
companies who make an extremely valuable kind of contribution to the project: dedicated maintainer
|
||||
time. Appium only survives because of the tireless efforts of the core maintainers, and some of us
|
||||
are only able to do this work because it is donated on behalf of our day jobs. We're therefore very
|
||||
excited to announce our first Development Partner: <a
|
||||
href="https://www.headspin.io/solutions/appium-mobile-test-automation">HeadSpin</a>!
|
||||
|
||||
<!-- more -->
|
||||
|
||||
<div style="text-align:center;width:100%">
|
||||
<a href="https://www.headspin.io/solutions/appium-mobile-test-automation"><img
|
||||
src="/docs/en/latest/assets/images/sponsor-logo-headspin.png" style="width: 300px"/></a>
|
||||
</div>
|
||||
|
||||
HeadSpin is a real device performance and UX analysis cloud, with full support for Appium. When you
|
||||
run your Appium tests on HeadSpin, you get access to comprehensive performance reports about your
|
||||
app, including potential network, system resource, or user experience issues. HeadSpin supports
|
||||
a variety of complex testing modes, including hooking up your own devices to the cloud, injecting
|
||||
and receiving video and audio to/from devices, working with media (streaming) platforms, and more.
|
||||
|
||||
HeadSpin has been one of the Appium project's biggest supporters for a long time, and currently
|
||||
employs two of Appium's core maintainers, donating a significant portion of their time towards the
|
||||
development, maintenance, support, and leadership of open source Appium repos. HeadSpin has also
|
||||
worked hard towards Appium's vision of a robust Appium ecosystem, contributing several
|
||||
HeadSpin-maintained Appium drivers and plugins to the community:
|
||||
|
||||
- A [Roku TV driver](https://github.com/headspinio/appium-roku-driver)
|
||||
- A [Tizen TV driver](https://github.com/headspinio/appium-tizen-tv-driver/)
|
||||
- A [LG webOS TV driver](https://github.com/headspinio/appium-lg-webos-driver/)
|
||||
- A [Unity game automation plugin](https://github.com/headspinio/appium-altunity-plugin)
|
||||
|
||||
These are all free and open source Appium components that HeadSpin has donated to the community
|
||||
with the goal of fostering collaboration in these areas of media app automation.
|
||||
|
||||
Looking to the future, HeadSpin plans to continue supporting Appium in significant ways, both as
|
||||
a Development Partner and a significant contributor to the Appium ecosystem. The Appium project is
|
||||
deeply indebted to HeadSpin for all of its support, and is proud to take this moment to recognize
|
||||
HeadSpin as our first official Development Partner!
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
authors:
|
||||
- jlipps
|
||||
date: 2024-06-10
|
||||
---
|
||||
|
||||
# Announcing Sauce Labs as Appium's Strategic Partner
|
||||
|
||||
The good news surrounding our new [sponsorship and contributor compensation
|
||||
program](https://appium.io/docs/en/latest/blog/2024/05/14/announcing-appiums-sponsorship-program/)
|
||||
just keeps coming! Effective immediately we are fortunate and excited to be able to welcome a new Strategic Partner to
|
||||
the Appium project: <a href="https://saucelabs.com/resources/blog/appium-strategic-partner">Sauce Labs</a>!
|
||||
|
||||
<!-- more -->
|
||||
|
||||
<div style="text-align:center;width:100%">
|
||||
<a href="https://saucelabs.com/resources/blog/appium-strategic-partner"><img src="/docs/en/latest/assets/images/sponsor-logo-sauce.png" style="width: 300px"/></a>
|
||||
</div>
|
||||
|
||||
Sauce Labs has a long history of support for the Appium project. In fact, Appium was initially
|
||||
incubated at Sauce Labs under the direction of [@jlipps](https://github.com/jlipps), in the early
|
||||
days of mobile automation. Sauce Labs always envisioned Appium as being a project for and by the
|
||||
community, and cemented this perspective in 2016 with the donation of Appium to the JS Foundation
|
||||
(now the [OpenJS Foundation](https://openjsf.org/)). To this day, developers associated with Sauce
|
||||
Labs continue to help maintain various parts of the Appium project.
|
||||
|
||||
Now, Sauce Labs is making a further commitment to support Appium financially as a way to enable
|
||||
our new contributor compensation program. We're very excited about this program as a vehicle for
|
||||
getting more people involved in Appium's development and maintenance. With the help of Strategic
|
||||
Partners like Sauce Labs, our project will be better able to meet the needs of our constantly
|
||||
growing userbase, and attract new developers (like you?) to build the Appium ecosystem together.
|
||||
Needless to say, we are extremely grateful for Sauce Labs's support!
|
||||
|
||||
**About Sauce Labs**
|
||||
|
||||
<em>Sauce Labs is the leader in continuous quality. Our Platform for Test helps organizations transform software testing from a chore to a competitive advantage. With decades of expertise and deep roots in the Selenium and Appium open source communities, high performing software teams use our platform to execute any testing workload across thousands of different devices, browsers, and operating systems—anywhere, any time, and at any scale. For more information, please visit [saucelabs.com](https://saucelabs.com).</em>
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
authors:
|
||||
- jlipps
|
||||
date: 2024-05-14
|
||||
---
|
||||
|
||||
# Announcing Appium's Sponsorship Program
|
||||
|
||||
Over the last several months, the Appium team has been working on a sponsorship program that is
|
||||
designed to help give back to Appium's contributors as well as to recognize important partner
|
||||
individuals or companies in the industry. This program is now officially launching! Let's dive into
|
||||
some of the details.
|
||||
|
||||
<!-- more -->
|
||||
|
||||
First of all, the details and fine print will always be available at Appium's [Governance
|
||||
document](https://github.com/appium/appium/blob/master/GOVERNANCE.md), which outlines how the
|
||||
project is run, who makes project decisions, etc... This document will be kept up to date with the
|
||||
latest details of the program, so that's the place to bookmark for reference!
|
||||
|
||||
As of now, Appium has opened up sponsorship opportunities via our [OpenCollective
|
||||
page](https://opencollective.com/appium). OpenCollective is a service which allows people to donate
|
||||
to open source groups. We've defined a number of giving tiers for donations, within a very wide
|
||||
range, and welcome any financial amount with gratitude! Based on the donation tier, sponsorship
|
||||
comes with a variety of benefits, including recognition at different places in the Appium repo,
|
||||
docs, and website. In addition to financial sponsorship, the project has decided to recognize
|
||||
significant donations of project leadership and maintenance efforts from companies who have
|
||||
invested heavily into Appium with their employees' time (we call these "Development Partners").
|
||||
|
||||
What will the project do with the funds raised through this sponsorship program? We aim to give it
|
||||
all back to the Appium community! With the details again available at our [Governance document](https://github.com/appium/appium/blob/master/GOVERNANCE.md),
|
||||
we have implemented a scheme very much inspired by our friends at [WebdriverIO](https://webdriver.io/blog/2024/02/15/new-contributor-stipend-program) (thanks WDIO
|
||||
friends!) There are three groups of contributors to Appium that this scheme supports: (1) project
|
||||
maintainers (those who devote consistent time to leading the project), (2) project contributors
|
||||
(anyone in the wider community that contributes code or documentation), and (3) upstream projects
|
||||
(other open source projects Appium relies heavily on to work well). Each month, the funds raised
|
||||
via sponsorship will be distributed in different amounts to each of these groups. So if you
|
||||
make a valuable contribution to Appium moving forward, you'll be eligible to get some cash as
|
||||
a thank-you! (You'll need to have your own OpenCollective account in good standing to receive
|
||||
funds).
|
||||
|
||||
We're very excited about this new program, and hope that it helps existing and new contributors to
|
||||
feel even better about donating their time to making Appium better. And of course, none of this
|
||||
would be possible without the amazing Partners and Sponsors we hope to attract! On that note, stay
|
||||
tuned over the next few weeks as we unveil some of our initial program launch Partners! And if you
|
||||
or your company would like to participate by supporting Appium financially, you are most welcome.
|
||||
Just head over to our OpenCollective page and choose the tier that reflects your desired
|
||||
contribution level.
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
authors:
|
||||
- jlipps
|
||||
date: 2024-03-07
|
||||
---
|
||||
|
||||
# Hello World!
|
||||
|
||||
This is the first post in the Appium blog. There's not much to see here yet. We're creating this
|
||||
space so we can make announcements or post other news, or information about events, that don't
|
||||
really fit inside the documentation itself.
|
||||
|
||||
<!-- more -->
|
||||
|
||||
Stay tuned for more!
|
||||
@@ -27,23 +27,25 @@ below.
|
||||
|`--base-path`|Base path to use as the prefix for all webdriver routes running on the server|string|`""`|`-pa`|
|
||||
|`--callback-address`|Callback IP address (default: same as `--address`)|string||`-ca`|
|
||||
|`--callback-port`|Callback port (default: same as `--port`) (Value must be between `1` and `65535`)|integer|`4723`|`-cp`|
|
||||
|`--config`|Path to an [Appium configuration JSON file](../guides/config.md)|string|||
|
||||
|`--debug-log-spacing`|Add exaggerated spacing in logs to help with visual inspection|boolean|`false`||
|
||||
|`--default-capabilities`|Set the default desired capabilities, which will be set on each session unless overridden by received capabilities. If a string, a path to a JSON file containing the capabilities, or raw JSON.|object||`-dc`|
|
||||
|`--deny-insecure`|Set which insecure features are not allowed to run in this server's sessions. Features are defined on a driver level; see documentation for more details. Features listed here will not be enabled even if also listed in `--allow-insecure`, and even if `--relaxed-security` is enabled. If string, a path to a text file containing policy or a comma-delimited list.|array<string>|`[]`||
|
||||
|`--driver`|Driver-specific configuration. Keys should correspond to driver package names|object|||
|
||||
|`--drivers-import-chunk-size`|The maximum amount of drivers that could be imported in parallel on server startup|number|`3`||
|
||||
|`--keep-alive-timeout`|Number of seconds the Appium server should apply as both the keep-alive timeout and the connection timeout for all requests. Setting this to `0` disables the timeout.|integer|`600`|`-ka`|
|
||||
|`--local-timezone`|Use local timezone for timestamps|boolean|`false`||
|
||||
|`--log`|Also send log output to this file|string||`-g`|
|
||||
|`--log-filters`|One or more log filtering rules|array|||
|
||||
|`--log-level`|Log level (console[:file]) (Value must be one of: `info`, `info:debug`, `info:info`, `info:warn`, `info:error`, `warn`, `warn:debug`, `warn:info`, `warn:warn`, `warn:error`, `error`, `error:debug`, `error:info`, `error:warn`, `error:error`, `debug`, `debug:debug`, `debug:info`, `debug:warn`, `debug:error`)|string|`debug`||
|
||||
|`--log-format`|Log format (Value must be to one of: `text`, `json`, `pretty_json`). If logs are printed as JSON then the text coloring is always disabled.|string|`text`||
|
||||
|`--log-no-colors`|Do not use color in console output|boolean|`false`||
|
||||
|`--log-timestamp`|Show timestamps in console output|boolean|`false`||
|
||||
|`--plugins-import-chunk-size`|The maximum amount of plugins that could be imported in parallel on server startup|number|`7`||
|
||||
|`--drivers-import-chunk-size`|The maximum amount of drivers that could be imported in parallel on server startup|number|`3`||
|
||||
|`--long-stacktrace`|Add long stack traces to log entries. Recommended for debugging only.|boolean|`false`||
|
||||
|`--no-perms-check`|Skip various permission checks on the server startup if set to true|boolean|`false`||
|
||||
|`--nodeconfig`|Path to configuration JSON file to register Appium as a node with Selenium Grid 3; otherwise the configuration itself|object|||
|
||||
|`--no-perms-check`|Skip various permission checks on the server startup|boolean|`false`||
|
||||
|`--nodeconfig`|Path to configuration JSON file to register Appium as a node with Selenium Grid 3; otherwise the configuration itself|string|||
|
||||
|`--plugin`|Plugin-specific configuration. Keys should correspond to plugin package names|object|||
|
||||
|`--plugins-import-chunk-size`|The maximum amount of plugins that could be imported in parallel on server startup|number|`7`||
|
||||
|`--port`|Port to listen on (Value must be between `1` and `65535`)|integer|`4723`|`-p`|
|
||||
|`--relaxed-security`|Disable additional security checks, so it is possible to use some advanced features, provided by drivers supporting this option. Only enable it if all the clients are in the trusted network and it's not the case if a client could potentially break out of the session sandbox. Specific features can be overridden by using `--deny-insecure`|boolean|`false`||
|
||||
|`--session-override`|Enables session override (clobbering)|boolean|`false`||
|
||||
@@ -55,3 +57,13 @@ below.
|
||||
|`--use-drivers`|A list of drivers to activate. By default, all installed drivers will be activated.|array<string>|`[]`||
|
||||
|`--use-plugins`|A list of plugins to activate. To activate all plugins, the value should be an array with a single item `"all"`.|array<string>|`[]`||
|
||||
|`--webhook`|Also send log output to this http listener|string||`-G`|
|
||||
|
||||
The following arguments are used for information retrieval, after which the server will automatically exit. They are therefore meant for reference or debug purposes.
|
||||
|
||||
|<div style="width:10em">Argument</div>|Description|Alias|
|
||||
|--|--|--|
|
||||
|`--help`|Print instructions on using the Appium command-line. This argument can also be used for any Appium subcommands.|`-h`|
|
||||
|`--show-build-info`|Print detailed information on the Appium server version||
|
||||
|`--show-config`|Print the current Appium server configuration details||
|
||||
|`--show-debug-info`|Print information on the current environment: details about the operating system, Node.js, and Appium itself||
|
||||
|`--version`|Print the Appium server version|`-v`|
|
||||
|
||||
@@ -19,3 +19,8 @@ environment variables that the Appium server understands:
|
||||
|`APPIUM_PORT`|Same as the `--port` CLI arg|
|
||||
|`APPIUM_RELOAD_EXTENSIONS`|Set to `1` to cause Appium to re-require extensions when new sessions are created. This is mostly useful for [building extensions](../developing/build-drivers.md)|
|
||||
|`APPIUM_OMIT_PEER_DEPS`|Adds `--omit=peer` to all the NPM commands run internally by Appium. Mostly an internal feature.|
|
||||
|`APPIUM_APPS_CACHE_MAX_AGE`|Allows to set the maximum age (in minutes) for [cached applications](../guides/caching.md). The default value is `60 * 24` (24 hours). Do not set it to a lower number than the duration of a single session startup.|
|
||||
|`APPIUM_APPS_CACHE_MAX_ITEMS`|Allows to set the maximum amount of [cached applications](../guides/caching.md). The default value is `1024`. Do not set it to a lower number than the amount of apps in all parallel sessions per process.|
|
||||
|`APPIUM_APPS_CACHE_IGNORE_URL_QUERY`| If the above option is enabled then the 'search' part of the app URL will be cut off from cache keys. See the corresponding
|
||||
[feature request](https://discuss.appium.io/t/regarding-app-caching-when-using-aws-s3-presigned-urls/42713)
|
||||
for more details. Disabled by default.|
|
||||
|
||||
@@ -30,28 +30,34 @@ All Extension CLI commands can take an optional `--json` argument, which will re
|
||||
the command as a machine-readable JSON string rather than the standard output, which is colourized
|
||||
and tuned for human consumption.
|
||||
|
||||
### `list`
|
||||
### `doctor`
|
||||
|
||||
List installed and available extensions. "Available" extensions include those which are officially
|
||||
recognized by the Appium team, but you are not limited to installing only the extensions displayed
|
||||
in this list.
|
||||
Run doctor checks for the given extension, which validate whether the extension has its prerequisites
|
||||
configured correctly. Note that not all extensions include doctor checks. See the
|
||||
[Building Doctor Checks](../developing/build-doctor-checks.md) tutorial for more details on
|
||||
how to create them.
|
||||
|
||||
Usage:
|
||||
|
||||
```
|
||||
appium <ext-type> list [--installed] [--updates] [--json]
|
||||
appium <ext-type> doctor <ext-name>
|
||||
```
|
||||
|
||||
Required arguments:
|
||||
|
||||
- `<ext-type>`: must be `driver` or `plugin`
|
||||
- `<ext-name>`: the name of the extension whose doctor checks you want to run
|
||||
|
||||
Optional arguments:
|
||||
|
||||
- `--installed`: show only installed extensions, not installed plus available extensions
|
||||
- `--updates`: for extensions installed via NPM, display a message if there are any updates
|
||||
- `--json`: return the result in JSON format
|
||||
|
||||
Example (run doctor checks for the UiAutomator2 driver):
|
||||
|
||||
```
|
||||
appium driver doctor uiautomator2
|
||||
```
|
||||
|
||||
### `install`
|
||||
|
||||
Install an extension. If successful, respond with the short name of the extension which can be used
|
||||
@@ -124,46 +130,26 @@ by `npm install`:
|
||||
appium plugin install --source=local /path/to/my/plugin
|
||||
```
|
||||
|
||||
### `update`
|
||||
### `list`
|
||||
|
||||
Update one or more extensions that have been installed via NPM. By default, Appium will not
|
||||
automatically update any extension that has a revision in its major version, so as to prevent
|
||||
unintended breaking changes.
|
||||
List installed and available extensions. "Available" extensions include those which are officially
|
||||
recognized by the Appium team, but you are not limited to installing only the extensions displayed
|
||||
in this list.
|
||||
|
||||
Usage:
|
||||
|
||||
```
|
||||
appium <ext-type> update <ext-name> [--unsafe] [--json]
|
||||
appium <ext-type> list [--installed] [--updates] [--json]
|
||||
```
|
||||
|
||||
Required arguments:
|
||||
|
||||
- `<ext-type>`: must be `driver` or `plugin`
|
||||
- `<ext-name>`: the name of the extension to update, or the string `installed` (which will update
|
||||
all installed extensions)
|
||||
|
||||
Optional arguments:
|
||||
|
||||
- `--unsafe`: direct Appium to go ahead and update passed a major version boundary
|
||||
- `--json`: return the result in JSON format
|
||||
|
||||
### `uninstall`
|
||||
|
||||
Remove an installed extension.
|
||||
|
||||
Usage:
|
||||
|
||||
```
|
||||
appium <ext-type> uninstall <ext-name> [--json]
|
||||
```
|
||||
|
||||
Required arguments:
|
||||
|
||||
- `<ext-type>`: must be `driver` or `plugin`
|
||||
- `<ext-name>`: the name of the extension to uninstall
|
||||
|
||||
Optional arguments:
|
||||
|
||||
- `--installed`: show only installed extensions, not installed plus available extensions
|
||||
- `--updates`: for extensions installed via NPM, display a message if there are any updates
|
||||
- `--json`: return the result in JSON format
|
||||
|
||||
### `run`
|
||||
@@ -187,7 +173,7 @@ Required arguments:
|
||||
|
||||
Optional arguments:
|
||||
|
||||
* `script-args`: any arguments that Appium does not interpret as belonging to its own set of
|
||||
- `script-args`: any arguments that Appium does not interpret as belonging to its own set of
|
||||
arguments will be passed along to the extension script
|
||||
- `--json`: return the result in JSON format
|
||||
|
||||
@@ -197,23 +183,44 @@ Example (run the `reset` script included with the UiAutomator2 driver):
|
||||
appium driver run uiautomator2 reset
|
||||
```
|
||||
|
||||
### `doctor`
|
||||
### `update`
|
||||
|
||||
Run doctor checks for the given extension if it has any. Extension authors can include
|
||||
runnable scripts that assist with driver or plugin preconditions validations. These scripts
|
||||
must be valid Node.js sources, must be listed in the package manifest, and must export
|
||||
class instances that comply to the particular requirements.
|
||||
See the [Building Doctor Checks](../developing/build-doctor-checks.md) tutorial for more
|
||||
details on these requirements.
|
||||
Update one or more extensions that have been installed via NPM. By default, Appium will not
|
||||
automatically update any extension past a major version boundary, so as to prevent
|
||||
unintended breaking changes.
|
||||
|
||||
Usage:
|
||||
|
||||
```
|
||||
appium <ext-type> doctor <ext-name>
|
||||
appium <ext-type> update <ext-name> [--unsafe] [--json]
|
||||
```
|
||||
|
||||
Example (run doctor checks for the UiAutomator2 driver):
|
||||
Required arguments:
|
||||
|
||||
- `<ext-type>`: must be `driver` or `plugin`
|
||||
- `<ext-name>`: the name of the extension to update, or the string `installed` (which will update
|
||||
all installed extensions)
|
||||
|
||||
Optional arguments:
|
||||
|
||||
- `--unsafe`: direct Appium to go ahead and update past a major version boundary
|
||||
- `--json`: return the result in JSON format
|
||||
|
||||
### `uninstall`
|
||||
|
||||
Remove an installed extension.
|
||||
|
||||
Usage:
|
||||
|
||||
```
|
||||
appium driver doctor uiautomator2
|
||||
appium <ext-type> uninstall <ext-name> [--json]
|
||||
```
|
||||
|
||||
Required arguments:
|
||||
|
||||
- `<ext-type>`: must be `driver` or `plugin`
|
||||
- `<ext-name>`: the name of the extension to uninstall
|
||||
|
||||
Optional arguments:
|
||||
|
||||
- `--json`: return the result in JSON format
|
||||
|
||||
@@ -11,14 +11,16 @@ the Appium server. This section of the Appium documentation describes how to use
|
||||
To start off, you can run `appium -v` or `appium --version` to return the installed version,
|
||||
or run `appium -h` or `appium --help` to return the help message.
|
||||
|
||||
The main `appium` executable provides 3 subcommands:
|
||||
The main `appium` executable provides the following subcommands:
|
||||
|
||||
1. `appium server` (or simply `appium`) - launch an Appium server
|
||||
- [See here for accepted arguments](./args.md)
|
||||
- For advanced features, [see here for accepted environment variables](./env-vars.md)
|
||||
2. `appium driver` - manage Appium drivers
|
||||
- [See here for accepted arguments](./extensions.md)
|
||||
- [See here for details](./extensions.md)
|
||||
3. `appium plugin` - manage Appium plugins
|
||||
- [See here for accepted arguments](./extensions.md)
|
||||
- [See here for details](./extensions.md)
|
||||
4. `appium setup` - batch install a preset of drivers and plugins
|
||||
- [See here for details](./setup.md)
|
||||
|
||||
Like the main command, you can also run each subcommand with the `-h` or `--help` flag to learn more about it.
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
hide:
|
||||
- toc
|
||||
|
||||
title: Setup Command-Line Usage
|
||||
---
|
||||
|
||||
The `setup` command aims to simplify the initial procedure of setting up Appium. It allows to install
|
||||
multiple extensions (drivers/plugins) in one go, without the need to run
|
||||
`appium <ext-name> install <ext-name>` multiple times.
|
||||
|
||||
The command has several presets that can be used to install different sets of extensions.
|
||||
The presets are as follows:
|
||||
|
||||
|Preset|Installation Command|Included Drivers|Included Plugins|
|
||||
|--|--|--|--|
|
||||
|Mobile|`appium setup mobile` or `appium setup`|`uiautomator2`, `xcuitest`[^1], `espresso`|`images`|
|
||||
|Desktop application|`appium setup desktop`|`mac2`[^1], `windows`[^2]|`images`|
|
||||
|Desktop browser|`appium setup browser`|`safari`[^1], `gecko`, `chromium`|`images`|
|
||||
|
||||
Attempting to install a preset while already having one or more of its included extensions installed
|
||||
will only install the missing extensions.
|
||||
|
||||
Refer to the [Ecosystem documentation](../ecosystem/index.md) to learn more about the extensions
|
||||
listed above.
|
||||
|
||||
[^1]: Only installed if the host machine is running macOS.
|
||||
[^2]: Only installed if the host machine is running Windows.
|
||||
@@ -217,6 +217,10 @@ A possibly empty list of elements inside the shadow root matching the selector
|
||||
|
||||
Get the log for a given log type.
|
||||
|
||||
!!! warning "Deprecated"
|
||||
|
||||
Please use the `/session/:sessionId/se/log` endpoint instead
|
||||
|
||||
<!-- comment source: method-signature -->
|
||||
|
||||
#### Parameters
|
||||
@@ -273,6 +277,10 @@ The event history for the session
|
||||
|
||||
Get available log types as a list of strings
|
||||
|
||||
!!! warning "Deprecated"
|
||||
|
||||
Please use the `/session/:sessionId/se/log/types` endpoint instead
|
||||
|
||||
<!-- comment source: method-signature -->
|
||||
|
||||
#### Response
|
||||
@@ -319,9 +327,22 @@ Get data for all sessions running on an Appium server
|
||||
|
||||
#### Response
|
||||
|
||||
`MultiSessionData`<`C`\>[]
|
||||
A list of session data objects.
|
||||
Each session data object will be returned with `id` and the session's capabilities as `capabilities` keys like an example below:
|
||||
|
||||
A list of session data objects
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id":"ba30c6da-c266-4734-8ddb-c16f5bb53e16",
|
||||
"capabilities":{ "platformName":"ios","browserName":"safari","automationName":"xcuitest","platformVersion":"17.2","deviceName":"iPhone 15" }
|
||||
},
|
||||
{
|
||||
"id":"1441110c-1ece-4e45-abbf-ebf404f45f0a",
|
||||
"capabilities":{ "platformName":"ios","browserName":"safari","automationName":"xcuitest","platformVersion":"17.0","deviceName":"iPhone 14" }
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
### `getSettings`
|
||||
|
||||
@@ -465,7 +486,9 @@ Set the various timeouts associated with a session
|
||||
|
||||
Set the implicit wait timeout
|
||||
|
||||
**`Deprecated`**
|
||||
!!! warning "Deprecated"
|
||||
|
||||
Please use the `/session/:sessionId/timeouts` endpoint instead
|
||||
|
||||
Use `timeouts` instead
|
||||
|
||||
@@ -506,7 +529,9 @@ Add a custom-named event to the Appium event log
|
||||
|
||||
Reset the current session (run the delete session and create session subroutines)
|
||||
|
||||
**`Deprecated`**
|
||||
!!! warning "Deprecated"
|
||||
|
||||
Please use each driver's launch, activate, terminate or cleanup method.
|
||||
|
||||
Use explicit session management commands instead
|
||||
|
||||
|
||||
@@ -58,20 +58,20 @@ work with certain versions of Appium). For Appium 2, for example, this would loo
|
||||
Your `package.json` must contain an `appium` field, like this (we call this the 'Appium extension
|
||||
metadata'):
|
||||
|
||||
```json
|
||||
{
|
||||
...,
|
||||
"appium": {
|
||||
"driverName": "fake",
|
||||
"automationName": "Fake",
|
||||
"platformNames": [
|
||||
"Fake"
|
||||
],
|
||||
"mainClass": "FakeDriver"
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
```json
|
||||
{
|
||||
...,
|
||||
"appium": {
|
||||
"driverName": "fake",
|
||||
"automationName": "Fake",
|
||||
"platformNames": [
|
||||
"Fake"
|
||||
],
|
||||
"mainClass": "FakeDriver"
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
The required subfields are:
|
||||
|
||||
@@ -130,12 +130,12 @@ like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"devDependencies": {
|
||||
...,
|
||||
"appium": "^2.0.0",
|
||||
"your-driver": "file:.",
|
||||
...
|
||||
}
|
||||
"devDependencies": {
|
||||
...,
|
||||
"appium": "^2.0.0",
|
||||
"your-driver": "file:.",
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ These drivers are currently maintained by the Appium team:
|
||||
|[Mac2](https://github.com/appium/appium-mac2-driver)|`mac2`|macOS|Native|
|
||||
|[Safari](https://github.com/appium/appium-safari-driver)|`safari`|macOS, iOS|Web|
|
||||
|[UiAutomator2](https://github.com/appium/appium-uiautomator2-driver)|`uiautomator2`|Android|Native, Hybrid, Web|
|
||||
|[Windows](https://github.com/appium/appium-windows-driver)|`windows`|Windows|Native|
|
||||
|[XCUITest](https://github.com/appium/appium-xcuitest-driver)|`xcuitest`|iOS|Native, Hybrid, Web|
|
||||
|
||||
### Other Drivers
|
||||
@@ -41,7 +42,6 @@ These drivers are not maintained by the Appium team and can be used to target ad
|
||||
|[Roku](https://github.com/headspinio/appium-roku-driver)|`--source=npm @headspinio/appium-roku-driver`|Roku|Native|HeadSpin|
|
||||
|[Tizen](https://github.com/Samsung/appium-tizen-driver)|`--source=npm appium-tizen-driver`|Android|Native|Community / Samsung|
|
||||
|[TizenTV](https://github.com/headspinio/appium-tizen-tv-driver)|`--source=npm appium-tizen-tv-driver`|Samsung TV|Web|HeadSpin|
|
||||
|[Windows](https://github.com/appium/appium-windows-driver)|`--source=npm appium-windows-driver`|Windows|Native|Community / Microsoft|
|
||||
|[Youi](https://github.com/YOU-i-Labs/appium-youiengine-driver)|`--source=npm appium-youiengine-driver`|iOS, Android, macOS, Linux, tvOS|Native|Community / You.i|
|
||||
|
||||
!!! note
|
||||
|
||||
@@ -8,7 +8,7 @@ title: Appium-Related Tools
|
||||
There are several Appium tools that have been created to to assist with things not directly related
|
||||
to testing, such as Appium installation, test development, and more.
|
||||
|
||||
### Appium Inspector
|
||||
### [Appium Inspector](https://appium.github.io/appium-inspector/latest/)
|
||||
|
||||
Appium has a graphical client which can be used to inspect application screenshots, view the
|
||||
application hierarchy, run Appium commands, record app interactions, and more. It is very useful
|
||||
@@ -18,14 +18,20 @@ Find downloads and more information on its GitHub page: [Appium Inspector](https
|
||||
|
||||
### Appium Doctor
|
||||
|
||||
The `appium-doctor` CLI tool can be used to validate proper environment setup for Android and iOS
|
||||
automation, and identify any common configuration issues. It can be installed with `npm`:
|
||||
Appium Doctor is a command-line tool built into Appium drivers and plugins.
|
||||
The command is expected to be used to validate whether a driver or plugin has all of its prerequisites and other environment details set up correctly
|
||||
if the driver/plugin author implemented the `doctor` command.
|
||||
|
||||
```sh
|
||||
npm install -g @appium/doctor
|
||||
For example, `uiautomator2` driver provides the `doctor` command below.
|
||||
|
||||
```
|
||||
appium driver doctor uiautomator2
|
||||
```
|
||||
|
||||
Learn more on its GitHub page: [Appium Doctor](https://github.com/appium/appium/tree/master/packages/doctor)
|
||||
It shows no result if the driver/plugin author did not implement them.
|
||||
|
||||
More information on this command can be found in the [Command-Line Usage documentation](../cli/extensions.md#doctor).
|
||||
For driver/plugin developers, please read [Building Doctor Checks](../developing/build-doctor-checks.md).
|
||||
|
||||
### Other Tools
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
---
|
||||
title: Local Validation Of Extension PRs
|
||||
---
|
||||
|
||||
Sometimes it might be necessary to validate if a remote driver or a plugin PR works for the particular local
|
||||
environment before it is merged or published. This tutorial describes how to achieve that.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Recent LTS version of NodeJS. Check [Node.js main page](https://nodejs.org) for the download link.
|
||||
- Recent version of the Appium server. Use the following commands to ensure you have
|
||||
the latest version installed: `npm uninstall appium` and `npm install -g appium`.
|
||||
- [Git](https://git-scm.com/) should be available locally.
|
||||
|
||||
## Installation
|
||||
|
||||
- [Check out]((https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally)) the PR locally.
|
||||
There is also an option (although it is less flexible, because you won't be able to easily fetch
|
||||
any changes to this PR later) to simply [download](https://docs.github.com/en/repositories/working-with-files/using-files/downloading-source-code-archives) and unzip the sources
|
||||
locally. If you choose the later option then no `git` tool would be necessary.
|
||||
- Navigate to the local driver or plugin folder and run `npm i` from that folder.
|
||||
- Make sure you don't have the given driver or plugin already installed. Use the `appium driver uninstall <driver_name>`
|
||||
or `appium plugin uninstall <plugin_name>` CLI in order to delete any leftovers. The value of
|
||||
`<driver_name>`/`<plugin_name>` depends on the actual driver or plugin name the PR has been prepared for.
|
||||
If you are not sure which name you need to use then check the content of the `package.json` manifest,
|
||||
which must be always located under the root folder of the fetched sources. You should be looking for
|
||||
the `"appium" -> "driverName"` entry value there.
|
||||
- Change the current folder to the one, which is NOT the driver/plugin folder root or its subfolder.
|
||||
Also, make sure your current working folder does not contain any extra `package.json` file. If
|
||||
it does then simply navigate to any other folder that does not.
|
||||
- Run the following command in order to link the driver/plugin sources to the Appium server:
|
||||
`appium driver install --source=local <full_path_to_driver_folder_with_fetched_sources>` or
|
||||
`appium plugin install --source=local <full_path_to_plugin_folder_with_fetched_sources>`.
|
||||
- Stop the Appium server if it is running and start it again (`appium server --use-drivers=<driver_name>`)
|
||||
to check the list of loaded drivers. If the linking succeeded then you must see the driver name and the path to its
|
||||
parent folder in the server logs. In case of a plugin it is required to explicitly request
|
||||
this plugin to be loaded upon server startup: `appium server --use-plugins=<plugin_name>`.
|
||||
|
||||
## Update
|
||||
|
||||
After you have tested the PR and there are issues it might be necessary to update the local branch with
|
||||
the recent changes from Git. Follow the next steps for that:
|
||||
|
||||
- Navigate to the parent folder of your local driver/plugin and run `git pull`.
|
||||
- Stop Appium server if it is running.
|
||||
- Run `npm i` in the parent folder of your local driver/plugin to rebuild it and update any dependencies if necessary.
|
||||
- Start Appium server again similarly to how this is done in the corresponding [Installation](#installation) step above.
|
||||
|
||||
## Switching Back To a Stable Release
|
||||
|
||||
After the PR is merged there is no need to use the local plugin/driver deployment anymore, and it makes sense
|
||||
to switch back to the package managed by NPM. Follow the next steps for that:
|
||||
|
||||
- Unlink the installed driver/plugin from the server by running `appium driver uninstall <driver_name>` or
|
||||
`appium plugin uninstall <driver_name>`.
|
||||
- Delete the local source folder (`rm -rf <full_path_to_plugin_or_driver_folder_with_fetched_sources>`).
|
||||
- Install the driver or the plugin from NPM. Check the component README in order to find a proper command for that.
|
||||
@@ -16,7 +16,8 @@ bundle for each test.
|
||||
|
||||
Caching could be applied to application bundles generated by
|
||||
[`configureApp`](https://github.com/appium/appium/blob/master/packages/base-driver/lib/basedriver/helpers.js#L107) helper call.
|
||||
Inherited drivers can customize their caching logic by providing own `onPostProcess` property definition, but the general
|
||||
Inherited drivers can customize their caching logic by providing own `onPostProcess`
|
||||
(or both `inDownload` and `onPostProcess`) property definition, but the general
|
||||
rule of thumb is that we need to cache locally all application bundles need to be downloaded and/or extracted
|
||||
first before they could be actually installed on the device under test. On iOS, for example, these are `.ipa` or
|
||||
`.zip` compressed application bundles, or .`aab` on Android.
|
||||
@@ -26,18 +27,17 @@ first before they could be actually installed on the device under test. On iOS,
|
||||
In order to validate whether an app bundle downloaded from the given URL could be (re)used from the cache the following
|
||||
steps are applied:
|
||||
|
||||
1. The script is sending `HEAD` request to the given link in order to only fetch response headers. If this request fails/
|
||||
times out then no caching is applied.
|
||||
2. The following header values are being extracted: `Last-Modified`, `Cache-Control`. If no `Last-Modified` header is present
|
||||
or the header value cannot be parsed as a valid datetime then no caching is applied.
|
||||
3. The script checks if the given URL is already present in the cache. If the app is not cached yet then it gets downloaded
|
||||
and its current header values along with hashsum are added to the cache.
|
||||
4. If the URL was already in the cache then the script verifies that:
|
||||
- the current `Last-Modified` datetime is not different from the previous one
|
||||
- the difference between the current `Last-Modified` datetime and the cached one is not greater than max-age (if present)
|
||||
- the hashsum of the cached file/folder is not changed (e.g. it was not corrupted while sitting in the cache)
|
||||
5. If all validations above succeed then the cached build is returned, otherwise the currently cached entry gets
|
||||
deleted and a new one is downloaded instead.
|
||||
1. The script checks if the given URL is already present in the cache.
|
||||
If yes then it tries to fetch previously remembered
|
||||
[Last-Modified](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified)
|
||||
or [ETag](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) header values for it.
|
||||
2. If `ETag` value is present then it is put into
|
||||
[If-None-Match request header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match).
|
||||
Else if `Last-Modified` header value is present then it is put into
|
||||
[If-Modified-Since request header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since).
|
||||
Otherwise, no caching is applied.
|
||||
3. If the response status is equal to `304` then the previously cached binary is used,
|
||||
otherwise the cached entry is reset and refreshed.
|
||||
|
||||
## Caching of Local Application Bundles
|
||||
|
||||
@@ -55,9 +55,19 @@ The cache where the base driver keeps all application bundles is located in the
|
||||
on per-process basis, so each test session initialized in scope of the same Appium server process takes advantages
|
||||
of it. It is a [LRU Cache](https://www.npmjs.com/package/lru-cache) with the following limitations:
|
||||
|
||||
- Max items: 1024
|
||||
- Max time to live (TTL) for each entry: 24 hours
|
||||
- Max items: 1024. You may customize it by providing a new value to
|
||||
the [APPIUM_APPS_CACHE_MAX_ITEMS](../cli/env-vars.md) environment variable.
|
||||
Do not set it to a lower number than the amount of apps in all parallel sessions per process.
|
||||
- Max time to live (TTL) for each entry: 24 hours.
|
||||
You may customize it by providing a new value to the
|
||||
[APPIUM_APPS_CACHE_MAX_AGE](../cli/env-vars.md) environment variable.
|
||||
Do not set it to a lower number than the duration of a single session startup.
|
||||
- TTL is refreshed for each entry upon access
|
||||
- By default the full application URL is used as cache key. You may change this behavior
|
||||
by enabling the [APPIUM_APPS_CACHE_IGNORE_URL_QUERY](../cli/env-vars.md) environment variable.
|
||||
If the above option is enabled then the 'search' part of the app URL will be cut off from cache keys.
|
||||
See the corresponding [feature request](https://discuss.appium.io/t/regarding-app-caching-when-using-aws-s3-presigned-urls/42713)
|
||||
for more details.
|
||||
|
||||
!!! warning
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ hide:
|
||||
title: Welcome
|
||||
---
|
||||
<style>
|
||||
.md-typeset h1 {
|
||||
.md-typeset h1,
|
||||
.appium-sponsor-thanks {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
@@ -19,6 +20,31 @@ software, designed to facilitate UI automation of many app platforms, including
|
||||
Android, Tizen), browser (Chrome, Firefox, Safari), desktop (macOS, Windows), TV (Roku, tvOS,
|
||||
Android TV, Samsung), and more!
|
||||
|
||||
|
||||
<div style="text-align: center; margin-top: 2rem; font-style: italic;">
|
||||
Appium is extremely grateful for the support of its key partners! (Learn more about our
|
||||
sponsorship program and contributor compensation scheme <a
|
||||
href="https://github.com/appium/appium/blob/master/GOVERNANCE.md#sponsorship">here</a>)
|
||||
<div class="homepageSponsors">
|
||||
<div class="homepageSponsor">
|
||||
<a href="https://www.headspin.io/solutions/appium-mobile-test-automation">
|
||||
<img src="assets/images/sponsor-logo-headspin.png" style="width: 200px;" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="homepageSponsor">
|
||||
<a href="https://www.browserstack.com/browserstack-appium?utm_campaigncode=701OW00000AoUTQYA3&utm_medium=partnered&utm_source=appium">
|
||||
<img src="assets/images/sponsor-logo-browserstack-dark.png#only-dark" style="width: 220px;" />
|
||||
<img src="assets/images/sponsor-logo-browserstack-light.png#only-light" style="width: 220px;" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="homepageSponsor">
|
||||
<a href="https://saucelabs.com/resources/blog/appium-strategic-partner">
|
||||
<img src="assets/images/sponsor-logo-sauce.png" style="width: 200px;" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
## Explore the Documentation
|
||||
|
||||
<div class="grid cards" markdown>
|
||||
|
||||
@@ -32,7 +32,7 @@ driver install`.
|
||||
So, from a technical perspective, an Appium driver is just a bit of code that inherits from some
|
||||
other Appium code. That's it! Now, inheriting from `BaseDriver` actually gives us a lot, because
|
||||
`BaseDriver` is essentially an encapsulation of the entire WebDriver protocol. So all a driver
|
||||
needs to do to do something useful is to *implement* Node.js methods with names corresponding to
|
||||
needs to do something useful is to *implement* Node.js methods with names corresponding to
|
||||
their WebDriver protocol equivalents.
|
||||
|
||||
So let's say I wanted to do something with this empty driver; first I have to decide which
|
||||
|
||||
@@ -12,10 +12,10 @@ running Appium and writing Appium scripts.
|
||||
The basic plan for this quickstart is as follows:
|
||||
|
||||
1. Install Appium
|
||||
1. Install an Appium driver and its dependencies (we'll be using the [UiAutomator2
|
||||
driver](https://github.com/appium/appium-uiautomator2-driver) for these examples)
|
||||
1. Install an Appium client library in your language of choice (this guide contains options for
|
||||
JavaScript, Python, Java, Ruby, and .NET).
|
||||
1. Install an Appium driver and its dependencies
|
||||
- This guide provides instructions for the [UiAutomator2 driver](https://github.com/appium/appium-uiautomator2-driver)
|
||||
1. Install an Appium client library in your language of choice
|
||||
- This guide contains options for JavaScript, Python, Java, Ruby, and .NET
|
||||
1. Write and run a simple Appium automation script using a sample application
|
||||
|
||||
### Requirements
|
||||
|
||||
@@ -9,33 +9,42 @@ title: Install Appium
|
||||
|
||||
Before installing, make sure to check the [System Requirements](./requirements.md).
|
||||
|
||||
You can install Appium globally using `npm`:
|
||||
Appium can be installed globally using `npm`:
|
||||
|
||||
```bash
|
||||
npm i -g appium
|
||||
npm install -g appium
|
||||
```
|
||||
|
||||
!!! note
|
||||
|
||||
Other package managers are not currently supported.
|
||||
|
||||
After installation, you should be able to run Appium from the command line:
|
||||
## Starting Appium
|
||||
|
||||
Appium can be started [using the command line](../cli/index.md):
|
||||
|
||||
```
|
||||
appium
|
||||
```
|
||||
|
||||
You should see some output that starts with a line like this:
|
||||
This launches the Appium server process, which loads all the installed Appium drivers, and
|
||||
begins waiting for new session requests from client connections (such as test automation scripts).
|
||||
Since the server process is independent from its clients, it must be explicitly launched before
|
||||
attempting to start a new session.
|
||||
|
||||
When the server is launched, the console log will list all the valid URLs that clients can use to
|
||||
connect to this server:
|
||||
|
||||
```
|
||||
[Appium] Welcome to Appium v2.4.1
|
||||
[Appium] You can provide the following URLs in your client code to connect to this server:
|
||||
[Appium] http://127.0.0.1:4723/ (only accessible from the same host)
|
||||
(... any other URLs ...)
|
||||
```
|
||||
|
||||
In order to update Appium using `npm`:
|
||||
Once a client requests a new session, the Appium server process will start logging all details about
|
||||
this session until its termination. Keep this in mind - if you ever encounter issues with Appium
|
||||
tests, you can always check the server log for more details.
|
||||
|
||||
```bash
|
||||
npm update -g appium
|
||||
```
|
||||
|
||||
That's it! If you see this, the Appium server is up and running. Go ahead and quit
|
||||
it (Ctrl-C) and move on to the [next step](./uiauto2-driver.md), where we'll install a driver for automating Android apps.
|
||||
So what's next? Even though Appium is installed and running, it does not come bundled with any
|
||||
drivers, which means it cannot automate anything yet. We will therefore set up automation for
|
||||
Android - continue to [Installing the UiAutomator2 Driver](./uiauto2-driver.md).
|
||||
|
||||
@@ -9,6 +9,7 @@ The basic requirements for the Appium server are:
|
||||
|
||||
* A macOS, Linux, or Windows operating system
|
||||
* [Node.js](https://nodejs.org) version in the [SemVer](https://semver.org) range `^14.17.0 || ^16.13.0 || >=18.0.0`
|
||||
* LTS is recommended
|
||||
* [`npm`](https://npmjs.com) version `>=8` (`npm` is usually bundled with Node.js, but can be upgraded
|
||||
independently)
|
||||
|
||||
@@ -23,6 +24,6 @@ documentation of the [Appium driver(s)](../ecosystem/drivers.md) for that platfo
|
||||
dependencies. It is almost universally the case that Appium drivers for a given platform will
|
||||
require the developer toolchain and SDKs for that platform to be installed.
|
||||
|
||||
You may find it useful to use the `appium-doctor` tool for verifying if all driver requirements are
|
||||
installed. It can check the prerequisites for Android and iOS drivers.
|
||||
Learn more on its GitHub page: [Appium Doctor](https://github.com/appium/appium/tree/master/packages/doctor)
|
||||
In order to assist with driver requirements, each (official) driver comes with the Appium Doctor tool,
|
||||
which allows to verify if all requirements have been set up. Learn more about how to use this tool in
|
||||
the [Command-Line Usage documentation](../cli/extensions.md#doctor).
|
||||
|
||||
@@ -60,8 +60,14 @@ set up on your system, so you can get busy making Android apps if you want!
|
||||
|
||||
## Install the driver itself
|
||||
|
||||
Since the UiAutomator2 driver is maintained by the core Appium team, it has an 'official' driver
|
||||
name that you can use to install it easily via the [Appium Extension CLI](../cli/extensions.md):
|
||||
### Standard Install
|
||||
|
||||
Like all Appium drivers, the UiAutomator2 driver is installed via the [Appium Extension CLI](../cli/extensions.md).
|
||||
Since UiAutomator2 is maintained by the core Appium team, it has an 'official' driver name
|
||||
(`uiautomator2`), which makes the installation simpler.
|
||||
|
||||
Before installing, make sure your Appium server is _not_ running (if it is, quit it with _Ctrl-C_).
|
||||
Then run the following command:
|
||||
|
||||
```bash
|
||||
appium driver install uiautomator2
|
||||
@@ -77,11 +83,9 @@ Driver uiautomator2@2.0.5 successfully installed
|
||||
- platformNames: ["Android"]
|
||||
```
|
||||
|
||||
Running this command will locate and install the latest version of the UiAutomator2 driver, making
|
||||
it available for automation. Note that when it is installed it tells you what platforms it is valid
|
||||
for (in this case, `Android`), and what automation name (the `appium:automationName`
|
||||
[capability](../guides/caps.md)) must be used to select this driver for use during an Appium
|
||||
session (in this case, `UiAutomator2`).
|
||||
Note how the installation process specifies what platforms is the driver valid for (in this case,
|
||||
`Android`), and what automation name (the `appium:automationName` [capability](../guides/caps.md))
|
||||
must be used to select this driver for use during an Appium session (in this case, `UiAutomator2`).
|
||||
|
||||
!!! note
|
||||
|
||||
@@ -90,6 +94,34 @@ session (in this case, `UiAutomator2`).
|
||||
prefer to use `npm` to manage Appium and its connected drivers. To learn more about this
|
||||
technique, visit the guide on [managing Appium extensions](../guides/managing-exts.md).
|
||||
|
||||
### Batch Install
|
||||
|
||||
You may want to use Appium with more than one driver. One way to accomplish this is to run
|
||||
`appium driver install <driver-name>` for each individual driver, but you can also install multiple
|
||||
drivers in one go:
|
||||
|
||||
```
|
||||
appium setup
|
||||
```
|
||||
|
||||
Running this will install Appium's mobile-specific drivers: UiAutomator2, [XCUITest](https://appium.github.io/appium-xcuitest-driver/)
|
||||
(only if running macOS), and [Espresso](https://github.com/appium/appium-espresso-driver).
|
||||
|
||||
You can also use this command to batch install drivers for desktop applications or desktop browsers.
|
||||
For more details on this, refer to the [Setup command documentation](../cli/setup.md).
|
||||
|
||||
### Validating the Install
|
||||
|
||||
The UiAutomator2 driver, like all official Appium drivers, comes with the Appium Doctor tool, which
|
||||
allows validating whether all prerequisites have been set up correctly:
|
||||
|
||||
```
|
||||
appium driver doctor uiautomator2
|
||||
```
|
||||
|
||||
This guide has focused on essential requirements, so Appium Doctor may suggest one or more optional
|
||||
fixes. But if you see `0 required fixes needed`, that means everything is set up!
|
||||
|
||||
Now, start the Appium server again (run `appium`), and you should see that the newly-installed
|
||||
driver is listed as available:
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# Blog
|
||||
|
||||
@@ -8,6 +8,7 @@ theme:
|
||||
language: en
|
||||
nav:
|
||||
- Welcome: index.md
|
||||
- Blog: blog/index.md
|
||||
- Introduction:
|
||||
- intro/index.md
|
||||
- Background:
|
||||
@@ -38,6 +39,7 @@ nav:
|
||||
- cli/args.md
|
||||
- cli/env-vars.md
|
||||
- cli/extensions.md
|
||||
- cli/setup.md
|
||||
- Command Reference:
|
||||
- commands/index.md
|
||||
- commands/base-driver.md
|
||||
@@ -50,6 +52,7 @@ nav:
|
||||
- guides/migrating-1-to-2.md
|
||||
- Server/Driver Configuration:
|
||||
- guides/managing-exts.md
|
||||
- guides/branch-testing.md
|
||||
- guides/config.md
|
||||
- guides/security.md
|
||||
- guides/log-filters.md
|
||||
|
||||
@@ -9,12 +9,12 @@ theme:
|
||||
nav:
|
||||
- 首页: index.md
|
||||
- 简介:
|
||||
- 介绍 Appium:
|
||||
- Appium 概述: intro/index.md
|
||||
- intro/index.md
|
||||
- 背景:
|
||||
- intro/appium.md
|
||||
- intro/drivers.md
|
||||
- intro/clients.md
|
||||
- intro/requirements.md
|
||||
- 历史: intro/history.md
|
||||
- intro/history.md
|
||||
- 快速开始:
|
||||
- quickstart/index.md
|
||||
- quickstart/install.md
|
||||
|
||||
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 9.9 KiB |
@@ -0,0 +1,31 @@
|
||||
.md-source__fact--version {
|
||||
display: none;
|
||||
}
|
||||
.md-source__fact:nth-child(1n + 2):before {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
|
||||
.appium-sponsor-thanks {
|
||||
width: 100%;
|
||||
margin: 0.5rem 0.6rem auto 0.6rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.appium-sponsor-thanks img {
|
||||
margin: auto 6px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.homepageSponsors {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 10px auto;
|
||||
max-width: 800px;
|
||||
}
|
||||
|
||||
.homepageSponsor {
|
||||
flex: 1;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<!-- Footer -->
|
||||
<footer class="md-footer">
|
||||
|
||||
<!-- Link to previous and/or next page -->
|
||||
{% if "navigation.footer" in features %}
|
||||
{% if page.previous_page or page.next_page %}
|
||||
{% if page.meta and page.meta.hide %}
|
||||
{% set hidden = "hidden" if "footer" in page.meta.hide %}
|
||||
{% endif %}
|
||||
<nav
|
||||
class="md-footer__inner md-grid"
|
||||
aria-label="{{ lang.t('footer') }}"
|
||||
{{ hidden }}
|
||||
>
|
||||
|
||||
<!-- Link to previous page -->
|
||||
{% if page.previous_page %}
|
||||
{% set direction = lang.t("footer.previous") %}
|
||||
<a
|
||||
href="{{ page.previous_page.url | url }}"
|
||||
class="md-footer__link md-footer__link--prev"
|
||||
aria-label="{{ direction }}: {{ page.previous_page.title | e }}"
|
||||
>
|
||||
<div class="md-footer__button md-icon">
|
||||
{% set icon = config.theme.icon.previous or "material/arrow-left" %}
|
||||
{% include ".icons/" ~ icon ~ ".svg" %}
|
||||
</div>
|
||||
<div class="md-footer__title">
|
||||
<span class="md-footer__direction">
|
||||
{{ direction }}
|
||||
</span>
|
||||
<div class="md-ellipsis">
|
||||
{{ page.previous_page.title }}
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<!-- Link to next page -->
|
||||
{% if page.next_page %}
|
||||
{% set direction = lang.t("footer.next") %}
|
||||
<a
|
||||
href="{{ page.next_page.url | url }}"
|
||||
class="md-footer__link md-footer__link--next"
|
||||
aria-label="{{ direction }}: {{ page.next_page.title | e }}"
|
||||
>
|
||||
<div class="md-footer__title">
|
||||
<span class="md-footer__direction">
|
||||
{{ direction }}
|
||||
</span>
|
||||
<div class="md-ellipsis">
|
||||
{{ page.next_page.title }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-footer__button md-icon">
|
||||
{% set icon = config.theme.icon.next or "material/arrow-right" %}
|
||||
{% include ".icons/" ~ icon ~ ".svg" %}
|
||||
</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Further information -->
|
||||
<div class="md-footer-meta md-typeset">
|
||||
<div class="md-footer-meta__inner md-grid">
|
||||
<!-- Sponsor thanks -->
|
||||
{% include "partials/sponsors.html" %}
|
||||
|
||||
{% include "partials/copyright.html" %}
|
||||
|
||||
<!-- Social links -->
|
||||
{% if config.extra.social %}
|
||||
{% include "partials/social.html" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
@@ -0,0 +1,15 @@
|
||||
<div class="appium-sponsor-thanks">
|
||||
Supported by
|
||||
|
||||
<a href="https://www.headspin.io/solutions/appium-mobile-test-automation">
|
||||
<img src="/docs/en/latest/assets/images/sponsor-logo-headspin.png" />
|
||||
</a>
|
||||
|
||||
<a href="https://www.browserstack.com/browserstack-appium?utm_campaigncode=701OW00000AoUTQYA3&utm_medium=partnered&utm_source=appium">
|
||||
<img src="/docs/en/latest/assets/images/sponsor-logo-browserstack-dark.png" />
|
||||
</a>
|
||||
|
||||
<a href="https://saucelabs.com/resources/blog/appium-strategic-partner">
|
||||
<img src="/docs/en/latest/assets/images/sponsor-logo-sauce.png" />
|
||||
</a>
|
||||
</div>
|
||||
@@ -20,7 +20,6 @@ const {
|
||||
DOCS_REMOTE,
|
||||
LATEST_ALIAS,
|
||||
} = require('./utils');
|
||||
const copyAssets = require('./copy-assets');
|
||||
const path = require('path');
|
||||
const semver = require('semver');
|
||||
const {version} = require('../../package.json');
|
||||
@@ -35,8 +34,6 @@ const push = Boolean(process.env.APPIUM_DOCS_PUBLISH);
|
||||
async function main() {
|
||||
log.info(`Building Appium docs and committing to ${DOCS_BRANCH}`);
|
||||
|
||||
await copyAssets();
|
||||
|
||||
const semVersion = semver.parse(version);
|
||||
if (!semVersion) {
|
||||
throw new Error(`Could not parse Appium version "${version}" as semver`);
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* This script copies generic assets from `ASSETS_DIR` to each docs language dir.
|
||||
*/
|
||||
|
||||
// @ts-check
|
||||
|
||||
// for simplicity this file is not transpiled and is run directly via an npm script
|
||||
/* eslint-disable promise/prefer-await-to-callbacks */
|
||||
/* eslint-disable promise/prefer-await-to-then */
|
||||
|
||||
const {fs} = require('@appium/support');
|
||||
const {log, LANGS, DOCS_DIR, ASSETS_DIR} = require('./utils');
|
||||
const path = require('path');
|
||||
|
||||
async function main() {
|
||||
log.info('Copying generic assets to docs language dirs');
|
||||
|
||||
for (const lang of LANGS) {
|
||||
const langPath = path.join(DOCS_DIR, lang);
|
||||
const langAssetPath = path.join(langPath, 'assets');
|
||||
log.info(`Deleting ${langAssetPath}`);
|
||||
await fs.rimraf(langAssetPath);
|
||||
log.info(`Copying assets into ${langAssetPath}`);
|
||||
await fs.copyFile(ASSETS_DIR, langAssetPath);
|
||||
}
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
main().catch((err) => {
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = main;
|
||||
@@ -0,0 +1,2 @@
|
||||
# Blog
|
||||
|
||||
@@ -1,6 +1,32 @@
|
||||
---
|
||||
title: Appium 概述
|
||||
hide:
|
||||
- toc
|
||||
|
||||
title: Appium in a Nutshell
|
||||
---
|
||||
正如主页上提到的那样,Appium旨在支持许多不同平台(移动、网络、桌面等)的UI自动化。不仅如此,它还旨在支持用不同语言(JS、Java、Python等)编写的自动化代码。将所有这些功能结合到一个程序中是一项非常艰巨、甚至不可能的任务!
|
||||
|
||||
为了实现这一目标,Appium实际上被分为四个部分:
|
||||
|
||||
TODO
|
||||
<div class="grid cards" markdown>
|
||||
- :material-image-filter-center-focus-strong: __Appium Core__ - 定义核心API
|
||||
- :material-car: __Drivers__ - 实现与特定平台的连接
|
||||
- :octicons-code-16: __Clients__ - 实现与特定平台的连接
|
||||
- :fontawesome-solid-plug: __Plugins__ - 更改或扩展Appium的核心功能
|
||||
</div>
|
||||
|
||||
因此,为了开始使用Appium自动化某些内容,您需要:
|
||||
- 安装Appium本身
|
||||
- 为您的目标平台安装驱动程序
|
||||
- 为您的目标编程语言安装客户端库
|
||||
- (可选)安装一个或多个插件
|
||||
|
||||
这些都是基础!如果您准备好加入,请继续[快速入门](../quickstart/index.md)!
|
||||
|
||||
如果您想了解有关其运作方式的更多详细信息,请参阅以下页面了解背景材料:
|
||||
|
||||
- [Appium Core](./appium.md)
|
||||
- [Appium Drivers](./drivers.md)
|
||||
- [Appium Clients](./clients.md)
|
||||
|
||||
最后,要了解Appium的起源,请查看[Appium项目历史](./history.md)。
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
---
|
||||
title: Appium Requirements
|
||||
---
|
||||
|
||||
|
||||
TODO
|
||||
@@ -1,5 +1,23 @@
|
||||
---
|
||||
title: Write a Test (Java)
|
||||
hide:
|
||||
- toc
|
||||
|
||||
title: 编写一个测试(Java)
|
||||
---
|
||||
|
||||
TODO
|
||||
Appium 团队为 Java 编程语言维护一个官方[客户端](https://github.com/appium/java-client).
|
||||
它是建立在 [Selenium](https://github.com/SeleniumHQ/selenium)上的.
|
||||
您也可以在 Kotlin 项目中使用该客户端.
|
||||
|
||||
遵循[在测试框架中添加 Appium Java 客户端](https://github.com/appium/java-client#add-appium-java-client-to-your-test-framework)
|
||||
教程,以便将该库连接到测试框架源。
|
||||
|
||||
Appium Java 客户端有专门的类来支持大多数官方 Appium 驱动程序。对于其他驱动程序
|
||||
您只需使用 [AppiumDriver](https://github.com/appium/java-client/blob/master/src/main/java/io/appium/java_client/AppiumDriver.java)类
|
||||
或在此基础上创建您的自定义衍生工具. 请查看 [驱动支持](https://github.com/appium/java-client#drivers-support)
|
||||
文章,了解有关当前驱动程序类实现的更多信息.
|
||||
|
||||
请参阅 [使用实例](https://github.com/appium/java-client#usage-examples) 一文,以了解
|
||||
如何从测试框架调用 Java 客户端功能。
|
||||
|
||||
成功运行测试后,您可以继续阅读以下内容 [下一步骤](./next-steps.md) 继续探索
|
||||
|
||||
@@ -1,6 +1,73 @@
|
||||
---
|
||||
title: Write a Test (JS)
|
||||
hide:
|
||||
- toc
|
||||
|
||||
title: 编写一个测试 (JS)
|
||||
---
|
||||
|
||||
要在 JavaScript(Node.js)中编写 Appium 测试,我们需要选择一个与 Appium 兼容的客户端
|
||||
库。维护最好的库和 Appium 团队推荐使用的库是
|
||||
[WebdriverIO](https://webdriver.io), 所有就让我们使用它吧。既然我们已经安装了 Appium,我们
|
||||
已经满足了 Node 和 NPM 的要求。因此,只需在计算机上创建一个新的项目目录
|
||||
然后在其中初始化一个新的 Node.js 项目:
|
||||
|
||||
TODO
|
||||
```bash
|
||||
npm init
|
||||
```
|
||||
|
||||
您在提示中输入什么内容并不重要,只要您最终得到一个有效的
|
||||
`package.json`.
|
||||
|
||||
|
||||
现在,通过 NPM 安装 `webdriverio` 软件包:
|
||||
|
||||
```bash
|
||||
npm i --save-dev webdriverio
|
||||
```
|
||||
|
||||
完成上述操作后,您的 `package.json` 文件应包含类似以下内容的部分:
|
||||
|
||||
```json title="package.json"
|
||||
--8<-- "./sample-code/quickstarts/js/package.json"
|
||||
```
|
||||
|
||||
现在是编写测试本身的时候了。创建一个名为 `test.js` 的新文件,内容如下:
|
||||
|
||||
```js title="test.js"
|
||||
--8<-- "./sample-code/quickstarts/js/test.js"
|
||||
```
|
||||
|
||||
!!! 注意
|
||||
|
||||
本指南的范围不包括完整介绍 WebdriverIO 客户端
|
||||
库或这里发生的一切,因此我们暂且不对代码本身进行详细解释。
|
||||
所以目前我们暂时不对代码本身进行详细解释。您可能需要特别阅读 Appium
|
||||
[能力](../guides/caps.md), 除了熟悉优秀的
|
||||
[WebdriverIO 文档](https://webdriver.io/docs/gettingstarted) 来获得更全面的解释,
|
||||
你还可以看到的各种 API 命令以及用途。
|
||||
|
||||
!!! 注意
|
||||
|
||||
示例代码可从 [GitHub Appium repository](https://github.com/appium/appium/tree/master/packages/appium/sample-code/quickstarts/js).
|
||||
|
||||
|
||||
基本上,这段代码正在执行以下操作:
|
||||
|
||||
1. 定义一组 "Capabilities" 能力值(参数),以便 Appium 知道您想自动执行哪种任务。
|
||||
要自动执行的任务。
|
||||
1. 在内置的 Android 设置应用程序上启动 Appium 会话。
|
||||
1. 找到 "Battery"列表项并点击它。
|
||||
1. 停顿片刻,纯粹是为了观察自动化视觉效果。
|
||||
1. 结束 Appium 会话。
|
||||
|
||||
就是这样!让我们试一试吧。运行测试前,请确保您的 Appium 服务器
|
||||
在另一个终端会话中运行,否则会出现一个有关无法连接到 Appium 服务器的错误。
|
||||
然后,你就可以执行脚本了:
|
||||
|
||||
```bash
|
||||
node test.js
|
||||
```
|
||||
|
||||
如果一切顺利,在应用再次关闭之前,你会看到 "设置 "应用打开并导航到 "Battery "视图
|
||||
|
||||
恭喜您,您已经开始了 Appium 之旅!请继续阅读一些 [下一步骤](./next-steps.md) 继续探索.
|
||||
|
||||
@@ -1,6 +1,50 @@
|
||||
---
|
||||
title: Write a Test (Python)
|
||||
hide:
|
||||
- toc
|
||||
|
||||
title: 编写一个测试 (Python)
|
||||
---
|
||||
[Appium Python Client](https://github.com/appium/python-client) 是官方的Appium Python客户端,可通过pypi里包名为[Appium-Python-Client](https://pypi.org/project/Appium-Python-Client/)进行安装。
|
||||
它继承自 [Selenium Python Binding](https://pypi.org/project/selenium/),
|
||||
因此安装Appium Python客户端时会包含selenium绑定。
|
||||
|
||||
```bash
|
||||
pip install Appium-Python-Client
|
||||
```
|
||||
|
||||
TODO
|
||||
这个示例使用Python内置的`unittest`模块,尽管你可以使用任何你想要的Python测试框架。
|
||||
Appium Python客户端自动添加`appium:`供应商前缀。
|
||||
通常你不需要担心前缀。
|
||||
|
||||
```python title="test.py"
|
||||
--8<-- "./sample-code/quickstarts/py/test.py"
|
||||
```
|
||||
|
||||
!!! note
|
||||
|
||||
在本指南中,我们不会详细解释Python客户端库或这里发生的所有事情,因此现在不对代码本身进行详细说明。
|
||||
|
||||
- 你可能想要特别了解一下Appium [Capabilities](../guides/caps.md)。
|
||||
- Python客户端GitHub仓库中的[功能测试代码](https://github.com/appium/python-client/tree/master/test/functional)应该有助于找到更多的工作示例。
|
||||
- [文档](https://appium.github.io/python-client-sphinx/)也有助于找到在Appium Python客户端中定义的方法。
|
||||
|
||||
!!! note
|
||||
|
||||
示例代码可从 [GitHub Appium仓库](https://github.com/appium/appium/tree/master/packages/appium/sample-code/quickstarts/py) 获取。
|
||||
|
||||
基本上,这段代码正在做以下事情:
|
||||
|
||||
1. 定义一组“Capabilities”(参数),发送到Appium服务器,以便Appium知道你想要自动化的事物类型。
|
||||
2. 在内置的 Android 设置应用程序上启动 Appium 会话。
|
||||
3. 查找“Battery”列表项并点击它。
|
||||
4. 停顿片刻,纯粹是为了观察自动化视觉效果。。
|
||||
5. 结束Appium会话。
|
||||
|
||||
就这些!让我们试一试。在运行测试之前,请确保你有一个Appium服务器在另一个终端会话中运行,否则你将收到无法连接到服务器的错误。然后,你可以执行脚本:
|
||||
|
||||
```bash
|
||||
python test.py
|
||||
```
|
||||
|
||||
如果一切顺利,在应用再次关闭之前,你会看到 "设置 "应用打开并导航到 "Battery "视图。
|
||||
恭喜您,您已经开始了您的Appium之旅了!继续阅读一些[下一步骤](./next-steps.md)来探索它吧。
|
||||
|
||||
@@ -1,6 +1,86 @@
|
||||
---
|
||||
title: Install the UiAutomator2 Driver
|
||||
---
|
||||
|
||||
title: 安装 UiAutomator2 驱动
|
||||
|
||||
TODO
|
||||
---
|
||||
|
||||
如果没有[驱动](../intro/drivers.md),你几乎无法使用 Appium,驱动是允许 Appium 自动化特定平台的接口。
|
||||
|
||||
!!! info
|
||||
|
||||
在本快速入门指南中,我们将自动化一个 Android 平台的应用,因为通过 Appium 进行 Android 自动化的系统要求与 Appium 本身相同(而 iOS 驱动例如,需要你使用 macOS)。
|
||||
|
||||
我们将使用的驱动称为 [UiAutomator2 驱动](https://github.com/appium/appium-uiautomator2-driver)。值得访问该驱动的文档并将其加入书签,因为这将是今后不可或缺的参考资料。
|
||||
|
||||
## 设置 Android 自动化要求
|
||||
|
||||
根据驱动的要求,除了一个运行中的 Appium 服务器,我们还需要设置以下内容:
|
||||
|
||||
### Android SDK
|
||||
|
||||
- 设置 Android SDK 要求的最简单方法是下载 [Android Studio](https://developer.android.com/studio)。
|
||||
我们需要使用其 SDK 管理器 (_设置 -> 外观和行为 -> 系统设置 -> Android SDK_) 来下载以下项目:
|
||||
- Android SDK 平台(选择我们想要自动化的任何 Android 平台,例如,API 级别 30)
|
||||
- Android SDK 平台工具
|
||||
- 如果愿意,你也可以不通过 Android Studio 下载这些项目:
|
||||
- 可以使用 [Android 命令行工具](https://developer.android.com/studio#command-line-tools-only) 中包含的 `sdkmanager` 下载 Android SDK 平台
|
||||
- [Android SDK 平台工具](https://developer.android.com/tools/releases/platform-tools)
|
||||
- 设置 `ANDROID_HOME` 环境变量,指向安装 Android SDK 的目录。通常可以在 Android Studio 的 SDK 管理器中找到这个目录的路径。它将包含 `platform-tools` 和其他目录。
|
||||
|
||||
### Java JDK
|
||||
|
||||
- 安装 Java JDK(对于最新的 Android API 级别,需要 JDK 9,否则需要 JDK 8)。你可以从 [Oracle](https://jdk.java.net/) 或 [Adoptium](https://adoptium.net/en-GB/temurin/releases/) 下载。
|
||||
确保下载的是 JDK 而不是 JRE。
|
||||
- 设置 `JAVA_HOME` 环境变量,指向 JDK 的安装目录。它将包含 `bin`、`include` 和其他目录。
|
||||
|
||||
### 准备设备
|
||||
|
||||
- 如果使用模拟器,使用 Android Studio 创建并启动一个 Android 虚拟设备 (AVD)。
|
||||
你可能需要下载你想要创建的模拟器的 API 级别的系统镜像。使用 Android Studio 中的 AVD 创建向导通常是完成所有这些操作的最简单方式。
|
||||
- 如果使用真实设备,应该[为开发设置并启用 USB 调试](https://developer.android.com/studio/debug/dev-options)。
|
||||
- 连接模拟器或设备后,你可以运行 `adb devices`(通过位于 `$ANDROID_HOME/platform-tools/adb` 的二进制文件)来验证你的设备是否显示为已连接。
|
||||
|
||||
一旦你的设备在 `adb` 中显示为已连接,并且你已验证环境变量设置正确,你就可以开始了!如果在这些步骤中遇到任何问题,请参考驱动文档,或必要时查看各种 Android 或 Java 文档网站。
|
||||
|
||||
此外,恭喜你:不管你是否打算,你现在已经在你的系统上设置了 Android 开发者工具链,所以你可以开始制作 Android 应用了!
|
||||
|
||||
## 安装驱动本身
|
||||
|
||||
由于 UiAutomator2 驱动是由核心 Appium 团队维护的,它有一个官方的驱动名称,你可以通过 [Appium 扩展 CLI](../cli/extensions.md) 轻松安装:
|
||||
|
||||
```bash
|
||||
appium driver install uiautomator2
|
||||
```
|
||||
|
||||
它应该产生类似下面的输出:
|
||||
|
||||
```
|
||||
Attempting to find and install driver 'uiautomator2'
|
||||
✔ Installing 'uiautomator2' using NPM install spec 'appium-uiautomator2-driver'
|
||||
Driver uiautomator2@2.0.5 successfully installed
|
||||
- automationName: UiAutomator2
|
||||
- platformNames: ["Android"]
|
||||
```
|
||||
|
||||
运行此命令将定位并安装 UiAutomator2 驱动的最新版本,使其可用于自动化。请注意,当安装时,它会告诉你哪些平台它适用(在这种情况下是 `Android`),以及在 Appium 会话中使用此驱动时必须使用的自动化名称(在这种情况下是 `UiAutomator2` 的 `appium:automationName` [capability](../guides/caps.md))。
|
||||
|
||||
!!! note
|
||||
|
||||
在这个快速入门中,我们使用了 [扩展 CLI](../cli/extensions.md) 来安装 UiAutomator2 驱动,但如果你将 Appium 集成到一个 Node.js 项目中,你可能更喜欢使用 `npm` 来管理 Appium 及其相关驱动。要了解更多关于这种技术的信息,请访问关于[管理 Appium 扩展](../guides/managing-exts.md)的指南。
|
||||
|
||||
现在,再次启动 Appium 服务器(运行 `appium`),你应该看到新安装的驱动被列为可用:
|
||||
|
||||
```
|
||||
[Appium] Available drivers:
|
||||
[Appium] - uiautomator2@2.0.5 (automationName 'UiAutomator2')
|
||||
```
|
||||
|
||||
Android 设置完成并且 UiAutomator2 驱动已安装后,你就可以编写你的第一个测试了!现在选择你喜欢的语言并试一试:
|
||||
|
||||
<div class="grid cards" markdown>
|
||||
|
||||
- :material-language-javascript: [__JavaScript__](./test-js.md)
|
||||
- :material-language-java: [__Java__](./test-java.md)
|
||||
- :material-language-python: [__Python__](./test-py.md)
|
||||
|
||||
</div>
|
||||
|
||||
@@ -21,6 +21,10 @@ import {getDefaultsForExtension} from './schema';
|
||||
import {DRIVER_TYPE, BIDI_BASE_PATH, BIDI_EVENT_NAME} from './constants';
|
||||
import WebSocket from 'ws';
|
||||
|
||||
const MIN_WS_CODE_VAL = 1000;
|
||||
const MAX_WS_CODE_VAL = 1015;
|
||||
const WS_FALLBACK_CODE = 1011; // server encountered an error while fulfilling request
|
||||
|
||||
const desiredCapabilityConstraints = /** @type {const} */ ({
|
||||
automationName: {
|
||||
presence: true,
|
||||
@@ -418,6 +422,16 @@ class AppiumDriver extends DriverCore {
|
||||
`Upstream bidi socket closed connection (code ${code}, reason: '${reason}'). ` +
|
||||
`Closing proxy connection to client`,
|
||||
);
|
||||
if (!_.isNumber(code)) {
|
||||
code = parseInt(code, 10);
|
||||
}
|
||||
if (_.isNaN(code) || code < MIN_WS_CODE_VAL || code > MAX_WS_CODE_VAL) {
|
||||
this.log.warn(
|
||||
`Received code ${code} from upstream socket, but this is not a valid ` +
|
||||
`websocket code. Rewriting to ${WS_FALLBACK_CODE} for ws compatibility`,
|
||||
);
|
||||
code = WS_FALLBACK_CODE;
|
||||
}
|
||||
ws.close(code, reason);
|
||||
});
|
||||
|
||||
@@ -1085,7 +1099,7 @@ class AppiumDriver extends DriverCore {
|
||||
// is to do the proxy and retrieve the result internally so it can be passed to the plugin
|
||||
// in case it calls 'await next()'. This requires that the driver have defined
|
||||
// 'proxyCommand' and not just 'proxyReqRes'.
|
||||
if (!dstSession.proxyCommand) {
|
||||
if (!dstSession?.proxyCommand) {
|
||||
throw new NoDriverProxyCommandError();
|
||||
}
|
||||
return await dstSession.proxyCommand(
|
||||
@@ -1106,7 +1120,7 @@ class AppiumDriver extends DriverCore {
|
||||
}
|
||||
|
||||
// here we know that we are executing a session command, and have a valid session driver
|
||||
return await dstSession.executeCommand(cmd, ...args);
|
||||
return await /** @type {any} */ (dstSession).executeCommand(cmd, ...args);
|
||||
};
|
||||
|
||||
// now take our default behavior, wrap it with any number of plugin behaviors, and run it
|
||||
|
||||
@@ -290,6 +290,16 @@ const serverArgsDisallowedInConfig = new Map([
|
||||
help: 'Show info about the Appium build and exit',
|
||||
},
|
||||
],
|
||||
[
|
||||
['--show-debug-info'],
|
||||
{
|
||||
dest: 'showDebugInfo',
|
||||
action: 'store_const',
|
||||
const: true,
|
||||
required: false,
|
||||
help: 'Show debug info about the current Appium deployment and exit',
|
||||
},
|
||||
],
|
||||
[
|
||||
['--show-config'],
|
||||
{
|
||||
|
||||
@@ -11,11 +11,19 @@ import {
|
||||
EXT_SUBCOMMAND_UNINSTALL,
|
||||
EXT_SUBCOMMAND_UPDATE,
|
||||
PLUGIN_TYPE,
|
||||
SERVER_SUBCOMMAND
|
||||
SERVER_SUBCOMMAND,
|
||||
SETUP_SUBCOMMAND
|
||||
} from '../constants';
|
||||
import {finalizeSchema, getArgSpec, hasArgSpec} from '../schema';
|
||||
import {rootDir} from '../config';
|
||||
import {getExtensionArgs, getServerArgs} from './args';
|
||||
import {
|
||||
SUBCOMMAND_MOBILE,
|
||||
SUBCOMMAND_DESKTOP,
|
||||
SUBCOMMAND_BROWSER,
|
||||
getPresetDrivers,
|
||||
determinePlatformName
|
||||
} from './setup-command';
|
||||
|
||||
export const EXTRA_ARGS = 'extraArgs';
|
||||
|
||||
@@ -24,7 +32,7 @@ export const EXTRA_ARGS = 'extraArgs';
|
||||
* will automatially inject the `server` subcommand.
|
||||
*/
|
||||
const NON_SERVER_ARGS = Object.freeze(
|
||||
new Set([DRIVER_TYPE, PLUGIN_TYPE, SERVER_SUBCOMMAND, '-h', '--help', '-v', '--version'])
|
||||
new Set([SETUP_SUBCOMMAND, DRIVER_TYPE, PLUGIN_TYPE, SERVER_SUBCOMMAND, '-h', '--help', '-v', '--version'])
|
||||
);
|
||||
|
||||
const version = fs.readPackageJsonFrom(rootDir).version;
|
||||
@@ -76,6 +84,9 @@ class ArgParser {
|
||||
|
||||
const subParsers = parser.add_subparsers({dest: 'subcommand'});
|
||||
|
||||
// add the 'setup' command
|
||||
ArgParser._addSetupToParser(subParsers);
|
||||
|
||||
// add the 'server' subcommand, and store the raw arguments on the parser
|
||||
// object as a way for other parts of the code to work with the arguments
|
||||
// conceptually rather than just through argparse
|
||||
@@ -280,6 +291,45 @@ class ArgParser {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add subcommand and sub-sub commands for 'setup' subcommand.
|
||||
* @param {import('argparse').SubParser} subParser
|
||||
*/
|
||||
static _addSetupToParser(subParser) {
|
||||
const setupParser = subParser.add_parser('setup', {
|
||||
add_help: true,
|
||||
help: `Select a preset of official drivers/plugins to install ` +
|
||||
`compatible with '${determinePlatformName()}' host platform. ` +
|
||||
`Existing drivers/plugins will remain. The default preset is 'mobile'.`,
|
||||
});
|
||||
|
||||
|
||||
ArgParser._patchExit(setupParser);
|
||||
const extSubParsers = setupParser.add_subparsers({
|
||||
dest: `setupCommand`,
|
||||
});
|
||||
|
||||
const parserSpecs = [
|
||||
{
|
||||
command: SUBCOMMAND_MOBILE,
|
||||
help: `The preset for mobile devices: ${_.join(getPresetDrivers(SUBCOMMAND_MOBILE), ',')}`
|
||||
},
|
||||
{
|
||||
command: SUBCOMMAND_BROWSER,
|
||||
help: `The preset for desktop browser drivers: ${_.join(getPresetDrivers(SUBCOMMAND_BROWSER), ',')}`
|
||||
},
|
||||
{
|
||||
command: SUBCOMMAND_DESKTOP,
|
||||
help: `The preset for desktop application drivers: ${_.join(getPresetDrivers(SUBCOMMAND_DESKTOP), ',')}`
|
||||
},
|
||||
];
|
||||
|
||||
for (const {command, help} of parserSpecs) {
|
||||
const parser = extSubParsers.add_parser(command, {help});
|
||||
ArgParser._patchExit(parser);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
import _ from 'lodash';
|
||||
import {
|
||||
DESKTOP_BROWSERS,
|
||||
DESKTOP_DRIVERS,
|
||||
MOBILE_DRIVERS
|
||||
} from '../constants';
|
||||
import {runExtensionCommand} from './extension';
|
||||
import { system } from '@appium/support';
|
||||
import log from '../logger';
|
||||
|
||||
/**
|
||||
* Subcommands of preset for setup
|
||||
*/
|
||||
export const SUBCOMMAND_MOBILE = 'mobile';
|
||||
export const SUBCOMMAND_DESKTOP = 'desktop';
|
||||
export const SUBCOMMAND_BROWSER = 'browser';
|
||||
|
||||
/**
|
||||
* Pairs of preset subcommand and driver candidates.
|
||||
* Driver names listed in KNOWN_DRIVERS to install by default
|
||||
*/
|
||||
const PRESET_PAIRS = Object.freeze(
|
||||
/** @type {const} */ ({
|
||||
mobile: _.keys(MOBILE_DRIVERS),
|
||||
desktop: _.keys(DESKTOP_DRIVERS),
|
||||
browser: _.keys(DESKTOP_BROWSERS)
|
||||
}),
|
||||
);
|
||||
const DRIVERS_ONLY_MACOS = ['xcuitest', 'safari', 'mac2'];
|
||||
|
||||
const DRIVERS_ONLY_WINDOWS = ['windows'];
|
||||
|
||||
/**
|
||||
* Plugin names listed in KNOWN_PLUGINS to install by default.
|
||||
*/
|
||||
export const DEFAULT_PLUGINS = ['images'];
|
||||
|
||||
/**
|
||||
* Return a list of drivers available for current host platform.
|
||||
* @param {import('appium/types').CliCommandSetupSubcommand} presetName
|
||||
* @returns {Array<string>}
|
||||
*/
|
||||
export function getPresetDrivers(presetName) {
|
||||
return _.filter(PRESET_PAIRS[presetName], (driver) => {
|
||||
if (_.includes(DRIVERS_ONLY_MACOS, driver)) {
|
||||
return system.isMac();
|
||||
}
|
||||
|
||||
if (_.includes(DRIVERS_ONLY_WINDOWS, driver)) {
|
||||
return system.isWindows();
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return desktop platform name for setup command description.
|
||||
* @returns {string}
|
||||
*/
|
||||
export function determinePlatformName() {
|
||||
if (system.isMac()) {
|
||||
return 'macOS';
|
||||
} else if (system.isWindows()) {
|
||||
return 'Windows';
|
||||
}
|
||||
return 'Linux';
|
||||
}
|
||||
|
||||
/**
|
||||
* Run 'setup' command to install drivers/plugins into the given appium home.
|
||||
* @template {import('appium/types').CliCommandSetup} SetupCmd
|
||||
* @param {import('appium/types').Args<SetupCmd>} preConfigArgs
|
||||
* @param {string} appiumHome
|
||||
* @param {DriverConfig} driverConfig
|
||||
* @param {PluginConfig} pluginConfig
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function runSetupCommand(appiumHome, preConfigArgs, driverConfig, pluginConfig) {
|
||||
switch (preConfigArgs.setupCommand) {
|
||||
case SUBCOMMAND_DESKTOP:
|
||||
await setupDesktopAppDrivers(driverConfig);
|
||||
await setupDefaultPlugins(pluginConfig);
|
||||
break;
|
||||
case SUBCOMMAND_BROWSER:
|
||||
await setupBrowserDrivers(driverConfig);
|
||||
await setupDefaultPlugins(pluginConfig);
|
||||
break;
|
||||
default:
|
||||
await setupMobileDrivers(driverConfig);
|
||||
await setupDefaultPlugins(pluginConfig);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Install drivers listed in DEFAULT_DRIVERS.
|
||||
* @param {DriverConfig} driverConfig
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function setupMobileDrivers(driverConfig) {
|
||||
await installDrivers(SUBCOMMAND_MOBILE, driverConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install all of known drivers listed in BROWSER_DRIVERS.
|
||||
* @param {DriverConfig} driverConfig
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function setupBrowserDrivers(driverConfig) {
|
||||
await installDrivers(SUBCOMMAND_BROWSER, driverConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install all of known drivers listed in DESKTOP_APP_DRIVERS.
|
||||
* @param {DriverConfig} driverConfig
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function setupDesktopAppDrivers(driverConfig) {
|
||||
await installDrivers(SUBCOMMAND_DESKTOP, driverConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the given driver name. It skips the installation if the given driver name was already installed.
|
||||
* @param {import('appium/types').CliCommandSetupSubcommand} subcommand
|
||||
* @param {DriverConfig} driverConfig
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function installDrivers(subcommand, driverConfig) {
|
||||
for (const driverName of getPresetDrivers(subcommand)) {
|
||||
await installExtension(driverName, extensionCommandArgs('driver', driverName, 'install'), driverConfig);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Install plugins listed in DEFAULT_PLUGINS.
|
||||
* @param {PluginConfig} pluginConfig
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function setupDefaultPlugins(pluginConfig) {
|
||||
for (const pluginName of DEFAULT_PLUGINS) {
|
||||
await installExtension(pluginName, extensionCommandArgs('plugin', pluginName, 'install'), pluginConfig);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the given extensionConfigArgs command after checking if the given extensionName was already installed.
|
||||
* @param {string} extensionName
|
||||
* @param {Args} extensionConfigArgs
|
||||
* @param {DriverConfig|PluginConfig} extensionConfig
|
||||
* @returns
|
||||
*/
|
||||
async function installExtension(extensionName, extensionConfigArgs, extensionConfig) {
|
||||
if (_.keys(extensionConfig.installedExtensions).includes(extensionName)) {
|
||||
log.info(`${extensionName} (${extensionConfig.installedExtensions[extensionName].version}) is already installed. ` +
|
||||
`Skipping the installation.`);
|
||||
return;
|
||||
}
|
||||
await runExtensionCommand(extensionConfigArgs, extensionConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the command config for driver or plugin.
|
||||
* @param {CliExtensionCommand} extensionCommand
|
||||
* @param {string} extensionName
|
||||
* @param {CliExtensionSubcommand} command
|
||||
* @returns {Args}
|
||||
*/
|
||||
function extensionCommandArgs(extensionCommand, extensionName, command) {
|
||||
return (extensionCommand === 'plugin')
|
||||
? {'subcommand': 'plugin', 'pluginCommand': command, 'plugin': extensionName}
|
||||
: {'subcommand': 'driver', 'driverCommand': command, 'driver': extensionName};
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('appium/types').CliExtensionCommand} CliExtensionCommand
|
||||
* @typedef {import('appium/types').CliExtensionSubcommand} CliExtensionSubcommand
|
||||
* @typedef {import('../extension/extension-config').ExtensionConfig<CliExtensionCommand>} PluginConfig
|
||||
* @typedef {import('../extension/extension-config').ExtensionConfig<CliExtensionCommand>} DriverConfig
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {import('appium/types').Args<CliExtensionCommand, CliExtensionSubcommand>} Args
|
||||
*/
|
||||
@@ -1,16 +1,18 @@
|
||||
/* eslint-disable no-console */
|
||||
import _ from 'lodash';
|
||||
import {system, fs} from '@appium/support';
|
||||
import {system, fs, npm} from '@appium/support';
|
||||
import axios from 'axios';
|
||||
import {exec} from 'teen_process';
|
||||
import semver from 'semver';
|
||||
import os from 'node:os';
|
||||
import {npmPackage} from './utils';
|
||||
import B from 'bluebird';
|
||||
import {getDefaultsForSchema, getAllArgSpecs} from './schema/schema';
|
||||
|
||||
export const APPIUM_VER = npmPackage.version;
|
||||
const ENGINES = /** @type {Record<string,string>} */ (npmPackage.engines);
|
||||
const MIN_NODE_VERSION = ENGINES.node;
|
||||
export const rootDir = fs.findRoot(__dirname);
|
||||
|
||||
const GIT_BINARY = `git${system.isWindows() ? '.exe' : ''}`;
|
||||
const GITHUB_API = 'https://api.github.com/repos/appium/appium';
|
||||
@@ -28,8 +30,9 @@ function getNodeVersion() {
|
||||
|
||||
/**
|
||||
* @param {boolean} [useGithubApiFallback]
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function updateBuildInfo(useGithubApiFallback = false) {
|
||||
export async function updateBuildInfo(useGithubApiFallback = false) {
|
||||
const sha = await getGitRev(useGithubApiFallback);
|
||||
if (!sha) {
|
||||
return;
|
||||
@@ -50,11 +53,61 @@ const getFullGitPath = _.memoize(async function getFullGitPath() {
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Prints server debug into into the console.
|
||||
*
|
||||
* @param {{
|
||||
* driverConfig: import('./extension/driver-config').DriverConfig,
|
||||
* pluginConfig: import('./extension/plugin-config').PluginConfig,
|
||||
* appiumHome: string
|
||||
* }} info
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function showDebugInfo({driverConfig, pluginConfig, appiumHome}) {
|
||||
const getNpmVersion = async () => {
|
||||
const {stdout} = await npm.exec('--version', [], {cwd: process.cwd()});
|
||||
return _.trim(stdout);
|
||||
};
|
||||
const findNpmLocation = async () => await fs.which(system.isWindows() ? 'npm.cmd' : 'npm');
|
||||
const [npmVersion, npmLocation] = await B.all([
|
||||
...([getNpmVersion, findNpmLocation].map((f) => getSafeResult(f, 'unknown'))),
|
||||
/** @type {any} */ (updateBuildInfo()),
|
||||
]);
|
||||
const debugInfo = {
|
||||
os: {
|
||||
platform: os.platform(),
|
||||
release: os.release(),
|
||||
arch: os.arch(),
|
||||
homedir: os.homedir(),
|
||||
username: os.userInfo().username,
|
||||
},
|
||||
node: {
|
||||
version: process.version,
|
||||
arch: process.arch,
|
||||
cwd: process.cwd(),
|
||||
argv: process.argv,
|
||||
env: process.env,
|
||||
npm: {
|
||||
location: npmLocation,
|
||||
version: npmVersion,
|
||||
},
|
||||
},
|
||||
appium: {
|
||||
location: rootDir,
|
||||
homedir: appiumHome,
|
||||
build: getBuildInfo(),
|
||||
drivers: driverConfig.installedExtensions,
|
||||
plugins: pluginConfig.installedExtensions,
|
||||
},
|
||||
};
|
||||
console.log(JSON.stringify(debugInfo, null, 2));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} [useGithubApiFallback]
|
||||
* @returns {Promise<string?>}
|
||||
*/
|
||||
async function getGitRev(useGithubApiFallback = false) {
|
||||
export async function getGitRev(useGithubApiFallback = false) {
|
||||
const fullGitPath = await getFullGitPath();
|
||||
if (fullGitPath) {
|
||||
try {
|
||||
@@ -122,11 +175,15 @@ async function getGitTimestamp(commitSha, useGithubApiFallback = false) {
|
||||
* and succeeds.
|
||||
* @returns {import('appium/types').BuildInfo}
|
||||
*/
|
||||
function getBuildInfo() {
|
||||
export function getBuildInfo() {
|
||||
return BUILD_INFO;
|
||||
}
|
||||
|
||||
function checkNodeOk() {
|
||||
/**
|
||||
* @returns {void}
|
||||
* @throws {Error} If Node version is outside of the supported range
|
||||
*/
|
||||
export function checkNodeOk() {
|
||||
const version = getNodeVersion();
|
||||
if (!semver.satisfies(version, MIN_NODE_VERSION)) {
|
||||
throw new Error(
|
||||
@@ -135,7 +192,7 @@ function checkNodeOk() {
|
||||
}
|
||||
}
|
||||
|
||||
async function showBuildInfo() {
|
||||
export async function showBuildInfo() {
|
||||
await updateBuildInfo(true);
|
||||
console.log(JSON.stringify(getBuildInfo())); // eslint-disable-line no-console
|
||||
}
|
||||
@@ -145,7 +202,7 @@ async function showBuildInfo() {
|
||||
* @param {Args} parsedArgs
|
||||
* @returns {Args}
|
||||
*/
|
||||
function getNonDefaultServerArgs(parsedArgs) {
|
||||
export function getNonDefaultServerArgs(parsedArgs) {
|
||||
/**
|
||||
* Flattens parsed args into a single level object for comparison with
|
||||
* flattened defaults across server args and extension args.
|
||||
@@ -253,7 +310,7 @@ const compactConfig = _.partial(
|
||||
* @param {Partial<ParsedArgs>} defaults - Configuration defaults from schemas
|
||||
* @param {ParsedArgs} parsedArgs - Entire parsed args object
|
||||
*/
|
||||
function showConfig(nonDefaultPreConfigParsedArgs, configResult, defaults, parsedArgs) {
|
||||
export function showConfig(nonDefaultPreConfigParsedArgs, configResult, defaults, parsedArgs) {
|
||||
console.log('Appium Configuration\n');
|
||||
console.log('from defaults:\n');
|
||||
console.dir(compactConfig(defaults));
|
||||
@@ -308,18 +365,22 @@ export async function requireDir(root, requireWriteable = true, displayName = 'f
|
||||
}
|
||||
}
|
||||
|
||||
const rootDir = fs.findRoot(__dirname);
|
||||
|
||||
export {
|
||||
getBuildInfo,
|
||||
checkNodeOk,
|
||||
showBuildInfo,
|
||||
getNonDefaultServerArgs,
|
||||
getGitRev,
|
||||
updateBuildInfo,
|
||||
showConfig,
|
||||
rootDir,
|
||||
};
|
||||
/**
|
||||
* Calculates the result of the given function and return its value
|
||||
* or the default one if there was an exception.
|
||||
*
|
||||
* @template T
|
||||
* @param {() => Promise<T>} f
|
||||
* @param {T} defaultValue
|
||||
* @returns {Promise<T>}
|
||||
*/
|
||||
async function getSafeResult(f, defaultValue) {
|
||||
try {
|
||||
return await f();
|
||||
} catch {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('appium/types').ParsedArgs} ParsedArgs
|
||||
|
||||
@@ -15,6 +15,12 @@ export const PLUGIN_TYPE = 'plugin';
|
||||
*/
|
||||
export const SERVER_SUBCOMMAND = 'server';
|
||||
|
||||
/**
|
||||
* The `setup` command of the `appium` CLI
|
||||
*/
|
||||
export const SETUP_SUBCOMMAND = 'setup';
|
||||
|
||||
|
||||
/**
|
||||
* The value of `--use-plugins` if _all_ plugins should be loaded
|
||||
*/
|
||||
@@ -33,19 +39,38 @@ export const KNOWN_PLUGINS = Object.freeze(
|
||||
}),
|
||||
);
|
||||
|
||||
export const MOBILE_DRIVERS = Object.freeze(
|
||||
/** @type {const} */ ({
|
||||
uiautomator2: 'appium-uiautomator2-driver',
|
||||
xcuitest: 'appium-xcuitest-driver',
|
||||
espresso: 'appium-espresso-driver',
|
||||
}),
|
||||
);
|
||||
|
||||
export const DESKTOP_DRIVERS = Object.freeze(
|
||||
/** @type {const} */ ({
|
||||
mac2: 'appium-mac2-driver',
|
||||
windows: 'appium-windows-driver',
|
||||
}),
|
||||
);
|
||||
|
||||
export const DESKTOP_BROWSERS = Object.freeze(
|
||||
/** @type {const} */ ({
|
||||
safari: 'appium-safari-driver',
|
||||
gecko: 'appium-geckodriver',
|
||||
chromium: 'appium-chromium-driver',
|
||||
}),
|
||||
);
|
||||
|
||||
// This is a map of driver names to npm packages representing those drivers.
|
||||
// The drivers in this list will be available to the CLI so users can just
|
||||
// type 'appium driver install 'name'', rather than having to specify the full
|
||||
// npm package. I.e., these are the officially recognized drivers.
|
||||
export const KNOWN_DRIVERS = Object.freeze(
|
||||
/** @type {const} */ ({
|
||||
uiautomator2: 'appium-uiautomator2-driver',
|
||||
xcuitest: 'appium-xcuitest-driver',
|
||||
mac2: 'appium-mac2-driver',
|
||||
espresso: 'appium-espresso-driver',
|
||||
safari: 'appium-safari-driver',
|
||||
gecko: 'appium-geckodriver',
|
||||
chromium: 'appium-chromium-driver',
|
||||
...MOBILE_DRIVERS,
|
||||
...DESKTOP_DRIVERS,
|
||||
...DESKTOP_BROWSERS,
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
@@ -57,13 +57,13 @@ function postRequest(configHolder, addr, port, basePath) {
|
||||
// Move Selenium 3 configuration properties to configuration object
|
||||
if (!_.has(configHolder, 'configuration')) {
|
||||
let configuration = {};
|
||||
for (const property in configHolder) {
|
||||
for (const property in /** @type {import('@appium/types').StringRecord} */ (configHolder)) {
|
||||
if (_.has(configHolder, property) && property !== 'capabilities') {
|
||||
configuration[property] = configHolder[property];
|
||||
delete configHolder[property];
|
||||
}
|
||||
}
|
||||
configHolder.configuration = configuration;
|
||||
/** @type {import('@appium/types').StringRecord} */ (configHolder).configuration = configuration;
|
||||
}
|
||||
|
||||
// if the node config does not have the appium/webdriver url, host, and port,
|
||||
|
||||
@@ -1,30 +1,27 @@
|
||||
import npmlog from 'npmlog';
|
||||
import globalLog from '@appium/logger';
|
||||
import {createLogger, format, transports} from 'winston';
|
||||
import {fs, logger} from '@appium/support';
|
||||
import { APPIUM_LOGGER_NAME } from './logger';
|
||||
import {fs} from '@appium/support';
|
||||
import _ from 'lodash';
|
||||
import { adler32 } from './utils';
|
||||
import { LRUCache } from 'lru-cache';
|
||||
|
||||
// set up distributed logging before everything else
|
||||
logger.patchLogger(npmlog);
|
||||
global._global_npmlog = npmlog;
|
||||
|
||||
global._global_npmlog = globalLog;
|
||||
// npmlog is used only for emitting, we use winston for output
|
||||
npmlog.level = 'info';
|
||||
const levels = {
|
||||
globalLog.level = 'info';
|
||||
const LEVELS_MAP = {
|
||||
debug: 4,
|
||||
info: 3,
|
||||
warn: 2,
|
||||
error: 1,
|
||||
};
|
||||
|
||||
const colors = {
|
||||
const COLORS_MAP = {
|
||||
info: 'cyan',
|
||||
debug: 'grey',
|
||||
warn: 'yellow',
|
||||
error: 'red',
|
||||
};
|
||||
|
||||
const npmToWinstonLevels = {
|
||||
const TO_WINSTON_LEVELS_MAP = {
|
||||
silly: 'debug',
|
||||
verbose: 'debug',
|
||||
debug: 'debug',
|
||||
@@ -33,36 +30,106 @@ const npmToWinstonLevels = {
|
||||
warn: 'warn',
|
||||
error: 'error',
|
||||
};
|
||||
const COLOR_CODE_PATTERN = /\u001b\[(\d+(;\d+)*)?m/g; // eslint-disable-line no-control-regex
|
||||
|
||||
const encounteredPrefixes = [];
|
||||
|
||||
let log = null;
|
||||
let useLocalTimeZone = false;
|
||||
|
||||
// add the timestamp in the correct format to the log info object
|
||||
const timestampFormat = format.timestamp({
|
||||
format() {
|
||||
let date = new Date();
|
||||
if (useLocalTimeZone) {
|
||||
date = new Date(date.valueOf() - date.getTimezoneOffset() * 60000);
|
||||
}
|
||||
// '2012-11-04T14:51:06.157Z' -> '2012-11-04 14:51:06:157'
|
||||
return date.toISOString().replace(/[TZ]/g, ' ').replace(/\./g, ':').trim();
|
||||
},
|
||||
// https://www.ditig.com/publications/256-colors-cheat-sheet
|
||||
const MIN_COLOR = 17;
|
||||
const MAX_COLOR = 231;
|
||||
/** @type {LRUCache<string, number>} */
|
||||
const COLORS_CACHE = new LRUCache({
|
||||
max: 1024,
|
||||
ttl: 1000 * 60 * 60 * 24, // expire after 24 hours
|
||||
updateAgeOnGet: true,
|
||||
});
|
||||
|
||||
/** @type {import('winston').Logger?} */
|
||||
let log = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {import('../types').ParsedArgs} args
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function init(args) {
|
||||
globalLog.level = 'silent';
|
||||
|
||||
// clean up in case we have initiated before since npmlog is a global object
|
||||
clear();
|
||||
|
||||
const transports = await createTransports(args);
|
||||
const transportNames = new Set(transports.map((tr) => tr.constructor.name));
|
||||
log = createLogger({
|
||||
transports,
|
||||
levels: LEVELS_MAP,
|
||||
});
|
||||
|
||||
const reportedLoggerErrors = new Set();
|
||||
// Capture logs emitted via npmlog and pass them through winston
|
||||
globalLog.on('log', (/** @type {MessageObject} */{level, message, prefix}) => {
|
||||
const {sessionSignature} = globalLog.asyncStorage.getStore() ?? {};
|
||||
/** @type {string[]} */
|
||||
const prefixes = [];
|
||||
if (sessionSignature) {
|
||||
prefixes.push(sessionSignature);
|
||||
}
|
||||
if (prefix) {
|
||||
prefixes.push(prefix);
|
||||
}
|
||||
let msg = message;
|
||||
if (!_.isEmpty(prefixes)) {
|
||||
const finalPrefix = prefixes
|
||||
.map(toDecoratedPrefix)
|
||||
.map((pfx) => isLogColorEnabled(args) ? colorizePrefix(pfx) : pfx)
|
||||
.join('');
|
||||
msg = `${finalPrefix} ${msg}`;
|
||||
}
|
||||
const winstonLevel = TO_WINSTON_LEVELS_MAP[level] || 'info';
|
||||
try {
|
||||
/** @type {import('winston').Logger} */(log)[winstonLevel](msg);
|
||||
if (_.isFunction(args.logHandler)) {
|
||||
args.logHandler(level, msg);
|
||||
}
|
||||
} catch (e) {
|
||||
if (!reportedLoggerErrors.has(e.message) && process.stderr.writable) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(
|
||||
`The log message '${_.truncate(msg, {length: 30})}' cannot be written into ` +
|
||||
`one or more requested destinations: ${transportNames}. Original error: ${e.message}`
|
||||
);
|
||||
reportedLoggerErrors.add(e.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
export function clear() {
|
||||
log?.clear();
|
||||
globalLog.removeAllListeners('log');
|
||||
}
|
||||
|
||||
// set the custom colors
|
||||
const colorizeFormat = format.colorize({
|
||||
colors,
|
||||
colors: COLORS_MAP,
|
||||
});
|
||||
|
||||
// Strip the color marking within messages
|
||||
const stripColorFormat = format(function stripColor(info) {
|
||||
const code = /\u001b\[(\d+(;\d+)*)?m/g; // eslint-disable-line no-control-regex
|
||||
info.message = info.message.replace(code, '');
|
||||
return info;
|
||||
return {
|
||||
...info,
|
||||
level: stripColorCodes(info.level),
|
||||
message: stripColorCodes(info.message),
|
||||
};
|
||||
})();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {ParsedArgs} args
|
||||
* @param {string} logLvl
|
||||
* @returns {transports.ConsoleTransportInstance}
|
||||
*/
|
||||
function createConsoleTransport(args, logLvl) {
|
||||
return new transports.Console({
|
||||
// @ts-expect-error The 'name' property should exist
|
||||
@@ -73,15 +140,19 @@ function createConsoleTransport(args, logLvl) {
|
||||
level: logLvl,
|
||||
stderrLevels: ['error'],
|
||||
format: format.combine(
|
||||
timestampFormat,
|
||||
args.logNoColors ? stripColorFormat : colorizeFormat,
|
||||
format.printf(function printInfo(info) {
|
||||
return `${args.logTimestamp ? `${info.timestamp} - ` : ''}${info.message}`;
|
||||
})
|
||||
formatTimestamp(args),
|
||||
isLogColorEnabled(args) ? colorizeFormat : stripColorFormat,
|
||||
format.printf(formatLogLine(args, true))
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {ParsedArgs} args
|
||||
* @param {string} logLvl
|
||||
* @returns {transports.FileTransportInstance}
|
||||
*/
|
||||
function createFileTransport(args, logLvl) {
|
||||
return new transports.File({
|
||||
// @ts-expect-error The 'name' property should exist
|
||||
@@ -94,19 +165,23 @@ function createFileTransport(args, logLvl) {
|
||||
level: logLvl,
|
||||
format: format.combine(
|
||||
stripColorFormat,
|
||||
timestampFormat,
|
||||
format.printf(function printInfo(info) {
|
||||
return `${info.timestamp} ${info.message}`;
|
||||
})
|
||||
formatTimestamp(args),
|
||||
format.printf(formatLogLine(args, false))
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {ParsedArgs} args
|
||||
* @param {string} logLvl
|
||||
* @returns {transports.HttpTransportInstance}
|
||||
*/
|
||||
function createHttpTransport(args, logLvl) {
|
||||
let host = '127.0.0.1';
|
||||
let port = 9003;
|
||||
|
||||
if (args.webhook.match(':')) {
|
||||
if (args.webhook?.match(':')) {
|
||||
const hostAndPort = args.webhook.split(':');
|
||||
host = hostAndPort[0];
|
||||
port = parseInt(hostAndPort[1], 10);
|
||||
@@ -124,23 +199,26 @@ function createHttpTransport(args, logLvl) {
|
||||
level: logLvl,
|
||||
format: format.combine(
|
||||
stripColorFormat,
|
||||
format.printf(function printInfo(info) {
|
||||
return `${info.timestamp} ${info.message}`;
|
||||
})
|
||||
format.printf(formatLogLine(args, false))
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {ParsedArgs} args
|
||||
* @returns {Promise<import('winston-transport')[]>}
|
||||
*/
|
||||
async function createTransports(args) {
|
||||
let transports = [];
|
||||
let consoleLogLevel = null;
|
||||
let fileLogLevel = null;
|
||||
|
||||
const transports = [];
|
||||
/** @type {string} */
|
||||
let consoleLogLevel;
|
||||
/** @type {string} */
|
||||
let fileLogLevel;
|
||||
if (args.loglevel && args.loglevel.match(':')) {
|
||||
// --log-level arg can optionally provide diff logging levels for console and file, separated by a colon
|
||||
const lvlPair = args.loglevel.split(':');
|
||||
consoleLogLevel = lvlPair[0] || consoleLogLevel;
|
||||
fileLogLevel = lvlPair[1] || fileLogLevel;
|
||||
[consoleLogLevel, fileLogLevel] = lvlPair;
|
||||
} else {
|
||||
consoleLogLevel = fileLogLevel = args.loglevel;
|
||||
}
|
||||
@@ -180,58 +258,95 @@ async function createTransports(args) {
|
||||
return transports;
|
||||
}
|
||||
|
||||
function getColorizedPrefix(prefix) {
|
||||
let prefixId = prefix.split('@')[0].trim();
|
||||
prefixId = prefixId.split(' (')[0].trim();
|
||||
if (encounteredPrefixes.indexOf(prefixId) < 0) {
|
||||
encounteredPrefixes.push(prefixId);
|
||||
}
|
||||
// using a multiple of 16 should cause 16 colors to be created
|
||||
const colorNumber = encounteredPrefixes.indexOf(prefixId) * 16;
|
||||
// use the modulus to cycle around color wheel
|
||||
return `\x1b[38;5;${colorNumber % 256}m${prefix}\x1b[0m`;
|
||||
/**
|
||||
*
|
||||
* @param {string} text
|
||||
* @returns {string}
|
||||
*/
|
||||
function toDecoratedPrefix(text) {
|
||||
return `[${text}]`;
|
||||
}
|
||||
|
||||
async function init(args) {
|
||||
npmlog.level = 'silent';
|
||||
/**
|
||||
* Selects the color of the text in terminal from the MIN_COLOR..MAX_COLOR
|
||||
* range. We use adler32 hashing to ensure that equal prefixes would always have
|
||||
* same colors.
|
||||
*
|
||||
* @param {string} text Initial text
|
||||
* @returns {string} Colorized text (with pseudocode cchars added)
|
||||
*/
|
||||
function colorizePrefix(text) {
|
||||
let colorIndex = COLORS_CACHE.get(text);
|
||||
if (!colorIndex) {
|
||||
const hash = adler32(text);
|
||||
colorIndex = MIN_COLOR + hash % (MAX_COLOR - MIN_COLOR);
|
||||
COLORS_CACHE.set(text, colorIndex);
|
||||
}
|
||||
return `\x1b[38;5;${colorIndex}m${text}\x1b[0m`;
|
||||
}
|
||||
|
||||
// set de facto param passed to timestamp function
|
||||
useLocalTimeZone = args.localTimezone;
|
||||
|
||||
// clean up in case we have initiated before since npmlog is a global object
|
||||
clear();
|
||||
|
||||
log = createLogger({
|
||||
transports: await createTransports(args),
|
||||
levels,
|
||||
});
|
||||
|
||||
// Capture logs emitted via npmlog and pass them through winston
|
||||
npmlog.on('log', ({level, message, prefix}) => {
|
||||
const winstonLevel = npmToWinstonLevels[level] || 'info';
|
||||
let msg = message;
|
||||
if (prefix) {
|
||||
const decoratedPrefix = `[${prefix}]`;
|
||||
const toColorizedDecoratedPrefix = () => prefix === APPIUM_LOGGER_NAME
|
||||
? decoratedPrefix.magenta
|
||||
: getColorizedPrefix(decoratedPrefix);
|
||||
msg = `${args.logNoColors ? decoratedPrefix : toColorizedDecoratedPrefix()} ${msg}`;
|
||||
/**
|
||||
* @param {ParsedArgs} args
|
||||
* @param {boolean} targetConsole
|
||||
* @returns {(info: import('logform').TransformableInfo) => string}
|
||||
*/
|
||||
function formatLogLine(args, targetConsole) {
|
||||
return (info) => {
|
||||
if (['json', 'pretty_json'].includes(args.logFormat)) {
|
||||
let infoCopy = {...info};
|
||||
if (targetConsole && !args.logTimestamp) {
|
||||
delete infoCopy.timestamp;
|
||||
}
|
||||
return JSON.stringify(infoCopy, null, args.logFormat === 'pretty_json' ? 2 : undefined);
|
||||
}
|
||||
log[winstonLevel](msg);
|
||||
if (args.logHandler && _.isFunction(args.logHandler)) {
|
||||
args.logHandler(level, msg);
|
||||
if (targetConsole) {
|
||||
return `${args.logTimestamp ? `${info.timestamp} - ` : ''}${info.message}`;
|
||||
}
|
||||
return `${info.timestamp} ${info.message}`;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* add the timestamp in the correct format to the log info object
|
||||
*
|
||||
* @param {ParsedArgs} args
|
||||
* @returns {import('logform').Format}
|
||||
*/
|
||||
function formatTimestamp(args) {
|
||||
return format.timestamp({
|
||||
format() {
|
||||
let date = new Date();
|
||||
if (args.localTimezone) {
|
||||
date = new Date(date.valueOf() - date.getTimezoneOffset() * 60000);
|
||||
}
|
||||
// '2012-11-04T14:51:06.157Z' -> '2012-11-04 14:51:06:157'
|
||||
return date.toISOString().replace(/[TZ]/g, ' ').replace(/\./g, ':').trim();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function clear() {
|
||||
if (log) {
|
||||
for (let transport of _.keys(log.transports)) {
|
||||
log.remove(transport);
|
||||
}
|
||||
}
|
||||
npmlog.removeAllListeners('log');
|
||||
/**
|
||||
* Strips color control codes from the given string
|
||||
*
|
||||
* @param {string} text
|
||||
* @returns {string}
|
||||
*/
|
||||
function stripColorCodes(text) {
|
||||
return text.replace(COLOR_CODE_PATTERN, '');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {ParsedArgs} args
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function isLogColorEnabled(args) {
|
||||
return !args.logNoColors && args.logFormat === 'text';
|
||||
}
|
||||
|
||||
export {init, clear};
|
||||
export default init;
|
||||
|
||||
/**
|
||||
* @typedef {import('appium/types').ParsedArgs} ParsedArgs
|
||||
* @typedef {import('@appium/logger').MessageObject} MessageObject
|
||||
*/
|
||||
|
||||
@@ -8,11 +8,12 @@ import {
|
||||
server as baseServer,
|
||||
normalizeBasePath,
|
||||
} from '@appium/base-driver';
|
||||
import {logger as logFactory, util, env} from '@appium/support';
|
||||
import {util, env} from '@appium/support';
|
||||
import {asyncify} from 'asyncbox';
|
||||
import _ from 'lodash';
|
||||
import {AppiumDriver} from './appium';
|
||||
import {runExtensionCommand} from './cli/extension';
|
||||
import { runSetupCommand } from './cli/setup-command';
|
||||
import {getParser} from './cli/parser';
|
||||
import {
|
||||
APPIUM_VER,
|
||||
@@ -21,6 +22,7 @@ import {
|
||||
getNonDefaultServerArgs,
|
||||
showConfig,
|
||||
showBuildInfo,
|
||||
showDebugInfo,
|
||||
requireDir,
|
||||
} from './config';
|
||||
import {readConfigFile} from './config-file';
|
||||
@@ -38,6 +40,7 @@ import {
|
||||
fetchInterfaces,
|
||||
V4_BROADCAST_IP,
|
||||
V6_BROADCAST_IP,
|
||||
isSetupCommandArgs,
|
||||
} from './utils';
|
||||
import net from 'node:net';
|
||||
|
||||
@@ -216,7 +219,7 @@ async function init(args) {
|
||||
}
|
||||
|
||||
// merge config and apply defaults.
|
||||
// the order of precendece is:
|
||||
// the order of precedence is:
|
||||
// 1. command line args
|
||||
// 2. config file
|
||||
// 3. defaults from config file.
|
||||
@@ -231,10 +234,19 @@ async function init(args) {
|
||||
return /** @type {InitResult<Cmd>} */ ({});
|
||||
}
|
||||
|
||||
if (preConfigArgs.showDebugInfo) {
|
||||
await showDebugInfo({
|
||||
driverConfig,
|
||||
pluginConfig,
|
||||
appiumHome,
|
||||
});
|
||||
return /** @type {InitResult<Cmd>} */ ({});
|
||||
}
|
||||
|
||||
await logsinkInit(serverArgs);
|
||||
|
||||
if (serverArgs.logFilters) {
|
||||
const {issues, rules} = await logFactory.loadSecureValuesPreprocessingRules(
|
||||
const {issues, rules} = await logger.unwrap().loadSecureValuesPreprocessingRules(
|
||||
serverArgs.logFilters,
|
||||
);
|
||||
if (!_.isEmpty(issues)) {
|
||||
@@ -248,10 +260,10 @@ async function init(args) {
|
||||
`Found no log filtering rules in '${serverArgs.logFilters}'. Is that expected?`,
|
||||
);
|
||||
} else {
|
||||
// Filtering aims to "hide" these values from the log,
|
||||
// so it would be nice to not show them in the log as well.
|
||||
logger.info(
|
||||
`Loaded ${util.pluralize('filtering rule', rules.length, true)} from '${
|
||||
serverArgs.logFilters
|
||||
}'`,
|
||||
`Loaded ${util.pluralize('filtering rule', rules.length, true)}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -276,6 +288,9 @@ async function init(args) {
|
||||
pluginConfig,
|
||||
appiumHome,
|
||||
});
|
||||
} else if (isSetupCommandArgs(preConfigArgs)) {
|
||||
await runSetupCommand(appiumHome, preConfigArgs, driverConfig, pluginConfig);
|
||||
return /** @type {InitResult<Cmd>} */ ({});
|
||||
} else {
|
||||
await requireDir(appiumHome, true, appiumHomeSourceName);
|
||||
if (isExtensionCommandArgs(preConfigArgs)) {
|
||||
@@ -465,6 +480,7 @@ export {main, init, resolveAppiumHome};
|
||||
* @typedef {import('appium/types').CliCommandServer} ServerCommand
|
||||
* @typedef {import('appium/types').CliCommandDriver} DriverCommand
|
||||
* @typedef {import('appium/types').CliCommandPlugin} PluginCommand
|
||||
* @typedef {import('appium/types').CliCommandSetup} SetupCommand
|
||||
* @typedef {import('./extension').DriverNameMap} DriverNameMap
|
||||
* @typedef {import('./extension').PluginNameMap} PluginNameMap
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@ import {ArgumentTypeError} from 'argparse';
|
||||
import _ from 'lodash';
|
||||
import {formatErrors as formatErrors} from '../config-file';
|
||||
import {flattenSchema, validate} from './schema';
|
||||
import {transformers} from './cli-transformers';
|
||||
import {transformers, parseCsvLine} from './cli-transformers';
|
||||
|
||||
/**
|
||||
* This module concerns functions which convert schema definitions to
|
||||
@@ -136,13 +136,19 @@ function subSchemaToArgDef(subSchema, argSpec) {
|
||||
}
|
||||
|
||||
case TYPENAMES.OBJECT: {
|
||||
argTypeFunction = transformers.json;
|
||||
argTypeFunction = _.flow(transformers.json, (o) => {
|
||||
// Arrays and plain strings are also valid JSON
|
||||
if (!_.isPlainObject(o)) {
|
||||
throw new ArgumentTypeError(`'${_.truncate(o, {length: 100})}' must be a plain object`);;
|
||||
}
|
||||
return o;
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
// arrays are treated as CSVs, because `argparse` doesn't handle array data.
|
||||
case TYPENAMES.ARRAY: {
|
||||
argTypeFunction = transformers.csv;
|
||||
argTypeFunction = parseCsvLine;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -182,12 +188,13 @@ function subSchemaToArgDef(subSchema, argSpec) {
|
||||
argOpts.metavar = screamingSnakeCase(name);
|
||||
}
|
||||
|
||||
// the validity of "appiumCliTransformer" should already have been determined
|
||||
// by ajv during schema validation in `finalizeSchema()`. the `array` &
|
||||
// `object` types have already added a formatter (see above, so we don't do it
|
||||
// twice).
|
||||
if (type !== TYPENAMES.ARRAY && type !== TYPENAMES.OBJECT && appiumCliTransformer) {
|
||||
argTypeFunction = _.flow(argTypeFunction ?? _.identity, transformers[appiumCliTransformer]);
|
||||
if (appiumCliTransformer && transformers[appiumCliTransformer]) {
|
||||
if (type === TYPENAMES.ARRAY) {
|
||||
const csvTransformer = /** @type {(x: string) => string[]} */ (argTypeFunction);
|
||||
argTypeFunction = (val) => _.flatMap(csvTransformer(val).map(transformers[appiumCliTransformer]));
|
||||
} else {
|
||||
argTypeFunction = _.flow(argTypeFunction ?? _.identity, transformers[appiumCliTransformer]);
|
||||
}
|
||||
}
|
||||
|
||||
if (argTypeFunction) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {ArgumentTypeError} from 'argparse';
|
||||
import {readFileSync, existsSync} from 'fs';
|
||||
import _ from 'lodash';
|
||||
|
||||
/**
|
||||
* This module provides custom keywords for Appium schemas, as well as
|
||||
@@ -16,7 +15,7 @@ import _ from 'lodash';
|
||||
* @param {string} value
|
||||
* @returns {string[]}
|
||||
*/
|
||||
function parseCsvLine(value) {
|
||||
export function parseCsvLine(value) {
|
||||
return value
|
||||
.split(',')
|
||||
.map((v) => v.trim())
|
||||
@@ -71,7 +70,6 @@ export const transformers = {
|
||||
}
|
||||
loadedFromFile = true;
|
||||
}
|
||||
|
||||
try {
|
||||
return loadedFromFile ? parseCsvFile(csv) : parseCsvLine(csv);
|
||||
} catch (err) {
|
||||
@@ -104,14 +102,10 @@ export const transformers = {
|
||||
loadedFromFile = true;
|
||||
}
|
||||
try {
|
||||
const result = JSON.parse(json);
|
||||
if (!_.isPlainObject(result)) {
|
||||
throw new Error(`'${_.truncate(result, {length: 100})}' is not an object`);
|
||||
}
|
||||
return result;
|
||||
return JSON.parse(json);
|
||||
} catch (e) {
|
||||
const msg = loadedFromFile
|
||||
? `The provided value of '${jsonOrPath}' must be a valid JSON`
|
||||
? `'${jsonOrPath}' must be a valid JSON`
|
||||
: `The provided value must be a valid JSON`;
|
||||
throw new TypeError(`${msg}. Original error: ${e.message}`);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import {processCapabilities, PROTOCOLS, STANDARD_CAPS, errors} from '@appium/bas
|
||||
import {inspect as dump} from 'util';
|
||||
import {node, fs} from '@appium/support';
|
||||
import path from 'path';
|
||||
import {SERVER_SUBCOMMAND, DRIVER_TYPE, PLUGIN_TYPE} from './constants';
|
||||
import {SERVER_SUBCOMMAND, DRIVER_TYPE, PLUGIN_TYPE, SETUP_SUBCOMMAND} from './constants';
|
||||
import os from 'node:os';
|
||||
|
||||
const W3C_APPIUM_PREFIX = 'appium';
|
||||
@@ -330,6 +330,16 @@ export function isServerCommandArgs(args) {
|
||||
return args.subcommand === SERVER_SUBCOMMAND;
|
||||
}
|
||||
|
||||
/**
|
||||
* @template {CliCommand} Cmd
|
||||
* @template {CliExtensionSubcommand|CliCommandSetupSubcommand|void} [SubCmd=void]
|
||||
* @param {Args<Cmd, SubCmd>} args
|
||||
* @returns {args is Args<SetupCommand>}
|
||||
*/
|
||||
export function isSetupCommandArgs(args) {
|
||||
return args.subcommand === SETUP_SUBCOMMAND;
|
||||
}
|
||||
|
||||
/**
|
||||
* @template {CliCommand} [Cmd=ServerCommand]
|
||||
* @template {CliExtensionSubcommand|void} [SubCmd=void]
|
||||
@@ -381,6 +391,62 @@ export function fetchInterfaces (family = null) {
|
||||
.filter(({family}) => !familyValue || familyValue && familyValue.includes(family));
|
||||
}
|
||||
|
||||
/**
|
||||
* https://github.com/SheetJS/js-adler32
|
||||
*
|
||||
* @param {string} str
|
||||
* @param {number?} [seed]
|
||||
* @returns {number}
|
||||
*/
|
||||
export function adler32(str, seed = null) {
|
||||
let a = 1, b = 0, L = str.length, M = 0, c = 0, d = 0;
|
||||
if (typeof seed === 'number') {
|
||||
a = seed & 0xFFFF;
|
||||
b = seed >>> 16;
|
||||
}
|
||||
for (let i = 0; i < L;) {
|
||||
M = Math.min(L - i, 2918);
|
||||
while (M > 0) {
|
||||
c = str.charCodeAt(i++);
|
||||
if (c < 0x80) {
|
||||
a += c;
|
||||
}
|
||||
else if (c < 0x800) {
|
||||
a += 192 | ((c >> 6) & 31);
|
||||
b += a;
|
||||
--M;
|
||||
a += 128 | (c & 63);
|
||||
} else if (c >= 0xD800 && c < 0xE000) {
|
||||
c = (c & 1023) + 64;
|
||||
d = str.charCodeAt(i++) & 1023;
|
||||
a += 240 | ((c >> 8) & 7);
|
||||
b += a;
|
||||
--M;
|
||||
a += 128 | ((c >> 2) & 63);
|
||||
b += a;
|
||||
--M;
|
||||
a += 128 | ((d >> 6) & 15) | ((c & 3) << 4);
|
||||
b += a;
|
||||
--M;
|
||||
a += 128 | (d & 63);
|
||||
} else {
|
||||
a += 224 | ((c >> 12) & 15);
|
||||
b += a;
|
||||
--M;
|
||||
a += 128 | ((c >> 6) & 63);
|
||||
b += a;
|
||||
--M;
|
||||
a += 128 | (c & 63);
|
||||
}
|
||||
b += a;
|
||||
--M;
|
||||
}
|
||||
a = (15 * (a >>> 16) + (a & 65535));
|
||||
b = (15 * (b >>> 16) + (b & 65535));
|
||||
}
|
||||
return ((b % 65521) << 16) | (a % 65521);
|
||||
}
|
||||
|
||||
export {
|
||||
inspect,
|
||||
parseCapsForInnerDriver,
|
||||
@@ -451,19 +517,21 @@ export {
|
||||
* @typedef {import('appium/types').CliCommand} CliCommand
|
||||
* @typedef {import('appium/types').CliExtensionSubcommand} CliExtensionSubcommand
|
||||
* @typedef {import('appium/types').CliExtensionCommand} CliExtensionCommand
|
||||
* @typedef {import('appium/types').CliCommandSetupSubcommand} CliCommandSetupSubcommand
|
||||
* @typedef {import('appium/types').CliCommandServer} ServerCommand
|
||||
* @typedef {import('appium/types').CliCommandDriver} DriverCommand
|
||||
* @typedef {import('appium/types').CliCommandPlugin} PluginCommand
|
||||
* @typedef {import('appium/types').CliCommandSetup} SetupCommand
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template {CliCommand} [Cmd=ServerCommand]
|
||||
* @template {CliExtensionSubcommand|void} [SubCmd=void]
|
||||
* @template {CliExtensionSubcommand|CliCommandSetupSubcommand|void} [SubCmd=void]
|
||||
* @typedef {import('appium/types').Args<Cmd, SubCmd>} Args
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template {CliCommand} [Cmd=ServerCommand]
|
||||
* @template {CliExtensionSubcommand|void} [SubCmd=void]
|
||||
* @template {CliExtensionSubcommand|CliCommandSetupSubcommand|void} [SubCmd=void]
|
||||
* @typedef {import('appium/types').ParsedArgs<Cmd, SubCmd>} ParsedArgs
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "appium",
|
||||
"version": "2.5.1",
|
||||
"version": "2.10.0",
|
||||
"description": "Automation for Apps.",
|
||||
"keywords": [
|
||||
"automation",
|
||||
@@ -45,10 +45,9 @@
|
||||
"scripts": {
|
||||
"build:docs": "node docs/scripts/build-docs.js",
|
||||
"build:docs:preview": "cross-env APPIUM_DOCS_PREVIEW=1 npm run build:docs",
|
||||
"build:docs:assets": "node docs/scripts/copy-assets.js",
|
||||
"build:docs:cli": "node docs/scripts/gen-cli-args-docs.js",
|
||||
"build:docs:reference": "node docs/scripts/build-reference.js",
|
||||
"dev:docs": "npm run build:docs:assets && npm run dev:docs:en",
|
||||
"dev:docs": "npm run dev:docs:en",
|
||||
"dev:docs:en": "appium-docs build --serve --mkdocs-yml ./docs/mkdocs-en.yml",
|
||||
"dev:docs:ja": "appium-docs build --serve --mkdocs-yml ./docs/mkdocs-ja.yml",
|
||||
"dev:docs:zh": "appium-docs build --serve --mkdocs-yml ./docs/mkdocs-zh.yml",
|
||||
@@ -60,41 +59,42 @@
|
||||
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@appium/base-driver": "^9.5.2",
|
||||
"@appium/base-plugin": "^2.2.28",
|
||||
"@appium/docutils": "^1.0.4",
|
||||
"@appium/schema": "~0.5.0",
|
||||
"@appium/support": "^4.2.2",
|
||||
"@appium/types": "^0.16.1",
|
||||
"@appium/base-driver": "^9.10.0",
|
||||
"@appium/base-plugin": "^2.2.36",
|
||||
"@appium/docutils": "^1.0.12",
|
||||
"@appium/logger": "^1.4.0",
|
||||
"@appium/schema": "^0.6.0",
|
||||
"@appium/support": "^5.0.0",
|
||||
"@appium/types": "^0.20.0",
|
||||
"@sidvind/better-ajv-errors": "2.1.3",
|
||||
"@types/argparse": "2.0.14",
|
||||
"@types/argparse": "2.0.16",
|
||||
"@types/bluebird": "3.5.42",
|
||||
"@types/fancy-log": "2.0.2",
|
||||
"@types/semver": "7.5.7",
|
||||
"@types/semver": "7.5.8",
|
||||
"@types/teen_process": "2.0.4",
|
||||
"@types/wrap-ansi": "3.0.0",
|
||||
"ajv": "8.12.0",
|
||||
"ajv-formats": "2.1.1",
|
||||
"ajv": "8.16.0",
|
||||
"ajv-formats": "3.0.1",
|
||||
"argparse": "2.0.1",
|
||||
"async-lock": "1.4.1",
|
||||
"asyncbox": "3.0.0",
|
||||
"axios": "1.6.7",
|
||||
"axios": "1.7.2",
|
||||
"bluebird": "3.7.2",
|
||||
"cross-env": "7.0.3",
|
||||
"lilconfig": "3.0.0",
|
||||
"lilconfig": "3.1.2",
|
||||
"lodash": "4.17.21",
|
||||
"npmlog": "7.0.1",
|
||||
"lru-cache": "10.2.2",
|
||||
"ora": "5.4.1",
|
||||
"package-changed": "3.0.0",
|
||||
"resolve-from": "5.0.0",
|
||||
"semver": "7.6.0",
|
||||
"semver": "7.6.2",
|
||||
"source-map-support": "0.5.21",
|
||||
"teen_process": "2.1.1",
|
||||
"type-fest": "4.10.1",
|
||||
"winston": "3.11.0",
|
||||
"teen_process": "2.1.4",
|
||||
"type-fest": "4.20.0",
|
||||
"winston": "3.13.0",
|
||||
"wrap-ansi": "7.0.0",
|
||||
"ws": "8.16.0",
|
||||
"yaml": "2.3.4"
|
||||
"ws": "8.17.0",
|
||||
"yaml": "2.4.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.17.0 || ^16.13.0 || >=18.0.0",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"webdriverio": "8.31.1"
|
||||
"webdriverio": "8.38.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ export default {
|
||||
driversImportChunkSize: 3,
|
||||
keepAliveTimeout: 600,
|
||||
localTimezone: false,
|
||||
logFormat: 'text',
|
||||
loglevel: 'debug',
|
||||
logNoColors: false,
|
||||
logTimestamp: false,
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import {createSandbox} from 'sinon';
|
||||
import {system} from '@appium/support';
|
||||
import {getPresetDrivers} from '../../../lib/cli/setup-command';
|
||||
|
||||
const expect = chai.expect;
|
||||
|
||||
describe('SetupCommand', function () {
|
||||
let sandbox;
|
||||
|
||||
beforeEach(function () {
|
||||
sandbox = createSandbox();
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
describe('getPresetDrivers', function () {
|
||||
it('for drivers on macOS environment', function () {
|
||||
sandbox.stub(system, 'isMac').returns(true);
|
||||
sandbox.stub(system, 'isWindows').returns(false);
|
||||
expect(getPresetDrivers('mobile')).eql(['uiautomator2', 'xcuitest', 'espresso']);
|
||||
expect(getPresetDrivers('browser')).eql(['safari', 'gecko', 'chromium']);
|
||||
expect(getPresetDrivers('desktop')).eql(['mac2']);
|
||||
});
|
||||
|
||||
it('for drivers on Windows environment', function () {
|
||||
sandbox.stub(system, 'isMac').returns(false);
|
||||
sandbox.stub(system, 'isWindows').returns(true);
|
||||
expect(getPresetDrivers('mobile')).eql(['uiautomator2', 'espresso']);
|
||||
expect(getPresetDrivers('browser')).eql(['gecko', 'chromium']);
|
||||
expect(getPresetDrivers('desktop')).eql(['windows']);
|
||||
});
|
||||
|
||||
it('for drivers on Linux environment', function () {
|
||||
sandbox.stub(system, 'isMac').returns(false);
|
||||
sandbox.stub(system, 'isWindows').returns(false);
|
||||
expect(getPresetDrivers('mobile')).eql(['uiautomator2', 'espresso']);
|
||||
expect(getPresetDrivers('browser')).eql(['gecko', 'chromium']);
|
||||
expect(getPresetDrivers('desktop')).eql([]);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
import _ from 'lodash';
|
||||
import {DRIVER_TYPE, PLUGIN_TYPE} from '../../lib/constants';
|
||||
import {DRIVER_TYPE, PLUGIN_TYPE, SETUP_SUBCOMMAND} from '../../lib/constants';
|
||||
import {getParser} from '../../lib/cli/parser';
|
||||
import {INSTALL_TYPES} from '../../lib/extension/extension-config';
|
||||
import * as schema from '../../lib/schema/schema';
|
||||
@@ -395,4 +395,22 @@ describe('parser', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Setup Parser', function () {
|
||||
let p;
|
||||
beforeEach(function () {
|
||||
p = getParser(true);
|
||||
});
|
||||
it('should not allow random sub-subcommands', function () {
|
||||
(() => p.parseArgs([SETUP_SUBCOMMAND, 'foo'])).should.throw();
|
||||
});
|
||||
|
||||
describe('all', function () {
|
||||
it('should allow an empty argument mobile', function () {
|
||||
const args = p.parseArgs([SETUP_SUBCOMMAND, 'mobile']);
|
||||
args.subcommand.should.eql(SETUP_SUBCOMMAND);
|
||||
args.setupCommand.should.eql('mobile');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,7 +4,6 @@ import _ from 'lodash';
|
||||
import {PLUGIN_TYPE} from '../../../lib/constants';
|
||||
import {finalizeSchema, registerSchema, resetSchema} from '../../../lib/schema';
|
||||
import {toParserArgs} from '../../../lib/schema/cli-args';
|
||||
import {transformers} from '../../../lib/schema/cli-transformers';
|
||||
|
||||
const {expect} = chai;
|
||||
|
||||
@@ -63,7 +62,7 @@ describe('cli-args', function () {
|
||||
});
|
||||
|
||||
it('should use the `json` transformer', function () {
|
||||
expect(result['--plugin-blob-foo']).to.have.property('type', transformers.json);
|
||||
expect(result['--plugin-blob-foo']).to.have.property('type');
|
||||
});
|
||||
|
||||
it('should contain a SCREAMING_SNAKE_CASE `metavar` prop', function () {
|
||||
@@ -78,7 +77,7 @@ describe('cli-args', function () {
|
||||
});
|
||||
|
||||
it('should use the `csv` transformer', function () {
|
||||
expect(result['--plugin-blob-foo']).to.have.property('type', transformers.csv);
|
||||
expect(result['--plugin-blob-foo']).to.have.property('type');
|
||||
});
|
||||
|
||||
it('should contain a SCREAMING_SNAKE_CASE `metavar` prop', function () {
|
||||
@@ -211,11 +210,11 @@ describe('cli-args', function () {
|
||||
|
||||
it('should error if the value is not valid for the transformer', function () {
|
||||
const schema = {
|
||||
properties: {foo: {type: 'string', appiumCliTransformer: 'json'}},
|
||||
properties: {foo: {type: 'object'}},
|
||||
type: 'object',
|
||||
};
|
||||
result = getArgs({schema, extName, extType});
|
||||
expect(() => result['--plugin-blob-foo'].type('123')).to.throw(/must be a valid json/i);
|
||||
expect(() => result['--plugin-blob-foo'].type('123')).to.throw(/must be a plain object/i);
|
||||
});
|
||||
|
||||
// this is unlikely to happen, but I want to establish the behavior as defined.
|
||||
|
||||
@@ -82,12 +82,10 @@ describe('utils', function () {
|
||||
'appium:foo2': 'bar2',
|
||||
}
|
||||
);
|
||||
res.error.should.eql({
|
||||
jsonwpCode: 61,
|
||||
error: 'invalid argument',
|
||||
w3cStatus: 400,
|
||||
_stacktrace: null,
|
||||
});
|
||||
res.error.jsonwpCode.should.eql(61);
|
||||
res.error.error.should.eql('invalid argument');
|
||||
res.error.w3cStatus.should.eql(400);
|
||||
_.isNull(res.error._stacktrace).should.be.true;
|
||||
});
|
||||
it('should reject if W3C caps are not passing constraints', function () {
|
||||
const err = parseCapsForInnerDriver(undefined, W3C_CAPS, {
|
||||
@@ -101,14 +99,13 @@ describe('utils', function () {
|
||||
...W3C_CAPS,
|
||||
firstMatch: [{foo: 'bar'}, {'appium:hello': 'world'}],
|
||||
};
|
||||
parseCapsForInnerDriver(BASE_CAPS, w3cCaps, {
|
||||
const error = parseCapsForInnerDriver(BASE_CAPS, w3cCaps, {
|
||||
hello: {presence: true},
|
||||
}).error.should.eql({
|
||||
jsonwpCode: 61,
|
||||
error: 'invalid argument',
|
||||
w3cStatus: 400,
|
||||
_stacktrace: null,
|
||||
});
|
||||
}).error;
|
||||
error.jsonwpCode.should.eql(61);
|
||||
error.error.should.eql('invalid argument');
|
||||
error.w3cStatus.should.eql(400);
|
||||
_.isNull(error._stacktrace).should.be.true;
|
||||
});
|
||||
it('should add appium prefixes to W3C caps that are not standard in W3C', function () {
|
||||
parseCapsForInnerDriver(undefined, {
|
||||
|
||||
@@ -2,6 +2,7 @@ import {DriverType, PluginType, ServerArgs} from '@appium/types';
|
||||
import {SetOptional} from 'type-fest';
|
||||
import {InstallType} from './manifest';
|
||||
export type CliCommandServer = 'server';
|
||||
export type CliCommandSetup = 'setup';
|
||||
export type CliCommandDriver = DriverType;
|
||||
export type CliCommandPlugin = PluginType;
|
||||
|
||||
@@ -13,7 +14,13 @@ export type CliExtensionCommand = CliCommandDriver | CliCommandPlugin;
|
||||
/**
|
||||
* Possible commands for the `appium` CLI.
|
||||
*/
|
||||
export type CliCommand = CliCommandServer | CliExtensionCommand;
|
||||
export type CliCommand = CliCommandServer | CliExtensionCommand | CliCommandSetup;
|
||||
|
||||
/**
|
||||
* Possible subcommands of {@linkcode CliCommandSetup}.
|
||||
* The command name will be preset name to get drivers/plugins to be installed.
|
||||
*/
|
||||
export type CliCommandSetupSubcommand = 'mobile' | 'browser' | 'desktop';
|
||||
|
||||
/**
|
||||
* Possible subcommands of {@linkcode CliCommandDriver} or
|
||||
@@ -55,6 +62,11 @@ export interface MoreArgs {
|
||||
*/
|
||||
showConfig?: boolean;
|
||||
|
||||
/**
|
||||
* If true, show the server debug info and exit
|
||||
*/
|
||||
showDebugInfo?: boolean;
|
||||
|
||||
/**
|
||||
* If true, open a REPL
|
||||
*/
|
||||
@@ -62,7 +74,7 @@ export interface MoreArgs {
|
||||
}
|
||||
|
||||
/**
|
||||
* These arguments are _not_ supported by the CLI, but only via programmatic usage / tests.
|
||||
* These arguments are not necessarily supported by the CLI, but via programmatic usage / tests.
|
||||
*/
|
||||
export interface ProgrammaticArgs {
|
||||
/**
|
||||
@@ -93,6 +105,11 @@ export interface ProgrammaticArgs {
|
||||
* If true, show config and exit
|
||||
*/
|
||||
showConfig?: boolean;
|
||||
|
||||
/**
|
||||
* If true, show debug info and exit
|
||||
*/
|
||||
showDebugInfo?: boolean;
|
||||
}
|
||||
|
||||
export interface DriverExtArgs {
|
||||
@@ -105,6 +122,10 @@ export interface PluginExtArgs {
|
||||
plugin?: string;
|
||||
}
|
||||
|
||||
export interface SetupArgs {
|
||||
setupCommand?: CliCommandSetupSubcommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* These are args which the user will specify if using an extension command
|
||||
*/
|
||||
@@ -132,9 +153,11 @@ export interface BaseExtArgs<Cmd extends CliExtensionCommand> {
|
||||
*/
|
||||
export type ExtArgs<
|
||||
Cmd extends CliExtensionCommand,
|
||||
SubCmd extends CliExtensionSubcommand
|
||||
SubCmd extends CliExtensionSubcommand | CliCommandSetupSubcommand
|
||||
> = BaseExtArgs<Cmd> &
|
||||
(Cmd extends CliCommandDriver
|
||||
(Cmd extends CliCommandSetup
|
||||
? SetupArgs
|
||||
: Cmd extends CliCommandDriver
|
||||
? DriverExtArgs
|
||||
: Cmd extends CliCommandPlugin
|
||||
? PluginExtArgs
|
||||
@@ -152,13 +175,15 @@ export type ExtArgs<
|
||||
*/
|
||||
export type CommonArgs<
|
||||
Cmd extends CliCommand = CliCommandServer,
|
||||
SubCmd extends CliExtensionSubcommand | void = void
|
||||
SubCmd extends CliExtensionSubcommand | CliCommandSetupSubcommand | void = void
|
||||
> = MoreArgs &
|
||||
ProgrammaticArgs &
|
||||
(Cmd extends CliCommandServer
|
||||
? ServerArgs
|
||||
: Cmd extends CliCommandSetup
|
||||
? SetupArgs
|
||||
: Cmd extends CliExtensionCommand
|
||||
? SubCmd extends CliExtensionSubcommand
|
||||
? SubCmd extends CliExtensionSubcommand | CliCommandSetupSubcommand
|
||||
? ExtArgs<Cmd, SubCmd>
|
||||
: never
|
||||
: never);
|
||||
@@ -168,7 +193,7 @@ export type CommonArgs<
|
||||
*/
|
||||
export type ParsedArgs<
|
||||
Cmd extends CliCommand = CliCommandServer,
|
||||
SubCmd extends CliExtensionSubcommand | void = void
|
||||
SubCmd extends CliExtensionSubcommand | CliCommandSetupSubcommand | void = void
|
||||
> = CommonArgs<Cmd, SubCmd>;
|
||||
|
||||
/**
|
||||
@@ -178,7 +203,7 @@ export type ParsedArgs<
|
||||
*/
|
||||
export type Args<
|
||||
Cmd extends CliCommand = CliCommandServer,
|
||||
SubCmd extends CliExtensionSubcommand | void = void
|
||||
SubCmd extends CliExtensionSubcommand | CliCommandSetupSubcommand | void = void
|
||||
> = Cmd extends CliCommandServer
|
||||
? SetOptional<CommonArgs<Cmd>, keyof ServerArgs>
|
||||
: ParsedArgs<Cmd, SubCmd>;
|
||||
|
||||
@@ -3,6 +3,112 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [9.10.0](https://github.com/appium/appium/compare/@appium/base-driver@9.9.0...@appium/base-driver@9.10.0) (2024-06-10)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **appium:** Add session signature to all logs ([#20202](https://github.com/appium/appium/issues/20202)) ([#20214](https://github.com/appium/appium/issues/20214)) ([0363aab](https://github.com/appium/appium/commit/0363aab8ba4fe0ec49845db2f493001aa873578b)), closes [#20222](https://github.com/appium/appium/issues/20222)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **driver-test-support:** update dependency @types/lodash to v4.17.5 ([69bbb53](https://github.com/appium/appium/commit/69bbb5370e671d2809a5bf997936b0b3cc1a0a0b))
|
||||
* **types:** update dependency type-fest to v4.20.0 ([#20227](https://github.com/appium/appium/issues/20227)) ([ea00626](https://github.com/appium/appium/commit/ea00626091e3ce87f6e3ed7a61003295272835e3))
|
||||
|
||||
|
||||
|
||||
## [9.9.0](https://github.com/appium/appium/compare/@appium/base-driver@9.8.1...@appium/base-driver@9.9.0) (2024-06-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **appium:** Add session signature to all logs ([#20202](https://github.com/appium/appium/issues/20202)) ([b3f8a47](https://github.com/appium/appium/commit/b3f8a47c2d3fa029bdb5592d7130c6d1664e53b5))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **appium:** Revert changes in 20203 and 20202 ([#20209](https://github.com/appium/appium/issues/20209)) ([40def9d](https://github.com/appium/appium/commit/40def9dbdbde64706111900967d66735257b7404)), closes [#20202](https://github.com/appium/appium/issues/20202) [#20203](https://github.com/appium/appium/issues/20203)
|
||||
|
||||
|
||||
|
||||
## [9.8.1](https://github.com/appium/appium/compare/@appium/base-driver@9.8.0...@appium/base-driver@9.8.1) (2024-06-06)
|
||||
|
||||
**Note:** Version bump only for package @appium/base-driver
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [9.8.0](https://github.com/appium/appium/compare/@appium/base-driver@9.7.0...@appium/base-driver@9.8.0) (2024-06-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **base-driver:** Make addition of search query params to cache optional ([#20195](https://github.com/appium/appium/issues/20195)) ([21316e9](https://github.com/appium/appium/commit/21316e94d05b2f97aa0349a82da229713e92446c))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **types:** update dependency type-fest to v4.19.0 ([#20193](https://github.com/appium/appium/issues/20193)) ([db62358](https://github.com/appium/appium/commit/db62358dbac25de2a75fdc7493338d98b1422c84))
|
||||
|
||||
|
||||
|
||||
## [9.7.0](https://github.com/appium/appium/compare/@appium/base-driver@9.6.0...@appium/base-driver@9.7.0) (2024-05-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **base-driver:** Add env variables to control applications cache ([#20042](https://github.com/appium/appium/issues/20042)) ([4e8c91c](https://github.com/appium/appium/commit/4e8c91c8f647e545344d5b49282628413e1ccb19))
|
||||
* **base-driver:** Add the original app link argument to configureApp callbacks ([#20035](https://github.com/appium/appium/issues/20035)) ([3423fd9](https://github.com/appium/appium/commit/3423fd9206f71481bb34919e02a3dc8c5e3bec00))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **base-driver:** Update the web socket upgrade behavior ([#20142](https://github.com/appium/appium/issues/20142)) ([275790e](https://github.com/appium/appium/commit/275790ec012d0c773b1248c3c2a541301cf0167b))
|
||||
* **driver-test-support:** update definitelytyped ([a8d36b0](https://github.com/appium/appium/commit/a8d36b0a981daf524bd4af422904193c087a8c2c))
|
||||
* **images-plugin:** update dependency lru-cache to v10.2.1 ([#20039](https://github.com/appium/appium/issues/20039)) ([f645b50](https://github.com/appium/appium/commit/f645b50d9d6008d374bc131be78d8be5d84a7f53))
|
||||
* **images-plugin:** update dependency lru-cache to v10.2.2 ([#20052](https://github.com/appium/appium/issues/20052)) ([f8d1fb7](https://github.com/appium/appium/commit/f8d1fb7df7b7d093d3664f58830cad5b5dffa244))
|
||||
* **support:** update dependency axios to v1.7.1 ([11510cb](https://github.com/appium/appium/commit/11510cb1a5d50a20ced884e5404d0be1e04ff142))
|
||||
* **support:** update dependency axios to v1.7.2 ([a876f11](https://github.com/appium/appium/commit/a876f112b51dd25f70094b9e75330b9558050e42))
|
||||
* **types:** update dependency type-fest to v4.18.2 ([#20103](https://github.com/appium/appium/issues/20103)) ([3b43be1](https://github.com/appium/appium/commit/3b43be17321f2ca16bac0abedabf9ef8cffa098a))
|
||||
* **types:** update dependency type-fest to v4.18.3 ([#20149](https://github.com/appium/appium/issues/20149)) ([d5369f8](https://github.com/appium/appium/commit/d5369f8b08e7439282c5a211e684b154cc9f0051))
|
||||
|
||||
|
||||
|
||||
## [9.6.0](https://github.com/appium/appium/compare/@appium/base-driver@9.5.4...@appium/base-driver@9.6.0) (2024-04-21)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **base-driver:** Add onDownload handler to the configureApp helper ([#20015](https://github.com/appium/appium/issues/20015)) ([8cf3efd](https://github.com/appium/appium/commit/8cf3efdbed6c0868f2d7838e249a3d2478f186d4))
|
||||
|
||||
|
||||
|
||||
## [9.5.4](https://github.com/appium/appium/compare/@appium/base-driver@9.5.3...@appium/base-driver@9.5.4) (2024-04-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* do not print deprecation errors for non-provided caps ([#19986](https://github.com/appium/appium/issues/19986)) ([9f655f6](https://github.com/appium/appium/commit/9f655f6f852bc10ca1f51529183c7c44eb4c79ea))
|
||||
|
||||
|
||||
|
||||
## [9.5.3](https://github.com/appium/appium/compare/@appium/base-driver@9.5.2...@appium/base-driver@9.5.3) (2024-04-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **base-driver:** update dependency express to v4.18.3 ([917084c](https://github.com/appium/appium/commit/917084ccca23c5483e7d83ce97721061dd2fe345))
|
||||
* **base-driver:** update dependency express to v4.19.1 ([a74132c](https://github.com/appium/appium/commit/a74132cc96d201bb5c7b7f11a7e3b1b79e7d2424))
|
||||
* **base-driver:** update dependency express to v4.19.2 ([7cb1621](https://github.com/appium/appium/commit/7cb1621e80bc4225c48833cc2bd02fe80dccd382))
|
||||
* **base-driver:** update dependency path-to-regexp to v6.2.2 ([#19979](https://github.com/appium/appium/issues/19979)) ([b8368bb](https://github.com/appium/appium/commit/b8368bb666fda44e3b0c45cc7307bff69fe40202))
|
||||
* **docutils:** update dependency typescript to v5.4.2 ([#19876](https://github.com/appium/appium/issues/19876)) ([2448fa0](https://github.com/appium/appium/commit/2448fa0145620657ccc72b5637f1b7737fe52580))
|
||||
* **driver-test-support:** update definitelytyped ([4776574](https://github.com/appium/appium/commit/47765747b66c5e0076f6ffe4619d6b98a42aee29))
|
||||
* **support:** update dependency axios to v1.6.8 ([bd6ab81](https://github.com/appium/appium/commit/bd6ab81c9408ab0f90fc25fc112f9257ec2973ad))
|
||||
|
||||
|
||||
|
||||
## [9.5.2](https://github.com/appium/appium/compare/@appium/base-driver@9.5.1...@appium/base-driver@9.5.2) (2024-02-13)
|
||||
|
||||
**Note:** Version bump only for package @appium/base-driver
|
||||
|
||||
@@ -1,34 +1,54 @@
|
||||
// @ts-check
|
||||
|
||||
import type {
|
||||
Constraints,
|
||||
NSCapabilities,
|
||||
Capabilities,
|
||||
W3CCapabilities,
|
||||
StandardCapabilities,
|
||||
} from '@appium/types';
|
||||
import type {
|
||||
StringKeyOf,
|
||||
MergeExclusive,
|
||||
} from 'type-fest';
|
||||
import _ from 'lodash';
|
||||
import {validator} from './desired-caps';
|
||||
import {util} from '@appium/support';
|
||||
import log from './logger';
|
||||
import {errors} from '../protocol/errors';
|
||||
|
||||
const APPIUM_VENDOR_PREFIX = 'appium:';
|
||||
const PREFIXED_APPIUM_OPTS_CAP = `${APPIUM_VENDOR_PREFIX}options`;
|
||||
export const APPIUM_VENDOR_PREFIX = 'appium:';
|
||||
export const PREFIXED_APPIUM_OPTS_CAP = `${APPIUM_VENDOR_PREFIX}options`;
|
||||
|
||||
export type ParsedCaps<C extends Constraints> = {
|
||||
allFirstMatchCaps: NSCapabilities<C>[];
|
||||
validatedFirstMatchCaps: Capabilities<C>[];
|
||||
requiredCaps: NSCapabilities<C>;
|
||||
matchedCaps: Capabilities<C> | null;
|
||||
validationErrors: string[];
|
||||
};
|
||||
export type ValidateCapsOpts = {
|
||||
/** if true, skip the presence constraint */
|
||||
skipPresenceConstraint?: boolean | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes primary caps object and merges it into a secondary caps object.
|
||||
* @template {Constraints} T
|
||||
* @template {Constraints} U
|
||||
* @template {Capabilities<T>} Primary
|
||||
* @template {Capabilities<U>} Secondary
|
||||
* @param {Primary} [primary]
|
||||
* @param {Secondary} [secondary]
|
||||
* @returns {MergeExclusive<Primary, Secondary>}
|
||||
*
|
||||
* @see https://www.w3.org/TR/webdriver/#dfn-merging-capabilities)
|
||||
*/
|
||||
function mergeCaps(
|
||||
primary = /** @type {Primary} */ ({}),
|
||||
secondary = /** @type {Secondary} */ ({})
|
||||
) {
|
||||
let result = /** @type {MergeExclusive<Primary, Secondary>} */ ({
|
||||
export function mergeCaps<
|
||||
T extends Constraints,
|
||||
U extends Constraints,
|
||||
Primary extends Capabilities<T>,
|
||||
Secondary extends Capabilities<U>
|
||||
>(
|
||||
primary: Primary | undefined = {} as Primary,
|
||||
secondary: Secondary | undefined = {} as Secondary
|
||||
): MergeExclusive<Primary, Secondary> {
|
||||
const result = ({
|
||||
...primary,
|
||||
});
|
||||
}) as MergeExclusive<Primary, Secondary>;
|
||||
|
||||
for (let [name, value] of Object.entries(secondary)) {
|
||||
for (const [name, value] of Object.entries(secondary)) {
|
||||
// Overwriting is not allowed. Primary and secondary must have different properties (w3c rule 4.4)
|
||||
if (!_.isUndefined(primary[name])) {
|
||||
throw new errors.InvalidArgumentError(
|
||||
@@ -37,7 +57,7 @@ function mergeCaps(
|
||||
)}) and secondary (${JSON.stringify(secondary)}) object`
|
||||
);
|
||||
}
|
||||
result[/** @type {keyof typeof result} */ (name)] = value;
|
||||
result[name as keyof typeof result] = value;
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -45,21 +65,20 @@ function mergeCaps(
|
||||
|
||||
/**
|
||||
* Validates caps against a set of constraints
|
||||
* @template {Constraints} C
|
||||
* @param {Capabilities<C>} caps
|
||||
* @param {C} [constraints]
|
||||
* @param {ValidateCapsOpts} [opts]
|
||||
* @returns {Capabilities<C>}
|
||||
*/
|
||||
function validateCaps(caps, constraints = /** @type {C} */ ({}), opts = {}) {
|
||||
let {skipPresenceConstraint} = opts;
|
||||
export function validateCaps<C extends Constraints>(
|
||||
caps: Capabilities<C>,
|
||||
constraints: C | undefined = {} as C,
|
||||
opts: ValidateCapsOpts | undefined = {}
|
||||
): Capabilities<C> {
|
||||
const {skipPresenceConstraint} = opts;
|
||||
|
||||
if (!_.isPlainObject(caps)) {
|
||||
throw new errors.InvalidArgumentError(`must be a JSON object`);
|
||||
}
|
||||
|
||||
// Remove the 'presence' constraint if we're not checking for it
|
||||
constraints = /** @type {C} */ (
|
||||
constraints = (
|
||||
_.mapValues(
|
||||
constraints,
|
||||
skipPresenceConstraint
|
||||
@@ -73,16 +92,16 @@ function validateCaps(caps, constraints = /** @type {C} */ ({}), opts = {}) {
|
||||
return constraint;
|
||||
}
|
||||
)
|
||||
);
|
||||
) as C;
|
||||
|
||||
const validationErrors = validator.validate(_.pickBy(caps, util.hasValue), constraints, {
|
||||
fullMessages: false,
|
||||
});
|
||||
|
||||
if (validationErrors) {
|
||||
let message = [];
|
||||
for (let [attribute, reasons] of _.toPairs(validationErrors)) {
|
||||
for (let reason of reasons) {
|
||||
const message: string[] = [];
|
||||
for (const [attribute, reasons] of _.toPairs(validationErrors)) {
|
||||
for (const reason of (reasons as string[])) {
|
||||
message.push(`'${attribute}' ${reason}`);
|
||||
}
|
||||
}
|
||||
@@ -99,7 +118,7 @@ function validateCaps(caps, constraints = /** @type {C} */ ({}), opts = {}) {
|
||||
*/
|
||||
export const STANDARD_CAPS = Object.freeze(
|
||||
new Set(
|
||||
/** @type {StringKeyOf<import('@appium/types').StandardCapabilities>[]} */ ([
|
||||
([
|
||||
'browserName',
|
||||
'browserVersion',
|
||||
'platformName',
|
||||
@@ -110,29 +129,22 @@ export const STANDARD_CAPS = Object.freeze(
|
||||
'timeouts',
|
||||
'unhandledPromptBehavior',
|
||||
'webSocketUrl',
|
||||
])
|
||||
]) as StringKeyOf<StandardCapabilities>[]
|
||||
)
|
||||
);
|
||||
|
||||
const STANDARD_CAPS_LOWER = new Set([...STANDARD_CAPS].map((cap) => cap.toLowerCase()));
|
||||
|
||||
/**
|
||||
* @param {string} cap
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function isStandardCap(cap) {
|
||||
export function isStandardCap(cap: string): boolean {
|
||||
return STANDARD_CAPS_LOWER.has(cap.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* If the 'appium:' prefix was provided and it's a valid capability, strip out the prefix
|
||||
* @template {Constraints} C
|
||||
* @param {NSCapabilities<C>} caps
|
||||
* @see https://www.w3.org/TR/webdriver/#dfn-extension-capabilities
|
||||
* @internal
|
||||
* @returns {Capabilities<C>}
|
||||
*/
|
||||
function stripAppiumPrefixes(caps) {
|
||||
export function stripAppiumPrefixes<C extends Constraints>(caps: NSCapabilities<C>): Capabilities<C> {
|
||||
// split into prefixed and non-prefixed.
|
||||
// non-prefixed should be standard caps at this point
|
||||
const [prefixedCaps, nonPrefixedCaps] = _.partition(_.keys(caps), (cap) =>
|
||||
@@ -140,14 +152,12 @@ function stripAppiumPrefixes(caps) {
|
||||
);
|
||||
|
||||
// initialize this with the k/v pairs of the non-prefixed caps
|
||||
let strippedCaps = /** @type {Capabilities<C>} */ (_.pick(caps, nonPrefixedCaps));
|
||||
const badPrefixedCaps = [];
|
||||
const strippedCaps = (_.pick(caps, nonPrefixedCaps)) as Capabilities<C>;
|
||||
const badPrefixedCaps: string[] = [];
|
||||
|
||||
// Strip out the 'appium:' prefix
|
||||
for (let prefixedCap of prefixedCaps) {
|
||||
const strippedCapName = /** @type {StringKeyOf<Capabilities<C>>} */ (
|
||||
prefixedCap.substring(APPIUM_VENDOR_PREFIX.length)
|
||||
);
|
||||
for (const prefixedCap of prefixedCaps) {
|
||||
const strippedCapName = prefixedCap.substring(APPIUM_VENDOR_PREFIX.length) as StringKeyOf<Capabilities<C>>;
|
||||
|
||||
// If it's standard capability that was prefixed, add it to an array of incorrectly prefixed capabilities
|
||||
if (isStandardCap(strippedCapName)) {
|
||||
@@ -178,10 +188,13 @@ function stripAppiumPrefixes(caps) {
|
||||
|
||||
/**
|
||||
* Get an array of all the unprefixed caps that are being used in 'alwaysMatch' and all of the 'firstMatch' object
|
||||
* @template {Constraints} C
|
||||
* @param {W3CCapabilities<C>} caps A capabilities object
|
||||
*/
|
||||
function findNonPrefixedCaps({alwaysMatch = {}, firstMatch = []}) {
|
||||
export function findNonPrefixedCaps<C extends Constraints>(
|
||||
{
|
||||
alwaysMatch = {},
|
||||
firstMatch = []
|
||||
}: W3CCapabilities<C>
|
||||
): string[] {
|
||||
return _.chain([alwaysMatch, ...firstMatch])
|
||||
.reduce(
|
||||
(unprefixedCaps, caps) => [
|
||||
@@ -194,27 +207,15 @@ function findNonPrefixedCaps({alwaysMatch = {}, firstMatch = []}) {
|
||||
.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returned by {@linkcode parseCaps}
|
||||
* @template {Constraints} C
|
||||
* @typedef ParsedCaps
|
||||
* @property {NSCapabilities<C>[]} allFirstMatchCaps
|
||||
* @property {Capabilities<C>[]} validatedFirstMatchCaps
|
||||
* @property {NSCapabilities<C>} requiredCaps
|
||||
* @property {Capabilities<C>|null} matchedCaps
|
||||
* @property {string[]} validationErrors
|
||||
*/
|
||||
|
||||
/**
|
||||
* Parse capabilities
|
||||
* @template {Constraints} C
|
||||
* @param {W3CCapabilities<C>} caps
|
||||
* @param {C} [constraints]
|
||||
* @param {boolean} [shouldValidateCaps]
|
||||
* @see https://www.w3.org/TR/webdriver/#processing-capabilities
|
||||
* @returns {ParsedCaps<C>}
|
||||
*/
|
||||
function parseCaps(caps, constraints = /** @type {C} */ ({}), shouldValidateCaps = true) {
|
||||
export function parseCaps<C extends Constraints>(
|
||||
caps: W3CCapabilities<C>,
|
||||
constraints: C | undefined = {} as C,
|
||||
shouldValidateCaps: boolean | undefined = true
|
||||
): ParsedCaps<C> {
|
||||
// If capabilities request is not an object, return error (#1.1)
|
||||
if (!_.isPlainObject(caps)) {
|
||||
throw new errors.InvalidArgumentError(
|
||||
@@ -224,9 +225,9 @@ function parseCaps(caps, constraints = /** @type {C} */ ({}), shouldValidateCaps
|
||||
|
||||
// Let 'requiredCaps' be property named 'alwaysMatch' from capabilities request (#2)
|
||||
// and 'allFirstMatchCaps' be property named 'firstMatch' from capabilities request (#3)
|
||||
let {
|
||||
alwaysMatch: requiredCaps = /** @type {NSCapabilities<C>} */ ({}), // If 'requiredCaps' is undefined, set it to an empty JSON object (#2.1)
|
||||
firstMatch: allFirstMatchCaps = /** @type {NSCapabilities<C>[]} */ ([{}]), // If 'firstMatch' is undefined set it to a singleton list with one empty object (#3.1)
|
||||
const {
|
||||
alwaysMatch: requiredCaps = {} as NSCapabilities<C>, // If 'requiredCaps' is undefined, set it to an empty JSON object (#2.1)
|
||||
firstMatch: allFirstMatchCaps = [{}] as NSCapabilities<C>[], // If 'firstMatch' is undefined set it to a singleton list with one empty object (#3.1)
|
||||
} = caps;
|
||||
|
||||
// Reject 'firstMatch' argument if it's not an array (#3.2)
|
||||
@@ -247,7 +248,7 @@ function parseCaps(caps, constraints = /** @type {C} */ ({}), shouldValidateCaps
|
||||
}
|
||||
|
||||
// Check for non-prefixed, non-standard capabilities and log warnings if they are found
|
||||
let nonPrefixedCaps = findNonPrefixedCaps(caps);
|
||||
const nonPrefixedCaps = findNonPrefixedCaps(caps);
|
||||
if (!_.isEmpty(nonPrefixedCaps)) {
|
||||
throw new errors.InvalidArgumentError(
|
||||
`All non-standard capabilities should have a vendor prefix. The following capabilities did not have one: ${nonPrefixedCaps}`
|
||||
@@ -256,8 +257,7 @@ function parseCaps(caps, constraints = /** @type {C} */ ({}), shouldValidateCaps
|
||||
|
||||
// Strip out the 'appium:' prefix from all
|
||||
let strippedRequiredCaps = stripAppiumPrefixes(requiredCaps);
|
||||
/** @type {Capabilities<C>[]} */
|
||||
let strippedAllFirstMatchCaps = allFirstMatchCaps.map(stripAppiumPrefixes);
|
||||
const strippedAllFirstMatchCaps: Capabilities<C>[] = allFirstMatchCaps.map(stripAppiumPrefixes);
|
||||
|
||||
// Validate the requiredCaps. But don't validate 'presence' because if that constraint fails on 'alwaysMatch' it could still pass on one of the 'firstMatch' keys
|
||||
if (shouldValidateCaps) {
|
||||
@@ -267,14 +267,11 @@ function parseCaps(caps, constraints = /** @type {C} */ ({}), shouldValidateCaps
|
||||
}
|
||||
// Remove the 'presence' constraint for any keys that are already present in 'requiredCaps'
|
||||
// since we know that this constraint has already passed
|
||||
const filteredConstraints = /** @type {C} */ (
|
||||
_.omitBy(constraints, (_, key) => key in strippedRequiredCaps)
|
||||
);
|
||||
const filteredConstraints = _.omitBy(constraints, (_, key) => key in strippedRequiredCaps) as C;
|
||||
|
||||
// Validate all of the first match capabilities and return an array with only the valid caps (see spec #5)
|
||||
/** @type {string[]} */
|
||||
let validationErrors = [];
|
||||
let validatedFirstMatchCaps = _.compact(
|
||||
const validationErrors: string[] = [];
|
||||
const validatedFirstMatchCaps = _.compact(
|
||||
strippedAllFirstMatchCaps.map((firstMatchCaps) => {
|
||||
try {
|
||||
// Validate firstMatch caps
|
||||
@@ -285,17 +282,16 @@ function parseCaps(caps, constraints = /** @type {C} */ ({}), shouldValidateCaps
|
||||
validationErrors.push(e.message);
|
||||
}
|
||||
})
|
||||
);
|
||||
) as Capabilities<C>[];
|
||||
|
||||
/**
|
||||
* Try to merge requiredCaps with first match capabilities, break once it finds its first match
|
||||
* (see spec #6)
|
||||
* @type {ParsedCaps<C>['matchedCaps']}
|
||||
*/
|
||||
let matchedCaps = null;
|
||||
for (let firstMatchCaps of validatedFirstMatchCaps) {
|
||||
let matchedCaps: ParsedCaps<C>['matchedCaps'] = null;
|
||||
for (const firstMatchCaps of validatedFirstMatchCaps) {
|
||||
try {
|
||||
matchedCaps = mergeCaps(strippedRequiredCaps, firstMatchCaps);
|
||||
matchedCaps = mergeCaps(strippedRequiredCaps, firstMatchCaps) as ParsedCaps<C>['matchedCaps'];
|
||||
if (matchedCaps) {
|
||||
break;
|
||||
}
|
||||
@@ -317,18 +313,15 @@ function parseCaps(caps, constraints = /** @type {C} */ ({}), shouldValidateCaps
|
||||
|
||||
/**
|
||||
* Calls parseCaps and just returns the matchedCaps variable
|
||||
* @template {Constraints} C
|
||||
* @template {W3CCapabilities<C>} W3CCaps
|
||||
* @param {W3CCaps} w3cCaps
|
||||
* @param {C} [constraints]
|
||||
* @param {boolean} [shouldValidateCaps]
|
||||
* @returns {Capabilities<C>}
|
||||
*/
|
||||
function processCapabilities(
|
||||
w3cCaps,
|
||||
constraints = /** @type {C} */ ({}),
|
||||
shouldValidateCaps = true
|
||||
) {
|
||||
export function processCapabilities<
|
||||
C extends Constraints,
|
||||
W3CCaps extends W3CCapabilities<C>
|
||||
>(
|
||||
w3cCaps: W3CCaps,
|
||||
constraints: C | undefined = {} as C,
|
||||
shouldValidateCaps: boolean | undefined = true
|
||||
): Capabilities<C> {
|
||||
const {matchedCaps, validationErrors} = parseCaps(w3cCaps, constraints, shouldValidateCaps);
|
||||
|
||||
// If we found an error throw an exception
|
||||
@@ -346,18 +339,14 @@ function processCapabilities(
|
||||
}
|
||||
}
|
||||
|
||||
return /** @type {Capabilities<C>} */ (matchedCaps ?? {});
|
||||
return (matchedCaps ?? {}) as Capabilities<C>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a copy of a "bare" (single-level, non-W3C) capabilities object which has taken everything
|
||||
* within the 'appium:options' capability and promoted it to the top level.
|
||||
*
|
||||
* @template {Constraints} C
|
||||
* @param {NSCapabilities<C>} obj
|
||||
* @return {NSCapabilities<C>} the capabilities with 'options' promoted if necessary
|
||||
*/
|
||||
function promoteAppiumOptionsForObject(obj) {
|
||||
export function promoteAppiumOptionsForObject<C extends Constraints>(obj: NSCapabilities<C>): NSCapabilities<C> {
|
||||
const appiumOptions = obj[PREFIXED_APPIUM_OPTS_CAP];
|
||||
if (!appiumOptions) {
|
||||
return obj;
|
||||
@@ -379,8 +368,8 @@ function promoteAppiumOptionsForObject(obj) {
|
||||
/**
|
||||
* @param {string} capName
|
||||
*/
|
||||
const shouldAddVendorPrefix = (capName) => !capName.startsWith(APPIUM_VENDOR_PREFIX);
|
||||
const verifyIfAcceptable = (/** @type {string} */ capName) => {
|
||||
const shouldAddVendorPrefix = (capName: string) => !capName.startsWith(APPIUM_VENDOR_PREFIX);
|
||||
const verifyIfAcceptable = (capName: string) => {
|
||||
if (!_.isString(capName)) {
|
||||
throw new errors.SessionNotCreatedError(
|
||||
`Capability names in ${PREFIXED_APPIUM_OPTS_CAP} must be strings. '${capName}' is unexpected`
|
||||
@@ -394,8 +383,8 @@ function promoteAppiumOptionsForObject(obj) {
|
||||
return capName;
|
||||
};
|
||||
const preprocessedOptions = _(appiumOptions)
|
||||
.mapKeys((value, /** @type {string} */ key) => verifyIfAcceptable(key))
|
||||
.mapKeys((value, key) => (shouldAddVendorPrefix(key) ? `${APPIUM_VENDOR_PREFIX}${key}` : key))
|
||||
.mapKeys((value, key: string) => verifyIfAcceptable(key))
|
||||
.mapKeys((value, key: string) => (shouldAddVendorPrefix(key) ? `${APPIUM_VENDOR_PREFIX}${key}` : key))
|
||||
.value();
|
||||
// warn if we are going to overwrite any keys on the base caps object
|
||||
const overwrittenKeys = _.intersection(Object.keys(obj), Object.keys(preprocessedOptions));
|
||||
@@ -406,7 +395,7 @@ function promoteAppiumOptionsForObject(obj) {
|
||||
);
|
||||
}
|
||||
return _.cloneDeep({
|
||||
.../** @type {NSCapabilities<C>} */ (_.omit(obj, PREFIXED_APPIUM_OPTS_CAP)),
|
||||
..._.omit(obj, PREFIXED_APPIUM_OPTS_CAP) as NSCapabilities<C>,
|
||||
...preprocessedOptions,
|
||||
});
|
||||
}
|
||||
@@ -414,13 +403,9 @@ function promoteAppiumOptionsForObject(obj) {
|
||||
/**
|
||||
* Return a copy of a capabilities object which has taken everything within the 'options'
|
||||
* capability and promoted it to the top level.
|
||||
*
|
||||
* @template {Constraints} C
|
||||
* @param {W3CCapabilities<C>} originalCaps
|
||||
* @return {W3CCapabilities<C>} the capabilities with 'options' promoted if necessary
|
||||
*/
|
||||
function promoteAppiumOptions(originalCaps) {
|
||||
const result = {};
|
||||
export function promoteAppiumOptions<C extends Constraints>(originalCaps: W3CCapabilities<C>): W3CCapabilities<C> {
|
||||
const result = {} as W3CCapabilities<C>;
|
||||
const {alwaysMatch, firstMatch} = originalCaps;
|
||||
if (_.isPlainObject(alwaysMatch)) {
|
||||
result.alwaysMatch = promoteAppiumOptionsForObject(alwaysMatch);
|
||||
@@ -434,59 +419,3 @@ function promoteAppiumOptions(originalCaps) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export {
|
||||
parseCaps,
|
||||
processCapabilities,
|
||||
validateCaps,
|
||||
mergeCaps,
|
||||
APPIUM_VENDOR_PREFIX,
|
||||
findNonPrefixedCaps,
|
||||
isStandardCap,
|
||||
stripAppiumPrefixes,
|
||||
promoteAppiumOptions,
|
||||
promoteAppiumOptionsForObject,
|
||||
PREFIXED_APPIUM_OPTS_CAP,
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {import('@appium/types').Constraints} Constraints
|
||||
* @typedef {import('@appium/types').Constraint} Constraint
|
||||
* @typedef {import('@appium/types').StringRecord} StringRecord
|
||||
* @typedef {import('@appium/types').BaseDriverCapConstraints} BaseDriverCapConstraints
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template {Constraints} C
|
||||
* @typedef {import('@appium/types').ConstraintsToCaps<C>} ConstraintsToCaps
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef ValidateCapsOpts
|
||||
* @property {boolean} [skipPresenceConstraint] - if true, skip the presence constraint
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template {Constraints} C
|
||||
* @typedef {import('@appium/types').NSCapabilities<C>} NSCapabilities
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template {Constraints} C
|
||||
* @typedef {import('@appium/types').Capabilities<C>} Capabilities
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template {Constraints} C
|
||||
* @typedef {import('@appium/types').W3CCapabilities<C>} W3CCapabilities
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {import('type-fest').StringKeyOf<T>} StringKeyOf
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template T,U
|
||||
* @typedef {import('type-fest').MergeExclusive<T, U>} MergeExclusive<T,U>
|
||||
*/
|
||||
@@ -74,8 +74,12 @@ validator.validators.isArray = function isArray(value) {
|
||||
return 'must be of type array';
|
||||
};
|
||||
validator.validators.deprecated = function deprecated(value, options, key) {
|
||||
if (options) {
|
||||
log.warn(`${key} is a deprecated capability`);
|
||||
// do not print caps that hasn't been provided.
|
||||
if (typeof value !== 'undefined' && options) {
|
||||
log.warn(
|
||||
`The '${key}' capability has been deprecated and must not be used anymore. ` +
|
||||
`Please check the driver documentation for possible alternatives.`
|
||||
);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -307,7 +307,7 @@ export class BaseDriver<
|
||||
this.newCommandTimeoutMs = (this.caps.newCommandTimeout as number) * 1000;
|
||||
}
|
||||
|
||||
this._log.prefix = helpers.generateDriverLogPrefix(this, this.sessionId);
|
||||
this._log.prefix = helpers.generateDriverLogPrefix(this);
|
||||
|
||||
this.log.info(`Session created with session id: ${this.sessionId}`);
|
||||
|
||||
@@ -347,7 +347,6 @@ export class BaseDriver<
|
||||
}
|
||||
}
|
||||
this.sessionId = null;
|
||||
this._log.prefix = helpers.generateDriverLogPrefix(this);
|
||||
}
|
||||
|
||||
logExtraCaps(caps: Capabilities<C>) {
|
||||
|
||||
@@ -9,26 +9,26 @@ import axios from 'axios';
|
||||
import B from 'bluebird';
|
||||
|
||||
// for compat with running tests transpiled and in-place
|
||||
const {version: BASEDRIVER_VER} = fs.readPackageJsonFrom(__dirname);
|
||||
export const {version: BASEDRIVER_VER} = fs.readPackageJsonFrom(__dirname);
|
||||
const IPA_EXT = '.ipa';
|
||||
const ZIP_EXTS = new Set(['.zip', IPA_EXT]);
|
||||
const ZIP_MIME_TYPES = ['application/zip', 'application/x-zip-compressed', 'multipart/x-zip'];
|
||||
const CACHED_APPS_MAX_AGE = 1000 * 60 * 60 * 24; // ms
|
||||
const MAX_CACHED_APPS = 1024;
|
||||
const CACHED_APPS_MAX_AGE_MS = 1000 * 60 * toNaturalNumber(60 * 24, 'APPIUM_APPS_CACHE_MAX_AGE');
|
||||
const MAX_CACHED_APPS = toNaturalNumber(1024, 'APPIUM_APPS_CACHE_MAX_ITEMS');
|
||||
const HTTP_STATUS_NOT_MODIFIED = 304;
|
||||
const DEFAULT_REQ_HEADERS = Object.freeze({
|
||||
'user-agent': `Appium (BaseDriver v${BASEDRIVER_VER})`,
|
||||
});
|
||||
const AVG_DOWNLOAD_SPEED_MEASUREMENT_THRESHOLD_SEC = 2;
|
||||
/** @type {LRUCache<string, import('@appium/types').CachedAppInfo>} */
|
||||
const APPLICATIONS_CACHE = new LRUCache({
|
||||
max: MAX_CACHED_APPS,
|
||||
ttl: CACHED_APPS_MAX_AGE, // expire after 24 hours
|
||||
ttl: CACHED_APPS_MAX_AGE_MS, // expire after 24 hours
|
||||
updateAgeOnGet: true,
|
||||
// @ts-ignore The fullPath property exists
|
||||
dispose: ({fullPath}, app) => {
|
||||
logger.info(
|
||||
`The application '${app}' cached at '${fullPath}' has ` +
|
||||
`expired after ${CACHED_APPS_MAX_AGE}ms`
|
||||
`expired after ${CACHED_APPS_MAX_AGE_MS}ms`
|
||||
);
|
||||
if (fullPath) {
|
||||
fs.rimraf(fullPath);
|
||||
@@ -46,16 +46,14 @@ process.on('exit', () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const appPaths = [...APPLICATIONS_CACHE.values()]
|
||||
// @ts-ignore The fullPath property exists
|
||||
.map(({fullPath}) => fullPath);
|
||||
const appPaths = [...APPLICATIONS_CACHE.values()].map(({fullPath}) => fullPath);
|
||||
logger.debug(
|
||||
`Performing cleanup of ${appPaths.length} cached ` +
|
||||
util.pluralize('application', appPaths.length)
|
||||
);
|
||||
for (const appPath of appPaths) {
|
||||
try {
|
||||
// Asynchronous calls are not supported in onExit handler
|
||||
// @ts-ignore it's defined
|
||||
fs.rimrafSync(appPath);
|
||||
} catch (e) {
|
||||
logger.warn(e.message);
|
||||
@@ -63,48 +61,12 @@ process.on('exit', () => {
|
||||
}
|
||||
});
|
||||
|
||||
function verifyAppExtension(app, supportedAppExtensions) {
|
||||
if (supportedAppExtensions.map(_.toLower).includes(_.toLower(path.extname(app)))) {
|
||||
return app;
|
||||
}
|
||||
throw new Error(
|
||||
`New app path '${app}' did not have ` +
|
||||
`${util.pluralize('extension', supportedAppExtensions.length, false)}: ` +
|
||||
supportedAppExtensions
|
||||
);
|
||||
}
|
||||
|
||||
async function calculateFolderIntegrity(folderPath) {
|
||||
return (await fs.glob('**/*', {cwd: folderPath})).length;
|
||||
}
|
||||
|
||||
async function calculateFileIntegrity(filePath) {
|
||||
return await fs.hash(filePath);
|
||||
}
|
||||
|
||||
async function isAppIntegrityOk(currentPath, expectedIntegrity = {}) {
|
||||
if (!(await fs.exists(currentPath))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Folder integrity check is simple:
|
||||
// Verify the previous amount of files is not greater than the current one.
|
||||
// We don't want to use equality comparison because of an assumption that the OS might
|
||||
// create some unwanted service files/cached inside of that folder or its subfolders.
|
||||
// Ofc, validating the hash sum of each file (or at least of file path) would be much
|
||||
// more precise, but we don't need to be very precise here and also don't want to
|
||||
// overuse RAM and have a performance drop.
|
||||
return (await fs.stat(currentPath)).isDirectory()
|
||||
? (await calculateFolderIntegrity(currentPath)) >= expectedIntegrity?.folder
|
||||
: (await calculateFileIntegrity(currentPath)) === expectedIntegrity?.file;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} app
|
||||
* @param {string|string[]|import('@appium/types').ConfigureAppOptions} options
|
||||
*/
|
||||
async function configureApp(
|
||||
export async function configureApp(
|
||||
app,
|
||||
options = /** @type {import('@appium/types').ConfigureAppOptions} */ ({})
|
||||
) {
|
||||
@@ -114,8 +76,8 @@ async function configureApp(
|
||||
}
|
||||
|
||||
let supportedAppExtensions;
|
||||
const onPostProcess =
|
||||
!_.isString(options) && !_.isArray(options) ? options.onPostProcess : undefined;
|
||||
const onPostProcess = !_.isString(options) && !_.isArray(options) ? options.onPostProcess : undefined;
|
||||
const onDownload = !_.isString(options) && !_.isArray(options) ? options.onDownload : undefined;
|
||||
|
||||
if (_.isString(options)) {
|
||||
supportedAppExtensions = [options];
|
||||
@@ -129,6 +91,7 @@ async function configureApp(
|
||||
}
|
||||
|
||||
let newApp = app;
|
||||
const originalAppLink = app;
|
||||
let shouldUnzipApp = false;
|
||||
let packageHash = null;
|
||||
/** @type {import('axios').AxiosResponse['headers']|undefined} */
|
||||
@@ -140,17 +103,16 @@ async function configureApp(
|
||||
maxAge: null,
|
||||
etag: null,
|
||||
};
|
||||
const {protocol, pathname} = url.parse(newApp);
|
||||
const isUrl = protocol === null ? false : ['http:', 'https:'].includes(protocol);
|
||||
const {protocol, pathname} = parseAppLink(app);
|
||||
const isUrl = isSupportedUrl(app);
|
||||
const appCacheKey = toCacheKey(app);
|
||||
|
||||
/** @type {import('@appium/types').CachedAppInfo|undefined} */
|
||||
// @ts-ignore We know the returned type
|
||||
const cachedAppInfo = APPLICATIONS_CACHE.get(app);
|
||||
const cachedAppInfo = APPLICATIONS_CACHE.get(appCacheKey);
|
||||
if (cachedAppInfo) {
|
||||
logger.debug(`Cached app data: ${JSON.stringify(cachedAppInfo, null, 2)}`);
|
||||
}
|
||||
|
||||
return await APPLICATIONS_CACHE_GUARD.acquire(app, async () => {
|
||||
return await APPLICATIONS_CACHE_GUARD.acquire(appCacheKey, async () => {
|
||||
if (isUrl) {
|
||||
// Use the app from remote URL
|
||||
logger.info(`Using downloadable app '${newApp}'`);
|
||||
@@ -162,20 +124,22 @@ async function configureApp(
|
||||
} else if (cachedAppInfo?.lastModified) {
|
||||
reqHeaders['if-modified-since'] = cachedAppInfo.lastModified.toUTCString();
|
||||
}
|
||||
logger.debug(`Request headers: ${JSON.stringify(reqHeaders)}`);
|
||||
|
||||
let {headers, stream, status} = await queryAppLink(newApp, reqHeaders);
|
||||
logger.debug(`Response status: ${status}`);
|
||||
try {
|
||||
if (!_.isEmpty(headers)) {
|
||||
logger.debug(`Etag: ${headers.etag}`);
|
||||
if (headers.etag) {
|
||||
logger.debug(`Etag: ${headers.etag}`);
|
||||
remoteAppProps.etag = headers.etag;
|
||||
}
|
||||
logger.debug(`Last-Modified: ${headers['last-modified']}`);
|
||||
if (headers['last-modified']) {
|
||||
logger.debug(`Last-Modified: ${headers['last-modified']}`);
|
||||
remoteAppProps.lastModified = new Date(headers['last-modified']);
|
||||
}
|
||||
logger.debug(`Cache-Control: ${headers['cache-control']}`);
|
||||
if (headers['cache-control']) {
|
||||
logger.debug(`Cache-Control: ${headers['cache-control']}`);
|
||||
remoteAppProps.immutable = /\bimmutable\b/i.test(headers['cache-control']);
|
||||
const maxAgeMatch = /\bmax-age=(\d+)\b/i.exec(headers['cache-control']);
|
||||
if (maxAgeMatch) {
|
||||
@@ -184,15 +148,15 @@ async function configureApp(
|
||||
}
|
||||
}
|
||||
if (cachedAppInfo && status === HTTP_STATUS_NOT_MODIFIED) {
|
||||
if (await isAppIntegrityOk(cachedAppInfo.fullPath, cachedAppInfo.integrity)) {
|
||||
if (await isAppIntegrityOk(/** @type {string} */ (cachedAppInfo.fullPath), cachedAppInfo.integrity)) {
|
||||
logger.info(`Reusing previously downloaded application at '${cachedAppInfo.fullPath}'`);
|
||||
return verifyAppExtension(cachedAppInfo.fullPath, supportedAppExtensions);
|
||||
return verifyAppExtension(/** @type {string} */ (cachedAppInfo.fullPath), supportedAppExtensions);
|
||||
}
|
||||
logger.info(
|
||||
`The application at '${cachedAppInfo.fullPath}' does not exist anymore ` +
|
||||
`or its integrity has been damaged. Deleting it from the internal cache`
|
||||
);
|
||||
APPLICATIONS_CACHE.delete(app);
|
||||
APPLICATIONS_CACHE.delete(appCacheKey);
|
||||
|
||||
if (!stream.closed) {
|
||||
stream.destroy();
|
||||
@@ -251,11 +215,16 @@ async function configureApp(
|
||||
}
|
||||
fileName = `${resultingName}${resultingExt}`;
|
||||
}
|
||||
const targetPath = await tempDir.path({
|
||||
prefix: fileName,
|
||||
suffix: '',
|
||||
});
|
||||
newApp = await fetchApp(stream, targetPath);
|
||||
newApp = onDownload
|
||||
? await onDownload({
|
||||
url: originalAppLink,
|
||||
headers: /** @type {import('@appium/types').HTTPHeaders} */ (_.clone(headers)),
|
||||
stream,
|
||||
})
|
||||
: await fetchApp(stream, await tempDir.path({
|
||||
prefix: fileName,
|
||||
suffix: '',
|
||||
}));
|
||||
} finally {
|
||||
if (!stream.closed) {
|
||||
stream.destroy();
|
||||
@@ -285,18 +254,18 @@ async function configureApp(
|
||||
const archivePath = newApp;
|
||||
if (packageHash === cachedAppInfo?.packageHash) {
|
||||
const fullPath = cachedAppInfo?.fullPath;
|
||||
if (await isAppIntegrityOk(fullPath, cachedAppInfo?.integrity)) {
|
||||
if (await isAppIntegrityOk(/** @type {string} */ (fullPath), cachedAppInfo?.integrity)) {
|
||||
if (archivePath !== app) {
|
||||
await fs.rimraf(archivePath);
|
||||
}
|
||||
logger.info(`Will reuse previously cached application at '${fullPath}'`);
|
||||
return verifyAppExtension(fullPath, supportedAppExtensions);
|
||||
return verifyAppExtension(/** @type {string} */ (fullPath), supportedAppExtensions);
|
||||
}
|
||||
logger.info(
|
||||
`The application at '${fullPath}' does not exist anymore ` +
|
||||
`or its integrity has been damaged. Deleting it from the cache`
|
||||
);
|
||||
APPLICATIONS_CACHE.delete(app);
|
||||
APPLICATIONS_CACHE.delete(appCacheKey);
|
||||
}
|
||||
const tmpRoot = await tempDir.openDir();
|
||||
try {
|
||||
@@ -327,7 +296,7 @@ async function configureApp(
|
||||
} else {
|
||||
integrity.file = await calculateFileIntegrity(appPathToCache);
|
||||
}
|
||||
APPLICATIONS_CACHE.set(app, {
|
||||
APPLICATIONS_CACHE.set(appCacheKey, {
|
||||
...remoteAppProps,
|
||||
timestamp: Date.now(),
|
||||
packageHash,
|
||||
@@ -342,6 +311,7 @@ async function configureApp(
|
||||
/** @type {import('@appium/types').PostProcessOptions<import('axios').AxiosResponseHeaders>} */ ({
|
||||
cachedAppInfo: _.clone(cachedAppInfo),
|
||||
isUrl,
|
||||
originalAppLink,
|
||||
headers: _.clone(headers),
|
||||
appPath: newApp,
|
||||
})
|
||||
@@ -352,12 +322,93 @@ async function configureApp(
|
||||
}
|
||||
|
||||
verifyAppExtension(newApp, supportedAppExtensions);
|
||||
return app !== newApp && (packageHash || _.values(remoteAppProps).some(Boolean))
|
||||
return appCacheKey !== toCacheKey(newApp) && (packageHash || _.values(remoteAppProps).some(Boolean))
|
||||
? await storeAppInCache(newApp)
|
||||
: newApp;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} app
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isPackageOrBundle(app) {
|
||||
return /^([a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+)+$/.test(app);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all instances 'firstKey' and create a duplicate with the key 'secondKey',
|
||||
* Do the same thing in reverse. If we find 'secondKey', create a duplicate with the key 'firstKey'.
|
||||
*
|
||||
* This will cause keys to be overwritten if the object contains 'firstKey' and 'secondKey'.
|
||||
|
||||
* @param {*} input Any type of input
|
||||
* @param {String} firstKey The first key to duplicate
|
||||
* @param {String} secondKey The second key to duplicate
|
||||
*/
|
||||
export function duplicateKeys(input, firstKey, secondKey) {
|
||||
// If array provided, recursively call on all elements
|
||||
if (_.isArray(input)) {
|
||||
return input.map((item) => duplicateKeys(item, firstKey, secondKey));
|
||||
}
|
||||
|
||||
// If object, create duplicates for keys and then recursively call on values
|
||||
if (_.isPlainObject(input)) {
|
||||
const resultObj = {};
|
||||
for (let [key, value] of _.toPairs(input)) {
|
||||
const recursivelyCalledValue = duplicateKeys(value, firstKey, secondKey);
|
||||
if (key === firstKey) {
|
||||
resultObj[secondKey] = recursivelyCalledValue;
|
||||
} else if (key === secondKey) {
|
||||
resultObj[firstKey] = recursivelyCalledValue;
|
||||
}
|
||||
resultObj[key] = recursivelyCalledValue;
|
||||
}
|
||||
return resultObj;
|
||||
}
|
||||
|
||||
// Base case. Return primitives without doing anything.
|
||||
return input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a desired capability and tries to JSON.parse it as an array,
|
||||
* and either returns the parsed array or a singleton array.
|
||||
*
|
||||
* @param {string|Array<String>} cap A desired capability
|
||||
*/
|
||||
export function parseCapsArray(cap) {
|
||||
if (_.isArray(cap)) {
|
||||
return cap;
|
||||
}
|
||||
|
||||
let parsedCaps;
|
||||
try {
|
||||
parsedCaps = JSON.parse(cap);
|
||||
if (_.isArray(parsedCaps)) {
|
||||
return parsedCaps;
|
||||
}
|
||||
} catch (ign) {
|
||||
logger.warn(`Failed to parse capability as JSON array`);
|
||||
}
|
||||
if (_.isString(cap)) {
|
||||
return [cap];
|
||||
}
|
||||
throw new Error(`must provide a string or JSON Array; received ${cap}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a string that uniquely describes driver instance
|
||||
*
|
||||
* @param {import('@appium/types').Core} obj driver instance
|
||||
* @param {string?} [sessionId=null] session identifier (if exists).
|
||||
* This parameter is deprecated and is not used.
|
||||
* @returns {string}
|
||||
*/
|
||||
export function generateDriverLogPrefix(obj, sessionId = null) {
|
||||
return `${obj.constructor.name}@${node.getObjectId(obj).substring(0, 4)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a HTTP GET query to fetch the app with caching enabled.
|
||||
* Follows https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching
|
||||
@@ -463,9 +514,7 @@ async function unzipApp(zipPath, dstRoot, supportedAppExtensions) {
|
||||
try {
|
||||
logger.debug(`Unzipping '${zipPath}'`);
|
||||
const timer = new timing.Timer().start();
|
||||
const useSystemUnzipEnv = process.env.APPIUM_PREFER_SYSTEM_UNZIP;
|
||||
const useSystemUnzip =
|
||||
_.isEmpty(useSystemUnzipEnv) || !['0', 'false'].includes(_.toLower(useSystemUnzipEnv));
|
||||
const useSystemUnzip = isEnvOptionEnabled('APPIUM_PREFER_SYSTEM_UNZIP', true);
|
||||
/**
|
||||
* Attempt to use use the system `unzip` (e.g., `/usr/bin/unzip`) due
|
||||
* to the significant performance improvement it provides over the native
|
||||
@@ -518,81 +567,145 @@ async function unzipApp(zipPath, dstRoot, supportedAppExtensions) {
|
||||
}
|
||||
}
|
||||
|
||||
function isPackageOrBundle(app) {
|
||||
return /^([a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+)+$/.test(app);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all instances 'firstKey' and create a duplicate with the key 'secondKey',
|
||||
* Do the same thing in reverse. If we find 'secondKey', create a duplicate with the key 'firstKey'.
|
||||
* Transforms the given app link to the cache key.
|
||||
* This is necessary to properly cache apps
|
||||
* having the same address, but different query strings,
|
||||
* for example ones stored in S3 using presigned URLs.
|
||||
*
|
||||
* This will cause keys to be overwritten if the object contains 'firstKey' and 'secondKey'.
|
||||
|
||||
* @param {*} input Any type of input
|
||||
* @param {String} firstKey The first key to duplicate
|
||||
* @param {String} secondKey The second key to duplicate
|
||||
* @param {string} app App link.
|
||||
* @returns {string} Transformed app link or the original arg if
|
||||
* no transfromation is needed.
|
||||
*/
|
||||
function duplicateKeys(input, firstKey, secondKey) {
|
||||
// If array provided, recursively call on all elements
|
||||
if (_.isArray(input)) {
|
||||
return input.map((item) => duplicateKeys(item, firstKey, secondKey));
|
||||
function toCacheKey(app) {
|
||||
if (!isEnvOptionEnabled('APPIUM_APPS_CACHE_IGNORE_URL_QUERY') || !isSupportedUrl(app)) {
|
||||
return app;
|
||||
}
|
||||
|
||||
// If object, create duplicates for keys and then recursively call on values
|
||||
if (_.isPlainObject(input)) {
|
||||
const resultObj = {};
|
||||
for (let [key, value] of _.toPairs(input)) {
|
||||
const recursivelyCalledValue = duplicateKeys(value, firstKey, secondKey);
|
||||
if (key === firstKey) {
|
||||
resultObj[secondKey] = recursivelyCalledValue;
|
||||
} else if (key === secondKey) {
|
||||
resultObj[firstKey] = recursivelyCalledValue;
|
||||
}
|
||||
resultObj[key] = recursivelyCalledValue;
|
||||
}
|
||||
return resultObj;
|
||||
}
|
||||
|
||||
// Base case. Return primitives without doing anything.
|
||||
return input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a desired capability and tries to JSON.parse it as an array,
|
||||
* and either returns the parsed array or a singleton array.
|
||||
*
|
||||
* @param {string|Array<String>} cap A desired capability
|
||||
*/
|
||||
function parseCapsArray(cap) {
|
||||
if (_.isArray(cap)) {
|
||||
return cap;
|
||||
}
|
||||
|
||||
let parsedCaps;
|
||||
try {
|
||||
parsedCaps = JSON.parse(cap);
|
||||
if (_.isArray(parsedCaps)) {
|
||||
return parsedCaps;
|
||||
const {href, search} = parseAppLink(app);
|
||||
if (href && search) {
|
||||
return href.replace(search, '');
|
||||
}
|
||||
} catch (ign) {
|
||||
logger.warn(`Failed to parse capability as JSON array`);
|
||||
}
|
||||
if (_.isString(cap)) {
|
||||
return [cap];
|
||||
}
|
||||
throw new Error(`must provide a string or JSON Array; received ${cap}`);
|
||||
if (href) {
|
||||
return href;
|
||||
}
|
||||
} catch {}
|
||||
return app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a string that uniquely describes driver instance
|
||||
* Safely parses the given app link to a URL object
|
||||
*
|
||||
* @param {import('@appium/types').Core} obj driver instance
|
||||
* @param {string?} sessionId session identifier (if exists)
|
||||
* @param {string} appLink
|
||||
* @returns {URL|import('@appium/types').StringRecord} Parsed URL object
|
||||
* or an empty object if the parsing has failed
|
||||
*/
|
||||
function parseAppLink(appLink) {
|
||||
try {
|
||||
return new URL(appLink);
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether we can threat the given app link
|
||||
* as a URL,
|
||||
*
|
||||
* @param {string} app
|
||||
* @returns {boolean} True if app is a supported URL
|
||||
*/
|
||||
function isSupportedUrl(app) {
|
||||
try {
|
||||
const {protocol} = parseAppLink(app);
|
||||
return ['http:', 'https:'].includes(protocol);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given environment option is enabled
|
||||
*
|
||||
* @param {string} optionName Option name
|
||||
* @param {boolean|null} [defaultValue=null] The value to return if the given env value
|
||||
* is not set explcitly
|
||||
* @returns {boolean} True if the option is enabled
|
||||
*/
|
||||
function isEnvOptionEnabled(optionName, defaultValue = null) {
|
||||
const value = process.env[optionName];
|
||||
if (!_.isNull(defaultValue) && _.isEmpty(value)) {
|
||||
return defaultValue;
|
||||
}
|
||||
return !_.isEmpty(value) && !['0', 'false', 'no'].includes(_.toLower(value));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} [envVarName]
|
||||
* @param {number} defaultValue
|
||||
* @returns {number}
|
||||
*/
|
||||
function toNaturalNumber(defaultValue, envVarName) {
|
||||
if (!envVarName || _.isUndefined(process.env[envVarName])) {
|
||||
return defaultValue;
|
||||
}
|
||||
const num = parseInt(`${process.env[envVarName]}`, 10);
|
||||
return num > 0 ? num : defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} app
|
||||
* @param {string[]} supportedAppExtensions
|
||||
* @returns {string}
|
||||
*/
|
||||
function generateDriverLogPrefix(obj, sessionId = null) {
|
||||
const instanceName = `${obj.constructor.name}@${node.getObjectId(obj).substring(0, 4)}`;
|
||||
return sessionId ? `${instanceName} (${sessionId.substring(0, 8)})` : instanceName;
|
||||
function verifyAppExtension(app, supportedAppExtensions) {
|
||||
if (supportedAppExtensions.map(_.toLower).includes(_.toLower(path.extname(app)))) {
|
||||
return app;
|
||||
}
|
||||
throw new Error(
|
||||
`New app path '${app}' did not have ` +
|
||||
`${util.pluralize('extension', supportedAppExtensions.length, false)}: ` +
|
||||
supportedAppExtensions
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} folderPath
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
async function calculateFolderIntegrity(folderPath) {
|
||||
return (await fs.glob('**/*', {cwd: folderPath})).length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} filePath
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async function calculateFileIntegrity(filePath) {
|
||||
return await fs.hash(filePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} currentPath
|
||||
* @param {import('@appium/types').StringRecord} expectedIntegrity
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
async function isAppIntegrityOk(currentPath, expectedIntegrity = {}) {
|
||||
if (!(await fs.exists(currentPath))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Folder integrity check is simple:
|
||||
// Verify the previous amount of files is not greater than the current one.
|
||||
// We don't want to use equality comparison because of an assumption that the OS might
|
||||
// create some unwanted service files/cached inside of that folder or its subfolders.
|
||||
// Ofc, validating the hash sum of each file (or at least of file path) would be much
|
||||
// more precise, but we don't need to be very precise here and also don't want to
|
||||
// overuse RAM and have a performance drop.
|
||||
return (await fs.stat(currentPath)).isDirectory()
|
||||
? (await calculateFolderIntegrity(currentPath)) >= expectedIntegrity?.folder
|
||||
: (await calculateFileIntegrity(currentPath)) === expectedIntegrity?.file;
|
||||
}
|
||||
|
||||
/** @type {import('@appium/types').DriverHelpers} */
|
||||
@@ -603,14 +716,6 @@ export default {
|
||||
parseCapsArray,
|
||||
generateDriverLogPrefix,
|
||||
};
|
||||
export {
|
||||
configureApp,
|
||||
isPackageOrBundle,
|
||||
duplicateKeys,
|
||||
parseCapsArray,
|
||||
generateDriverLogPrefix,
|
||||
BASEDRIVER_VER,
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef RemoteAppProps
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
import _ from 'lodash';
|
||||
import log from './logger';
|
||||
import {errors} from '../protocol';
|
||||
import {handleIdempotency} from './idempotency';
|
||||
export {handleIdempotency} from './idempotency';
|
||||
import {pathToRegexp} from 'path-to-regexp';
|
||||
|
||||
function allowCrossDomain(req, res, next) {
|
||||
/**
|
||||
*
|
||||
* @param {import('express').Request} req
|
||||
* @param {import('express').Response} res
|
||||
* @param {import('express').NextFunction} next
|
||||
* @returns {any}
|
||||
*/
|
||||
export function allowCrossDomain(req, res, next) {
|
||||
try {
|
||||
res.header('Access-Control-Allow-Origin', '*');
|
||||
res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, OPTIONS, DELETE');
|
||||
@@ -22,7 +30,11 @@ function allowCrossDomain(req, res, next) {
|
||||
next();
|
||||
}
|
||||
|
||||
function allowCrossDomainAsyncExecute(basePath) {
|
||||
/**
|
||||
* @param {string} basePath
|
||||
* @returns {import('express').RequestHandler}
|
||||
*/
|
||||
export function allowCrossDomainAsyncExecute(basePath) {
|
||||
return (req, res, next) => {
|
||||
// there are two paths for async responses, so cover both
|
||||
// https://regex101.com/r/txYiEz/1
|
||||
@@ -36,12 +48,17 @@ function allowCrossDomainAsyncExecute(basePath) {
|
||||
};
|
||||
}
|
||||
|
||||
function fixPythonContentType(basePath) {
|
||||
/**
|
||||
*
|
||||
* @param {string} basePath
|
||||
* @returns {import('express').RequestHandler}
|
||||
*/
|
||||
export function fixPythonContentType(basePath) {
|
||||
return (req, res, next) => {
|
||||
// hack because python client library gives us wrong content-type
|
||||
if (
|
||||
new RegExp(`^${_.escapeRegExp(basePath)}`).test(req.path) &&
|
||||
/^Python/.test(req.headers['user-agent'])
|
||||
/^Python/.test(req.headers['user-agent'] ?? '')
|
||||
) {
|
||||
if (req.headers['content-type'] === 'application/x-www-form-urlencoded') {
|
||||
req.headers['content-type'] = 'application/json; charset=utf-8';
|
||||
@@ -51,14 +68,75 @@ function fixPythonContentType(basePath) {
|
||||
};
|
||||
}
|
||||
|
||||
function defaultToJSONContentType(req, res, next) {
|
||||
/**
|
||||
*
|
||||
* @param {import('express').Request} req
|
||||
* @param {import('express').Response} res
|
||||
* @param {import('express').NextFunction} next
|
||||
* @returns {any}
|
||||
*/
|
||||
export function handleLogContext(req, res, next) {
|
||||
const contextStorage = global._global_npmlog?.asyncStorage;
|
||||
if (!contextStorage) {
|
||||
return next();
|
||||
}
|
||||
|
||||
const sessionIdMatch = SESSION_ID_PATTERN.exec(req.url);
|
||||
contextStorage.enterWith(
|
||||
sessionIdMatch ? {sessionSignature: sessionIdMatch[1].substring(0, 8)} : {}
|
||||
);
|
||||
return next();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {import('express').Request} req
|
||||
* @param {import('express').Response} res
|
||||
* @param {import('express').NextFunction} next
|
||||
* @returns {any}
|
||||
*/
|
||||
export function defaultToJSONContentType(req, res, next) {
|
||||
if (!req.headers['content-type']) {
|
||||
req.headers['content-type'] = 'application/json; charset=utf-8';
|
||||
}
|
||||
next();
|
||||
}
|
||||
|
||||
function catchAllHandler(err, req, res, next) {
|
||||
/**
|
||||
*
|
||||
* @param {import('@appium/types').StringRecord<import('@appium/types').WSServer>} webSocketsMapping
|
||||
* @returns {import('express').RequestHandler}
|
||||
*/
|
||||
export function handleUpgrade(webSocketsMapping) {
|
||||
return (req, res, next) => {
|
||||
if (!req.headers?.upgrade || _.toLower(req.headers.upgrade) !== 'websocket') {
|
||||
return next();
|
||||
}
|
||||
let currentPathname;
|
||||
try {
|
||||
currentPathname = new URL(req.url ?? '').pathname;
|
||||
} catch {
|
||||
currentPathname = req.url ?? '';
|
||||
}
|
||||
for (const [pathname, wsServer] of _.toPairs(webSocketsMapping)) {
|
||||
if (pathToRegexp(pathname).test(currentPathname)) {
|
||||
return wsServer.handleUpgrade(req, req.socket, Buffer.from(''), (ws) => {
|
||||
wsServer.emit('connection', ws, req);
|
||||
});
|
||||
}
|
||||
}
|
||||
log.info(`Did not match the websocket upgrade request at ${currentPathname} to any known route`);
|
||||
next();
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Error} err
|
||||
* @param {import('express').Request} req
|
||||
* @param {import('express').Response} res
|
||||
* @param {import('express').NextFunction} next
|
||||
*/
|
||||
export function catchAllHandler(err, req, res, next) {
|
||||
if (res.headersSent) {
|
||||
return next(err);
|
||||
}
|
||||
@@ -79,7 +157,11 @@ function catchAllHandler(err, req, res, next) {
|
||||
log.error(err);
|
||||
}
|
||||
|
||||
function catch404Handler(req, res) {
|
||||
/**
|
||||
* @param {import('express').Request} req
|
||||
* @param {import('express').Response} res
|
||||
*/
|
||||
export function catch404Handler(req, res) {
|
||||
log.debug(`No route found for ${req.url}`);
|
||||
const error = errors.UnknownCommandError;
|
||||
res.status(error.w3cStatus()).json(
|
||||
@@ -106,13 +188,3 @@ function patchWithSessionId(req, body) {
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
||||
export {
|
||||
allowCrossDomain,
|
||||
fixPythonContentType,
|
||||
defaultToJSONContentType,
|
||||
catchAllHandler,
|
||||
allowCrossDomainAsyncExecute,
|
||||
handleIdempotency,
|
||||
catch404Handler,
|
||||
};
|
||||
|
||||
@@ -14,7 +14,9 @@ import {
|
||||
catchAllHandler,
|
||||
allowCrossDomainAsyncExecute,
|
||||
handleIdempotency,
|
||||
handleUpgrade,
|
||||
catch404Handler,
|
||||
handleLogContext,
|
||||
} from './middleware';
|
||||
import {guineaPig, guineaPigScrollable, guineaPigAppBanner, welcome, STATIC_DIR} from './static';
|
||||
import {produceError, produceCrash} from './crash';
|
||||
@@ -109,6 +111,7 @@ async function server(opts) {
|
||||
allowCors,
|
||||
basePath,
|
||||
extraMethodMap,
|
||||
webSocketsMapping: appiumServer.webSocketsMapping,
|
||||
});
|
||||
// allow extensions to update the app and http server objects
|
||||
for (const updater of serverUpdaters) {
|
||||
@@ -139,10 +142,12 @@ function configureServer({
|
||||
allowCors = true,
|
||||
basePath = DEFAULT_BASE_PATH,
|
||||
extraMethodMap = {},
|
||||
webSocketsMapping = {},
|
||||
}) {
|
||||
basePath = normalizeBasePath(basePath);
|
||||
|
||||
app.use(endLogFormatter);
|
||||
app.use(handleLogContext);
|
||||
|
||||
// set up static assets
|
||||
app.use(favicon(path.resolve(STATIC_DIR, 'favicon.ico')));
|
||||
@@ -152,7 +157,7 @@ function configureServer({
|
||||
app.use(`${basePath}/produce_error`, produceError);
|
||||
app.use(`${basePath}/crash`, produceCrash);
|
||||
|
||||
// add middlewares
|
||||
app.use(handleUpgrade(webSocketsMapping));
|
||||
if (allowCors) {
|
||||
app.use(allowCrossDomain);
|
||||
} else {
|
||||
@@ -195,6 +200,7 @@ function configureHttp({httpServer, reject, keepAliveTimeout}) {
|
||||
* @type {AppiumServer}
|
||||
*/
|
||||
const appiumServer = /** @type {any} */ (httpServer);
|
||||
appiumServer.webSocketsMapping = {};
|
||||
appiumServer.addWebSocketHandler = addWebSocketHandler;
|
||||
appiumServer.removeWebSocketHandler = removeWebSocketHandler;
|
||||
appiumServer.removeAllWebSocketHandlers = removeAllWebSocketHandlers;
|
||||
@@ -370,4 +376,5 @@ export {server, configureServer, normalizeBasePath};
|
||||
* @property {boolean} [allowCors]
|
||||
* @property {string} [basePath]
|
||||
* @property {MethodMap} [extraMethodMap]
|
||||
* @property {import('@appium/types').StringRecord} [webSocketsMapping={}]
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/* eslint-disable require-await */
|
||||
import _ from 'lodash';
|
||||
import {URL} from 'url';
|
||||
import B from 'bluebird';
|
||||
import { pathToRegexp } from 'path-to-regexp';
|
||||
|
||||
const DEFAULT_WS_PATHNAME_PREFIX = '/ws';
|
||||
|
||||
@@ -11,27 +9,6 @@ const DEFAULT_WS_PATHNAME_PREFIX = '/ws';
|
||||
* @type {AppiumServer['addWebSocketHandler']}
|
||||
*/
|
||||
async function addWebSocketHandler(handlerPathname, handlerServer) {
|
||||
if (_.isUndefined(this.webSocketsMapping)) {
|
||||
this.webSocketsMapping = {};
|
||||
// https://github.com/websockets/ws/pull/885
|
||||
this.on('upgrade', (request, socket, head) => {
|
||||
let currentPathname;
|
||||
try {
|
||||
currentPathname = new URL(request.url ?? '').pathname;
|
||||
} catch {
|
||||
currentPathname = request.url ?? '';
|
||||
}
|
||||
for (const [pathname, wsServer] of _.toPairs(this.webSocketsMapping)) {
|
||||
if (pathToRegexp(pathname).test(currentPathname)) {
|
||||
wsServer.handleUpgrade(request, socket, head, (ws) => {
|
||||
wsServer.emit('connection', ws, request);
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
socket.destroy();
|
||||
});
|
||||
}
|
||||
this.webSocketsMapping[handlerPathname] = handlerServer;
|
||||
}
|
||||
|
||||
@@ -40,10 +17,6 @@ async function addWebSocketHandler(handlerPathname, handlerServer) {
|
||||
* @type {AppiumServer['getWebSocketHandlers']}
|
||||
*/
|
||||
async function getWebSocketHandlers(keysFilter = null) {
|
||||
if (_.isEmpty(this.webSocketsMapping)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return _.toPairs(this.webSocketsMapping).reduce((acc, [pathname, wsServer]) => {
|
||||
if (!_.isString(keysFilter) || pathname.includes(keysFilter)) {
|
||||
acc[pathname] = wsServer;
|
||||
|
||||
@@ -134,10 +134,12 @@ class ProtocolConverter {
|
||||
const bodyObj = util.safeJsonParse(body);
|
||||
if (_.isPlainObject(bodyObj)) {
|
||||
if (this.downstreamProtocol === W3C && _.has(bodyObj, 'name') && !_.has(bodyObj, 'handle')) {
|
||||
this.log.debug(`Copied 'name' value '${bodyObj.name}' to 'handle' as per W3C spec`);
|
||||
this.log.debug(
|
||||
`Copied 'name' value '${/** @type {import('@appium/types').StringRecord} */ (bodyObj).name}' to 'handle' as per W3C spec`
|
||||
);
|
||||
return await this.proxyFunc(url, method, {
|
||||
...bodyObj,
|
||||
handle: bodyObj.name,
|
||||
.../** @type {import('@appium/types').StringRecord} */ (bodyObj),
|
||||
handle: /** @type {import('@appium/types').StringRecord} */ (bodyObj).name,
|
||||
});
|
||||
}
|
||||
if (
|
||||
@@ -145,10 +147,12 @@ class ProtocolConverter {
|
||||
_.has(bodyObj, 'handle') &&
|
||||
!_.has(bodyObj, 'name')
|
||||
) {
|
||||
this.log.debug(`Copied 'handle' value '${bodyObj.handle}' to 'name' as per JSONWP spec`);
|
||||
this.log.debug(
|
||||
`Copied 'handle' value '${/** @type {import('@appium/types').StringRecord} */ (bodyObj).handle}' to 'name' as per JSONWP spec`
|
||||
);
|
||||
return await this.proxyFunc(url, method, {
|
||||
...bodyObj,
|
||||
name: bodyObj.handle,
|
||||
.../** @type {import('@appium/types').StringRecord} */ (bodyObj),
|
||||
name: /** @type {import('@appium/types').StringRecord} */ (bodyObj).handle,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import ES6Error from 'es6-error';
|
||||
import _ from 'lodash';
|
||||
import {util, logger} from '@appium/support';
|
||||
import {StatusCodes as HTTPStatusCodes} from 'http-status-codes';
|
||||
@@ -8,8 +7,36 @@ const w3cLog = logger.getLogger('W3C');
|
||||
|
||||
const W3C_UNKNOWN_ERROR = 'unknown error';
|
||||
|
||||
class BaseError extends Error {
|
||||
constructor(message = '') {
|
||||
super(message);
|
||||
/** @type {[string, () => any][]} */
|
||||
const propsMap = [
|
||||
['message', () => message],
|
||||
['name', () => this.constructor.name],
|
||||
['stack', () => (new Error(message)).stack],
|
||||
];
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
const shouldSkipStack = Error.hasOwnProperty('captureStackTrace');
|
||||
for (const [propName, valueGetter] of propsMap) {
|
||||
if (propName === 'stack' && shouldSkipStack) {
|
||||
continue;
|
||||
}
|
||||
Object.defineProperty(this, propName, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value: valueGetter(),
|
||||
writable: true,
|
||||
});
|
||||
}
|
||||
if (shouldSkipStack) {
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// base error class for all of our errors
|
||||
export class ProtocolError extends ES6Error {
|
||||
export class ProtocolError extends BaseError {
|
||||
constructor(msg, jsonwpCode, w3cStatus, error) {
|
||||
super(msg);
|
||||
this.jsonwpCode = jsonwpCode;
|
||||
@@ -896,7 +923,7 @@ function generateBadParametersMessage(requiredParams, actualParams) {
|
||||
}
|
||||
|
||||
// Equivalent to W3C InvalidArgumentError
|
||||
export class BadParametersError extends ES6Error {
|
||||
export class BadParametersError extends BaseError {
|
||||
static error() {
|
||||
return 'invalid argument';
|
||||
}
|
||||
@@ -916,7 +943,7 @@ export class BadParametersError extends ES6Error {
|
||||
* In case of ProxyRequestError should fetch the actual error by calling `getActualError()`
|
||||
* for proxy failure to generate the client response.
|
||||
*/
|
||||
export class ProxyRequestError extends ES6Error {
|
||||
export class ProxyRequestError extends BaseError {
|
||||
constructor(err, responseError, httpStatus) {
|
||||
let responseErrorObj = util.safeJsonParse(responseError);
|
||||
if (!_.isPlainObject(responseErrorObj)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import _ from 'lodash';
|
||||
import {util, logger, node} from '@appium/support';
|
||||
import {util, logger} from '@appium/support';
|
||||
import {validators} from './validators';
|
||||
import {
|
||||
errors,
|
||||
@@ -14,6 +14,7 @@ import {formatResponseValue, formatStatus} from './helpers';
|
||||
import {MAX_LOG_BODY_LENGTH, PROTOCOLS, DEFAULT_BASE_PATH} from '../constants';
|
||||
import {isW3cCaps} from '../helpers/capabilities';
|
||||
import log from '../basedriver/logger';
|
||||
import { generateDriverLogPrefix } from '../basedriver/helpers';
|
||||
|
||||
const CREATE_SESSION_COMMAND = 'createSession';
|
||||
const DELETE_SESSION_COMMAND = 'deleteSession';
|
||||
@@ -60,12 +61,7 @@ function getLogger(driver, sessionId = null) {
|
||||
return dstDriver.log;
|
||||
}
|
||||
|
||||
let logPrefix = dstDriver.constructor
|
||||
? `${dstDriver.constructor.name}@${node.getObjectId(dstDriver).substring(0, 8)}`
|
||||
: 'AppiumDriver';
|
||||
if (sessionId) {
|
||||
logPrefix += ` (${sessionId.substring(0, 8)})`;
|
||||
}
|
||||
const logPrefix = generateDriverLogPrefix(dstDriver);
|
||||
return logger.getLogger(logPrefix);
|
||||
}
|
||||
|
||||
@@ -259,9 +255,7 @@ function routeConfiguringFunction(driver) {
|
||||
throw new Error('Drivers must implement `sessionExists` property');
|
||||
}
|
||||
|
||||
// "execute" isn't defined anywhere
|
||||
// @ts-expect-error
|
||||
if (!(driver.executeCommand || driver.execute)) {
|
||||
if (!(/** @type {any} */ (driver).executeCommand || /** @type {any} */ (driver).execute)) {
|
||||
throw new Error('Drivers must implement `executeCommand` or `execute` method');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@appium/base-driver",
|
||||
"version": "9.5.2",
|
||||
"version": "9.10.0",
|
||||
"description": "Base driver class for Appium drivers",
|
||||
"keywords": [
|
||||
"automation",
|
||||
@@ -44,31 +44,30 @@
|
||||
"test:types": "tsd"
|
||||
},
|
||||
"dependencies": {
|
||||
"@appium/support": "^4.2.2",
|
||||
"@appium/types": "^0.16.1",
|
||||
"@appium/support": "^5.0.0",
|
||||
"@appium/types": "^0.20.0",
|
||||
"@colors/colors": "1.6.0",
|
||||
"@types/async-lock": "1.4.2",
|
||||
"@types/bluebird": "3.5.42",
|
||||
"@types/express": "4.17.21",
|
||||
"@types/lodash": "4.14.202",
|
||||
"@types/lodash": "4.17.5",
|
||||
"@types/method-override": "0.0.35",
|
||||
"@types/serve-favicon": "2.5.7",
|
||||
"async-lock": "1.4.1",
|
||||
"asyncbox": "3.0.0",
|
||||
"axios": "1.6.7",
|
||||
"axios": "1.7.2",
|
||||
"bluebird": "3.7.2",
|
||||
"body-parser": "1.20.2",
|
||||
"es6-error": "4.1.1",
|
||||
"express": "4.18.2",
|
||||
"express": "4.19.2",
|
||||
"http-status-codes": "2.3.0",
|
||||
"lodash": "4.17.21",
|
||||
"lru-cache": "10.2.0",
|
||||
"lru-cache": "10.2.2",
|
||||
"method-override": "3.0.0",
|
||||
"morgan": "1.10.0",
|
||||
"path-to-regexp": "6.2.1",
|
||||
"path-to-regexp": "6.2.2",
|
||||
"serve-favicon": "2.5.0",
|
||||
"source-map-support": "0.5.21",
|
||||
"type-fest": "4.10.1",
|
||||
"type-fest": "4.20.0",
|
||||
"validate.js": "0.13.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
|
||||
@@ -35,11 +35,9 @@ describe('Websockets (e2e)', function () {
|
||||
ws.send(WS_DATA);
|
||||
}
|
||||
});
|
||||
const previousListenerCount = baseServer.listenerCount('upgrade');
|
||||
const endpoint = `${DEFAULT_WS_PATHNAME_PREFIX}/hello`;
|
||||
const timeout = 5000;
|
||||
await baseServer.addWebSocketHandler(endpoint, wss);
|
||||
baseServer.listenerCount('upgrade').should.be.above(previousListenerCount);
|
||||
_.keys(await baseServer.getWebSocketHandlers()).length.should.eql(1);
|
||||
await new B((resolve, reject) => {
|
||||
const client = new WebSocket(`ws://${TEST_HOST}:${port}${endpoint}`);
|
||||
@@ -78,7 +76,6 @@ describe('Websockets (e2e)', function () {
|
||||
client.on('error', resolve);
|
||||
setTimeout(resolve, timeout);
|
||||
});
|
||||
baseServer.listenerCount('upgrade').should.be.above(previousListenerCount);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -59,7 +59,7 @@ describe('server configuration', function () {
|
||||
const app = fakeApp();
|
||||
const configureRoutes = () => {};
|
||||
configureServer({app, addRoutes: configureRoutes});
|
||||
app.use.callCount.should.equal(14);
|
||||
app.use.callCount.should.equal(16);
|
||||
app.all.callCount.should.equal(4);
|
||||
});
|
||||
|
||||
|
||||
@@ -3,6 +3,70 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [2.2.36](https://github.com/appium/appium/compare/@appium/base-plugin@2.2.35...@appium/base-plugin@2.2.36) (2024-06-10)
|
||||
|
||||
**Note:** Version bump only for package @appium/base-plugin
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.2.35](https://github.com/appium/appium/compare/@appium/base-plugin@2.2.34...@appium/base-plugin@2.2.35) (2024-06-06)
|
||||
|
||||
**Note:** Version bump only for package @appium/base-plugin
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.2.34](https://github.com/appium/appium/compare/@appium/base-plugin@2.2.33...@appium/base-plugin@2.2.34) (2024-06-06)
|
||||
|
||||
**Note:** Version bump only for package @appium/base-plugin
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.2.33](https://github.com/appium/appium/compare/@appium/base-plugin@2.2.32...@appium/base-plugin@2.2.33) (2024-06-06)
|
||||
|
||||
**Note:** Version bump only for package @appium/base-plugin
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.2.32](https://github.com/appium/appium/compare/@appium/base-plugin@2.2.31...@appium/base-plugin@2.2.32) (2024-05-27)
|
||||
|
||||
**Note:** Version bump only for package @appium/base-plugin
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.2.31](https://github.com/appium/appium/compare/@appium/base-plugin@2.2.30...@appium/base-plugin@2.2.31) (2024-04-21)
|
||||
|
||||
**Note:** Version bump only for package @appium/base-plugin
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.2.30](https://github.com/appium/appium/compare/@appium/base-plugin@2.2.29...@appium/base-plugin@2.2.30) (2024-04-16)
|
||||
|
||||
**Note:** Version bump only for package @appium/base-plugin
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.2.29](https://github.com/appium/appium/compare/@appium/base-plugin@2.2.28...@appium/base-plugin@2.2.29) (2024-04-08)
|
||||
|
||||
**Note:** Version bump only for package @appium/base-plugin
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.2.28](https://github.com/appium/appium/compare/@appium/base-plugin@2.2.27...@appium/base-plugin@2.2.28) (2024-02-13)
|
||||
|
||||
**Note:** Version bump only for package @appium/base-plugin
|
||||
|
||||