Skip to content

Commit b08305f

Browse files
committed
Install Slack so we can run Electron tests in GHA
1 parent b04e885 commit b08305f

File tree

4 files changed

+28
-19
lines changed

4 files changed

+28
-19
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ jobs:
3131
run: |
3232
apt-get update
3333
apt-get install p7zip-full xterm
34-
cp test/chrome-docker-wrapper.sh /usr/local/bin/google-chrome
34+
35+
wget https://downloads.slack-edge.com/linux_releases/slack-desktop-4.12.2-amd64.deb
36+
apt install ./slack-desktop-4.12.2-amd64.deb
37+
38+
cp test/no-sandbox-docker-wrapper.sh /usr/local/bin/google-chrome
39+
cp test/no-sandbox-docker-wrapper.sh /usr/local/bin/slack
3540
3641
# Fix $HOME perms to make Firefox happy
3742
chown $(whoami) $HOME

test/chrome-docker-wrapper.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

test/interceptors/electron.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ const interceptorSetup = setupInterceptor('electron');
1111
// We use slack as a test app. Doesn't really matter what it is, but
1212
// slack is pretty common, easy to kill & restart, and fairly representative.
1313
const electronAppPath: string | undefined = [
14+
'/usr/local/bin/slack', // Wrapper, used in CI to inject --no-sandbox
1415
'/usr/bin/slack',
1516
'/Applications/Slack.app/Contents/MacOS/Slack',
1617
`${os.homedir()}\\AppData\\Local\\slack\\slack.exe`
1718
].find((path) => fs.existsSync(path));
1819

1920
describe('Electron interception', function () {
20-
this.timeout(5000000);
21+
this.timeout(5000);
2122

2223
beforeEach(async () => {
2324
const { server } = await interceptorSetup;

test/no-sandbox-docker-wrapper.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
trap : SIGTERM SIGINT
3+
4+
# We need to inject a --no-sandbox option, because inside Docker Chrome/Electron apps
5+
# can't start their sandbox, so without this it refuses to start at all.
6+
7+
# It's assumed that this is copied/linked into a file in /usr/local/bin to wrap a
8+
# binary with the same name (e.g. google-chrome) in /usr/bin:
9+
/usr/bin/$(basename $0) --no-sandbox "$@" &
10+
APP_PID=$!
11+
12+
wait $APP_PID
13+
14+
WAIT_EXIT_CODE=$?
15+
16+
# If this script gets killed, kill the app with the same signal
17+
if [[ WAIT_EXIT_CODE -gt 128 ]]
18+
then
19+
kill -$(($WAIT_EXIT_CODE - 128)) $APP_PID
20+
fi

0 commit comments

Comments
 (0)