-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
#36 try to get a chrome and firefox e2e test running #99
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster | ||
ARG VARIANT=16-bullseye | ||
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT} | ||
|
||
# [Optional] Uncomment this section to install additional OS packages. | ||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
# && apt-get -y install --no-install-recommends <your-package-list-here> | ||
|
||
###################### Firefox | ||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive && apt-get install --no-install-recommends -y firefox-esr | ||
###################### | ||
|
||
###################### Chrome | ||
RUN useradd apps | ||
RUN mkdir -p /home/apps && chown apps:apps /home/apps | ||
# Install xvfb. | ||
RUN apt-get install -y xvfb | ||
# Install wget. | ||
RUN apt-get install -y wget | ||
# Install wmctrl. | ||
RUN apt-get install -y wmctrl | ||
# Set the Chrome repo. | ||
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ | ||
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list | ||
# Install Chrome. | ||
RUN apt-get update && apt-get -y install google-chrome-stable | ||
|
||
COPY bootstrap.sh / | ||
|
||
CMD '/bootstrap.sh' | ||
|
||
#################### | ||
|
||
# [Optional] Uncomment if you want to install an additional version of node using nvm | ||
# ARG EXTRA_NODE_VERSION=10 | ||
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" | ||
|
||
# [Optional] Uncomment if you want to install more global node packages | ||
# RUN su node -c "npm install -g <your-package-list -here>" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster | ||
ARG VARIANT=16-bullseye | ||
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT} | ||
|
||
# Install tslint, typescript. eslint is installed by javascript image | ||
ARG NODE_MODULES="tslint-to-eslint-config typescript" | ||
COPY library-scripts/meta.env /usr/local/etc/vscode-dev-containers | ||
RUN su node -c "umask 0002 && npm install -g ${NODE_MODULES}" \ | ||
&& npm cache clean --force > /dev/null 2>&1 | ||
|
||
# [Optional] Uncomment this section to install additional OS packages. | ||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
# && apt-get -y install --no-install-recommends <your-package-list-here> | ||
|
||
# [Optional] Uncomment if you want to install an additional version of node using nvm | ||
# ARG EXTRA_NODE_VERSION=10 | ||
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
|
||
# Based on: http://www.richud.com/wiki/Ubuntu_Fluxbox_GUI_with_x11vnc_and_Xvfb | ||
|
||
readonly G_LOG_I='[INFO]' | ||
readonly G_LOG_W='[WARN]' | ||
readonly G_LOG_E='[ERROR]' | ||
|
||
main() { | ||
launch_xvfb | ||
launch_window_manager | ||
} | ||
|
||
launch_xvfb() { | ||
# Set defaults if the user did not specify envs. | ||
export DISPLAY=${XVFB_DISPLAY:-:1} | ||
local screen=${XVFB_SCREEN:-0} | ||
local resolution=${XVFB_RESOLUTION:-1280x1024x24} | ||
local timeout=${XVFB_TIMEOUT:-5} | ||
|
||
# Start and wait for either Xvfb to be fully up or we hit the timeout. | ||
Xvfb ${DISPLAY} -screen ${screen} ${resolution} & | ||
local loopCount=0 | ||
until xdpyinfo -display ${DISPLAY} > /dev/null 2>&1 | ||
do | ||
loopCount=$((loopCount+1)) | ||
sleep 1 | ||
if [ ${loopCount} -gt ${timeout} ] | ||
then | ||
echo "${G_LOG_E} xvfb failed to start." | ||
exit 1 | ||
fi | ||
done | ||
} | ||
|
||
launch_window_manager() { | ||
local timeout=${XVFB_TIMEOUT:-5} | ||
|
||
# Start and wait for either fluxbox to be fully up or we hit the timeout. | ||
fluxbox & | ||
local loopCount=0 | ||
until wmctrl -m > /dev/null 2>&1 | ||
do | ||
loopCount=$((loopCount+1)) | ||
sleep 1 | ||
if [ ${loopCount} -gt ${timeout} ] | ||
then | ||
echo "${G_LOG_E} fluxbox failed to start." | ||
exit 1 | ||
fi | ||
done | ||
} | ||
|
||
control_c() { | ||
echo "" | ||
exit | ||
} | ||
|
||
trap control_c SIGINT SIGTERM SIGHUP | ||
|
||
main | ||
|
||
exit |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/containers/typescript-node | ||
{ | ||
"name": "Node.js & TypeScript", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
// Update 'VARIANT' to pick a Node version: 18, 16, 14. | ||
// Append -bullseye or -buster to pin to an OS version. | ||
// Use -bullseye variants on local on arm64/Apple Silicon. | ||
"args": { | ||
"VARIANT": "16-bullseye" | ||
} | ||
}, | ||
|
||
"features": { | ||
"desktop-lite": { | ||
"password": "vscode", | ||
"webPort": "6080", | ||
"vncPort": "5901" | ||
} | ||
}, | ||
"runArgs": ["--shm-size=2g"], | ||
|
||
// Configure tool-specific properties. | ||
"customizations": { | ||
// Configure properties specific to VS Code. | ||
"vscode": { | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"k--kato.intellij-idea-keybindings", | ||
"dbaeumer.vscode-eslint", | ||
"svelte.svelte-vscode" | ||
] | ||
} | ||
}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
"forwardPorts": [6080,5901], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "yarn install", | ||
|
||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
"remoteUser": "node" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,8 +31,10 @@ export default defineConfig({ | |
disableAutoLaunch: process.env.BROWSER === 'none', | ||
browser: process.env.BROWSER === 'firefox' ? 'firefox' : 'chrome', | ||
webExtConfig: { | ||
startUrl: 'https://www.youtube.com/watch?v=5qap5aO4i9A' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. poor lofi girl, her old stream was DMCA taken down. I've replaced it with the current stream, if that's OK. |
||
} | ||
startUrl: 'https://www.youtube.com/watch?v=jfKfPfyJRdk', | ||
args: process.env.BROWSER === 'firefox' ? [''] : ['--no-sandbox', '--autoplay-policy=no-user-gesture-required'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. chrome won't start under docker unless you use the The autoplay-policy option is really only there to let the video start without user interaction. It's not necessary. |
||
}, | ||
verbose: true | ||
}), | ||
svelte({ | ||
configFile: path.resolve(__dirname, 'svelte.config.js'), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after starting up the devcontainer, visit
http://localhost:6080
and see a web-based VNC client. Use the passwordvscode
and connect and see a working desktop environment.Then in the commandline or terminal, run the normal
yarn start
to get the browser loaded with the extension.