Fix HLS automatic test (#2572)

* mv automated test cleanup to tools.sh

check media file exists before streaming in test/ocTestStream.sh
fix automatic test ffmpeg detection
mv trap to tools
mv update_storage_config() to tools
enable S3 test

* fix video file check in test/ocTestStream.sh

* cleanup ci

* mv auto test owncast build-run to start_owncast()

* suppress cleanup errors

* fix style

* fix Browser Test paths

* use pull_request event for Browser Tests

* explicitly mention when test is skipped

* refactor shell scripts
This commit is contained in:
Meisam
2023-01-12 05:11:13 +01:00
committed by GitHub
parent fcc3ed74e2
commit dd72879d09
8 changed files with 101 additions and 115 deletions

View File

@@ -5,7 +5,6 @@ set -o pipefail
source ../tools.sh
TEMP_DB=$(mktemp)
BUILD_ID=$((RANDOM % 7200 + 600))
BROWSER="electron" # Default. Will try to use Google Chrome.
@@ -16,61 +15,43 @@ else
echo "Google Chrome not found. Using Electron."
fi
# Change to the root directory of the repository
pushd "$(git rev-parse --show-toplevel)"
# Bundle the updated web code into the server codebase.
if [ -z "$SKIP_BUILD" ]; then
echo "Bundling web code into server..."
# Change to the root directory of the repository
pushd "$(git rev-parse --show-toplevel)"
./build/web/bundleWeb.sh >/dev/null
popd
else
echo "Skipping web build..."
fi
# Install the web test framework
if [ -z "$SKIP_BUILD" ]; then
echo "Installing test dependencies..."
pushd test/automated/browser
npm install --quiet --no-progress
popd
else
echo "Skipping dependencies installation"
fi
set -o nounset
ffmpegInstall
install_ffmpeg
# Build and run owncast from source
echo "Building owncast..."
go build -o owncast main.go
echo "Running owncast..."
./owncast -database "$TEMP_DB" &
SERVER_PID=$!
pushd test/automated/browser
start_owncast
# Run cypress browser tests for desktop
npx cypress run --browser "$BROWSER" --group "desktop-offline" --env tags=desktop --ci-build-id $BUILD_ID --tag "desktop,offline" --record --key e9c8b547-7a8f-452d-8c53-fd7531491e3b --spec "cypress/e2e/offline/*.cy.js"
# Run cypress browser tests for mobile
npx cypress run --browser "$BROWSER" --group "mobile-offline" --ci-build-id $BUILD_ID --tag "mobile,offline" --record --key e9c8b547-7a8f-452d-8c53-fd7531491e3b --spec "cypress/e2e/offline/*.cy.js" --config viewportWidth=375,viewportHeight=667
# Start streaming the test file over RTMP to
# the local owncast instance.
echo "Waiting for stream to start..."
../../ocTestStream.sh &
STREAMING_CLIENT=$!
function finish {
echo "Cleaning up..."
kill $SERVER_PID $STREAMING_CLIENT
rm -fr "$TEMP_DB" "$FFMPEG_PATH"
}
trap finish EXIT SIGHUP SIGINT SIGTERM SIGQUIT SIGABRT SIGTERM
sleep 20
start_stream
# Run cypress browser tests for desktop
npx cypress run --browser "$BROWSER" --group "desktop-online" --env tags=desktop --ci-build-id $BUILD_ID --tag "desktop,online" --record --key e9c8b547-7a8f-452d-8c53-fd7531491e3b --spec "cypress/e2e/online/*.cy.js"