Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add install-chromedriver command #366

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

KazuCocoa
Copy link
Member

Let's add the same automatic download (latest one) which is removed from appium-chromedriver.

This command will give the below log's ability.

kazu $ appium driver run chromium install-chromedriver
WARN Appium Appium encountered 1 warning while validating drivers found in manifest /Users/kazu/github/appium-chromium-driver/node_modules/.cache/appium/extensions.yaml
WARN Appium Driver "chromium" has 1 potential problem: 
WARN Appium   - Driver "chromium" (package `appium-chromium-driver`) may be incompatible with the current version of Appium (v2.6.0) due to its peer dependency on Appium ^2.11.5. Please install a compatible version of the driver.
dbug ChromedriverGoogleapisStorageClient Parsed 776 entries from storage XML
info ChromedriverGoogleapisStorageClient The total count of entries in the mapping: 546
info ChromedriverChromelabsStorageClient The total count of entries in the mapping: 4975
dbug ChromedriverStorageClient Selecting chromedrivers whose versions match to 130.0.6723.58
dbug ChromedriverStorageClient Got 5 items
dbug ChromedriverStorageClient Selecting chromedrivers whose platform matches to mac:arm64
dbug ChromedriverStorageClient Got 1 item
dbug ChromedriverStorageClient Excluding older patches if present
dbug ChromedriverStorageClient Versions mapping: {
dbug ChromedriverStorageClient   "130": [
dbug ChromedriverStorageClient     "130.0.6723.58"
dbug ChromedriverStorageClient   ]
dbug ChromedriverStorageClient }
dbug ChromedriverStorageClient Got 1 driver to sync: [
dbug ChromedriverStorageClient   "130.0.6723.58/chromedriver-mac-arm64.zip"
dbug ChromedriverStorageClient ]
dbug ChromedriverStorageClient Retrieving 'https://storage.googleapis.com/chrome-for-testing-public/130.0.6723.58/mac-arm64/chromedriver-mac-arm64.zip' to '/var/folders/l5/4djs4rts6dg8jxwjv45wkr_w0000gn/T/2024920-54661-1rq3y7o.td0k/0.zip'
dbug Support Traversed 2 directories and 3 files in 2ms
dbug ChromedriverStorageClient Moving the extracted 'chromedriver' to '/Users/kazu/github/appium-chromium-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver-mac-arm64_v130.0.6723.58'
dbug ChromedriverStorageClient Permissions of the file '/Users/kazu/github/appium-chromium-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver-mac-arm64_v130.0.6723.58' have been changed to 755
info ChromedriverStorageClient Successfully synchronized 1 chromedriver
✔ install-chromedriver successfully ran
kazu $ CHROMEDRIVER_VERSION=131.0.6778.3 appium driver run chromium install-chromedriver
WARN Appium Appium encountered 1 warning while validating drivers found in manifest /Users/kazu/github/appium-chromium-driver/node_modules/.cache/appium/extensions.yaml
WARN Appium Driver "chromium" has 1 potential problem: 
WARN Appium   - Driver "chromium" (package `appium-chromium-driver`) may be incompatible with the current version of Appium (v2.6.0) due to its peer dependency on Appium ^2.11.5. Please install a compatible version of the driver.
dbug ChromedriverGoogleapisStorageClient Parsed 776 entries from storage XML
info ChromedriverGoogleapisStorageClient The total count of entries in the mapping: 546
info ChromedriverChromelabsStorageClient The total count of entries in the mapping: 4975
dbug ChromedriverStorageClient Selecting chromedrivers whose versions match to 131.0.6778.3
dbug ChromedriverStorageClient Got 5 items
dbug ChromedriverStorageClient Selecting chromedrivers whose platform matches to mac:arm64
dbug ChromedriverStorageClient Got 1 item
dbug ChromedriverStorageClient Excluding older patches if present
dbug ChromedriverStorageClient Versions mapping: {
dbug ChromedriverStorageClient   "131": [
dbug ChromedriverStorageClient     "131.0.6778.3"
dbug ChromedriverStorageClient   ]
dbug ChromedriverStorageClient }
dbug ChromedriverStorageClient Got 1 driver to sync: [
dbug ChromedriverStorageClient   "131.0.6778.3/chromedriver-mac-arm64.zip"
dbug ChromedriverStorageClient ]
dbug ChromedriverStorageClient Retrieving 'https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.3/mac-arm64/chromedriver-mac-arm64.zip' to '/var/folders/l5/4djs4rts6dg8jxwjv45wkr_w0000gn/T/2024920-54819-14lyp1m.o995/0.zip'
dbug Support Traversed 2 directories and 3 files in 1ms
dbug ChromedriverStorageClient Moving the extracted 'chromedriver' to '/Users/kazu/github/appium-chromium-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver-mac-arm64_v131.0.6778.3'
dbug ChromedriverStorageClient Permissions of the file '/Users/kazu/github/appium-chromium-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver-mac-arm64_v131.0.6778.3' have been changed to 755
info ChromedriverStorageClient Successfully synchronized 1 chromedriver
✔ install-chromedriver successfully ran
kazu $ ls /Users/kazu/github/appium-chromium-driver/node_modules/appium-chromedriver/chromedriver/mac/
chromedriver-mac-arm64_v130.0.6723.58 chromedriver-mac-arm64_v131.0.6778.3

#363

README.md Outdated Show resolved Hide resolved
README.md Outdated
[Chorme for testing](https://github.com/GoogleChromeLabs/chrome-for-testing)
in `node_modules/appium-chromedriver/chromedriver` directory with `appium driver run chromium install-chromedriver`.

As same as [appium-chromedriver](https://github.com/appium/appium-chromedriver),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if it also would make sense to introduce command line arguments for the same

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean giving CHROMEDRIVER_VERSION and CHROMELABS_URL would not be helpful? So, just gives appium driver run chromium install-chromedriver to download latest version?

Copy link
Contributor

@mykola-mokhnach mykola-mokhnach Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's fine to have env variables. I mean that maybe duplicating their functionality by adding --chromedriver-version and --chromelabs-url command line params it would be more convenient for end users.

README.md Outdated Show resolved Hide resolved
package.json Outdated
@@ -33,7 +33,8 @@
"README.md",
"CHANGELOG.md",
"LICENSE",
"npm-shrinkwrap.json"
"npm-shrinkwrap.json",
"scripts/*.mjs"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simply include the whole scripts dir

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if we also need to add this folder to the list of linted sources

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I might miss somewhere. npx eslint scripts/install-chromedriver.mjs worked but npx eslint . ignored the scripts.

VERSION_LATEST;
}

async function formatCdVersion (ver) {
Copy link
Contributor

@mykola-mokhnach mykola-mokhnach Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why cannot we import these functions and constants instead of duplicating them?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same above

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean exporting them from appium-chromedriver's index and import them from the module? No special reason but just to not modify the chromedriver side only for these usage in scripts. e.g. Move formatCdVersion from test to somewhere and exporting it.
Or importing them from appium-chromedriver/build/lib/constants...? Then, appium-chromedriver may not know if the path could be used by other modules (this package.) so probably not good to do it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no need to export from index. You may export directly from build/lib. See, for example, https://github.com/appium/appium-windows-driver/blob/dba67a91039f8919373e7e913f862c2b8dcda867/scripts/install-wad.mjs#L7

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, then you mean import LATEST from 'appium-chromedriver/build/lib/constants'; correct? Then, the https://github.com/appium/appium-chromedriver should keep the structure to not break https://github.com/appium/appium-chromium-driver (this module). I wanted to avoid calling other package's internal path such as build/lib... since it means https://github.com/appium/appium-chromedriver maintenance should keep taking care of https://github.com/appium/appium-chromium-driver

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may still call the script directly from node_modules in appium-chromium-driver. Although, I would consider either adding a separate script to the latter then. Same with uia2 driver

@KazuCocoa KazuCocoa marked this pull request as draft October 21, 2024 08:20
@KazuCocoa KazuCocoa marked this pull request as ready for review October 22, 2024 02:27
@KazuCocoa
Copy link
Member Author

updated with the latest chromedriver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants