medic / cht-core

The CHT Core Framework makes it faster to build responsive, offline-first digital health apps that equip health workers to provide better care in their communities. It is a central resource of the Community Health Toolkit.
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
441 stars 211 forks source link

Builds are failing because Webdriver cannot download Chromedriver #8881

Closed dianabarsan closed 8 months ago

dianabarsan commented 8 months ago

Describe the issue Example build: https://github.com/medic/cht-core/actions/runs/7934590909/job/21666328737

Checking API
API is up
API startup: User contact doc setup
Error: Error: Download failed: server returned code 404. URL: https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/121.0.6167.184/linux64/chromedriver-linux64.zip

It looks like google has changed the domain where they host chromedriver downloadables. This is already tracked in the webdriverio repo: https://github.com/webdriverio/webdriverio/issues/12251

Describe the improvement you'd like Fix the build by upgrading webdriverio after a fix is published.

Describe alternatives you've considered Find a workaround, like downloading older browser versions that are still available on the old domain.

dianabarsan commented 8 months ago

WDIO published a fix: https://github.com/webdriverio/webdriverio/releases/tag/v8.32.2

Upgrading to the latest version of wdio is proving non-trivial unfortunately.

garethbowen commented 8 months ago

@dianabarsan If it's helpful, I went down the upgrade path and solved some of the problems in this PR: https://github.com/medic/cht-core/pull/8817

The commit messages are rubbish but there's one for "upgrade wdio" and most of what's below that was fixing wdio issues.

dianabarsan commented 8 months ago

Thanks :)

The one error that I'm struggling with is:

[0-0] TypeError: browser.cdp is not a function
[0-0]     at Object.saveBrowserLogs (/home/diana/projects/cht-core-3/tests/utils/browser-logs.js:8:19)

cdp is a custom command added by the devtools service and we use it to get browser logs.

garethbowen commented 8 months ago

Yeah that's exactly where I got stuck too. Sorry I couldn't find any info for it :/

dianabarsan commented 8 months ago

I just made some progress. It seems that the service add the commands in the before hook, and we also call the commands in the before hook. there seems to be some race condition, where wdio doesn't wait until the service is set up before firing the custom before script.

dianabarsan commented 8 months ago

I've tracked this down and submitted a bug report in webdriverIO: https://github.com/webdriverio/webdriverio/issues/12321

Adding a timeout to wait for the devtools service to be fully registered is a possible workaround for us now.

garethbowen commented 8 months ago

Merged. Thanks @dianabarsan !