mirror of
https://github.com/hanzoai/team.git
synced 2026-11-01 07:55:31 +00:00
* Switch Cypress to use shared ESLint config * Run --fix in Cypress * Manually fix remaining lint issues in Cypress * Switch Playwright to use shared ESLint config * Run --fix in Playwright * Manually fix remaining lint issues in Playwright * Install and cache web app deps during Cypress CI builds This also caches the types and client package. That isn't needed currently since it uses prepackaged versions of those, but I imagine we might change that at some point. * Run e2e-tests-check when ESLint plugin is updated * Change E2E test GHA caching to cache all of web app node_modules * Fix mismatch between cache save and restore * Try bumping cache keys * Copy step to install dependencies to server.run_cypress.sh I don't know how this must've worked before, but if this fixes the issue, it seems like neither Cypress nor Playwright actually use the cached depenendencies. * Try disabling caching entirely for Cypress tests * Try bypassing makefile? * Try also manually building dependencies in run_specs.sh I don't know why this appears to duplicate run_cypress.sh and run_playwright.sh, both of which are called run_test.sh which might not be used any more as best I can tell. * Try installing the web app dependencies in yet another place * Disable the extra steps in server.prepare.sh specifically for Cypress * Revert changes to update cache key and disable web app depenedency cache on Cypress builds
63 lines
2.4 KiB
Bash
Executable File
63 lines
2.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# shellcheck disable=SC2038
|
|
set -e -u -o pipefail
|
|
cd "$(dirname "$0")"
|
|
. .e2erc
|
|
|
|
# Print run information
|
|
mme2e_log "Printing Cypress container informations"
|
|
${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress node -p 'module.paths'
|
|
${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress bash <<"EOF"
|
|
cat <<INNEREOF
|
|
node version: $(node -v)
|
|
npm version: $(npm -v)
|
|
debian version: $(cat /etc/debian_version)
|
|
user: $(whoami)
|
|
chrome: $(google-chrome --version || true)
|
|
firefox: $(firefox --version || true)
|
|
INNEREOF
|
|
EOF
|
|
|
|
mme2e_log "Prepare Cypress: install dependencies"
|
|
${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress bash <<EOF
|
|
cd webapp/
|
|
npm install --cache /tmp/empty-cache
|
|
cd ../e2e-tests/cypress
|
|
npm install --cache /tmp/empty-cache
|
|
EOF
|
|
|
|
# Initialize cypress report directory
|
|
mme2e_log "Prepare Cypress: clean and initialize report and logs directory"
|
|
${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress bash <<EOF
|
|
rm -rf logs results
|
|
mkdir -p logs
|
|
mkdir -p results/junit
|
|
touch results/junit/empty.xml
|
|
echo '<?xml version="1.0" encoding="UTF-8"?>' > results/junit/empty.xml
|
|
EOF
|
|
|
|
# Run cypress test
|
|
# No need to collect its exit status: if it's nonzero, this script will terminate since we use '-e'
|
|
LOGFILE_SUFFIX="${CI_BASE_URL//\//_}" # Remove slashes from CI_BASE_URL to produce a usable filename
|
|
# shellcheck disable=SC2016
|
|
if ${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress bash -c '[ -n "${AUTOMATION_DASHBOARD_URL}" ]'; then
|
|
mme2e_log "AUTOMATION_DASHBOARD_URL is set. Using run_test_cycle.js for the cypress run"
|
|
${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress node run_test_cycle.js | tee "../cypress/logs/${LOGFILE_SUFFIX}_cypress.log"
|
|
else
|
|
mme2e_log "AUTOMATION_DASHBOARD_URL is unset. Using run_tests.js for the cypress run"
|
|
# shellcheck disable=SC2086
|
|
${MME2E_DC_SERVER} exec -T -u "$MME2E_UID" -- cypress node run_tests.js $TEST_FILTER | tee "../cypress/logs/${LOGFILE_SUFFIX}_cypress.log"
|
|
fi
|
|
|
|
# Collect run results
|
|
cat >../cypress/results/summary.json <<EOF
|
|
{
|
|
"passed": $(find ../cypress/results/mochawesome-report/json/tests/ -name '*.json' | xargs -l jq -r '.stats.passes' | jq -s add),
|
|
"failed": $(find ../cypress/results/mochawesome-report/json/tests/ -name '*.json' | xargs -l jq -r '.stats.failures' | jq -s add),
|
|
"failed_expected": 0
|
|
}
|
|
EOF
|
|
|
|
# Collect server logs
|
|
${MME2E_DC_SERVER} logs --no-log-prefix -- server >"../cypress/logs/${LOGFILE_SUFFIX}_mattermost.log" 2>&1
|