grafana/e2e/run-suite
Alexa V 9ea1042329
Dashboard: POC to run existing e2e with dashboardScene feature toggle (#84598)
* Standarize e2e for addDashbaord e2e flow

* WIP: Duplicate e2e dashboard flows and smoke test for scene e2e tests

* Fix autoformatting mistake for bash file

* Enable dashboardScene using local storage and only for the scene folder

* Add missing folders

* Set the feature toggle in the before of all tests

* Revert "Standarize e2e for addDashbaord e2e flow"

This reverts commit 6b9ea9d5a4.

* Add missing e2e selectors to NavToolbarActions, and modify addDashboard scene flow

* e2e: panels_smokescreen.spec.ts migrated

* e2e smokeTestSceneario migrated

* Start migrating dashbaord-suite e2e

* WIP create variable types

* adjust tests for scenes

* restore dashboard json file

* update scenes version

* restore pkg/build/wire/internal/wire/testdata modifications

* finalising test adjusments

* restore pkg/build/wire/internal/wire/testdata files

* add latest scenes version and update tests

* add drone setup for dashboard scenes tests

* update to latest scenes version

* adjust drone errors

* adjust indentation in drone yml file

* drone adjustments

* add github workflow to run scenes e2e

* restore drone file

* adjust github workflow

* wip: github workflow adjustments

* test remove gpu

* bump

* undo formating changes

* wip: github workflow debugging

* adjusting flaky tests

* update to latest scenes

* clean up workflow file

* adjust flaky test

* clean up pr

* finalise worflow logic and add to codeowners

* clean up launching old arch dashboards e2e separately

---------

Co-authored-by: Sergej-Vlasov <sergej.s.vlasov@gmail.com>
Co-authored-by: Jeff Levin <jeff@levinology.com>
2024-05-01 17:56:48 +03:00

129 lines
3.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -xeo pipefail
. scripts/grafana-server/variables
if ((BASH_VERSINFO[0] < 4)); then
echo "Bash ver >= 4 is needed to run this script"
echo "Please upgrade your bash - run 'brew install bash' if you use Homebrew on MacOS"
exit 1;
fi
HOST=${HOST:-$DEFAULT_HOST}
PORT=${PORT:-$DEFAULT_PORT}
echo -e "Starting Cypress scenarios"
args=("$@")
CMD="cypress run --browser=chrome"
PARAMS=""
CLEANUP=""
declare -A env=(
[BASE_URL]=${BASE_URL:-"http://$HOST:$PORT"}
[SLOWMO]=0
)
testFilesForSingleSuite="*.spec.ts"
rootForEnterpriseSuite="./e2e/extensions-suite"
rootForScenesSuite="./e2e/scenes"
declare -A cypressConfig=(
[screenshotsFolder]=./e2e/"${args[0]}"/screenshots
[fixturesFolder]=./e2e/cypress/fixtures
[videosFolder]=./e2e/"${args[0]}"/videos
[downloadsFolder]=./e2e/cypress/downloads
[fileServerFolder]=./e2e/cypress
[specPattern]=./e2e/*-suite/*spec.ts
[defaultCommandTimeout]=30000
[viewportWidth]=1920
[viewportHeight]=1080
[trashAssetsBeforeRuns]=false
[reporter]=./e2e/log-reporter.js
[baseUrl]=${BASE_URL:-"http://$HOST:$PORT"}
)
case "$1" in
"debug")
echo -e "Debug mode"
env[SLOWMO]=1
PARAMS="--no-exit"
;;
"dev")
echo "Dev mode"
CMD="cypress open"
;;
"benchmark")
echo "Benchmark"
PARAMS="--headed --no-runner-ui"
env[BENCHMARK_PLUGIN_ENABLED]=true
env[BENCHMARK_PLUGIN_RESULTS_FOLDER]=./e2e/benchmarks/"${args[1]}"/results
cypressConfig[video]=false
cypressConfig[screenshotsFolder]=./e2e/benchmarks/"${args[1]}"/screenshots
cypressConfig[specPattern]=./e2e/benchmarks/"${args[1]}"/$testFilesForSingleSuite
;;
"enterprise")
echo "Enterprise"
CLEANUP="rm -rf ./e2e/extensions-suite"
SETUP="cp -Lr ./e2e/extensions ./e2e/extensions-suite"
enterpriseSuite=$(basename "${args[1]}")
case "$2" in
"debug")
echo -e "Debug mode"
env[SLOWMO]=1
PARAMS="--no-exit"
enterpriseSuite=$(basename "${args[2]}")
;;
"dev")
echo "Dev mode"
CMD="cypress open"
enterpriseSuite=$(basename "${args[2]}")
;;
esac
cypressConfig[specPattern]=$rootForEnterpriseSuite/$enterpriseSuite/*-suite/*.spec.ts
$CLEANUP && $SETUP
;;
"")
;;
"scenes")
env[SCENES]=true
cypressConfig[specPattern]=$rootForScenesSuite/*/$testFilesForSingleSuite
cypressConfig[video]=false
# CMD="cypress open"
;;
*)
cypressConfig[specPattern]=./e2e/"${args[0]}"/$testFilesForSingleSuite
cypressConfig[video]=${args[1]}
;;
esac
function join () {
local -n map=$1
local delimiter=","
local res=""
for key in "${!map[@]}"
do
value=${map[$key]}
if [ -z "${res}" ]; then
res=$key=$value
else
res=$res$delimiter$key=$value
fi
done
echo "$res"
}
export TZ="Pacific/Honolulu"
yarn run $CMD --env "$(join env)" \
--config "$(join cypressConfig)" \
$PARAMS
$CLEANUP