mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-01-05 15:12:11 +00:00
cc02b87de7
It contains a weird mix of stuff and hides valuable files from view at the root of the repo. Better to have: - Docs at the root - Rest of the github/release-related hodgepodge (screenshots, scripts) in hidden folder .github
62 lines
1.8 KiB
Bash
Executable File
62 lines
1.8 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
|
|
|
|
|
|
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
nativefier_dir="$script_dir/.."
|
|
pushd "$nativefier_dir"
|
|
|
|
printf "\n***** Creating test dirs & resources *****\n"
|
|
tmp_dir=$(mktemp -d -t nativefier-manual-test-XXXXX)
|
|
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"
|
|
|
|
printf "\n***** Building test app *****\n"
|
|
node ./lib/cli.js 'https://npmjs.com/' \
|
|
--inject "$injected_css" \
|
|
--inject "$injected_js" \
|
|
--name "app" \
|
|
"$tmp_dir"
|
|
|
|
printf "\n***** Test checklist *****
|
|
- Injected js: should show an alert saying hello
|
|
- Injected css: should make npmjs all blue
|
|
- Internal links open internally
|
|
- External links open in browser
|
|
- Keyboard shortcuts: {back, forward, zoom in/out/zero} work
|
|
- Console: no Electron runtime deprecation warnings/error logged
|
|
"
|
|
|
|
printf "\n***** Running app *****\n"
|
|
if [ "$(uname -s)" = "Darwin" ]; then
|
|
open -a "$tmp_dir/app-darwin-x64/app.app"
|
|
else
|
|
"$tmp_dir/app-linux-x64/app"
|
|
fi
|
|
|
|
printf "\nDid everything work as expected? [yN] "
|
|
read -r response
|
|
if [ "$response" != 'y' ]; then
|
|
echo "Back to fixing"
|
|
exit 1
|
|
else
|
|
echo "Yayyyyyyyyyyy"
|
|
fi
|
|
|
|
if [ -n "$tmp_dir" ]; then
|
|
printf "\n***** Deleting test dir %s *****\n" "$tmp_dir"
|
|
rm -rf "$tmp_dir"
|
|
fi
|