murano-dashboard/functional_tests/collect_results.sh
zhurong 3ab9a10055 Add murano dashboard selenium functional test
Depends-On: I12cf2dbc62a25c1a56f7f0f7d54b7df412c2b397
Change-Id: I4b8f7e30c3d78c662bfcd44a5a46cfffc4dd2227
Implements: blueprint dashboard-selenium-tests-migrate-to-infra-ci
2018-01-22 13:05:31 +00:00

32 lines
1007 B
Bash
Executable File

DEST=${DEST:-/opt/stack/new}
DASHBOARD_DIR=$DEST/murano-dashboard
function create_artifacts_dir() {
dst="${WORKSPACE}/logs/artifacts"
mkdir -p "${dst}"
}
function collect_screenshots() {
# Copy screenshots for failed tests
if [[ -d "$DASHBOARD_DIR/muranodashboard/tests/functional/screenshots/" ]]; then
mkdir -p "${WORKSPACE}/logs/artifacts/screenshots"
cp -Rv $DASHBOARD_DIR/muranodashboard/tests/functional/screenshots/* "${WORKSPACE}/logs/artifacts/screenshots/"
fi
}
function generate_html_report() {
local xml_report="${WORKSPACE}/logs/test_report.xml"
local html_report="${WORKSPACE}/logs/test_report.html"
if [[ -f "${WORKSPACE}/logs/test_report.xml" ]]; then
$(which python) "$DASHBOARD_DIR/functional_tests/generate_html_report.py" "${xml_report}" "${html_report}"
cp "${html_report}" "${WORKSPACE}/index.html"
fi
}
function do_collect_results() {
create_artifacts_dir
collect_screenshots
generate_html_report
}