Create dedicated test Splitwise group to avoid polluting production data

Resolved 💬 3 comments Opened Oct 15, 2025 by vishnujayvel Closed Jan 11, 2026

Issue Description

Currently, E2E tests that interact with Splitwise API would use the user's primary/production Splitwise group, which can pollute real expense data with test entries.

Problem

User Quote:

"I also want to create a separate task for creating a test split voice group that we can actually validate and test instead of using the primary group because you know I'm doing this mainly for my own personal need and my husband's service has been getting a lot of spam items."

Current Behavior

Tests use whatever group ID is configured in the extension, which is typically the user's primary group. Running tests creates real expenses in production group.

Impact

  1. Data Pollution: Test expenses appear alongside real expenses
  2. Notification Spam: Group members receive notifications for test expenses
  3. Confusion: Hard to distinguish test data from real data
  4. Cleanup Required: Manual deletion of test expenses after each test run

Proposed Solution

Step 1: Create Dedicated Test Group

  1. Create a new Splitwise group (via web UI or API)
  2. Name it clearly: "SplitSage Test Group [DO NOT USE]"
  3. Add only test accounts (no real users)
  4. Document group ID for test configuration

Step 2: Configure Tests to Use Test Group

# tests/v2/conftest.py or test_config.json
TEST_CONFIG = {
    "gemini_api_key": os.getenv("TEST_GEMINI_API_KEY"),
    "splitwise_api_key": os.getenv("TEST_SPLITWISE_API_KEY"),
    "test_group_id": os.getenv("TEST_SPLITWISE_GROUP_ID"),  # Dedicated test group
    "production_group_id": os.getenv("SPLITWISE_GROUP_ID")  # Never used in tests
}

Step 3: Add Test Cleanup

Optionally, add teardown to clean up test expenses:

@pytest.fixture(autouse=True)
def cleanup_test_expenses(browser_context):
    """Clean up test expenses after each test"""
    yield
    
    # After test completes, delete any expenses created
    # (Could track expense IDs during test and delete them)

Step 4: Add Safety Checks

Prevent accidental production usage:

def validate_test_group(group_id):
    """Ensure we're not using production group in tests"""
    PRODUCTION_GROUP_IDS = [
        # List of known production group IDs to block
    ]
    
    if group_id in PRODUCTION_GROUP_IDS:
        raise ValueError(f"Cannot use production group {group_id} in tests!")

Implementation Checklist

  • [ ] Create new Splitwise group via web UI
  • [ ] Name: "SplitSage Test Group [DO NOT USE]"
  • [ ] Add only test user accounts
  • [ ] Document group ID
  • [ ] Update test configuration to use test group
  • [ ] Add TEST_SPLITWISE_GROUP_ID env var
  • [ ] Update conftest.py fixture
  • [ ] Update test files to use test group
  • [ ] Add safety checks to prevent production usage
  • [ ] Validate group ID is not production
  • [ ] Add clear error messages
  • [ ] Document test group setup in README
  • [ ] How to create test group
  • [ ] How to configure group ID
  • [ ] How to verify tests use correct group
  • [ ] (Optional) Add test cleanup automation
  • [ ] Track created expense IDs
  • [ ] Delete after test completion

Benefits

  • No production pollution: Test data stays separate
  • No spam notifications: Real users aren't bothered
  • Clear separation: Easy to identify test vs real data
  • Safer testing: Can test destructive operations without fear
  • Repeatable: Can run tests multiple times without cleanup

Alternative Approaches

Option 1: Mock Splitwise API (Ideal for CI/CD)

  • Create mock server that mimics Splitwise API
  • No real API calls during tests
  • Faster and more reliable
  • Requires initial setup effort

Option 2: Splitwise Sandbox Environment

  • Check if Splitwise offers a test/sandbox API
  • Would be ideal but may not be available

Option 3: Current Approach with Manual Cleanup

  • Continue using production group
  • Manually delete test expenses after each run
  • Not ideal but simplest short-term

Recommendation

Create dedicated test group (Option from description) is recommended because:

  • ✅ Simple to implement (just create a group)
  • ✅ No code changes required initially
  • ✅ Immediate improvement to testing safety
  • ✅ Can add automation later

Related Issues

  • #9554 - Test Framework: E2E tests require hardcoded API keys

Priority

Medium-High - Actively affecting user's production data quality and causing notification spam to group members.

Next Steps

  1. User creates test Splitwise group
  2. Configure TEST_SPLITWISE_GROUP_ID environment variable
  3. Update tests to use test group ID
  4. Validate tests no longer touch production group
  5. (Optional) Add automated cleanup

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗