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

Solution for VCS and WebMock no longer working #254

Closed
kristofenyi opened this issue Aug 1, 2023 · 5 comments
Closed

Solution for VCS and WebMock no longer working #254

kristofenyi opened this issue Aug 1, 2023 · 5 comments

Comments

@kristofenyi
Copy link

kristofenyi commented Aug 1, 2023

Summary

webdrivers 5.2 is unable to locate latest chromedriver Net::HTTPServerException: 404 "Not Found" with https://chromedriver.storage.googleapis.com/115.0.5790.110/chromedriver_linux64.zip
webdrivers 5.3.1 makes http request to GET https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json & fails

Debug Info

Please provide the following information for bug reports:

  • Webdrivers version:
  • Ruby version: ruby-3.1.2
  • Operating system / CI Environment: Ubuntu 20.4
  • Browser and version:Google Chrome 115.0.5790.110 & ChromeDriver 115.0.5790.110

It is probably my setting with not allowing calls to external urls from cassets. But i am getting

rails Webdrivers::NetworkError:  Net::HTTPServerException: 404 "Not Found"
Failure/Error: driven_by :selenium, using: :headless_chrome, screen_size: [1400, 2000]

          VCR::Errors::UnhandledHTTPRequestError:


            ================================================================================
            An HTTP request has been made that VCR does not know how to handle:
              GET https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json

            There is currently no cassette in use. There are a few ways
            you can configure VCR to handle this request:

              * If you're surprised VCR is raising this error
                and want insight about how VCR attempted to handle the request,
                you can use the debug_logger configuration option to log more details [1].
              * If you want VCR to record this request and play it back during future test
                runs, you should wrap your test (or this portion of your test) in a
                `VCR.use_cassette` block [2].
              * If you only want VCR to handle requests made while a cassette is in use,
                configure `allow_http_connections_when_no_cassette = true`. VCR will
                ignore this request since it is made when there is no cassette [3].
              * If you want VCR to ignore this request (and others like it), you can
                set an `ignore_request` callback [4].

            [1] https://www.relishapp.com/vcr/vcr/v/6-1-0/docs/configuration/debug-logging
            [2] https://www.relishapp.com/vcr/vcr/v/6-1-0/docs/getting-started
            [3] https://www.relishapp.com/vcr/vcr/v/6-1-0/docs/configuration/allow-http-connections-when-no-cassette
            [4] https://www.relishapp.com/vcr/vcr/v/6-1-0/docs/configuration/ignore-request```


#### Expected Behavior
Use headless chrome to run rpsec tests

#### Actual Behavior
Not able to locate driver or make GET call to ```https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json```
@timdiggins
Copy link

@kristofenyi can you share how you solved this? Having the same problem (and when we ignore the relevant hosts, we're getting a crash in chromedrivers / selenium says chrome binary not found. Manually updating chromedriver via RAILS_ENV=test rails webdrivers:chromedriver:update doesn't seem to help

@titusfortner
Copy link
Owner

I updated the wiki for this: https://github.com/titusfortner/webdrivers/wiki/Using-with-VCR-or-WebMock

The recommendation is to use Selenium 4.11 and do something like this so the Selenium Manager binary is not executed:

          allow(Selenium::WebDriver::DriverFinder).to receive(:path).and_return('/path/to/driver')

@titusfortner
Copy link
Owner

If you're trying to skip everything driver related, can return nil and also mock the file assertions:

          allow(Selenium::WebDriver:: Platform).to receive(:assert_file)
          allow(Selenium::WebDriver:: Platform).to receive(:assert_executable)

Let me know what the actual use case is and if I can help further.

@titusfortner titusfortner changed the title webdrivers 5.2 can't locate v115 chromedriver. webdrivers 5.3 makes http req to github Solution for VCS and WebMock no longer working Aug 2, 2023
@titusfortner
Copy link
Owner

I guess I'll leave this closed because my current plan for webdrivers 6 is to wrap Selenium Manager directly. But if someone has a PR that makes this work, I'll look at it.

@timdiggins
Copy link

Thanks for response! Our plan is to upgrade to Ruby 3.0 so we can get the selenium-webdrivers up to 4.11 (from 4.9), but in the meantime we had to add "edgedl.me.gvt1.com" as well as "googlechromelabs.github.io" to the vcr ignore_hosts and then everything works - but it does seem slower than before -- haven't looked into it yet.

AndrewKvalheim added a commit to SeaGL/osem that referenced this issue Sep 6, 2023
#!/usr/bin/env bash
set -Eeuxo pipefail

function merge() { id="$1"; title="$2"
  git pull --no-ff --no-commit --strategy-option 'theirs' 'openSUSE' "pull/$id/head"
  git commit --message "Merge #‌$id \"$title\""

  items+=( "- [ ] $title [#$id](https://github.com/openSUSE/osem/pull/$id)" )
}

function merge_draft() { branch="$1"; title="$2"
  git pull --no-ff --no-commit --strategy-option 'theirs' 'AndrewKvalheim' "$branch"
  git commit --message "Merge draft AndrewKvalheim:$branch"

  items+=( "- [ ] $title [\`$branch\`](https://github.com/AndrewKvalheim/osem/tree/$branch)" )
}

function pick() { hash="$1"; title="$2"
  git cherry-pick "$hash"
  rebased="$(git rev-parse HEAD)"

  items+=( "- [ ] $title [\`${rebased:0:7}\`]($rebased)" )
}

function revert() { hash="$1"; title="$2"; note="$3"
  git revert --no-edit "$hash"

  items+=( "- [ ] Revert “$title” [\`${hash:0:7}\`](openSUSE@$hash) ($note)" )
}

items=()

git fetch --prune 'openSUSE'
git checkout 'interim'
git reset --hard 'openSUSE/master'

merge '2654' 'Fix access to the version history of organization-level roles'
merge '3059' 'Add setting to disable email notifications of comments'
merge '3058' 'Add surveys during CFP response'
merge '3140' 'Don’t automatically select a difficulty level'
merge '3243' 'Corrections to proposal help text'
merge '3244' 'Resolve inability to schedule events'
merge_draft 'hide-commercials' 'Restrict commercial management to organizers'
pick '9cac6fdc9c679590c42eb285ab50af54fabe32e6' 'Add notifications of user registrations'
pick '56b9e646b491035cf6aef4025dafcb395fe75a56' 'Configure deployment to Dokku'
pick '26bff0c72be21c9fa311cc4abd118ba81cf525d0' 'Work around [titusfortner/webdrivers#254](titusfortner/webdrivers#254)'

IFS=$'\n'
cat << MARKDOWN > 'README.md'
# About this branch

Our goal is to run [upstream] OSEM without modifications to its codebase. We currently still make a few modifications in this interim branch:

${items[*]}

These divergences from upstream should be seen as a to-do list, where completing an item means either solving its need in a general way upstream, or adjusting our procedures to accommodate upstream’s existing capabilities or limitations.

## Guidelines

Don’t develop on this branch. It follows upstream by regularly **rebasing** the above modifications. When a modification is no longer necessary, it will be dropped during the rebase. When there are no remaining modifications, this branch will be deleted.

[upstream]: https://github.com/openSUSE/osem
MARKDOWN
git add 'README.md'
git commit --message "Document interim branch

$(cat "${BASH_SOURCE[0]}")"

git --no-pager log --color --oneline 'openSUSE/master'..'interim'
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

No branches or pull requests

3 participants