Skip to content

Commit 2b1e75a

Browse files
Add function to install chrome-for-testing
Signed-off-by: Evgeniy Dikevich <evgeny.dikevich@innowise.com>
1 parent af34bda commit 2b1e75a

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

earthly/flutter/Earthfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ flutter-base:
5656

5757
WORKDIR frontend
5858

59-
DO installer+INSTALL_CHROME_LINUX64 --version=141.0.7390.122
59+
# DO installer+INSTALL_CHROME_LINUX64 --version=141.0.7390.122
60+
DO installer+INSTALL_CHROME_FOR_TESTING --version=141.0.7390.122
6061
DO installer+INSTALL_FIREFOX_LINUX64 --version=115.15.0esr-1
6162
DO installer+INSTALL_EDGE_LINUX64 --version=125.0.2535.51
6263

63-
# test-flutter-base : installs required tools and packages for flutter development.
64+
# test-flutter-base: installs required tools and packages for flutter development.
6465
test-flutter-base:
6566
BUILD +flutter-base
6667

@@ -144,7 +145,6 @@ PUBLISH_DRY_RUN:
144145
RUN dart pub publish --dry-run
145146
END
146147

147-
148148
# Runs unit tests.
149149
UNIT_TESTS:
150150
FUNCTION

earthly/flutter/installer/Earthfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,39 @@ INSTALL_CHROMIUM:
137137
&& rm -rf /opt/${PACKAGE_TYPE}.zip
138138
END
139139

140+
# based on https://github.com/GoogleChromeLabs/chrome-for-testing/issues/55#issuecomment-2369600641
141+
INSTALL_CHROME_FOR_TESTING:
142+
FUNCTION
143+
144+
ARG --required version
145+
ARG TARGETARCH
146+
LET BLUE ='\033[0;34m'
147+
148+
IF [ "$TARGETARCH" = "amd64" ]
149+
RUN printf "${BLUE} Installing Chrome-for-testing..." \
150+
&& curl -sSL -o /opt/chrome.zip "${BASE_URL}/chrome-for-testing/${version}/chrome-linux64.zip" \
151+
&& unzip /opt/chrome.zip -d /opt/chrome \
152+
&& mv /opt/chrome/chrome-linux64/* /opt/chrome \
153+
&& rm -rf /opt/chrome/chrome-linux64 \
154+
&& while read pkg; do apt-get satisfy -y --no-install-recommends "${pkg}"; done < /opt/chrome/deb.deps \
155+
&& ln -s /opt/chrome/chrome /usr/local/bin/google-chrome \
156+
&& rm -f /opt/chrome.zip
157+
RUN google-chrome --version
158+
159+
RUN printf "${BLUE} Installing Chromedriver..." \
160+
&& curl -sSL -o /opt/chromedriver.zip "${BASE_URL}/chrome-for-testing/${version}/chromedriver-linux64.zip" \
161+
&& unzip -j /opt/chromedriver.zip -d /usr/local/bin/ \
162+
&& rm -rf /opt/chromedriver.zip
163+
RUN chromedriver --version
164+
ELSE
165+
DO +INSTALL_CHROMIUM --version=$version --PACKAGE_TYPE="chromium" --DOWNLOAD_URL="${BASE_URL}/chromium/${version}/chromium_${TARGETARCH}.zip"
166+
RUN chromium --version
167+
DO +PATCH_CHROME --BIN_TO_PATCH="chromium"
168+
169+
DO +INSTALL_CHROMIUM --version=$version --PACKAGE_TYPE="chromium-driver" --DOWNLOAD_URL="${BASE_URL}/chromium/${version}/chromium-driver-${TARGETARCH}.zip"
170+
RUN chromedriver --version
171+
END
172+
140173
PATCH_CHROME:
141174
FUNCTION
142175
ARG --required BIN_TO_PATCH

0 commit comments

Comments
 (0)