Compare commits

..
Author SHA1 Message Date
Jonathan Lipps 89e5f7e8db chore: publish
- appium@2.10.3
 - @appium/base-driver@9.10.3
 - @appium/base-plugin@2.2.39
 - @appium/doctor@2.1.6
 - @appium/docutils@1.0.15
 - @appium/driver-test-support@0.6.3
 - @appium/fake-plugin@3.1.43
 - @appium/images-plugin@3.0.14
 - @appium/logger@1.4.2
 - @appium/plugin-test-support@0.3.38
 - @appium/support@5.0.3
 - @appium/test-support@3.0.43
 - @appium/types@0.20.3
2024-06-11 13:02:33 -07:00
Corneliu Duplachi 9469aaef0e fix(logger): use index.d.ts for types instead of index.ts (#20247) 2024-06-11 21:18:52 +02:00
Jonathan Lipps 2b12d5974a chore: publish
- appium@2.10.2
 - @appium/base-driver@9.10.2
 - @appium/base-plugin@2.2.38
 - @appium/doctor@2.1.5
 - @appium/docutils@1.0.14
 - @appium/driver-test-support@0.6.2
 - @appium/fake-plugin@3.1.42
 - @appium/images-plugin@3.0.13
 - @appium/plugin-test-support@0.3.37
 - @appium/schema@0.6.1
 - @appium/support@5.0.2
 - @appium/test-support@3.0.42
 - @appium/types@0.20.2
2024-06-11 12:06:28 -07:00
Jonathan Lipps 45cc948671 fix(schema): edit a comment in order to trigger a publish 2024-06-11 12:05:50 -07:00
Jonathan Lipps 192f1f3793 chore: publish
- appium@2.10.1
 - @appium/base-driver@9.10.1
 - @appium/base-plugin@2.2.37
 - @appium/doctor@2.1.4
 - @appium/docutils@1.0.13
 - @appium/driver-test-support@0.6.1
 - @appium/fake-plugin@3.1.41
 - @appium/images-plugin@3.0.12
 - @appium/logger@1.4.1
 - @appium/plugin-test-support@0.3.36
 - @appium/support@5.0.1
 - @appium/test-support@3.0.41
 - @appium/types@0.20.1
2024-06-11 11:55:29 -07:00
Edgars Eglītis 5baf93672d chore(support): update changelog (#20246)
* chore: update support package changelog

* chore: update wording for changelog
2024-06-11 20:31:07 +03:00
Mykola Mokhnach c670010ec7 fix(logger): Type declaration for DEFAULT_LOG_LEVELS (#20244) 2024-06-11 18:07:59 +02:00
renovate[bot] 4a07f82cec chore(deps): update eslint-related packages to v7.13.0 2024-06-11 13:01:06 +00:00
renovate[bot] b28b524957 chore(deps): update dependency prettier to v3.3.2 2024-06-11 09:03:31 +00:00
Jonathan Lipps f40598161c chore: publish
- appium@2.10.0
 - @appium/base-driver@9.10.0
 - @appium/base-plugin@2.2.36
 - @appium/doctor@2.1.3
 - @appium/docutils@1.0.12
 - @appium/driver-test-support@0.6.0
 - @appium/fake-plugin@3.1.40
 - @appium/images-plugin@3.0.11
 - @appium/logger@1.4.0
 - @appium/plugin-test-support@0.3.35
 - @appium/schema@0.6.0
 - @appium/support@5.0.0
 - @appium/test-support@3.0.40
 - @appium/types@0.20.0
2024-06-10 16:29:53 -07:00
Jonathan LippsandEdgars Eglītis 0ddedec0c4 docs(appium): add sauce labs as strategic sponsor (#20240)
* docs(appium): add sauce labs as strategic sponsor

* Update SPONSORS.md

Co-authored-by: Edgars Eglītis <37242620+eglitise@users.noreply.github.com>

---------

Co-authored-by: Edgars Eglītis <37242620+eglitise@users.noreply.github.com>
2024-06-10 13:36:54 -07:00
Edgars Eglītis def3474b05 docs(appium): fix more image links (#20238) 2024-06-10 10:29:41 -07:00
Jonathan Lipps 1b9c1e96a3 docs(appium): fix sponsor logo image urls again 2024-06-10 09:49:27 -07:00
Jonathan Lipps e60e840316 docs(appium): fix sponsor logo image urls 2024-06-10 08:20:37 -07:00
Jonathan Lipps 6505d7921a docs(appium): fix sponsor logo image urls 2024-06-10 08:17:37 -07:00
Jonathan LippsandEdgars Eglītis def655cb39 docs(appium): add strategic partner browserstack (#20232)
* docs(appium): add strategic partner browserstack

* Partner announce (#20237)

* docs: move assets to override dir

* docs: remove copy-assets script

* docs: fix browserstack color-specific logo

---------

Co-authored-by: Edgars Eglītis <edgars.eglitis@outlook.com>

---------

Co-authored-by: Edgars Eglītis <edgars.eglitis@outlook.com>
2024-06-10 08:05:51 -07:00
renovate[bot] 1828501c66 fix(docutils): update dependency lilconfig to v3.1.2 2024-06-10 10:52:58 +00:00
renovate[bot] 6a08c95fc9 fix(docutils): update dependency yaml to v2.4.5 2024-06-09 09:03:13 +00:00
Mykola Mokhnach a156bc5bf5 chore(support): Simplify the logic for the AppiumLogger instance retrieval (#20230) 2024-06-09 08:07:52 +02:00
Mykola Mokhnach dbc3b668a0 feat(support): Move SecureValuesPreprocessor to @appum/logger (#20228)
The SecureValuesPreprocessor has been moved directly to the @appum/logger module and set as a private logger instance property.
The loadSecureValuesPreprocessingRules method is now public instance method of the Logger class. Unit tests were ported to the @appium/logger module as well.
2024-06-08 14:38:53 +02:00
renovate[bot] 69bbb5370e fix(driver-test-support): update dependency @types/lodash to v4.17.5 2024-06-08 12:03:35 +00:00
renovate[bot] ea00626091 fix(types): update dependency type-fest to v4.20.0 (#20227)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-06-08 13:38:47 +03:00
Mykola Mokhnach 1e86537e94 feat(appium): Add a possibility to print logs in json format (#20224) 2024-06-08 08:08:37 +02:00
Kazuaki Matsuo 93c271ec5d feat(support): remove unleakString as no usage (#20221)
BREAKING CHANGE: Remove unleakString since it is now in appium/logger
2024-06-07 17:57:13 -07:00
0363aab8ba feat(appium): Add session signature to all logs (#20202) (#20214)
* feat(appium): Add session signature to all logs (#20202) (#20214)

* test(logger): add tests for unleakString (#20222)

---------

Co-authored-by: Mykola Mokhnach <mokhnach@gmail.com>
Co-authored-by: Edgars Eglītis <37242620+eglitise@users.noreply.github.com>
2024-06-07 13:13:39 -07:00
Kazuaki Matsuo dd421b397b feat(support): Remove patchLogger from logger (#20220)
BREAKING CHANGE: Remove patchLogger exported method from logger
2024-06-07 09:44:08 -07:00
Kazuaki Matsuo 8ee7d07af4 feat(logger): Add the debug level to the default logger (#20219)
* feat(logger): Add the debug level to the default logger
2024-06-07 09:43:49 -07:00
Kazuaki Matsuo 1c19a8dbba chore(logger): update lerna to keep ISC as the license (#20217)
* chore(logger): update lerna to keep ISC as the license

* tweak sync
2024-06-07 09:43:23 -07:00
renovate[bot] 1ed646cc8f chore(docutils): update dependency mkdocs-material to v9.5.26 2024-06-07 05:50:25 +00:00
Jonathan Lipps d4ce2a82d9 chore: publish
- appium@2.9.0
 - @appium/base-driver@9.9.0
 - @appium/base-plugin@2.2.35
 - @appium/doctor@2.1.2
 - @appium/docutils@1.0.11
 - @appium/driver-test-support@0.5.0
 - @appium/fake-plugin@3.1.39
 - @appium/images-plugin@3.0.10
 - @appium/logger@1.3.0
 - @appium/plugin-test-support@0.3.34
 - @appium/support@4.5.0
 - @appium/test-support@3.0.39
 - @appium/types@0.19.2
2024-06-06 16:25:41 -07:00
Kazuaki Matsuo 40def9dbdb fix(appium): Revert changes in 20203 and 20202 (#20209)
* Revert "feat(appium): Add session signature to all logs (#20202)"

This reverts commit b3f8a47c2d.

* Revert "feat(logger): Add the 'debug' level to the default logger (#20203)"

This reverts commit 7fd9d5f626.
2024-06-06 16:17:57 -07:00
Mykola Mokhnach b3f8a47c2d feat(appium): Add session signature to all logs (#20202) 2024-06-06 22:46:52 +02:00
76 changed files with 1661 additions and 670 deletions
+1 -1
View File
@@ -63,6 +63,6 @@ appium.zip
**/build-fixtures/**
*.tsbuildinfo
packages/*/LICENSE
\!packages/*/LICENSE
local_appium_home
*.tgz
+21 -6
View File
@@ -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">
@@ -185,14 +185,29 @@ and wants to give back financially to the project, we use these funds to [encour
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 Partners
### Development and Strategic Partners
Appium is incredibly grateful to our Development Partners for their sustained contribution of
project development and leadership!
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/assets/images/sponsor-logo-headspin.png"
width="300" alt="HeadSpin" /></a>
<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
+9 -2
View File
@@ -12,7 +12,7 @@ We are very grateful for the support of our Development Partners, who donate App
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/assets/images/sponsor-logo-headspin.png" width="250"/></a>
src="packages/appium/docs/overrides/assets/images/sponsor-logo-headspin.png" width="250"/></a>
## Strategic Partners
@@ -20,7 +20,14 @@ We are very grateful for the financial and marketing support of our exclusive St
who contribute a significant ongoing investment of funds to help the project attract and reward
contributors!
* *Coming Soon!*
<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
+258 -238
View File
File diff suppressed because it is too large Load Diff
+6 -5
View File
@@ -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",
@@ -94,8 +95,8 @@
"@types/teen_process": "2.0.4",
"@types/ws": "8.5.10",
"@types/yargs": "17.0.32",
"@typescript-eslint/eslint-plugin": "7.12.0",
"@typescript-eslint/parser": "7.12.0",
"@typescript-eslint/eslint-plugin": "7.13.0",
"@typescript-eslint/parser": "7.13.0",
"asyncbox": "3.0.0",
"chai": "4.4.1",
"chai-as-promised": "7.1.2",
@@ -121,7 +122,7 @@
"mocha": "10.4.0",
"mocha-chai-jest-snapshot": "1.1.4",
"npm-run-all2": "6.2.0",
"prettier": "3.3.1",
"prettier": "3.3.2",
"rewiremock": "3.14.5",
"rimraf": "5.0.7",
"serve-static": "1.15.0",
+57
View File
@@ -3,6 +3,63 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.10.3](https://github.com/appium/appium/compare/appium@2.10.2...appium@2.10.3) (2024-06-11)
**Note:** Version bump only for package appium
## [2.10.2](https://github.com/appium/appium/compare/appium@2.10.1...appium@2.10.2) (2024-06-11)
**Note:** Version bump only for package appium
## [2.10.1](https://github.com/appium/appium/compare/appium@2.10.0...appium@2.10.1) (2024-06-11)
**Note:** Version bump only for package appium
## [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)
+21 -6
View File
@@ -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">
@@ -185,14 +185,29 @@ and wants to give back financially to the project, we use these funds to [encour
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 Partners
### Development and Strategic Partners
Appium is incredibly grateful to our Development Partners for their sustained contribution of
project development and leadership!
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/assets/images/sponsor-logo-headspin.png"
width="300" alt="HeadSpin" /></a>
<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
+1
View File
@@ -1,3 +1,4 @@
en/latest
en/assets
ja/assets
zh/assets
@@ -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,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>
+1
View File
@@ -38,6 +38,7 @@ below.
|`--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`||
|`--long-stacktrace`|Add long stack traces to log entries. Recommended for debugging only.|boolean|`false`||
+21 -7
View File
@@ -21,14 +21,28 @@ Android, Tizen), browser (Chrome, Firefox, Safari), desktop (macOS, Windows), TV
Android TV, Samsung), and more!
<div style="text-align: center">
<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>)
<br/>
<a href="https://www.headspin.io/solutions/appium-mobile-test-automation">
<img src="assets/images/sponsor-logo-headspin.png" style="width: 200px;" />
</a>
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

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

@@ -7,12 +7,25 @@
.appium-sponsor-thanks {
width: 100%;
margin: auto 0.6rem;
margin: 0.5rem 0.6rem auto 0.6rem;
display: flex;
align-items: center;
}
.appium-sponsor-thanks img {
margin: auto 6px;
height: 50px;
height: 40px;
}
.homepageSponsors {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
margin: 10px auto;
max-width: 800px;
}
.homepageSponsor {
flex: 1;
}
@@ -1,6 +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;
+200 -103
View File
@@ -1,29 +1,27 @@
import globalLog from '@appium/logger';
import {createLogger, format, transports} from 'winston';
import {fs} from '@appium/support';
import { APPIUM_LOGGER_NAME } from './logger';
import _ from 'lodash';
import { adler32 } from './utils';
import { LRUCache } from 'lru-cache';
// set up distributed logging before everything else
global._global_npmlog = globalLog;
// npmlog is used only for emitting, we use winston for output
globalLog.level = 'info';
const levels = {
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',
@@ -32,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
@@ -72,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
@@ -93,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);
@@ -123,28 +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 {import('@appium/types').StringRecord} args
* @param {ParsedArgs} args
* @returns {Promise<import('winston-transport')[]>}
*/
async function createTransports(args) {
const transports = [];
let consoleLogLevel = null;
let fileLogLevel = null;
/** @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;
}
@@ -184,72 +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) {
globalLog.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();
const transports = await createTransports(args);
const transportNames = new Set(transports.map((tr) => tr.constructor.name));
log = createLogger({
transports,
levels,
});
const reportedLoggerErrors = new Set();
// Capture logs emitted via npmlog and pass them through winston
globalLog.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}`;
}
try {
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);
/**
* @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);
}
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);
}
}
globalLog.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
*/
+2 -2
View File
@@ -8,7 +8,7 @@ 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';
@@ -246,7 +246,7 @@ async function init(args) {
await logsinkInit(serverArgs);
if (serverArgs.logFilters) {
const {issues, rules} = await logFactory.loadSecureValuesPreprocessingRules(
const {issues, rules} = await logger.unwrap().loadSecureValuesPreprocessingRules(
serverArgs.logFilters,
);
if (!_.isEmpty(issues)) {
+56
View File
@@ -391,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,
+13 -13
View File
@@ -1,6 +1,6 @@
{
"name": "appium",
"version": "2.8.0",
"version": "2.10.3",
"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,13 +59,13 @@
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
},
"dependencies": {
"@appium/base-driver": "^9.8.1",
"@appium/base-plugin": "^2.2.34",
"@appium/docutils": "^1.0.10",
"@appium/logger": "^1.2.0",
"@appium/schema": "~0.5.0",
"@appium/support": "^4.4.0",
"@appium/types": "^0.19.1",
"@appium/base-driver": "^9.10.3",
"@appium/base-plugin": "^2.2.39",
"@appium/docutils": "^1.0.15",
"@appium/logger": "^1.4.2",
"@appium/schema": "^0.6.1",
"@appium/support": "^5.0.3",
"@appium/types": "^0.20.3",
"@sidvind/better-ajv-errors": "2.1.3",
"@types/argparse": "2.0.16",
"@types/bluebird": "3.5.42",
@@ -82,19 +81,20 @@
"axios": "1.7.2",
"bluebird": "3.7.2",
"cross-env": "7.0.3",
"lilconfig": "3.1.1",
"lilconfig": "3.1.2",
"lodash": "4.17.21",
"lru-cache": "10.2.2",
"ora": "5.4.1",
"package-changed": "3.0.0",
"resolve-from": "5.0.0",
"semver": "7.6.2",
"source-map-support": "0.5.21",
"teen_process": "2.1.4",
"type-fest": "4.19.0",
"type-fest": "4.20.0",
"winston": "3.13.0",
"wrap-ansi": "7.0.0",
"ws": "8.17.0",
"yaml": "2.4.3"
"yaml": "2.4.5"
},
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0",
+1
View File
@@ -9,6 +9,7 @@ export default {
driversImportChunkSize: 3,
keepAliveTimeout: 600,
localTimezone: false,
logFormat: 'text',
loglevel: 'debug',
logNoColors: false,
logTimestamp: false,
+53
View File
@@ -3,6 +3,59 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [9.10.3](https://github.com/appium/appium/compare/@appium/base-driver@9.10.2...@appium/base-driver@9.10.3) (2024-06-11)
**Note:** Version bump only for package @appium/base-driver
## [9.10.2](https://github.com/appium/appium/compare/@appium/base-driver@9.10.1...@appium/base-driver@9.10.2) (2024-06-11)
**Note:** Version bump only for package @appium/base-driver
## [9.10.1](https://github.com/appium/appium/compare/@appium/base-driver@9.10.0...@appium/base-driver@9.10.1) (2024-06-11)
**Note:** Version bump only for package @appium/base-driver
## [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
@@ -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>) {
@@ -401,15 +401,14 @@ export function parseCapsArray(cap) {
* Generate a string that uniquely describes driver instance
*
* @param {import('@appium/types').Core} obj driver instance
* @param {string?} sessionId session identifier (if exists)
* @param {string?} [sessionId=null] session identifier (if exists).
* This parameter is deprecated and is not used.
* @returns {string}
*/
export function generateDriverLogPrefix(obj, sessionId = null) {
const instanceName = `${obj.constructor.name}@${node.getObjectId(obj).substring(0, 4)}`;
return sessionId ? `${instanceName} (${sessionId.substring(0, 8)})` : instanceName;
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
+21 -3
View File
@@ -1,7 +1,7 @@
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';
/**
@@ -68,6 +68,26 @@ export function fixPythonContentType(basePath) {
};
}
/**
*
* @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
@@ -168,5 +188,3 @@ function patchWithSessionId(req, body) {
}
return body;
}
export { handleIdempotency };
@@ -16,6 +16,7 @@ import {
handleIdempotency,
handleUpgrade,
catch404Handler,
handleLogContext,
} from './middleware';
import {guineaPig, guineaPigScrollable, guineaPigAppBanner, welcome, STATIC_DIR} from './static';
import {produceError, produceCrash} from './crash';
@@ -146,6 +147,7 @@ function configureServer({
basePath = normalizeBasePath(basePath);
app.use(endLogFormatter);
app.use(handleLogContext);
// set up static assets
app.use(favicon(path.resolve(STATIC_DIR, 'favicon.ico')));
+4 -10
View File
@@ -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');
}
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@appium/base-driver",
"version": "9.8.1",
"version": "9.10.3",
"description": "Base driver class for Appium drivers",
"keywords": [
"automation",
@@ -44,13 +44,13 @@
"test:types": "tsd"
},
"dependencies": {
"@appium/support": "^4.4.0",
"@appium/types": "^0.19.1",
"@appium/support": "^5.0.3",
"@appium/types": "^0.20.3",
"@colors/colors": "1.6.0",
"@types/async-lock": "1.4.2",
"@types/bluebird": "3.5.42",
"@types/express": "4.17.21",
"@types/lodash": "4.17.4",
"@types/lodash": "4.17.5",
"@types/method-override": "0.0.35",
"@types/serve-favicon": "2.5.7",
"async-lock": "1.4.1",
@@ -67,7 +67,7 @@
"path-to-regexp": "6.2.2",
"serve-favicon": "2.5.0",
"source-map-support": "0.5.21",
"type-fest": "4.19.0",
"type-fest": "4.20.0",
"validate.js": "0.13.1"
},
"optionalDependencies": {
@@ -59,7 +59,7 @@ describe('server configuration', function () {
const app = fakeApp();
const configureRoutes = () => {};
configureServer({app, addRoutes: configureRoutes});
app.use.callCount.should.equal(15);
app.use.callCount.should.equal(16);
app.all.callCount.should.equal(4);
});
+40
View File
@@ -3,6 +3,46 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.2.39](https://github.com/appium/appium/compare/@appium/base-plugin@2.2.38...@appium/base-plugin@2.2.39) (2024-06-11)
**Note:** Version bump only for package @appium/base-plugin
## [2.2.38](https://github.com/appium/appium/compare/@appium/base-plugin@2.2.37...@appium/base-plugin@2.2.38) (2024-06-11)
**Note:** Version bump only for package @appium/base-plugin
## [2.2.37](https://github.com/appium/appium/compare/@appium/base-plugin@2.2.36...@appium/base-plugin@2.2.37) (2024-06-11)
**Note:** Version bump only for package @appium/base-plugin
## [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
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@appium/base-plugin",
"version": "2.2.34",
"version": "2.2.39",
"description": "The base plugin used to create Appium 2.0 plugins",
"keywords": [
"automation",
@@ -40,8 +40,8 @@
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
},
"dependencies": {
"@appium/base-driver": "^9.8.1",
"@appium/support": "^4.4.0"
"@appium/base-driver": "^9.10.3",
"@appium/support": "^5.0.3"
},
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0",
+40
View File
@@ -3,6 +3,46 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.1.6](https://github.com/appium/appium/compare/@appium/doctor@2.1.5...@appium/doctor@2.1.6) (2024-06-11)
**Note:** Version bump only for package @appium/doctor
## [2.1.5](https://github.com/appium/appium/compare/@appium/doctor@2.1.4...@appium/doctor@2.1.5) (2024-06-11)
**Note:** Version bump only for package @appium/doctor
## [2.1.4](https://github.com/appium/appium/compare/@appium/doctor@2.1.3...@appium/doctor@2.1.4) (2024-06-11)
**Note:** Version bump only for package @appium/doctor
## [2.1.3](https://github.com/appium/appium/compare/@appium/doctor@2.1.2...@appium/doctor@2.1.3) (2024-06-10)
**Note:** Version bump only for package @appium/doctor
## [2.1.2](https://github.com/appium/appium/compare/@appium/doctor@2.1.1...@appium/doctor@2.1.2) (2024-06-06)
**Note:** Version bump only for package @appium/doctor
## [2.1.1](https://github.com/appium/appium/compare/@appium/doctor@2.1.0...@appium/doctor@2.1.1) (2024-06-06)
**Note:** Version bump only for package @appium/doctor
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@appium/doctor",
"version": "2.1.1",
"version": "2.1.6",
"description": "Test environment for fitness to run Appium",
"keywords": [
"automation",
@@ -44,7 +44,7 @@
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
},
"dependencies": {
"@appium/support": "^4.4.0",
"@appium/support": "^5.0.3",
"@colors/colors": "1.6.0",
"@types/bluebird": "3.5.42",
"@types/teen_process": "2.0.4",
+43
View File
@@ -3,6 +3,49 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.0.15](https://github.com/appium/appium/compare/@appium/docutils@1.0.14...@appium/docutils@1.0.15) (2024-06-11)
**Note:** Version bump only for package @appium/docutils
## [1.0.14](https://github.com/appium/appium/compare/@appium/docutils@1.0.13...@appium/docutils@1.0.14) (2024-06-11)
**Note:** Version bump only for package @appium/docutils
## [1.0.13](https://github.com/appium/appium/compare/@appium/docutils@1.0.12...@appium/docutils@1.0.13) (2024-06-11)
**Note:** Version bump only for package @appium/docutils
## [1.0.12](https://github.com/appium/appium/compare/@appium/docutils@1.0.11...@appium/docutils@1.0.12) (2024-06-10)
### 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))
## [1.0.11](https://github.com/appium/appium/compare/@appium/docutils@1.0.10...@appium/docutils@1.0.11) (2024-06-06)
**Note:** Version bump only for package @appium/docutils
## [1.0.10](https://github.com/appium/appium/compare/@appium/docutils@1.0.9...@appium/docutils@1.0.10) (2024-06-06)
**Note:** Version bump only for package @appium/docutils
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@appium/docutils",
"version": "1.0.10",
"version": "1.0.15",
"description": "Documentation generation utilities for Appium and related projects",
"keywords": [
"automation",
@@ -48,7 +48,7 @@
"start": "node ./build/lib/cli/index.js"
},
"dependencies": {
"@appium/support": "^4.4.0",
"@appium/support": "^5.0.3",
"@appium/tsconfig": "^0.3.3",
"@sliphua/lilconfig-ts-loader": "3.2.2",
"@types/which": "3.0.4",
@@ -56,16 +56,16 @@
"consola": "3.2.3",
"diff": "5.2.0",
"json5": "2.2.3",
"lilconfig": "3.1.1",
"lilconfig": "3.1.2",
"lodash": "4.17.21",
"pkg-dir": "5.0.0",
"read-pkg": "5.2.0",
"semver": "7.6.2",
"source-map-support": "0.5.21",
"teen_process": "2.1.4",
"type-fest": "4.19.0",
"type-fest": "4.20.0",
"typescript": "5.4.5",
"yaml": "2.4.3",
"yaml": "2.4.5",
"yargs": "17.7.2",
"yargs-parser": "21.1.1"
},
+1 -1
View File
@@ -1,5 +1,5 @@
mkdocs==1.6.0
mkdocs-git-revision-date-localized-plugin==1.2.6
mkdocs-material==9.5.25
mkdocs-material==9.5.26
mkdocs-redirects==1.2.1
mike==2.1.1
+53
View File
@@ -3,6 +3,59 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.6.3](https://github.com/appium/appium/compare/@appium/driver-test-support@0.6.2...@appium/driver-test-support@0.6.3) (2024-06-11)
**Note:** Version bump only for package @appium/driver-test-support
## [0.6.2](https://github.com/appium/appium/compare/@appium/driver-test-support@0.6.1...@appium/driver-test-support@0.6.2) (2024-06-11)
**Note:** Version bump only for package @appium/driver-test-support
## [0.6.1](https://github.com/appium/appium/compare/@appium/driver-test-support@0.6.0...@appium/driver-test-support@0.6.1) (2024-06-11)
**Note:** Version bump only for package @appium/driver-test-support
## [0.6.0](https://github.com/appium/appium/compare/@appium/driver-test-support@0.5.0...@appium/driver-test-support@0.6.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))
## [0.5.0](https://github.com/appium/appium/compare/@appium/driver-test-support@0.4.26...@appium/driver-test-support@0.5.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)
## [0.4.26](https://github.com/appium/appium/compare/@appium/driver-test-support@0.4.25...@appium/driver-test-support@0.4.26) (2024-06-06)
**Note:** Version bump only for package @appium/driver-test-support
@@ -57,23 +57,6 @@ export function driverUnitTestSuite(
});
});
describe('Log prefix', function () {
it('should setup log prefix', async function () {
const d = new DriverClass();
const previousPrefix = d.log.prefix;
await d.createSession({
alwaysMatch: {...defaultCaps, platformName: 'Fake', 'appium:deviceName': 'Commodore 64'},
firstMatch: [{}],
});
try {
expect(previousPrefix).not.to.eql(d.log.prefix);
} finally {
await d.deleteSession();
expect(previousPrefix).to.eql(d.log.prefix);
}
});
});
it('should return an empty status object', async function () {
let status = await d.getStatus();
status.should.eql({});
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@appium/driver-test-support",
"version": "0.4.26",
"version": "0.6.3",
"description": "Test utilities for Appium drivers",
"keywords": [
"automation",
@@ -41,8 +41,8 @@
},
"types": "./build/lib/index.d.ts",
"dependencies": {
"@appium/types": "^0.19.1",
"@types/lodash": "4.17.4",
"@appium/types": "^0.20.3",
"@types/lodash": "4.17.5",
"@types/stoppable": "1.1.3",
"axios": "1.7.2",
"bluebird": "3.7.2",
@@ -52,7 +52,7 @@
"sinon": "18.0.0",
"source-map-support": "0.5.21",
"stoppable": "1.1.0",
"type-fest": "4.19.0"
"type-fest": "4.20.0"
},
"peerDependencies": {
"appium": "^2.0.0-beta.43",
+40
View File
@@ -3,6 +3,46 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [3.1.43](https://github.com/appium/appium/compare/@appium/fake-plugin@3.1.42...@appium/fake-plugin@3.1.43) (2024-06-11)
**Note:** Version bump only for package @appium/fake-plugin
## [3.1.42](https://github.com/appium/appium/compare/@appium/fake-plugin@3.1.41...@appium/fake-plugin@3.1.42) (2024-06-11)
**Note:** Version bump only for package @appium/fake-plugin
## [3.1.41](https://github.com/appium/appium/compare/@appium/fake-plugin@3.1.40...@appium/fake-plugin@3.1.41) (2024-06-11)
**Note:** Version bump only for package @appium/fake-plugin
## [3.1.40](https://github.com/appium/appium/compare/@appium/fake-plugin@3.1.39...@appium/fake-plugin@3.1.40) (2024-06-10)
**Note:** Version bump only for package @appium/fake-plugin
## [3.1.39](https://github.com/appium/appium/compare/@appium/fake-plugin@3.1.38...@appium/fake-plugin@3.1.39) (2024-06-06)
**Note:** Version bump only for package @appium/fake-plugin
## [3.1.38](https://github.com/appium/appium/compare/@appium/fake-plugin@3.1.37...@appium/fake-plugin@3.1.38) (2024-06-06)
**Note:** Version bump only for package @appium/fake-plugin
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@appium/fake-plugin",
"version": "3.1.38",
"version": "3.1.43",
"description": "A fake Appium 2.0 plugin",
"keywords": [
"automation",
@@ -39,8 +39,8 @@
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
},
"dependencies": {
"@appium/base-plugin": "^2.2.34",
"@appium/support": "^4.4.0",
"@appium/base-plugin": "^2.2.39",
"@appium/support": "^5.0.3",
"@types/bluebird": "3.5.42",
"bluebird": "3.7.2",
"lodash": "4.17.21",
+40
View File
@@ -3,6 +3,46 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [3.0.14](https://github.com/appium/appium/compare/@appium/images-plugin@3.0.13...@appium/images-plugin@3.0.14) (2024-06-11)
**Note:** Version bump only for package @appium/images-plugin
## [3.0.13](https://github.com/appium/appium/compare/@appium/images-plugin@3.0.12...@appium/images-plugin@3.0.13) (2024-06-11)
**Note:** Version bump only for package @appium/images-plugin
## [3.0.12](https://github.com/appium/appium/compare/@appium/images-plugin@3.0.11...@appium/images-plugin@3.0.12) (2024-06-11)
**Note:** Version bump only for package @appium/images-plugin
## [3.0.11](https://github.com/appium/appium/compare/@appium/images-plugin@3.0.10...@appium/images-plugin@3.0.11) (2024-06-10)
**Note:** Version bump only for package @appium/images-plugin
## [3.0.10](https://github.com/appium/appium/compare/@appium/images-plugin@3.0.9...@appium/images-plugin@3.0.10) (2024-06-06)
**Note:** Version bump only for package @appium/images-plugin
## [3.0.9](https://github.com/appium/appium/compare/@appium/images-plugin@3.0.8...@appium/images-plugin@3.0.9) (2024-06-06)
**Note:** Version bump only for package @appium/images-plugin
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@appium/images-plugin",
"version": "3.0.9",
"version": "3.0.14",
"description": "Plugin for working with images and image elements in Appium",
"keywords": [
"automation",
@@ -40,7 +40,7 @@
},
"dependencies": {
"@appium/opencv": "^3.0.4",
"@appium/support": "^4.4.0",
"@appium/support": "^5.0.3",
"lodash": "4.17.21",
"lru-cache": "10.2.2",
"sharp": "0.33.4",
+43
View File
@@ -3,6 +3,49 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.4.2](https://github.com/appium/appium/compare/@appium/logger@1.4.1...@appium/logger@1.4.2) (2024-06-11)
### Bug Fixes
* **logger:** use `index.d.ts` for types instead of `index.ts` ([#20247](https://github.com/appium/appium/issues/20247)) ([9469aae](https://github.com/appium/appium/commit/9469aaef0e31d27b4814bc14763b0abeb6e11bf7))
## [1.4.1](https://github.com/appium/appium/compare/@appium/logger@1.4.0...@appium/logger@1.4.1) (2024-06-11)
### Bug Fixes
* **logger:** Type declaration for DEFAULT_LOG_LEVELS ([#20244](https://github.com/appium/appium/issues/20244)) ([c670010](https://github.com/appium/appium/commit/c670010ec7ea1c2730839e86b308837a83fc026e))
## [1.4.0](https://github.com/appium/appium/compare/@appium/logger@1.3.0...@appium/logger@1.4.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)
* **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))
## [1.3.0](https://github.com/appium/appium/compare/@appium/logger@1.2.0...@appium/logger@1.3.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)
## [1.2.0](https://github.com/appium/appium/compare/@appium/logger@1.1.0...@appium/logger@1.2.0) (2024-06-06)
+45 -5
View File
@@ -1,14 +1,24 @@
import _ from 'lodash';
import {EventEmitter} from 'node:events';
// @ts-ignore This module does not provide type definitons
import setBlocking from 'set-blocking';
// @ts-ignore This module does not provide type definitons
import consoleControl from 'console-control-strings';
import * as util from 'node:util';
import type {MessageObject, StyleObject, Logger, LogLevel} from './types';
import type {
MessageObject,
StyleObject,
Logger,
LogLevel,
PreprocessingRulesLoadResult,
LogFiltersConfig
} from './types';
import type {Writable} from 'node:stream';
import {AsyncLocalStorage} from 'node:async_hooks';
import { unleakString } from './utils';
import { SecureValuesPreprocessor } from './secure-values-preprocessor';
const DEFAULT_LOG_LEVELS: any[][] = [
const DEFAULT_LOG_LEVELS = [
['silly', -Infinity, {inverse: true}, 'sill'],
['verbose', 1000, {fg: 'cyan', bg: 'black'}, 'verb'],
['debug', 1500, {fg: 'cyan', bg: 'black'}, 'dbug'],
@@ -32,6 +42,7 @@ export class Log extends EventEmitter implements Logger {
heading: string;
stream: Writable; // Defaults to process.stderr
_asyncStorage: AsyncLocalStorage<Record<string, any>>;
_colorEnabled?: boolean;
_buffer: MessageObject[];
_style: Record<LogLevel | string, StyleObject | undefined>;
@@ -39,6 +50,7 @@ export class Log extends EventEmitter implements Logger {
_disp: Record<LogLevel | string, number | string>;
_id: number;
_paused: boolean;
_secureValuesPreprocessor: SecureValuesPreprocessor;
constructor() {
super();
@@ -53,6 +65,8 @@ export class Log extends EventEmitter implements Logger {
this.headingStyle = {fg: 'white', bg: 'black'};
this._id = 0;
this._paused = false;
this._asyncStorage = new AsyncLocalStorage();
this._secureValuesPreprocessor = new SecureValuesPreprocessor();
this._style = {};
this._levels = {};
@@ -70,6 +84,10 @@ export class Log extends EventEmitter implements Logger {
);
}
get asyncStorage(): AsyncLocalStorage<Record<string, any>> {
return this._asyncStorage;
}
enableColor(): void {
this._colorEnabled = true;
}
@@ -179,7 +197,7 @@ export class Log extends EventEmitter implements Logger {
for (const formatArg of [message, ...args]) {
messageArguments.push(formatArg);
// resolve stack traces to a plain string.
if (typeof formatArg === 'object' && formatArg instanceof Error && formatArg.stack) {
if (_.isError(formatArg) && formatArg.stack) {
Object.defineProperty(formatArg, 'stack', {
value: (stack = formatArg.stack + ''),
enumerable: true,
@@ -196,8 +214,8 @@ export class Log extends EventEmitter implements Logger {
id: this._id++,
timestamp: Date.now(),
level,
prefix: unleakString(prefix || ''),
message: unleakString(formattedMessage),
prefix: this._secureValuesPreprocessor.preprocess(unleakString(prefix || '')),
message: this._secureValuesPreprocessor.preprocess(unleakString(formattedMessage)),
};
this.emit('log', m);
@@ -215,6 +233,28 @@ export class Log extends EventEmitter implements Logger {
this.emitLog(m);
}
/**
* Loads the JSON file containing secure values replacement rules.
* This might be necessary to hide sensitive values that may possibly
* appear in Appium logs.
* Each call to this method replaces the previously loaded rules if any existed.
*
* @param {string|string[]|LogFiltersConfig} rulesJsonPath The full path to the JSON file containing
* the replacement rules. Each rule could either be a string to be replaced
* or an object with predefined properties.
* @throws {Error} If the given file cannot be loaded
* @returns {Promise<PreprocessingRulesLoadResult>}
*/
async loadSecureValuesPreprocessingRules(
rulesJsonPath: string | string[] | LogFiltersConfig
): Promise<PreprocessingRulesLoadResult> {
const issues = await this._secureValuesPreprocessor.loadRules(rulesJsonPath);
return {
issues,
rules: _.cloneDeep(this._secureValuesPreprocessor.rules),
};
}
private emitLog(m: MessageObject): void {
if (this._paused) {
this._buffer.push(m);
@@ -1,17 +1,25 @@
import _ from 'lodash';
import type {
SecureValuePreprocessingRule,
LogFilterRegex,
LogFiltersConfig,
LogFilter,
} from './types';
const DEFAULT_REPLACER = '**SECURE**';
/**
* Type guard for log filter type
* @param {object} value
* @returns {value is import('@appium/types').LogFilterRegex}
* @returns {value is LogFilterRegex}
*/
function isLogFilterRegex(value) {
function isLogFilterRegex(value: object): value is LogFilterRegex {
return 'pattern' in value;
}
class SecureValuesPreprocessor {
export class SecureValuesPreprocessor {
_rules: SecureValuePreprocessingRule[];
constructor() {
this._rules = [];
}
@@ -20,20 +28,20 @@ class SecureValuesPreprocessor {
* @returns {Array<SecureValuePreprocessingRule>} The list of successfully
* parsed preprocessing rules
*/
get rules() {
get rules(): Array<SecureValuePreprocessingRule> {
return this._rules;
}
/**
* Parses single rule from the given JSON file
*
* @param {string|import('@appium/types').LogFilter} rule The rule might
* @param {string|LogFilter} rule The rule might
* either be represented as a single string or a configuration object
* @throws {Error} If there was an error while parsing the rule
* @returns {SecureValuePreprocessingRule} The parsed rule
*/
parseRule(rule) {
let pattern;
parseRule(rule: string | LogFilter): SecureValuePreprocessingRule {
let pattern: string | undefined;
let replacer = DEFAULT_REPLACER;
let flags = ['g'];
if (_.isString(rule)) {
@@ -89,23 +97,21 @@ class SecureValuesPreprocessor {
/**
* Loads rules from the given JSON file
*
* @param {string|string[]|import('@appium/types').LogFiltersConfig} filters
* @param {string|string[]|LogFiltersConfig} filters
* One or more log parsing rules
* @throws {Error} If the format of the source file is invalid or
* it does not exist
* @returns {Promise<string[]>} The list of issues found while parsing each rule.
* An empty list is returned if no rule parsing issues were found
*/
async loadRules(filters) {
/** @type {string[]} */
const issues = [];
/** @type {(import('@appium/types').LogFilter|string)[]} */
const rawRules = [];
async loadRules(filters: string | string[] | LogFiltersConfig): Promise<string[]> {
const issues: string[] = [];
const rawRules: (LogFilter | string)[] = [];
for (const source of (_.isArray(filters) ? filters : [filters])) {
if (_.isPlainObject(source)) {
rawRules.push(/** @type {import('@appium/types').LogFilter} */ (source));
rawRules.push(source as LogFilter);
} else if (_.isString(source)) {
rawRules.push(source);
rawRules.push(String(source));
} else {
issues.push(`'${source}' must be a valid log filtering rule`);
}
@@ -115,7 +121,7 @@ class SecureValuesPreprocessor {
try {
this._rules.push(this.parseRule(rawRule));
} catch (e) {
issues.push(e.message);
issues.push((e as Error).message);
}
}
return issues;
@@ -129,27 +135,15 @@ class SecureValuesPreprocessor {
* @param {string} str The string to make replacements in
* @returns {string} The string with replacements made
*/
preprocess(str) {
if (this._rules.length === 0 || !_.isString(str)) {
preprocess(str: string): string {
if (this._rules.length === 0 || !str || !_.isString(str)) {
return str;
}
let result = str;
for (const rule of this._rules) {
result = result.replace(rule.pattern, rule.replacer);
result = result.replace(rule.pattern, rule.replacer ?? DEFAULT_REPLACER);
}
return result;
}
}
const SECURE_VALUES_PREPROCESSOR = new SecureValuesPreprocessor();
export {SECURE_VALUES_PREPROCESSOR, SecureValuesPreprocessor};
export default SECURE_VALUES_PREPROCESSOR;
/**
* @typedef SecureValuePreprocessingRule
* @property {RegExp} pattern The parsed pattern which is going to be used for replacement
* @property {string} [replacer] The replacer value to use. By default
* equals to `DEFAULT_SECURE_REPLACER`
*/
+61
View File
@@ -1,4 +1,5 @@
import type {EventEmitter} from 'node:events';
import type {AsyncLocalStorage} from 'node:async_hooks';
export interface Logger extends EventEmitter {
level: string;
@@ -34,6 +35,10 @@ export interface Logger extends EventEmitter {
error(prefix: string, message: any, ...args: any[]): void;
silent(prefix: string, message: any, ...args: any[]): void;
loadSecureValuesPreprocessingRules(
rulesJsonPath: string | string[] | LogFiltersConfig
): Promise<PreprocessingRulesLoadResult>;
enableColor(): void;
disableColor(): void;
@@ -49,6 +54,8 @@ export interface Logger extends EventEmitter {
addLevel(level: string, n: number, style?: StyleObject, disp?: string): void;
get asyncStorage(): AsyncLocalStorage<Record<string, any>>;
// Allows for custom log levels
// log.addLevel("custom", level)
// log.custom(prefix, message)
@@ -83,3 +90,57 @@ export interface MessageObject {
prefix: string;
message: string;
}
export interface SecureValuePreprocessingRule {
/** The parsed pattern which is going to be used for replacement */
pattern: RegExp;
/** The replacer value to use. By default equals to `DEFAULT_SECURE_REPLACER` */
replacer?: string;
}
export interface PreprocessingRulesLoadResult {
/**
* The list of rule parsing issues (one item per rule).
* Rules with issues are skipped. An empty list is returned if no parsing issues exist.
*/
issues: string[];
/**
* The list of successfully loaded
* replacement rules. The list could be empty if no rules were loaded.
*/
rules: SecureValuePreprocessingRule[];
}
export type LogFilter = {
/**
* Replacement string for matched text
*/
replacer?: string;
/**
* Matching flags; see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#advanced_searching_with_flags
*/
flags?: string;
[k: string]: unknown;
} & (LogFilterText | LogFilterRegex);
/**
* One or more log filtering rules
*/
export type LogFiltersConfig = LogFilter[];
export interface LogFilterText {
/**
* Text to match
*/
text: string;
[k: string]: unknown;
}
/**
* Log filter with regular expression
*/
export interface LogFilterRegex {
/**
* Regex pattern to match
*/
pattern: string;
[k: string]: unknown;
}
+4 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@appium/logger",
"version": "1.2.0",
"version": "1.4.2",
"author": "https://github.com/appium",
"description": "A Universal Logger For The Appium Ecosystem",
"repository": {
@@ -9,7 +9,7 @@
"directory": "packages/logger"
},
"main": "build/index.js",
"types": "index.ts",
"types": "build/index.d.ts",
"files": [
"index.ts",
"lib",
@@ -28,9 +28,10 @@
},
"dependencies": {
"console-control-strings": "1.1.0",
"lodash": "4.17.21",
"set-blocking": "2.0.0"
},
"license": "Apache-2.0",
"license": "ISC",
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0",
"npm": ">=8"
+15
View File
@@ -1,5 +1,6 @@
/* eslint-disable no-console */
import { Log } from '../../lib/log';
import { unleakString } from '../../lib/utils';
import {Stream} from 'node:stream';
describe('basic', async function () {
@@ -422,4 +423,18 @@ describe('basic', async function () {
o.includes('\u001b[7mtest message\u001b[0m').should.be.true;
});
});
describe('unleakString', function () {
it('should unleak a string', function () {
unleakString('yolo').should.eql('yolo');
});
it('should unleak a multiline string', function () {
unleakString(' yolo\nbolo ').should.eql(' yolo\nbolo ');
});
it('should convert an object to a string', function () {
for (const obj of [{}, null, undefined, [], 0]) {
unleakString(obj).should.eql(`${obj}`);
}
});
});
});
@@ -1,7 +1,7 @@
import {SecureValuesPreprocessor} from '../../lib/log-internal';
import {SecureValuesPreprocessor} from '../../lib/secure-values-preprocessor';
describe('Log Internals', function () {
/** @type {import('../../lib/log-internal').SecureValuesPreprocessor} */
/** @type {import('../../lib/secure-values-prepreocessor').SecureValuesPreprocessor} */
let preprocessor;
beforeEach(function () {
+40
View File
@@ -3,6 +3,46 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.3.38](https://github.com/appium/appium/compare/@appium/plugin-test-support@0.3.37...@appium/plugin-test-support@0.3.38) (2024-06-11)
**Note:** Version bump only for package @appium/plugin-test-support
## [0.3.37](https://github.com/appium/appium/compare/@appium/plugin-test-support@0.3.36...@appium/plugin-test-support@0.3.37) (2024-06-11)
**Note:** Version bump only for package @appium/plugin-test-support
## [0.3.36](https://github.com/appium/appium/compare/@appium/plugin-test-support@0.3.35...@appium/plugin-test-support@0.3.36) (2024-06-11)
**Note:** Version bump only for package @appium/plugin-test-support
## [0.3.35](https://github.com/appium/appium/compare/@appium/plugin-test-support@0.3.34...@appium/plugin-test-support@0.3.35) (2024-06-10)
**Note:** Version bump only for package @appium/plugin-test-support
## [0.3.34](https://github.com/appium/appium/compare/@appium/plugin-test-support@0.3.33...@appium/plugin-test-support@0.3.34) (2024-06-06)
**Note:** Version bump only for package @appium/plugin-test-support
## [0.3.33](https://github.com/appium/appium/compare/@appium/plugin-test-support@0.3.32...@appium/plugin-test-support@0.3.33) (2024-06-06)
**Note:** Version bump only for package @appium/plugin-test-support
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@appium/plugin-test-support",
"version": "0.3.33",
"version": "0.3.38",
"description": "Testing utilities for Appium plugins",
"keywords": [
"automation",
@@ -41,7 +41,7 @@
"test:unit": "exit 0"
},
"dependencies": {
"@appium/types": "^0.19.1",
"@appium/types": "^0.20.3",
"get-port": "5.1.1",
"log-symbols": "4.1.0",
"source-map-support": "0.5.21",
+18
View File
@@ -3,6 +3,24 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.6.1](https://github.com/appium/appium/compare/@appium/schema@0.6.0...@appium/schema@0.6.1) (2024-06-11)
### Bug Fixes
* **schema:** edit a comment in order to trigger a publish ([45cc948](https://github.com/appium/appium/commit/45cc9486711b6100e78317c9dd7fb4f65a41d1eb))
## [0.6.0](https://github.com/appium/appium/compare/@appium/schema@0.5.0...@appium/schema@0.6.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))
## [0.5.0](https://github.com/appium/appium/compare/@appium/schema@0.4.2...@appium/schema@0.5.0) (2023-12-18)
+17 -5
View File
@@ -1,5 +1,5 @@
/**
* The single-source-of-truth of the Appium server configuration
* The single-source-of-truth of the Appium server configuration.
*
* This defines _both_ what the CLI supports and what the config files support.
*/
@@ -171,6 +171,14 @@ export const AppiumConfigJsonSchema = /** @type {const} */ ({
title: 'log-level config',
type: 'string',
},
'log-format': {
appiumCliDest: 'logFormat',
default: 'text',
description: 'Log format (text|json|pretty_json)',
enum: ['text', 'json', 'pretty_json'],
title: 'log-format config',
type: 'string',
},
'log-no-colors': {
default: false,
description: 'Do not use color in console output',
@@ -185,13 +193,15 @@ export const AppiumConfigJsonSchema = /** @type {const} */ ({
},
'plugins-import-chunk-size': {
default: 7,
description: 'The maximum amount of plugins that could be imported in parallel on server startup',
description:
'The maximum amount of plugins that could be imported in parallel on server startup',
title: 'plugins-import-chunk-size config',
type: 'number',
},
'drivers-import-chunk-size': {
default: 3,
description: 'The maximum amount of drivers that could be imported in parallel on server startup',
description:
'The maximum amount of drivers that could be imported in parallel on server startup',
title: 'drivers-import-chunk-size config',
type: 'number',
},
@@ -301,13 +311,15 @@ export const AppiumConfigJsonSchema = /** @type {const} */ ({
type: 'string',
},
'ssl-cert-path': {
description: 'Full path to the .cert file if TLS is used. Must be provided together with "ssl-key-path"',
description:
'Full path to the .cert file if TLS is used. Must be provided together with "ssl-key-path"',
title: '.cert file path',
appiumCliDest: 'sslCertificatePath',
type: 'string',
},
'ssl-key-path': {
description: 'Full path to the .key file if TLS is used. Must be provided together with "ssl-cert-path"',
description:
'Full path to the .key file if TLS is used. Must be provided together with "ssl-cert-path"',
title: '.key file path',
appiumCliDest: 'sslKeyPath',
type: 'string',
@@ -173,6 +173,18 @@
"title": "log-level config",
"type": "string"
},
"log-format": {
"appiumCliDest": "logFormat",
"default": "text",
"description": "Log format (text|json|pretty_json)",
"enum": [
"text",
"json",
"pretty_json"
],
"title": "log-format config",
"type": "string"
},
"log-no-colors": {
"default": false,
"description": "Do not use color in console output",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@appium/schema",
"version": "0.5.0",
"version": "0.6.1",
"description": "Appium Configuration Schema",
"keywords": [
"automation",
+62
View File
@@ -3,6 +3,68 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [5.0.3](https://github.com/appium/appium/compare/@appium/support@5.0.2...@appium/support@5.0.3) (2024-06-11)
**Note:** Version bump only for package @appium/support
## [5.0.2](https://github.com/appium/appium/compare/@appium/support@5.0.1...@appium/support@5.0.2) (2024-06-11)
**Note:** Version bump only for package @appium/support
## [5.0.1](https://github.com/appium/appium/compare/@appium/support@5.0.0...@appium/support@5.0.1) (2024-06-11)
**Note:** Version bump only for package @appium/support
## [5.0.0](https://github.com/appium/appium/compare/@appium/support@4.5.0...@appium/support@5.0.0) (2024-06-10)
### ⚠ BREAKING CHANGES
* **support:** Remove unleakString since it is now in appium/logger
* **support:** Remove patchLogger exported method from logger
* **support:** Removed the 'log-internals' module
* **support:** Moved the 'loadSecureValuesPreprocessingRules' API to the '@appium/logger' package
### 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)
* **support:** Move SecureValuesPreprocessor to @appum/logger ([#20228](https://github.com/appium/appium/issues/20228)) ([dbc3b66](https://github.com/appium/appium/commit/dbc3b668a0a7a815d23f1cae4207d435fc09034d))
* **support:** Remove patchLogger from logger ([#20220](https://github.com/appium/appium/issues/20220)) ([dd421b3](https://github.com/appium/appium/commit/dd421b397b41cf4d5ed5a434edf72701f5936bb1))
* **support:** remove unleakString as no usage ([#20221](https://github.com/appium/appium/issues/20221)) ([93c271e](https://github.com/appium/appium/commit/93c271ec5d7ffc3f68b3ced3d15170387f9ab6c9))
### Bug Fixes
* **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))
## [4.5.0](https://github.com/appium/appium/compare/@appium/support@4.4.0...@appium/support@4.5.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)
## [4.4.0](https://github.com/appium/appium/compare/@appium/support@4.3.0...@appium/support@4.4.0) (2024-06-06)
-1
View File
@@ -51,7 +51,6 @@ All utility functions are split into a bunch of different categories. Each categ
|env|Several helpers needed by the server to cope with internal dependencies and manifests|
|fs|Most of the functions here are just thin wrappers over utility functions available in [Promises API](https://nodejs.org/api/fs.html#promises-api)|
|image-util|Utilities to work with images. Use [sharp](https://github.com/lovell/sharp) under the hood.<br>:bangbang: Node >=18.17 is required to use these utilities|
|log-internal|Utilities needed for internal Appium log config assistance|
|logging|See [the logging section below](#logging)|
|mjpeg|Helpers needed to implement [MJPEG streaming](https://en.wikipedia.org/wiki/Motion_JPEG#Video_streaming)|
|net|Helpers needed for network interactions, for example, upload and download of files|
-1
View File
@@ -80,4 +80,3 @@ export type {
ZipCompressionOptions,
ZipSourceOptions,
} from './zip';
export type {SecureValuePreprocessingRule} from './log-internal';
+73 -98
View File
@@ -1,72 +1,61 @@
// @ts-check
import globalLog from '@appium/logger';
import _ from 'lodash';
import moment from 'moment';
import SECURE_VALUES_PREPROCESSOR from './log-internal';
/** @type {import('@appium/types').AppiumLoggerLevel[]} */
export const LEVELS = ['silly', 'verbose', 'debug', 'info', 'http', 'warn', 'error'];
const MAX_LOG_RECORDS_COUNT = 3000;
const PREFIX_TIMESTAMP_FORMAT = 'HH-mm-ss:SSS';
// mock log object used in testing mode
let mockLog = {};
for (let level of LEVELS) {
mockLog[level] = () => {};
}
// export a default logger with no prefix
export const log = getLogger();
// mock log object is used in testing mode to silence the output
const MOCK_LOG = {
unwrap: () => ({
loadSecureValuesPreprocessingRules: () => ({
issues: [],
rules: [],
}),
level: 'verbose',
prefix: '',
log: _.noop,
}),
...(_.fromPairs(LEVELS.map((l) => [l, _.noop]))),
};
/**
*
* @returns {[import('@appium/logger').Logger, boolean]}
*/
function _getLogger() {
// check if the user set the `_TESTING` or `_FORCE_LOGS` flag
const testingMode = process.env._TESTING === '1';
const forceLogMode = process.env._FORCE_LOGS === '1';
// if is possible that there is a logger instance that is already around,
// in which case we want t o use that
const usingGlobalLog = !!global._global_npmlog;
let logger;
if (testingMode && !forceLogMode) {
// in testing mode, use a mock logger object that we can query
logger = mockLog;
} else {
// otherwise, either use the global, or a new `npmlog` object
logger = global._global_npmlog || globalLog;
// The default value is 10000, which causes excessive memory usage
logger.maxRecordSize = MAX_LOG_RECORDS_COUNT;
}
return [logger, usingGlobalLog];
}
/**
* @param {AppiumLoggerPrefix?} prefix
* @param {boolean} logTimestamp whether to include timestamps into log prefixes
* @returns {string}
*/
function getActualPrefix(prefix, logTimestamp = false) {
const result = (_.isFunction(prefix) ? prefix() : prefix) ?? '';
return logTimestamp ? `[${moment().format(PREFIX_TIMESTAMP_FORMAT)}] ${result}` : result;
}
/**
*
* @param {AppiumLoggerPrefix?} prefix
* @param {AppiumLoggerPrefix?} [prefix=null]
* @returns {AppiumLogger}
*/
function getLogger(prefix = null) {
let [logger, usingGlobalLog] = _getLogger();
export function getLogger(prefix = null) {
const [logger, usingGlobalLog] = _getLogger();
// wrap the logger so that we can catch and modify any logging
let wrappedLogger = {
const wrappedLogger = {
unwrap: () => logger,
levels: LEVELS,
prefix,
/**
* Logs given arguments at the error level and returns
* the error object.
*
* @param {...any} args
* @returns {Error}
*/
errorWithException (/** @type {any[]} */ ...args) {
this.error(...args);
// make sure we have an `Error` object. Wrap if necessary
return _.isError(args[0]) ? args[0] : new Error(args.join('\n'));
},
/**
* @deprecated Use {@link errorWithException} instead
* @param {...any} args
* @throws {Error}
*/
errorAndThrow (/** @type {any[]} */ ...args) {
throw this.errorWithException(args);
},
};
// allow access to the level of the underlying logger
Object.defineProperty(wrappedLogger, 'level', {
get() {
@@ -78,32 +67,15 @@ function getLogger(prefix = null) {
enumerable: true,
configurable: true,
});
const logTimestamp = process.env._LOG_TIMESTAMP === '1';
const isDebugTimestampLoggingEnabled = process.env._LOG_TIMESTAMP === '1';
// add all the levels from `npmlog`, and map to the underlying logger
for (const level of LEVELS) {
wrappedLogger[level] = /** @param {...any} args */ function (...args) {
const actualPrefix = getActualPrefix(this.prefix, logTimestamp);
for (const arg of args) {
const out = _.isError(arg) && arg.stack ? arg.stack : `${arg}`;
for (const line of out.split('\n')) {
logger[level](actualPrefix, SECURE_VALUES_PREPROCESSOR.preprocess(line));
}
}
wrappedLogger[level] = /** @param {any[]} args */ function (...args) {
const finalPrefix = getFinalPrefix(this.prefix, isDebugTimestampLoggingEnabled);
// @ts-ignore This is OK
logger[level](finalPrefix, ...args);
};
}
wrappedLogger.errorWithException = function (/** @type {any[]} */ ...args) {
this.error(...args);
// make sure we have an `Error` object. Wrap if necessary
return _.isError(args[0]) ? args[0] : new Error(args.join('\n'));
};
/**
* @deprecated Use {@link errorWithException} instead
*/
wrappedLogger.errorAndThrow = function (/** @type {any[]} */ ...args) {
throw this.errorWithException(args);
};
if (!usingGlobalLog) {
// if we're not using a global log specified from some top-level package,
// set the log level to a default of verbose. Otherwise, let the top-level
@@ -114,37 +86,40 @@ function getLogger(prefix = null) {
}
/**
* @typedef LoadResult
* @property {string[]} issues The list of rule parsing issues (one item per rule).
* Rules with issues are skipped. An empty list is returned if no parsing issues exist.
* @property {import('./log-internal').SecureValuePreprocessingRule[]} rules The list of successfully loaded
* replacement rules. The list could be empty if no rules were loaded.
*/
/**
* Loads the JSON file containing secure values replacement rules.
* This might be necessary to hide sensitive values that may possibly
* appear in Appium logs.
* Each call to this method replaces the previously loaded rules if any existed.
*
* @param {string|string[]|import('@appium/types').LogFiltersConfig} rulesJsonPath The full path to the JSON file containing
* the replacement rules. Each rule could either be a string to be replaced
* or an object with predefined properties.
* @throws {Error} If the given file cannot be loaded
* @returns {Promise<LoadResult>}
* @returns {[import('@appium/logger').Logger, boolean]}
*/
async function loadSecureValuesPreprocessingRules(rulesJsonPath) {
const issues = await SECURE_VALUES_PREPROCESSOR.loadRules(rulesJsonPath);
return {
issues,
rules: _.cloneDeep(SECURE_VALUES_PREPROCESSOR.rules),
};
function _getLogger() {
// check if the user set the `_TESTING` or `_FORCE_LOGS` flag
const testingMode = process.env._TESTING === '1';
const forceLogMode = process.env._FORCE_LOGS === '1';
// if is possible that there is a logger instance that is already around,
// in which case we want t o use that
const useGlobalLog = !!global._global_npmlog;
const logger = testingMode && !forceLogMode
// in testing mode, use a mock logger object that we can query
? MOCK_LOG
// otherwise, either use the global, or a new `npmlog` object
: (global._global_npmlog || globalLog);
// The default value is 10000, which causes excessive memory usage
logger.maxRecordSize = MAX_LOG_RECORDS_COUNT;
return [logger, useGlobalLog];
}
// export a default logger with no prefix
const log = getLogger();
/**
* @param {AppiumLoggerPrefix?} prefix
* @param {boolean} [shouldLogTimestamp=false] whether to include timestamps into log prefixes
* @returns {string}
*/
function getFinalPrefix(prefix, shouldLogTimestamp = false) {
const result = (_.isFunction(prefix) ? prefix() : prefix) ?? '';
if (!shouldLogTimestamp) {
return result;
}
const formattedTimestamp = `[${moment().format(PREFIX_TIMESTAMP_FORMAT)}]`;
return result ? `${formattedTimestamp} ${result}` : formattedTimestamp;
}
export {log, getLogger, loadSecureValuesPreprocessingRules};
export default log;
/**
-13
View File
@@ -358,18 +358,6 @@ function quote(args) {
return shellQuote(_.castArray(args));
}
/**
* This function is necessary to workaround unexpected memory leaks
* caused by NodeJS string interning
* behavior described in https://bugs.chromium.org/p/v8/issues/detail?id=2869
*
* @param {any} s - The string to unleak
* @return {string} Either the unleaked string or the original object converted to string
*/
function unleakString(s) {
return ` ${s}`.substring(1);
}
/**
* @typedef PluralizeOptions
* @property {boolean} [inclusive=false] - Whether to prefix with the number (e.g., 3 ducks)
@@ -555,7 +543,6 @@ export {
compareVersions,
coerceVersion,
quote,
unleakString,
jsonStringify,
pluralize,
GiB,
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@appium/support",
"version": "4.4.0",
"version": "5.0.3",
"description": "Support libs used across appium packages",
"keywords": [
"automation",
@@ -41,9 +41,9 @@
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
},
"dependencies": {
"@appium/logger": "^1.2.0",
"@appium/logger": "^1.4.2",
"@appium/tsconfig": "^0.3.3",
"@appium/types": "^0.19.1",
"@appium/types": "^0.20.3",
"@colors/colors": "1.6.0",
"@types/archiver": "6.0.2",
"@types/base64-stream": "1.0.5",
@@ -89,7 +89,7 @@
"source-map-support": "0.5.21",
"supports-color": "8.1.1",
"teen_process": "2.1.4",
"type-fest": "4.19.0",
"type-fest": "4.20.0",
"uuid": "9.0.1",
"which": "4.0.0",
"yauzl": "3.1.3"
-14
View File
@@ -503,20 +503,6 @@ describe('util', function () {
});
});
describe('unleakString', function () {
it('should unleak a string', function () {
util.unleakString('yolo').should.eql('yolo');
});
it('should unleak a multiline string', function () {
util.unleakString(' yolo\nbolo ').should.eql(' yolo\nbolo ');
});
it('should convert an object to a string', function () {
for (const obj of [{}, null, undefined, [], 0]) {
util.unleakString(obj).should.eql(`${obj}`);
}
});
});
describe('pluralize', function () {
/*
* The pluralize library (https://github.com/blakeembrey/pluralize)
+40
View File
@@ -3,6 +3,46 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [3.0.43](https://github.com/appium/appium/compare/@appium/test-support@3.0.42...@appium/test-support@3.0.43) (2024-06-11)
**Note:** Version bump only for package @appium/test-support
## [3.0.42](https://github.com/appium/appium/compare/@appium/test-support@3.0.41...@appium/test-support@3.0.42) (2024-06-11)
**Note:** Version bump only for package @appium/test-support
## [3.0.41](https://github.com/appium/appium/compare/@appium/test-support@3.0.40...@appium/test-support@3.0.41) (2024-06-11)
**Note:** Version bump only for package @appium/test-support
## [3.0.40](https://github.com/appium/appium/compare/@appium/test-support@3.0.39...@appium/test-support@3.0.40) (2024-06-10)
**Note:** Version bump only for package @appium/test-support
## [3.0.39](https://github.com/appium/appium/compare/@appium/test-support@3.0.38...@appium/test-support@3.0.39) (2024-06-06)
**Note:** Version bump only for package @appium/test-support
## [3.0.38](https://github.com/appium/appium/compare/@appium/test-support@3.0.37...@appium/test-support@3.0.38) (2024-06-06)
**Note:** Version bump only for package @appium/test-support
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@appium/test-support",
"version": "3.0.38",
"version": "3.0.43",
"description": "A collection of test utilities used across Appium packages",
"keywords": [
"automation",
@@ -45,7 +45,7 @@
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
},
"dependencies": {
"@appium/support": "^4.4.0",
"@appium/support": "^5.0.3",
"@colors/colors": "1.6.0",
"bluebird": "3.7.2",
"lodash": "4.17.21",
+46
View File
@@ -3,6 +3,52 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.20.3](https://github.com/appium/appium/compare/@appium/types@0.20.2...@appium/types@0.20.3) (2024-06-11)
**Note:** Version bump only for package @appium/types
## [0.20.2](https://github.com/appium/appium/compare/@appium/types@0.20.1...@appium/types@0.20.2) (2024-06-11)
**Note:** Version bump only for package @appium/types
## [0.20.1](https://github.com/appium/appium/compare/@appium/types@0.20.0...@appium/types@0.20.1) (2024-06-11)
**Note:** Version bump only for package @appium/types
## [0.20.0](https://github.com/appium/appium/compare/@appium/types@0.19.2...@appium/types@0.20.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))
### Bug Fixes
* **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))
## [0.19.2](https://github.com/appium/appium/compare/@appium/types@0.19.1...@appium/types@0.19.2) (2024-06-06)
**Note:** Version bump only for package @appium/types
## [0.19.1](https://github.com/appium/appium/compare/@appium/types@0.19.0...@appium/types@0.19.1) (2024-06-06)
+5
View File
@@ -93,6 +93,10 @@ export type LogLevelConfig =
| "debug:info"
| "debug:warn"
| "debug:error";
/**
* Log format (text|json|pretty_json)
*/
export type LogFormatConfig = "text" | "json" | "pretty_json";
/**
* Do not use color in console output
*/
@@ -191,6 +195,7 @@ export interface ServerConfig {
log?: LogConfig;
"log-filters"?: LogFiltersConfig;
"log-level"?: LogLevelConfig;
"log-format"?: LogFormatConfig;
"log-no-colors"?: LogNoColorsConfig;
"log-timestamp"?: LogTimestampConfig;
"plugins-import-chunk-size"?: PluginsImportChunkSizeConfig;
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@appium/types",
"version": "0.19.1",
"version": "0.20.3",
"description": "Various type declarations used across Appium",
"keywords": [
"automation",
@@ -38,12 +38,12 @@
"test:types": "tsd"
},
"dependencies": {
"@appium/logger": "^1.2.0",
"@appium/schema": "^0.5.0",
"@appium/logger": "^1.4.2",
"@appium/schema": "^0.6.1",
"@appium/tsconfig": "^0.3.3",
"@types/express": "4.17.21",
"@types/ws": "8.5.10",
"type-fest": "4.19.0"
"type-fest": "4.20.0"
},
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0",