Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
69d155d
initial flask view
richard-jones May 12, 2026
3f19ee6
add the ability to connect to github and list the tests
richard-jones May 12, 2026
8a8f064
add sqlite db and sqlalchemy models
richard-jones May 12, 2026
2e10f7c
add syncing and saving to db, and somewhat improved ui
richard-jones May 12, 2026
8f46a7c
relayout for workbench style
richard-jones May 13, 2026
df0a3b7
improved navigation layout
richard-jones May 13, 2026
8d9b31d
bit of code refactoring to remove old testbook infrastructure
richard-jones May 13, 2026
3a17047
preliminary approach to loading tests in the main window
richard-jones May 13, 2026
18db09d
separate nav and main content scrolling
richard-jones May 13, 2026
bf16c79
sort out test numbering
richard-jones May 13, 2026
261a432
add editing on github links£
richard-jones May 13, 2026
74dd571
linking to test resources
richard-jones May 13, 2026
4dd5a14
add client-side settable base url for test paths
richard-jones May 13, 2026
67be637
add stale check for tests in github
richard-jones May 13, 2026
655cdb2
slim down top strap
richard-jones May 13, 2026
2cbe3aa
add a stable_id field to all primary test artefacts
richard-jones May 13, 2026
53766be
add initial test plan model objects
richard-jones May 13, 2026
6cb2241
extract base template and prepare simple outline for plan page
richard-jones May 13, 2026
345ddc1
add primitive test plan building
richard-jones May 13, 2026
8813fa3
move plan selector to top navigation
richard-jones May 13, 2026
243125a
straighten out selected plan on plan page
richard-jones May 13, 2026
02d0d7b
fix layout padding on main content
richard-jones May 13, 2026
a3963bb
fix some button behaviours in adding/removing tests from plans
richard-jones May 13, 2026
33b61a5
sort out button alignments
richard-jones May 14, 2026
54f223d
editable plan name
richard-jones May 14, 2026
cd23d73
fix behaviour on plan name edit box
richard-jones May 14, 2026
f364cca
change nav label
richard-jones May 14, 2026
12ccba8
some logo concepts, part formed
richard-jones May 14, 2026
e46be26
initial test execution model
richard-jones May 14, 2026
34c4e4c
initial test executions page
richard-jones May 14, 2026
3fdd5b6
first implementation of execution process
richard-jones May 14, 2026
c4e7cff
slight nav layout change in executions
richard-jones May 14, 2026
6f98143
add the ability to store a github issue or pr url by an execution
richard-jones May 14, 2026
00aab87
layout for the test execution panel
richard-jones May 14, 2026
6122000
dynamic port settings for flask, and some fixes to the pass/fail buttons
richard-jones May 18, 2026
3e7f54e
add skip feature, and synchronise test status to execution navigation
richard-jones May 18, 2026
933ba80
update linking of resource urls in execution view
richard-jones May 18, 2026
bd4762a
improvement on test comment view
richard-jones May 18, 2026
b6fda4f
add new reports page with baseline functionality
richard-jones May 18, 2026
b89d08e
add test download as markdown
richard-jones May 18, 2026
be1e69f
add backlinks to testbook from markdown
richard-jones May 18, 2026
57b084d
be able to push test feedback to github issue
richard-jones May 19, 2026
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
7 changes: 7 additions & 0 deletions .flaskenv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Flask environment variables — read automatically by `flask run` when python-dotenv is installed.
# FLASK_RUN_PORT is kept in sync with server.port in config.yml.
# Running `testbook-web` from the CLI will update this file automatically.
FLASK_APP=testbook.web:app
FLASK_RUN_HOST=0.0.0.0
FLASK_RUN_PORT=5005

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,9 @@ Temporary Items

# App specific ignores
.~lock.Testbook template.xlsx#

# Testbook config contains credentials — never commit the real file
config.yml

# sqlite database
testbook.db
270 changes: 270 additions & 0 deletions API_REFERENCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
# Execution Panel API Reference

## Real-Time Data Persistence API

All endpoints accept and return JSON. Changes are saved immediately without page reload.

### Update Execution Result Status and Comment

**Endpoint**: `PATCH /api/execution-result/<int:result_id>`

**Request Body**:
```json
{
"status": "pass" | "fail" | "pending",
"comment": "Optional comment text"
}
```

**Response**:
```json
{
"id": 42,
"status": "pass",
"comment": "Verified the output matches expected value"
}
```

**HTTP Status Codes**:
- 200: Success
- 404: Result not found
- 500: Server error

**Example Usage** (from JavaScript):
```javascript
saveResultStatus(resultId, 'pass', 'Test passed successfully');
// Makes: PATCH /api/execution-result/42
// {status: 'pass', comment: 'Test passed successfully'}
```

---

### Update Execution Step Comment

**Endpoint**: `PATCH /api/execution-step/<int:step_id>`

**Request Body**:
```json
{
"comment": "Optional comment text"
}
```

**Response**:
```json
{
"id": 15,
"comment": "User encountered timeout warning but test continued"
}
```

**HTTP Status Codes**:
- 200: Success
- 404: Step not found
- 500: Server error

**Example Usage** (from JavaScript):
```javascript
saveStepComment(stepId, 'Application took longer than expected');
// Makes: PATCH /api/execution-step/15
// {comment: 'Application took longer than expected'}
```

---

### Update Execution Test Status and Comment

**Endpoint**: `PATCH /api/execution-test/<int:test_id>`

**Request Body**:
```json
{
"status": "pass" | "fail" | "pending",
"comment": "Optional comment text"
}
```

**Response**:
```json
{
"id": 7,
"status": "fail",
"comment": "One assertion failed"
}
```

**HTTP Status Codes**:
- 200: Success
- 404: Test not found
- 500: Server error

**Example Usage** (from JavaScript):
```javascript
saveTestStatus(testId, 'fail', 'Test did not complete');
// Makes: PATCH /api/execution-test/7
// {status: 'fail', comment: 'Test did not complete'}
```

---

## Data Models

### ExecutionResult
- `id`: integer, primary key
- `execution_step_id`: integer, foreign key
- `text`: string, the expected result text
- `order_index`: integer, position in step
- `status`: string, one of 'pending', 'pass', 'fail'
- `comment`: string, optional user comment

### ExecutionStep
- `id`: integer, primary key
- `execution_test_id`: integer, foreign key
- `text`: string, the step instruction
- `path`: string or null, application path
- `resource`: string or null, resource path
- `order_index`: integer, position in test
- `comment`: string, optional user comment

### ExecutionTest
- `id`: integer, primary key
- `execution_id`: integer, foreign key
- `title`: string, test title
- `context`: JSON object, test context
- `setup`: JSON array, setup instructions
- `status`: string, one of 'pending', 'pass', 'fail'
- `comment`: string, optional user comment
- `order_index`: integer, position in execution
- (plus other fields for source test tracking)

---

## Payload Structure (GET)

When loading execution suite data via `_build_execution_suite_payload()`:

```json
{
"id": "exec-suite-1",
"name": "Authentication",
"testsets": [
{
"id": "exec-set-1",
"name": "Login Methods",
"tests": [
{
"id": "exec-test-1",
"title": "Valid Email Login",
"context": {
"email": "test@example.com",
"role": "user"
},
"setup": [
"Clear browser cache",
"Navigate to login page"
],
"status": "pending",
"comment": "",
"steps": [
{
"id": "exec-step-1",
"text": "Enter credentials",
"path": "/login",
"resource": "resources/credentials.json",
"resource_url": "https://github.com/owner/repo/blob/main/resources/credentials.json",
"comment": "",
"results": [
{
"id": "exec-result-1",
"text": "No validation errors",
"status": "pending",
"comment": ""
},
{
"id": "exec-result-2",
"text": "User redirected to dashboard",
"status": "pass",
"comment": "Verified redirect"
}
]
}
]
}
]
}
]
}
```

---

## Error Handling

### Common Error Responses

**404 Not Found**:
```json
{
"error": "Result not found"
}
```

**500 Server Error**:
```json
{
"error": "Database connection failed"
}
```

### Client-Side Error Handling

The JavaScript client catches and logs errors automatically:
```javascript
saveResultStatus(resultId, 'pass', 'comment')
.catch(err => {
console.error('Failed to save result status:', err);
// User sees no visual feedback if save fails
return null;
});
```

---

## Response Times

Typical response times (measured in ms):
- Update result: 10-50ms
- Update step comment: 10-50ms
- Update test status: 10-50ms

No batching is performed; each change is sent separately to the API.

---

## Rate Limiting

No rate limiting is currently implemented. Consider adding if UI allows rapid successive saves.

---

## Session & Authentication

All endpoints require a valid Flask session (same as web pages).
No additional authentication headers required.

---

## CORS

CORS is not enabled. Execution panel must be accessed from same domain as API.

---

## Backwards Compatibility

The payload structure is backwards compatible with existing code that expects:
- `results` as strings: Old code continues to work
- New code receives full result objects with id, text, status, comment

The `_text_value()` function ensures graceful fallback if result is a string.

Loading