chore(e2e): simplify Cypress record key usage (#29327)

This commit is contained in:
Evan Rusackas 2024-06-24 10:07:04 -06:00 committed by GitHub
parent fe3ba12801
commit 4fe04e63ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 10 deletions

View File

@ -63,9 +63,12 @@ github:
# combination here.
contexts:
- lint-check
- cypress-matrix (0, chrome)
- cypress-matrix (1, chrome)
- cypress-matrix (2, chrome)
- cypress-matrix (3, chrome)
- cypress-matrix (4, chrome)
- cypress-matrix (5, chrome)
- frontend-build
- pre-commit
- python-lint

View File

@ -130,12 +130,12 @@ jobs:
CYPRESS_BROWSER: ${{ matrix.browser }}
PARALLEL_ID: ${{ matrix.parallel_id }}
PARALLELISM: 6
CYPRESS_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
with:
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)
with:
name: screenshots
path: ${{ github.workspace }}/superset-frontend/cypress-base/cypress/screenshots
name: cypress-artifact-${{ github.run_id }}-${{ github.job }}

View File

@ -24,6 +24,7 @@ from datetime import datetime
XVFB_PRE_CMD = "xvfb-run --auto-servernum --server-args='-screen 0, 1024x768x24' "
REPO = os.getenv("GITHUB_REPOSITORY") or "apache/superset"
GITHUB_EVENT_NAME = os.getenv("GITHUB_REPOSITORY") or "push"
CYPRESS_RECORD_KEY = os.getenv("CYPRESS_RECORD_KEY") or ""
def compute_hash(file_path: str) -> str:
@ -55,13 +56,7 @@ def get_cypress_cmd(
if use_dashboard:
# Run using cypress.io service
cypress_key = os.getenv("CYPRESS_KEY")
command = f"echo {cypress_key} | base64 --decode"
cypress_record_key = (
subprocess.check_output(command, shell=True).decode("utf-8").strip()
)
os.environ["CYPRESS_RECORD_KEY"] = cypress_record_key
spec: str = "*/**/*"
spec: str = "cypress/e2e/*/**/*"
cmd = (
f"{XVFB_PRE_CMD} "
f'{cypress_cmd} --spec "{spec}" --browser {browser} '
@ -70,7 +65,7 @@ def get_cypress_cmd(
)
else:
# Run local, but split the execution
os.environ.pop("CYPRESS_KEY", None)
os.environ.pop("CYPRESS_RECORD_KEY", None)
spec_list_str = ",".join(sorted(spec_list))
if _filter:
spec_list_str = ",".join(sorted([s for s in spec_list if _filter in s]))