Skip to content
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

Feature: warden vnc to connect with Selenium Debug VNC #116

Merged
merged 7 commits into from
Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

**Enhancements:**

* Added `warden vnc` command to launch VNC tunnel via SSH or (when installed) launch Remmina ([#116](https://github.com/davidalger/warden/pull/116) by @lbajsarowicz)
* Updated `warden env`, `warden svc` and `warden db` to print help text when called without any parameters specified

## Version [0.7.0](https://github.com/davidalger/warden/tree/0.7.0) (2020-07-22)
Expand Down
45 changes: 45 additions & 0 deletions commands/vnc.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
[[ ! ${WARDEN_DIR} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!\033[0m" && exit 1

WARDEN_ENV_PATH="$(locateEnvPath)" || exit $?
loadEnvConfig "${WARDEN_ENV_PATH}" || exit $?

if [[ ${WARDEN_SELENIUM} -ne 1 ]] || [[ ${WARDEN_SELENIUM_DEBUG} -ne 1 ]]; then
fatal "The project environment must have WARDEN_SELENIUM and WARDEN_SELENIUM_DEBUG enabled to use this command"
fi

WARDEN_SELENIUM_INDEX=${WARDEN_PARAMS[0]:-1}
WARDEN_SELENIUM_VNC=${WARDEN_ENV_NAME}_${WARDEN_PARAMS[1]:-selenium-chrome}_${WARDEN_SELENIUM_INDEX}

if ! which remmina >/dev/null; then
EXPOSE_PORT=$((5900 + WARDEN_SELENIUM_INDEX))

echo "Connect with your VNC client to 127.0.0.1:${EXPOSE_PORT}"
echo " Password: secret"
echo "You can also use URL: vnc://127.0.0.1:${EXPOSE_PORT}/?VncPassword=secret"
ssh -N -L localhost:${EXPOSE_PORT}:${WARDEN_SELENIUM_VNC}:5900 tunnel.warden.test
else

cat > "${WARDEN_ENV_PATH}/.remmina" <<-EOF
[remmina]
name=${WARDEN_SELENIUM_VNC} Debug
proxy=
ssh_enabled=1
colordepth=8
server=${WARDEN_SELENIUM_VNC}
ssh_auth=3
quality=9
scale=1
ssh_username=user
password=.
disablepasswordstoring=0
viewmode=1
window_width=1200
window_height=780
ssh_server=tunnel.warden.test:2222
protocol=VNC
EOF

echo -e "Launching VNC session via Remmina. Password is \"\033[1msecret\"\033[0m"
remmina -c "${WARDEN_ENV_PATH}/.remmina"
fi
11 changes: 11 additions & 0 deletions commands/vnc.help
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
[[ ! ${WARDEN_DIR} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!\033[0m" && exit 1

WARDEN_USAGE=$(cat <<EOF
\033[33mUsage:\033[0m
vnc [index]

\033[33mOptions:\033[0m
-h, --help Display this help menu
EOF
)