2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-11-12 08:06:27 +00:00
nativefier/.github/manual-test
Johan von Forstner 79009e87cd
Add getDisplayMedia and PipeWire support (#1477)
I'm picking up @RickStanley's abandoned PR #1321 again to add
screensharing support (fixes #927), with the following additional
changes:

- In newer Electron versions, `desktopCapturer.getSources` must be
called from the main process, so I solved this with an IPC call.
- Importing from `./helpers/helpers` in 'preload.ts' does not work, as
was mentioned by @DimICE in
https://github.com/nativefier/nativefier/pull/1321#issuecomment-1001518035.
I'm not very familiar with TypeScript or Electron, so not sure why that
is and how it could be solved - for now I just copied the referenced
`isWayland` function to `preload.ts`.
- Add a screensharing test to the manual test script, as requested by
@ronjouch in
https://github.com/nativefier/nativefier/pull/1321#issuecomment-1006725818

As far as I understood from the discussion in #1321, the last point was
basically the only thing that was missing to get this merged, correct?

---------

Co-authored-by: Rick Stanley <rick-stanley@outlook.com>
Co-authored-by: Rick Stanley <rick.stanley@lambda3.com.br>
Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2023-03-23 11:50:19 -04:00

124 lines
3.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Manual test to validate some hard-to-programmatically-test features work.
set -eo pipefail
missingDeps=false
if ! command -v mktemp > /dev/null; then echo "Missing mktemp"; missingDeps=true; fi
if ! command -v uname > /dev/null; then echo "Missing uname"; missingDeps=true; fi
if ! command -v node > /dev/null; then echo "Missing node"; missingDeps=true; fi
if [ "$missingDeps" = true ]; then exit 1; fi
function launch_app() {
printf '\n*** Running app\n'
if [ "$(uname -s)" = "Darwin" ]; then
open -a "$1/$2-darwin-x64/$2.app"
elif [ "$(uname -o)" = "Msys" ]; then
"$1/$2-win32-x64/$2.exe"
else
"$1/$2-linux-x64/$2"
fi
}
function do_cleanup() {
if [ -n "$1" ]; then
printf '\n***** Deleting test dir %s *****\n' "$1"
rm -rf "$1"
printf '\n'
fi
}
function request_feedback() {
printf '\nDid everything work as expected? [yN] '
read -r response
do_cleanup "$1"
if [ "$response" != 'y' ]; then
echo "Back to fixing"
exit 1
fi
echo "Yayyyyyyyyyyy"
}
printf "\n***** SMOKE TEST 1: Setting up test and building app... *****\n"
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
nativefier_dir="$script_dir/.."
pushd "$nativefier_dir"
tmp_dir=$(mktemp -d -t nativefier-manual-test-XXXXX)
name="nativefier-smoke-test-1"
resources_dir="$tmp_dir/resources"
mkdir "$resources_dir"
injected_css="$resources_dir/inject.css"
injected_js="$resources_dir/inject.js"
echo '* { background-color: blue; }' > "$injected_css"
echo 'alert("hello world from inject");' > "$injected_js"
node ./lib/cli.js 'https://npmjs.com/' \
--inject "$injected_css" \
--inject "$injected_js" \
--name "$name" \
"$tmp_dir"
printf '\n***** SMOKE TEST 1: Test checklist *****
- Context menu -> Open Link In New Window works
- MAC ONLY: Context menu -> Open Link In New Tab works
- Keyboard shortcuts: {back, forward, zoom in/out/zero} work
- Console: no Electron runtime deprecation warnings/error logged'
launch_app "$tmp_dir" "$name"
request_feedback "$tmp_dir"
# ------------------------------------------------------------------------------
printf '\n***** SMOKE TEST 2: Setting up test and building app... *****\n'
tmp_dir=$(mktemp -d -t nativefier-manual-test-tray-XXXXX)
name='nativefier-smoke-test-2'
node ./lib/cli.js 'https://google.com/' \
--name "$name" \
--tray \
"$tmp_dir"
printf '\n***** SMOKE TEST 2: Test checklist *****
- Should have an app with a tray icon
- Console: no Electron runtime deprecation warnings/error logged'
launch_app "$tmp_dir" "$name"
request_feedback "$tmp_dir"
# ------------------------------------------------------------------------------
printf '\n***** SMOKE TEST 3: Setting up test and building app... *****\n'
tmp_dir=$(mktemp -d -t nativefier-manual-test-start-in-tray-XXXXX)
name='nativefier-smoke-test-3'
node ./lib/cli.js 'https://google.com/' \
--name "$name" \
--tray start-in-tray \
"$tmp_dir"
printf '\n***** SMOKE TEST 3: Test checklist *****
- Should have an app that does not show a window initially,
but will have a tray icon that will show the window.
- Console: no Electron runtime deprecation warnings/error logged'
launch_app "$tmp_dir" "$name"
request_feedback "$tmp_dir"
# ------------------------------------------------------------------------------
printf '\n***** SMOKE TEST 4: Setting up test and building app... *****\n'
tmp_dir=$(mktemp -d -t nativefier-manual-test-start-in-tray-XXXXX)
name='nativefier-smoke-test-4'
node ./lib/cli.js 'https://meet.jit.si/nativefier-test' \
--name "$name" \
"$tmp_dir"
printf '\n***** SMOKE TEST 4: Test checklist *****
- Join the Jitsi meeting and try to share your screen
(third button from the left in the bottom bar)
- An overlay should appear where you can select a screen/window to share
- After selecting a screen, a thumbnail of the shared screen should appear on
the top right
- Console: no Electron runtime deprecation warnings/error logged'
launch_app "$tmp_dir" "$name"
request_feedback "$tmp_dir"