Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions agent/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,39 @@ def assign(test_id):

click.echo(f"\n✅ TC '{test_id}' assigned to '{new_assignee}'!\n")

# Command: delete a test case
@cli.command()
@click.argument("test_id")
def delete_test(test_id):
"""Delete a test case from the database. Ex: python agent/cli.py delete-test TC-001"""
with open(TEST_CASES_PATH, "r") as f:
data = json.load(f)

test = next((tc for tc in data["test_cases"] if tc["id"] == test_id), None)

if test is None:
click.echo(f"\n❌ Test case '{test_id}' not found.\n")
return

click.echo(f"\n🗑️ You are about to delete the following test case:")
click.echo(f" {test['id']} | {test['title']} | {test['state']} | {test['assigned_to']}\n")

confirm = click.confirm(" Are you sure you want to delete this test case?", default=False)

if not confirm:
click.echo(f"\n❌ Deletion cancelled.\n")
return

data["test_cases"] = [tc for tc in data["test_cases"] if tc["id"] != test_id]

with open(TEST_CASES_PATH, "w") as f:
json.dump(data, f, indent=2, ensure_ascii=False)

log_event("test_deleted", test_id, f"Test case '{test['title']}' deleted")

click.echo(f"\n✅ Test case '{test_id}' successfully deleted!\n")


# Command: run a playwright test
@cli.command()
@click.argument("test_id")
Expand Down
6 changes: 6 additions & 0 deletions agent/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def test_cases_menu():
"✏️ Update Test Case",
"👤 Assign Test Case",
"🎭 Run Playwright Test",
"🗑️ Delete Test Case",
"📊 Stats",
"📤 Export Test Cases History",
"⬅️ Back"
Expand Down Expand Up @@ -96,6 +97,11 @@ def test_cases_menu():
else:
run_command(["run-test", test_id])
wait_for_menu()

elif choice == "🗑️ Delete Test Case":
test_id = questionary.text("Test Case ID (e.g. TC-001):").ask()
run_command(["delete-test", test_id])
wait_for_menu()

elif choice == "📊 Stats":
run_command(["stats"])
Expand Down
24 changes: 24 additions & 0 deletions knowledge_base/history.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,30 @@
"type": "test_run",
"test_id": "TC-001",
"details": "Playwright test ran — result: Passed"
},
{
"timestamp": "2026-08-11 09:57",
"type": "test_deleted",
"test_id": "TC-001",
"details": "Test case 'new title' deleted"
},
{
"timestamp": "2026-08-11 10:00",
"type": "test_created",
"test_id": "TC-001 log in",
"details": "Test case 'log in' created"
},
{
"timestamp": "2026-08-11 10:11",
"type": "test_created",
"test_id": "TC-001",
"details": "Test case 'Log in' created"
},
{
"timestamp": "2026-08-11 10:12",
"type": "test_deleted",
"test_id": "TC-001",
"details": "Test case 'Log in' deleted"
}
]
}
40 changes: 15 additions & 25 deletions knowledge_base/test_cases/test_cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"last_updated": "2026-06-30",
"test_cases": [
{
"id": "TC-001",
"id": "TC-002",
"work_item_type": "Test Case",
"title": "new title",
"area_path": "Login/logout",
"assigned_to": "Tester",
"state": "Passed",
"playwright_file": "tests/test_login.py::test_login_valid_credentials",
"title": "Login with invalid credentials",
"area_path": "Project/Login",
"assigned_to": "Diogo",
"state": "Active",
"playwright_file": "tests/test_login.py::test_login_invalid_credentials",
"steps": [
{
"step": 1,
Expand All @@ -18,39 +18,29 @@
},
{
"step": 2,
"action": "Enter valid email and password",
"expected": "Fields are filled correctly"
"action": "Enter invalid email and wrong password",
"expected": "Fields are filled"
},
{
"step": 3,
"action": "Click 'Login'",
"expected": "User is redirected to the dashboard"
"expected": "Error message is displayed"
}
]
},
{
"id": "TC-002",
"id": "TC-001 log in",
"work_item_type": "Test Case",
"title": "Login with invalid credentials",
"area_path": "Project/Login",
"title": "log in",
"area_path": "Log in",
"assigned_to": "Diogo",
"state": "Active",
"playwright_file": "tests/test_login.py::test_login_invalid_credentials",
"playwright_file": "",
"steps": [
{
"step": 1,
"action": "Open the login page",
"expected": "Login page is displayed"
},
{
"step": 2,
"action": "Enter invalid email and wrong password",
"expected": "Fields are filled"
},
{
"step": 3,
"action": "Click 'Login'",
"expected": "Error message is displayed"
"action": "Log in to account",
"expected": "it loggins"
}
]
}
Expand Down