From dfb9af36df0e34814cb40dd88e21123056a87306 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Tue, 21 Jan 2025 12:06:19 -0800 Subject: [PATCH] chore: cypress set up tweaks (#31926) --- .github/workflows/superset-e2e.yml | 2 +- docker/docker-init.sh | 17 ++++++++++------- scripts/cypress_run.py | 2 +- .../cypress-base/cypress.config.ts | 12 ++++++++++-- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/.github/workflows/superset-e2e.yml b/.github/workflows/superset-e2e.yml index b5646e8f41704..cbf9728f2381d 100644 --- a/.github/workflows/superset-e2e.yml +++ b/.github/workflows/superset-e2e.yml @@ -138,7 +138,7 @@ jobs: run: cypress-run-all ${{ env.USE_DASHBOARD }} - name: Upload Artifacts uses: actions/upload-artifact@v4 - if: github.event_name == 'workflow_dispatch' && (steps.check.outputs.python || steps.check.outputs.frontend) + if: failure() with: path: ${{ github.workspace }}/superset-frontend/cypress-base/cypress/screenshots name: cypress-artifact-${{ github.run_id }}-${{ github.job }} diff --git a/docker/docker-init.sh b/docker/docker-init.sh index b513f52ededfb..f9bd09ed14d4d 100755 --- a/docker/docker-init.sh +++ b/docker/docker-init.sh @@ -50,12 +50,16 @@ echo_step "1" "Complete" "Applying DB migrations" # Create an admin user echo_step "2" "Starting" "Setting up admin user ( admin / $ADMIN_PASSWORD )" -superset fab create-admin \ - --username admin \ - --firstname Superset \ - --lastname Admin \ - --email admin@superset.com \ - --password "$ADMIN_PASSWORD" +if [ "$CYPRESS_CONFIG" == "true" ]; then + superset load_test_users +else + superset fab create-admin \ + --username admin \ + --email admin@superset.com \ + --password "$ADMIN_PASSWORD" \ + --firstname Superset \ + --lastname Admin +fi echo_step "2" "Complete" "Setting up admin user" # Create default roles and permissions echo_step "3" "Starting" "Setting up roles and perms" @@ -67,7 +71,6 @@ if [ "$SUPERSET_LOAD_EXAMPLES" = "yes" ]; then echo_step "4" "Starting" "Loading examples" # If Cypress run which consumes superset_test_config – load required data for tests if [ "$CYPRESS_CONFIG" == "true" ]; then - superset load_test_users superset load_examples --load-test-data else superset load_examples diff --git a/scripts/cypress_run.py b/scripts/cypress_run.py index 7c99788d0a704..7531aad8dafa3 100644 --- a/scripts/cypress_run.py +++ b/scripts/cypress_run.py @@ -20,7 +20,7 @@ import subprocess from datetime import datetime -XVFB_PRE_CMD = "xvfb-run --auto-servernum --server-args='-screen 0, 1024x768x24' " +XVFB_PRE_CMD = "xvfb-run --auto-servernum --server-args='-screen 0, 1280x1024x24' " REPO = os.getenv("GITHUB_REPOSITORY") or "apache/superset" GITHUB_EVENT_NAME = os.getenv("GITHUB_EVENT_NAME") or "push" CYPRESS_RECORD_KEY = os.getenv("CYPRESS_RECORD_KEY") or "" diff --git a/superset-frontend/cypress-base/cypress.config.ts b/superset-frontend/cypress-base/cypress.config.ts index 391856d874c4c..2eaed82cb0a75 100644 --- a/superset-frontend/cypress-base/cypress.config.ts +++ b/superset-frontend/cypress-base/cypress.config.ts @@ -26,7 +26,7 @@ export default eyesPlugin( defineConfig({ chromeWebSecurity: false, defaultCommandTimeout: 8000, - numTestsKeptInMemory: 5, + numTestsKeptInMemory: 3, // Disabled after realizing this MESSES UP rison encoding in intricate ways experimentalFetchPolyfill: false, experimentalMemoryManagement: true, @@ -58,7 +58,15 @@ export default eyesPlugin( }); launchOptions.args.push( - ...['--disable-dev-shm-usage', '--disable-gpu'], + '--disable-dev-shm-usage', + '--disable-gpu', + '--no-sandbox', + '--disable-software-rasterizer', + '--memory-pressure-off', + '--js-flags=--max-old-space-size=4096', + '--disable-background-timer-throttling', + '--disable-backgrounding-occluded-windows', + '--disable-renderer-backgrounding', ); } return launchOptions;