Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to skip Cypress dashboard E2E tests using a label or env var #13146

Merged
merged 11 commits into from
Jan 20, 2025
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ env:
TEST_BASE_URL: https://127.0.0.1/dashboard
API: https://127.0.0.1
TEST_PROJECT_ID: rancher-dashboard
TEST_DISABLE_DASHBOARD_LABEL: "${{ contains(github.event.pull_request.labels.*.name, 'ci/skip-e2e-dashboard')}}"
cnotv marked this conversation as resolved.
Show resolved Hide resolved
CYPRESS_API_URL: http://139.59.134.103:1234/
TEST_RUN_ID: ${{github.run_number}}-${{github.run_attempt}}-${{github.event.pull_request.title || github.event.head_commit.message}}
# Build the dashboard to use in tests. When set to false it will grab `latest` from CDN (useful for running e2e tests quickly)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"e2e:dev": "START_SERVER_AND_TEST_INSECURE=1 server-test start:dev https-get://localhost:8005 cy:run:sorry",
"e2e:build": "mkdir dist && TEST_INSTRUMENT=false ./scripts/build-e2e",
"e2e:docker": "yarn docker:local:stop && ./scripts/e2e-docker-start $RANCHER_VERSION_E2E",
"e2e:prod": "BUILD_DASHBOARD=$BUILD_DASHBOARD GREP_TAGS=$GREP_TAGS TEST_USERNAME=$TEST_USERNAME TEST_BASE_URL=https://127.0.0.1/dashboard yarn cy:run",
"e2e:prod": "BUILD_DASHBOARD=$BUILD_DASHBOARD GREP_TAGS=$GREP_TAGS TEST_USERNAME=$TEST_USERNAME TEST_BASE_URL=https://127.0.0.1/dashboard yarn cy:run:sorry",
"coverage": "npx nyc merge coverage coverage/coverage.json",
"storybook": "cd storybook && yarn storybook",
"build-storybook": "cd storybook && yarn install --no-lockfile && NODE_OPTIONS=--max_old_space_size=4096 yarn build-storybook --quiet",
Expand Down
15 changes: 14 additions & 1 deletion scripts/e2e
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,17 @@ if [ $# -eq 1 ]; then
SPEC_ARG="--spec ${1}"
fi

CYPRESS_coverage=true CYPRESS_API_URL='http://139.59.134.103:1234' cy2 run ${SPEC_ARG} --group "$GREP_TAGS" --browser chrome --record --key rancher-dashboard --parallel --ci-build-id "$ID"
# Define the command to use (cy2 or cypress)
richard-cox marked this conversation as resolved.
Show resolved Hide resolved
if [ "${TEST_DISABLE_DASHBOARD}" = "true" ] || [ "${TEST_DISABLE_DASHBOARD_LABEL}" = "true" ]; then
echo "Running Cypress without dashboard"
CYPRESS_COMMAND="cypress run ${SPEC_ARG}"
else
echo "Running Cypress with Sorry Cypress on dashboard"
CYPRESS_COMMAND="cy2 run ${SPEC_ARG} --ci-build-id \"$ID\" --record --key rancher-dashboard --parallel --group \"$GREP_TAGS\""
fi

# Construct the full command
E2E_COMMAND="CYPRESS_API_URL='http://139.59.134.103:1234' ${CYPRESS_COMMAND} --browser chrome"

# Execute the command
eval $E2E_COMMAND
Loading