Skip to content

Commit

Permalink
fix: battling cypress' dashboard feature
Browse files Browse the repository at this point in the history
Following up on a series of PRs to try and fix cypress run, latest being this one #30430.

Here I'm working a bit in the dark since the logic on `master` in CI is slightly different from the logic in PRs.

On my latest try, I had an error related to a combination of retries in the context where the dashboard is used. Issue was around the group id's not being unique. Here I'm working around it by adding the attempt number to the group's id, which should fix it.

At this point I'm beyond annoyed with Cypress. Last try before I shut down using the dashboard feature (a paying service we don't really get much if any benefit from) at all.
  • Loading branch information
mistercrunch committed Sep 30, 2024
1 parent c7aeb21 commit acd1291
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions scripts/cypress_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,31 @@ def run_cypress_for_test_file(
browser = os.getenv("CYPRESS_BROWSER", "chrome")
chrome_flags = "--disable-dev-shm-usage"

# Create Cypress command for a single test file
if use_dashboard:
cmd = (
f"{XVFB_PRE_CMD} "
f'{cypress_cmd} --spec "{test_file}" --browser {browser} '
f"--record --group matrix{group}-file{i} --tag {REPO},{GITHUB_EVENT_NAME} "
f"--ci-build-id {build_id} "
f"-- {chrome_flags}"
)
else:
for attempt in range(retries):
# Create Cypress command for a single test file
os.environ.pop("CYPRESS_RECORD_KEY", None)
cmd = (
cmd: str = (
f"{XVFB_PRE_CMD} "
f"{cypress_cmd} --browser {browser} "
f'--spec "{test_file}" '
f"-- {chrome_flags}"
)

if dry_run:
# Print the command instead of executing it
print(f"DRY RUN: {cmd}")
return 0

for attempt in range(retries):
if use_dashboard:
# If/when we want to use cypress' dashboard feature to record the run
group_id = f"matrix{group}-file{i}-{attempt}"
cmd = (
f"{XVFB_PRE_CMD} "
f'{cypress_cmd} --spec "{test_file}" --browser {browser} '
f"--record --group {group_id} --tag {REPO},{GITHUB_EVENT_NAME} "
f"--ci-build-id {build_id} "
f"-- {chrome_flags}"
)
print(f"RUN: {cmd} (Attempt {attempt + 1}/{retries})")
if dry_run:
# Print the command instead of executing it
print(f"DRY RUN: {cmd}")
return 0

process = subprocess.Popen(
cmd,
shell=True,
Expand Down

0 comments on commit acd1291

Please sign in to comment.