From a062a7b69712a8c28aceca4fc4b5cdd331ee2c89 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 4 Jul 2025 12:56:08 +1000 Subject: [PATCH] Add Billy proxy to Chrome in system specs And demonstrate the use of puffing-billy browser proxy. Billy can cache and record responses to browser requests. For that to work we need to allow network connections and disable VCR. But instead I found that the Billy proxy is just like any other Ruby backend code and its connections can be recorded with VCR instead. And instead of stubbing requests via Billy.proxy, we can use standard Webmock `stub_request`. Now we use puffing-billy just to relay browser requests via our Ruby app. --- .../handles_HTTPS.yml | 42 + .../loads_a_website.yml | 948 ++++++++++++++++++ spec/system/billy_spec.rb | 21 + spec/system/support/cuprite_setup.rb | 14 +- 4 files changed, 1022 insertions(+), 3 deletions(-) create mode 100644 spec/fixtures/vcr_cassettes/Testing_external_scripts_loaded_in_the_browser/handles_HTTPS.yml create mode 100644 spec/fixtures/vcr_cassettes/Testing_external_scripts_loaded_in_the_browser/loads_a_website.yml create mode 100644 spec/system/billy_spec.rb diff --git a/spec/fixtures/vcr_cassettes/Testing_external_scripts_loaded_in_the_browser/handles_HTTPS.yml b/spec/fixtures/vcr_cassettes/Testing_external_scripts_loaded_in_the_browser/handles_HTTPS.yml new file mode 100644 index 0000000000..2c1127632c --- /dev/null +++ b/spec/fixtures/vcr_cassettes/Testing_external_scripts_loaded_in_the_browser/handles_HTTPS.yml @@ -0,0 +1,42 @@ +--- +http_interactions: +- request: + method: get + uri: http://www.gstatic.com/generate_204 + body: + encoding: UTF-8 + string: '' + headers: + Proxy-Connection: + - keep-alive + Pragma: + - no-cache + Cache-Control: + - no-cache + User-Agent: + - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/138.0.0.0 + Safari/537.36 + Accept-Encoding: + - '' + Accept-Language: + - en-US,en;q=0.9 + Connection: + - close + response: + status: + code: 204 + message: No Content + headers: + Content-Length: + - '0' + Cross-Origin-Resource-Policy: + - cross-origin + Date: + - Fri, 11 Jul 2025 05:04:02 GMT + Connection: + - close + body: + encoding: UTF-8 + string: '' + recorded_at: Fri, 11 Jul 2025 05:04:02 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/fixtures/vcr_cassettes/Testing_external_scripts_loaded_in_the_browser/loads_a_website.yml b/spec/fixtures/vcr_cassettes/Testing_external_scripts_loaded_in_the_browser/loads_a_website.yml new file mode 100644 index 0000000000..9299ce7d1a --- /dev/null +++ b/spec/fixtures/vcr_cassettes/Testing_external_scripts_loaded_in_the_browser/loads_a_website.yml @@ -0,0 +1,948 @@ +--- +http_interactions: +- request: + method: get + uri: http://clients2.google.com/time/1/current?cup2hreq=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855&cup2key=9:s5jDVMfcuUIhrqbHhePH_nBoAC1CjxTn99-PT031EBI + body: + encoding: UTF-8 + string: '' + headers: + Proxy-Connection: + - keep-alive + Pragma: + - no-cache + Cache-Control: + - no-cache + User-Agent: + - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/138.0.0.0 + Safari/537.36 + Accept-Encoding: + - '' + Connection: + - close + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + X-Content-Type-Options: + - nosniff + X-Cup-Server-Proof: + - 304402203592554ffcc4bc9ea59f39b1ac3f09be988e1987742afef742d1b40a6fe1cc56022057ef8ace9edc80e72939c136e2b29069e75cc3886817ddbae3b7a9a1fb025c98:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - Mon, 01 Jan 1990 00:00:00 GMT + Date: + - Fri, 11 Jul 2025 04:56:31 GMT + Content-Disposition: + - attachment; filename="json.txt"; filename*=UTF-8''json.txt + Cross-Origin-Resource-Policy: + - same-site + Cross-Origin-Opener-Policy: + - same-origin + Server: + - ESF + X-Xss-Protection: + - '0' + X-Frame-Options: + - SAMEORIGIN + Accept-Ranges: + - none + Vary: + - Sec-Fetch-Dest, Sec-Fetch-Mode, Sec-Fetch-Site,Accept-Encoding + Connection: + - close + Transfer-Encoding: + - chunked + body: + encoding: UTF-8 + string: |- + )]}' + {"current_time_millis":1752209791246,"server_nonce":3.589026436260661E-105} + recorded_at: Fri, 11 Jul 2025 04:56:31 GMT +- request: + method: post + uri: https://accounts.google.com/ListAccounts?gpsia=1&json=standard&source=ChromiumBrowser + body: + encoding: UTF-8 + string: " " + headers: + Connection: + - close + Content-Length: + - '1' + Origin: + - https://www.google.com + Content-Type: + - application/x-www-form-urlencoded + Sec-Fetch-Site: + - none + Sec-Fetch-Mode: + - no-cors + Sec-Fetch-Dest: + - empty + User-Agent: + - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/138.0.0.0 + Safari/537.36 + Accept-Encoding: + - '' + Accept-Language: + - en-US,en;q=0.9 + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Access-Control-Allow-Origin: + - https://www.google.com + Access-Control-Allow-Credentials: + - 'true' + X-Content-Type-Options: + - nosniff + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - Mon, 01 Jan 1990 00:00:00 GMT + Date: + - Fri, 11 Jul 2025 04:56:32 GMT + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Cross-Origin-Opener-Policy: + - same-origin + Accept-Ch: + - Sec-CH-UA-Arch, Sec-CH-UA-Bitness, Sec-CH-UA-Full-Version, Sec-CH-UA-Full-Version-List, + Sec-CH-UA-Model, Sec-CH-UA-WoW64, Sec-CH-UA-Form-Factors, Sec-CH-UA-Platform, + Sec-CH-UA-Platform-Version + Content-Security-Policy: + - require-trusted-types-for 'script';report-uri /_/IdentityListAccountsHttp/cspreport + - script-src 'report-sample' 'nonce-DAr6J4mndfAlMG1hXXiENw' 'unsafe-inline';object-src + 'none';base-uri 'self';report-uri /_/IdentityListAccountsHttp/cspreport;worker-src + 'self' + - 'script-src ''unsafe-inline'' ''unsafe-eval'' blob: data: ''self'' https://apis.google.com + https://ssl.gstatic.com https://www.google.com https://www.googletagmanager.com + https://www.gstatic.com https://www.google-analytics.com;report-uri /_/IdentityListAccountsHttp/cspreport/allowlist' + - 'script-src ''unsafe-inline'' ''unsafe-eval'' blob: data:;report-uri /_/IdentityListAccountsHttp/cspreport/fine-allowlist' + Permissions-Policy: + - ch-ua-arch=*, ch-ua-bitness=*, ch-ua-full-version=*, ch-ua-full-version-list=*, + ch-ua-model=*, ch-ua-wow64=*, ch-ua-form-factors=*, ch-ua-platform=*, ch-ua-platform-version=* + Reporting-Endpoints: + - default="/_/IdentityListAccountsHttp/web-reports?context=eJzjEtHikmII0pBiOHxtB5Meyy0mIyAW4uFo2HzoMJvAjlX_JzMp6SblF8ZnpqTmlWSWVOZkFpckJifnl-aVFBenFpWlFsUbGRiZGpgbmOkZmMcXGAAAaV4b9A" + Server: + - ESF + X-Xss-Protection: + - '0' + Alt-Svc: + - h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 + Accept-Ranges: + - none + Vary: + - Origin,Accept-Encoding + Connection: + - close + Transfer-Encoding: + - chunked + body: + encoding: UTF-8 + string: '["gaia.l.a.r",[]]' + recorded_at: Fri, 11 Jul 2025 04:56:32 GMT +- request: + method: get + uri: https://deb.debian.org/debian/ + body: + encoding: UTF-8 + string: '' + headers: + Connection: + - close + Upgrade-Insecure-Requests: + - '1' + User-Agent: + - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/138.0.0.0 + Safari/537.36 + Accept: + - text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 + Sec-Ch-Ua: + - '"Not)A;Brand";v="8", "Chromium";v="138"' + Sec-Ch-Ua-Mobile: + - "?0" + Sec-Ch-Ua-Platform: + - '"Linux"' + Sec-Fetch-Site: + - none + Sec-Fetch-Mode: + - navigate + Sec-Fetch-User: + - "?1" + Sec-Fetch-Dest: + - document + Accept-Encoding: + - '' + Accept-Language: + - en-US,en;q=0.9 + response: + status: + code: 200 + message: OK + headers: + Connection: + - close + Content-Length: + - '6121' + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - sameorigin + Referrer-Policy: + - no-referrer + X-Xss-Protection: + - '1' + Permissions-Policy: + - interest-cohort=() + X-Clacks-Overhead: + - GNU Terry Pratchett + Content-Type: + - text/html;charset=UTF-8 + Backend: + - 4qpvL1tJyeV1P6Tmf0Lj8g--F_skroutz_debian_backend_mirrors_debian_org + Via: + - 1.1 varnish, 1.1 varnish + Accept-Ranges: + - bytes + Age: + - '0' + Date: + - Fri, 11 Jul 2025 04:56:32 GMT + X-Served-By: + - cache-ams21082-AMS, cache-mel11231-MEL + X-Cache: + - HIT, MISS + X-Cache-Hits: + - 2, 0 + X-Timer: + - S1752209792.452248,VS0,VE236 + Vary: + - Accept-Encoding + X-Req-Url: + - recv="/debian/",deliver="/debian/" + body: + encoding: UTF-8 + string: | + + + + Index of /debian + + +

Index of /debian

+ + + + + + + + + + + + + + + + + + + +
[ICO]NameLast modifiedSize

[PARENTDIR]Parent Directory  -
[   ]README2025-05-17 08:29 1.2K
[   ]README.CD-manufacture2010-06-26 09:52 1.3K
[TXT]README.html2025-05-17 08:29 2.8K
[TXT]README.mirrors.html2017-03-04 20:08 291
[TXT]README.mirrors.txt2017-03-04 20:08 86
[DIR]dists/2025-05-17 08:29 -
[DIR]doc/2025-07-11 01:52 -
[   ]extrafiles2025-07-11 02:21 193K
[DIR]indices/2025-07-11 02:20 -
[   ]ls-lR.gz2025-07-11 02:14 15M
[DIR]pool/2022-10-05 17:09 -
[DIR]project/2008-11-17 23:05 -
[DIR]tools/2012-10-10 16:29 -
[DIR]zzz-dists/2023-10-07 11:07 -

+ + + + Debian Archive + + + + +

Debian Archive

+ +

See https://www.debian.org/ + for information about Debian GNU/Linux.

+ +

Current Releases

+ +

Four Debian releases are available on the main site:

+ +
+
+ +
Debian 10.13, or buster
+
Debian 10.13 was released Saturday, 10th September 2022. + Installation + and upgrading instructions, + More information +
+ +
Debian 11.11, or bullseye
+
Debian 11.11 was released Saturday, 31st August 2024. + Installation + and upgrading instructions, + More information +
+ +
Debian 12.11, or bookworm
+
Debian 12.11 was released Saturday, 17th May 2025. + Installation + and upgrading instructions, + More information +
+ +
Testing, or trixie
+
The current tested development snapshot is named trixie.
+ Packages which have been tested in unstable and passed automated + tests propagate to this release.
+ More information +
+ +
Unstable, or sid
+
The current development snapshot is named sid.
+ Untested candidate packages for future releases.
+ More information +
+
+
+ +

Old Releases

+ +

Older releases of Debian are at + http://archive.debian.org/debian-archive +
+ More information +

+ +

CDs

+ +

For more information about Debian CDs, please see + README.CD-manufacture. +
+ Further information +

+ +

Mirrors

+ +

For more information about Debian mirrors, please see + README.mirrors.html. +
+ Further information +

+ +

Other directories

+ + + + + +
doc Debian documentation.
indices Various indices of the site.
project Experimental packages and other miscellaneous files.
+ + + + + recorded_at: Fri, 11 Jul 2025 04:56:32 GMT +- request: + method: get + uri: https://deb.debian.org/icons/compressed.gif + body: + encoding: UTF-8 + string: '' + headers: + Connection: + - close + Sec-Ch-Ua-Platform: + - '"Linux"' + User-Agent: + - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/138.0.0.0 + Safari/537.36 + Sec-Ch-Ua: + - '"Not)A;Brand";v="8", "Chromium";v="138"' + Sec-Ch-Ua-Mobile: + - "?0" + Accept: + - image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8 + Sec-Fetch-Site: + - same-origin + Sec-Fetch-Mode: + - no-cors + Sec-Fetch-Dest: + - image + Accept-Encoding: + - '' + Accept-Language: + - en-US,en;q=0.9 + response: + status: + code: 200 + message: OK + headers: + Connection: + - close + Content-Length: + - '1038' + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - sameorigin + Referrer-Policy: + - no-referrer + X-Xss-Protection: + - '1' + Permissions-Policy: + - interest-cohort=() + Last-Modified: + - Sat, 20 Nov 2004 20:16:24 GMT + Etag: + - '"40e-3e9564c23b600"' + X-Clacks-Overhead: + - GNU Terry Pratchett + Content-Type: + - image/gif + Backend: + - 4qpvL1tJyeV1P6Tmf0Lj8g--F_static_backend + Accept-Ranges: + - bytes + Age: + - '0' + Date: + - Fri, 11 Jul 2025 04:56:34 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-mel11275-MEL + X-Cache: + - HIT + X-Cache-Hits: + - '0' + X-Timer: + - S1752209794.092857,VS0,VE544 + X-Req-Url: + - recv="/icons/compressed.gif",deliver="/icons/compressed.gif" + body: + encoding: ASCII-8BIT + string: !binary |- + R0lGODlhFAAWAOcAAP//////zP//mf//Zv//M///AP/M///MzP/Mmf/MZv/MM//MAP+Z//+ZzP+Zmf+ZZv+ZM/+ZAP9m//9mzP9mmf9mZv9mM/9mAP8z//8zzP8zmf8zZv8zM/8zAP8A//8AzP8Amf8AZv8AM/8AAMz//8z/zMz/mcz/Zsz/M8z/AMzM/8zMzMzMmczMZszMM8zMAMyZ/8yZzMyZmcyZZsyZM8yZAMxm/8xmzMxmmcxmZsxmM8xmAMwz/8wzzMwzmcwzZswzM8wzAMwA/8wAzMwAmcwAZswAM8wAAJn//5n/zJn/mZn/Zpn/M5n/AJnM/5nMzJnMmZnMZpnMM5nMAJmZ/5mZzJmZmZmZZpmZM5mZAJlm/5lmzJlmmZlmZplmM5lmAJkz/5kzzJkzmZkzZpkzM5kzAJkA/5kAzJkAmZkAZpkAM5kAAGb//2b/zGb/mWb/Zmb/M2b/AGbM/2bMzGbMmWbMZmbMM2bMAGaZ/2aZzGaZmWaZZmaZM2aZAGZm/2ZmzGZmmWZmZmZmM2ZmAGYz/2YzzGYzmWYzZmYzM2YzAGYA/2YAzGYAmWYAZmYAM2YAADP//zP/zDP/mTP/ZjP/MzP/ADPM/zPMzDPMmTPMZjPMMzPMADOZ/zOZzDOZmTOZZjOZMzOZADNm/zNmzDNmmTNmZjNmMzNmADMz/zMzzDMzmTMzZjMzMzMzADMA/zMAzDMAmTMAZjMAMzMAAAD//wD/zAD/mQD/ZgD/MwD/AADM/wDMzADMmQDMZgDMMwDMAACZ/wCZzACZmQCZZgCZMwCZAABm/wBmzABmmQBmZgBmMwBmAAAz/wAzzAAzmQAzZgAzMwAzAAAA/wAAzAAAmQAAZgAAM+4AAN0AALsAAKoAAIgAAHcAAFUAAEQAACIAABEAAADuAADdAAC7AACqAACIAAB3AABVAABEAAAiAAARAAAA7gAA3QAAuwAAqgAAiAAAdwAAVQAARAAAIgAAEe7u7t3d3bu7u6qqqoiIiHd3d1VVVURERCIiIhEREQAAACH+TlRoaXMgYXJ0IGlzIGluIHRoZSBwdWJsaWMgZG9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tLCBTZXB0ZW1iZXIgMTk5NQAh+QQBAAAkACwAAAAAFAAWAAAImQBJCCTBqmDBgQgTDmQFAABDVgojEmzI0KHEhBUrWrwoMGNDihwnAvjHiqRJjhX/qVz5D+VHAFZiWmmZ8BGHji9hxqTJ4ZFAmzc1vpxJgkPPn0Y5CP04M6lPEkCN5mxoJelRqFY5TM36NGrPqV67Op0KM6rYnkup/gMq1mdamC1tdn36lijUpwjr0pSoFyUrmTJLhiTBkqXCgAA7 + recorded_at: Fri, 11 Jul 2025 04:56:34 GMT +- request: + method: get + uri: https://deb.debian.org/icons/blank.gif + body: + encoding: UTF-8 + string: '' + headers: + Connection: + - close + Sec-Ch-Ua-Platform: + - '"Linux"' + User-Agent: + - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/138.0.0.0 + Safari/537.36 + Sec-Ch-Ua: + - '"Not)A;Brand";v="8", "Chromium";v="138"' + Sec-Ch-Ua-Mobile: + - "?0" + Accept: + - image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8 + Sec-Fetch-Site: + - same-origin + Sec-Fetch-Mode: + - no-cors + Sec-Fetch-Dest: + - image + Accept-Encoding: + - '' + Accept-Language: + - en-US,en;q=0.9 + response: + status: + code: 200 + message: OK + headers: + Connection: + - close + Content-Length: + - '148' + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - sameorigin + Referrer-Policy: + - no-referrer + X-Xss-Protection: + - '1' + Permissions-Policy: + - interest-cohort=() + Last-Modified: + - Sat, 20 Nov 2004 20:16:24 GMT + Etag: + - '"94-3e9564c23b600"' + X-Clacks-Overhead: + - GNU Terry Pratchett + Content-Type: + - image/gif + Backend: + - 4qpvL1tJyeV1P6Tmf0Lj8g--F_static_backend + Accept-Ranges: + - bytes + Age: + - '0' + Date: + - Fri, 11 Jul 2025 04:56:34 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-mel11256-MEL + X-Cache: + - HIT + X-Cache-Hits: + - '0' + X-Timer: + - S1752209794.092746,VS0,VE559 + X-Req-Url: + - recv="/icons/blank.gif",deliver="/icons/blank.gif" + body: + encoding: ASCII-8BIT + string: !binary |- + R0lGODlhFAAWAKEAAP///8z//wAAAAAAACH+TlRoaXMgYXJ0IGlzIGluIHRoZSBwdWJsaWMgZG9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tLCBTZXB0ZW1iZXIgMTk5NQAh+QQBAAABACwAAAAAFAAWAAACE4yPqcvtD6OctNqLs968+w+GSQEAOw== + recorded_at: Fri, 11 Jul 2025 04:56:34 GMT +- request: + method: get + uri: https://deb.debian.org/icons/back.gif + body: + encoding: UTF-8 + string: '' + headers: + Connection: + - close + Sec-Ch-Ua-Platform: + - '"Linux"' + User-Agent: + - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/138.0.0.0 + Safari/537.36 + Sec-Ch-Ua: + - '"Not)A;Brand";v="8", "Chromium";v="138"' + Sec-Ch-Ua-Mobile: + - "?0" + Accept: + - image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8 + Sec-Fetch-Site: + - same-origin + Sec-Fetch-Mode: + - no-cors + Sec-Fetch-Dest: + - image + Accept-Encoding: + - '' + Accept-Language: + - en-US,en;q=0.9 + response: + status: + code: 200 + message: OK + headers: + Connection: + - close + Content-Length: + - '216' + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - sameorigin + Referrer-Policy: + - no-referrer + X-Xss-Protection: + - '1' + Permissions-Policy: + - interest-cohort=() + Last-Modified: + - Sat, 20 Nov 2004 20:16:24 GMT + Etag: + - '"d8-3e9564c23b600"' + X-Clacks-Overhead: + - GNU Terry Pratchett + Content-Type: + - image/gif + Backend: + - 4qpvL1tJyeV1P6Tmf0Lj8g--F_static_backend + Accept-Ranges: + - bytes + Age: + - '0' + Date: + - Fri, 11 Jul 2025 04:56:34 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-mel11253-MEL + X-Cache: + - HIT + X-Cache-Hits: + - '0' + X-Timer: + - S1752209794.092777,VS0,VE544 + X-Req-Url: + - recv="/icons/back.gif",deliver="/icons/back.gif" + body: + encoding: ASCII-8BIT + string: !binary |- + R0lGODlhFAAWAMIAAP///8z//5mZmWZmZjMzMwAAAAAAAAAAACH+TlRoaXMgYXJ0IGlzIGluIHRoZSBwdWJsaWMgZG9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tLCBTZXB0ZW1iZXIgMTk5NQAh+QQBAAABACwAAAAAFAAWAAADSxi63P4jEPJqEDNTu6LO3PVpnDdOFnaCkHQGBTcqRRxuWG0v+5LrNUZQ8QPqeMakkaZsFihOpyDajMCoOoJAGNVWkt7QVfzokc+LBAA7 + recorded_at: Fri, 11 Jul 2025 04:56:34 GMT +- request: + method: get + uri: https://deb.debian.org/icons/hand.right.gif + body: + encoding: UTF-8 + string: '' + headers: + Connection: + - close + Sec-Ch-Ua-Platform: + - '"Linux"' + User-Agent: + - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/138.0.0.0 + Safari/537.36 + Sec-Ch-Ua: + - '"Not)A;Brand";v="8", "Chromium";v="138"' + Sec-Ch-Ua-Mobile: + - "?0" + Accept: + - image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8 + Sec-Fetch-Site: + - same-origin + Sec-Fetch-Mode: + - no-cors + Sec-Fetch-Dest: + - image + Accept-Encoding: + - '' + Accept-Language: + - en-US,en;q=0.9 + response: + status: + code: 200 + message: OK + headers: + Connection: + - close + Content-Length: + - '217' + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - sameorigin + Referrer-Policy: + - no-referrer + X-Xss-Protection: + - '1' + Permissions-Policy: + - interest-cohort=() + Last-Modified: + - Sat, 20 Nov 2004 20:16:24 GMT + Etag: + - '"d9-3e9564c23b600"' + X-Clacks-Overhead: + - GNU Terry Pratchett + Content-Type: + - image/gif + Backend: + - 4qpvL1tJyeV1P6Tmf0Lj8g--F_static_backend + Accept-Ranges: + - bytes + Age: + - '0' + Date: + - Fri, 11 Jul 2025 04:56:34 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-mel11263-MEL + X-Cache: + - HIT + X-Cache-Hits: + - '0' + X-Timer: + - S1752209794.137505,VS0,VE543 + X-Req-Url: + - recv="/icons/hand.right.gif",deliver="/icons/hand.right.gif" + body: + encoding: ASCII-8BIT + string: !binary |- + R0lGODlhFAAWAMIAAP/////Mmcz//5lmMwAAAAAAAAAAAAAAACH+TlRoaXMgYXJ0IGlzIGluIHRoZSBwdWJsaWMgZG9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tLCBTZXB0ZW1iZXIgMTk5NQAh+QQBAAACACwAAAAAFAAWAAADTCi63P4wykkdubiSwDuRVydi5CWEYjBsKbe2rDjMdMwRw1iaaZx7jcDm8nOpVsFjsSh0CFuq46fxko0eKOtsiu0UuRHfVlOqmM9oSgIAOw== + recorded_at: Fri, 11 Jul 2025 04:56:34 GMT +- request: + method: get + uri: https://deb.debian.org/icons/text.gif + body: + encoding: UTF-8 + string: '' + headers: + Connection: + - close + Sec-Ch-Ua-Platform: + - '"Linux"' + User-Agent: + - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/138.0.0.0 + Safari/537.36 + Sec-Ch-Ua: + - '"Not)A;Brand";v="8", "Chromium";v="138"' + Sec-Ch-Ua-Mobile: + - "?0" + Accept: + - image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8 + Sec-Fetch-Site: + - same-origin + Sec-Fetch-Mode: + - no-cors + Sec-Fetch-Dest: + - image + Accept-Encoding: + - '' + Accept-Language: + - en-US,en;q=0.9 + response: + status: + code: 200 + message: OK + headers: + Connection: + - close + Content-Length: + - '229' + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - sameorigin + Referrer-Policy: + - no-referrer + X-Xss-Protection: + - '1' + Permissions-Policy: + - interest-cohort=() + Last-Modified: + - Sat, 20 Nov 2004 20:16:24 GMT + Etag: + - '"e5-3e9564c23b600"' + X-Clacks-Overhead: + - GNU Terry Pratchett + Content-Type: + - image/gif + Backend: + - 4qpvL1tJyeV1P6Tmf0Lj8g--F_static_backend + Accept-Ranges: + - bytes + Age: + - '0' + Date: + - Fri, 11 Jul 2025 04:56:34 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-mel11266-MEL + X-Cache: + - HIT + X-Cache-Hits: + - '0' + X-Timer: + - S1752209794.137616,VS0,VE546 + X-Req-Url: + - recv="/icons/text.gif",deliver="/icons/text.gif" + body: + encoding: ASCII-8BIT + string: !binary |- + R0lGODlhFAAWAMIAAP///8z//5mZmTMzMwAAAAAAAAAAAAAAACH+TlRoaXMgYXJ0IGlzIGluIHRoZSBwdWJsaWMgZG9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tLCBTZXB0ZW1iZXIgMTk5NQAh+QQBAAABACwAAAAAFAAWAAADWDi6vPEwDECrnSO+aTvPEddVIriN1wVxROtSxBDPJwq7bo23luALhJqt8gtKbrsXBSgcEo2spBLAPDp7UKT02bxWRdrp94rtbpdZMrrr/A5+8LhPFpHajQkAOw== + recorded_at: Fri, 11 Jul 2025 04:56:34 GMT +- request: + method: get + uri: https://deb.debian.org/icons/unknown.gif + body: + encoding: UTF-8 + string: '' + headers: + Connection: + - close + Sec-Ch-Ua-Platform: + - '"Linux"' + User-Agent: + - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/138.0.0.0 + Safari/537.36 + Sec-Ch-Ua: + - '"Not)A;Brand";v="8", "Chromium";v="138"' + Sec-Ch-Ua-Mobile: + - "?0" + Accept: + - image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8 + Sec-Fetch-Site: + - same-origin + Sec-Fetch-Mode: + - no-cors + Sec-Fetch-Dest: + - image + Accept-Encoding: + - '' + Accept-Language: + - en-US,en;q=0.9 + response: + status: + code: 200 + message: OK + headers: + Connection: + - close + Content-Length: + - '245' + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - sameorigin + Referrer-Policy: + - no-referrer + X-Xss-Protection: + - '1' + Permissions-Policy: + - interest-cohort=() + Last-Modified: + - Sat, 20 Nov 2004 20:16:24 GMT + Etag: + - '"f5-3e9564c23b600"' + X-Clacks-Overhead: + - GNU Terry Pratchett + Content-Type: + - image/gif + Backend: + - 4qpvL1tJyeV1P6Tmf0Lj8g--F_static_backend + Accept-Ranges: + - bytes + Age: + - '0' + Date: + - Fri, 11 Jul 2025 04:56:34 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-mel11261-MEL + X-Cache: + - HIT + X-Cache-Hits: + - '0' + X-Timer: + - S1752209794.137743,VS0,VE554 + X-Req-Url: + - recv="/icons/unknown.gif",deliver="/icons/unknown.gif" + body: + encoding: ASCII-8BIT + string: !binary |- + R0lGODlhFAAWAMIAAP///8z//5mZmTMzMwAAAAAAAAAAAAAAACH+TlRoaXMgYXJ0IGlzIGluIHRoZSBwdWJsaWMgZG9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tLCBTZXB0ZW1iZXIgMTk5NQAh+QQBAAABACwAAAAAFAAWAAADaDi6vPEwDECrnSO+aTvPEQcIAmGaIrhR5XmKgMq1LkoMN7ECrjDWp52r0iPpJJ0KjUAq7SxLE+sI+9V8vycFiM0iLb2O80s8JcfVJJTaGYrZYPNby5Ov6WolPD+XDJqAgSQ4EUCGQQEJADs= + recorded_at: Fri, 11 Jul 2025 04:56:34 GMT +- request: + method: get + uri: https://deb.debian.org/icons/folder.gif + body: + encoding: UTF-8 + string: '' + headers: + Connection: + - close + Sec-Ch-Ua-Platform: + - '"Linux"' + User-Agent: + - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/138.0.0.0 + Safari/537.36 + Sec-Ch-Ua: + - '"Not)A;Brand";v="8", "Chromium";v="138"' + Sec-Ch-Ua-Mobile: + - "?0" + Accept: + - image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8 + Sec-Fetch-Site: + - same-origin + Sec-Fetch-Mode: + - no-cors + Sec-Fetch-Dest: + - image + Accept-Encoding: + - '' + Accept-Language: + - en-US,en;q=0.9 + response: + status: + code: 200 + message: OK + headers: + Connection: + - close + Content-Length: + - '225' + Server: + - Apache + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - sameorigin + Referrer-Policy: + - no-referrer + X-Xss-Protection: + - '1' + Permissions-Policy: + - interest-cohort=() + Last-Modified: + - Sat, 20 Nov 2004 20:16:24 GMT + Etag: + - '"e1-3e9564c23b600"' + X-Clacks-Overhead: + - GNU Terry Pratchett + Content-Type: + - image/gif + Backend: + - 4qpvL1tJyeV1P6Tmf0Lj8g--F_static_backend + Accept-Ranges: + - bytes + Age: + - '0' + Date: + - Fri, 11 Jul 2025 04:56:35 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-mel11253-MEL + X-Cache: + - HIT + X-Cache-Hits: + - '0' + X-Timer: + - S1752209795.922267,VS0,VE545 + X-Req-Url: + - recv="/icons/folder.gif",deliver="/icons/folder.gif" + body: + encoding: ASCII-8BIT + string: !binary |- + R0lGODlhFAAWAMIAAP/////Mmcz//5lmMzMzMwAAAAAAAAAAACH+TlRoaXMgYXJ0IGlzIGluIHRoZSBwdWJsaWMgZG9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tLCBTZXB0ZW1iZXIgMTk5NQAh+QQBAAACACwAAAAAFAAWAAADVCi63P4wyklZufjOErrvRcR9ZKYpxUB6aokGQyzHKxyO9RoTV54PPJyPBewNSUXhcWc8soJOIjTaSVJhVphWxd3CeILUbDwmgMPmtHrNIyxM8Iw7AQA7 + recorded_at: Fri, 11 Jul 2025 04:56:35 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/system/billy_spec.rb b/spec/system/billy_spec.rb new file mode 100644 index 0000000000..251e827af8 --- /dev/null +++ b/spec/system/billy_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require 'system_helper' + +RSpec.describe "Testing external scripts loaded in the browser" do + it "loads a website", :vcr do + visit "http://deb.debian.org:80/debian/" + expect(page).to have_content "Debian Archive" + end + + it "handles HTTPS", :vcr do + visit "https://deb.debian.org:443/debian/" + expect(page).to have_content "Debian Archive" + end + + it "stubs content" do + stub_request(:get, "https://deb.debian.org:443").to_return(body: "stubbed") + visit "https://deb.debian.org:443" + expect(page).to have_content "stubbed" + end +end diff --git a/spec/system/support/cuprite_setup.rb b/spec/system/support/cuprite_setup.rb index 431d4d546d..6d44e72ba3 100644 --- a/spec/system/support/cuprite_setup.rb +++ b/spec/system/support/cuprite_setup.rb @@ -4,7 +4,9 @@ require "capybara/cuprite" headless = ActiveModel::Type::Boolean.new.cast(ENV.fetch("HEADLESS", true)) -browser_options = {} +browser_options = { + "ignore-certificate-errors" => nil, +} browser_options["no-sandbox"] = nil if ENV['CI'] || ENV['DOCKER'] Capybara.register_driver(:cuprite_ofn) do |app| @@ -15,10 +17,16 @@ Capybara.register_driver(:cuprite_ofn) do |app| process_timeout: 60, timeout: 60, # Don't load scripts from external sources, like google maps or stripe - url_whitelist: [%r{http://localhost}i, %r{http://0.0.0.0}i, %r{http://127.0.0.1}], + url_whitelist: [ + %r{^http://localhost}, %r{^http://0.0.0.0}, %r{http://127.0.0.1}, + + # Just for testing external connections: spec/system/billy_spec.rb + %r{^https?://deb.debian.org}, + ], inspector: true, headless:, - js_errors: true + js_errors: true, + proxy: { host: Billy.proxy.host, port: Billy.proxy.port }, ) end