1515SHELL := /bin/bash
1616# WPTD_PATH will have a trailing slash, e.g. /home/user/wpt.fyi/
1717WPTD_PATH := $(dir $(abspath $(lastword $(MAKEFILE_LIST ) ) ) )
18- NODE_SELENIUM_PATH := $(WPTD_PATH ) webapp/node_modules/selenium-standalone/.selenium/
18+ GECKODRIVER_TAG := v0.36.0
19+ GECKODRIVER_PATH =/usr/bin/geckodriver
1920FIREFOX_PATH := /usr/bin/firefox
21+ CHROME_VERSION := 138.0.7204.94
22+ CHROME_INSTALL_DIR := /opt/chrome-for-testing
23+ # CFT_BINARY can also be 'chrome-headless-shell'
24+ CFT_BINARY := chrome
25+ CFT_FOLDER := $(CFT_BINARY ) -linux64
26+ CHROME_ACTUAL_PATH := $(CHROME_INSTALL_DIR ) /$(CFT_FOLDER ) /$(CFT_BINARY )
27+ # Needed because some tools are hardcoded to /usr/bin/google-chrome
2028CHROME_PATH := /usr/bin/google-chrome
2129CHROMEDRIVER_PATH =/usr/bin/chromedriver
2230USE_FRAME_BUFFER := true
@@ -118,11 +126,11 @@ webdriver_node_deps:
118126
119127# _go_webdriver_test is not intended to be used directly; use go_firefox_test or
120128# go_chrome_test instead.
121- _go_webdriver_test : var-BROWSER java go_build xvfb geckodriver dev_appserver_deps gcc
129+ _go_webdriver_test : var-BROWSER java go_build xvfb geckodriver chromedriver dev_appserver_deps gcc
122130 @ # This Go test manages Xvfb itself, so we don't start/stop Xvfb for it.
123131 @ # The following variables are defined here because we don't know the
124132 @ # path before installing geckodriver as it includes version strings.
125- GECKODRIVER_PATH=" $( shell find $( NODE_SELENIUM_PATH ) geckodriver/ -type f -name ' *geckodriver ' ) " ; \
133+ GECKODRIVER_PATH=$( GECKODRIVER_PATH ) \
126134 COMMAND=" go test $( VERBOSE) -timeout=15m -tags=large ./webdriver -args \
127135 -firefox_path=$(FIREFOX_PATH ) \
128136 -geckodriver_path=$$ GECKODRIVER_PATH \
@@ -139,18 +147,19 @@ web_components_test: xvfb firefox chrome webapp_node_modules_all psmisc
139147
140148dev_appserver_deps : gcloud-app-engine-go gcloud-cloud-datastore-emulator gcloud-beta java
141149
142- # Note: If we change to downloading chrome from Chrome For Testing, modify the
143- # `chromedriver` target below to use the `known-good-versions-with-downloads.json` endpoint.
144- # More details can be found in the comment for the `chromedriver` target.
145- # TODO: pinning Chrome to 130 due to https://github.com/web-platform-tests/wpt.fyi/issues/4129
146- chrome : wget
147- if [[ -z " $$ (which google-chrome)" ]]; then \
148- ARCHIVE=google-chrome-stable_130.0.6723.116-1_amd64.deb; \
149- wget -q https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/$$ {ARCHIVE}; \
150- sudo apt-get update; \
151- sudo dpkg --install $$ {ARCHIVE} 2> /dev/null || true ; \
152- sudo apt-get install --fix-broken --fix-missing -qqy; \
153- sudo dpkg --install $$ {ARCHIVE} 2> /dev/null; \
150+ chrome : wget unzip
151+ if [[ ! -f " $( CHROME_ACTUAL_PATH) " ]]; then \
152+ CHROME_CFT_URL=" https://storage.googleapis.com/chrome-for-testing-public/$( CHROME_VERSION) /linux64/$( CFT_FOLDER) .zip" ; \
153+ TEMP_DIR=$$(mktemp -d ) ; \
154+ wget -q -O $$ {TEMP_DIR}/$(CFT_FOLDER ) .zip $$ {CHROME_CFT_URL}; \
155+ unzip -q $$ {TEMP_DIR}/$(CFT_FOLDER ) .zip -d $$ {TEMP_DIR}; \
156+ sudo mkdir -p $(CHROME_INSTALL_DIR ) ; \
157+ sudo mv $$ {TEMP_DIR}/$(CFT_FOLDER ) $(CHROME_INSTALL_DIR ) /; \
158+ sudo apt update; \
159+ while read pkg ; do sudo apt-get satisfy -y --no-install-recommends " $$ {pkg}" ; done < $(CHROME_INSTALL_DIR ) /$(CFT_FOLDER ) /deb.deps; \
160+ sudo chmod +x $(CHROME_ACTUAL_PATH ) ; \
161+ sudo ln -sf $(CHROME_ACTUAL_PATH ) $(CHROME_PATH ) ; \
162+ rm -rf $$ {TEMP_DIR}; \
154163 fi
155164
156165# Pull ChromeDriver from Chrome For Testing (CfT)
@@ -159,10 +168,6 @@ chrome: wget
159168#
160169# CfT only has ChromeDriver URLs for chrome versions >=115. But assuming `chrome`
161170# target above remains pulling the latest stable, this will not be a problem.
162- #
163- # Until we also pull chrome from CfT, we should use the latest-patch-versions-per-build-with-downloads.json.
164- # When we make the switch, we can download from the known-good-versions-with-downloads.json endpoint too.
165- # More details: https://github.com/web-platform-tests/wpt.fyi/pull/3433/files#r1282787489
166171chromedriver : wget unzip chrome jq
167172 if [[ ! -f " $( CHROMEDRIVER_PATH) " ]]; then \
168173 CHROME_VERSION=$$(google-chrome --version | grep -ioE "[0-9]+\.[0-9]+\.[0-9]+" ) ; \
@@ -182,7 +187,16 @@ firefox: bzip2 wget
182187 sudo ln -s $$ HOME/browsers/firefox/firefox $(FIREFOX_PATH ) ; \
183188 fi
184189
185- geckodriver : node-wct-local
190+ geckodriver : wget unzip curl jq
191+ if [[ ! -f " $( GECKODRIVER_PATH) " ]]; then \
192+ GECKODRIVER_URL=" https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_TAG} /geckodriver-${GECKODRIVER_TAG} -linux64.tar.gz" ; \
193+ TEMP_DIR=$$(mktemp -d ) ; \
194+ wget -q -O $$ {TEMP_DIR}/geckodriver-linux64.tar.gz $$ {GECKODRIVER_URL}; \
195+ tar -xzf $$ {TEMP_DIR}/geckodriver-linux64.tar.gz -C $$ {TEMP_DIR}; \
196+ sudo mv $$ {TEMP_DIR}/geckodriver $(GECKODRIVER_PATH ) ; \
197+ sudo chmod +x $(GECKODRIVER_PATH ) ; \
198+ rm -rf $$ {TEMP_DIR}; \
199+ fi
186200
187201golangci-lint : curl gpg
188202 if [ " $$ (which golangci-lint)" == " " ]; then \
0 commit comments