-
-
Notifications
You must be signed in to change notification settings - Fork 4
E2e test fw lite #1866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
hahn-kev
wants to merge
33
commits into
develop
Choose a base branch
from
e2e-test-fw-lite
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
E2e test fw lite #1866
Changes from 25 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
d0088b8
e2e specs
hahn-kev 837732f
create e2e test directory
hahn-kev c2eb8bf
add a health check endpoint
hahn-kev 27d6186
implement fw lite launcher and tests
hahn-kev 46b33ed
setup test data managment
hahn-kev 9478006
setup server operations helper
hahn-kev 93c9aaf
ensure e2e test server is used for lexbox server
hahn-kev bcb0bef
set environment to development to allow oauth to work with self signe…
hahn-kev 8f0b38e
main integration tests
hahn-kev 0a3ac6a
rename config server to lexboxServer for clarity
hahn-kev fc01abe
put an id on the server div for testing
hahn-kev 28b2ab0
ensure we never redirect to the login page, instead redirect home
hahn-kev 2ff9146
fix integration tests so they work
hahn-kev 14871fb
get some more tests passing
hahn-kev 2d61419
cleanup unused stuff
hahn-kev ff70b5f
Merge branch 'develop' into e2e-test-fw-lite
hahn-kev 27afd18
move tests into snapshots folder, along with their playwright config
hahn-kev 4d5b458
split playwright tests into snapshot and e2e
hahn-kev 8349a74
rework the tests, add helper endpoint for deleting a project
hahn-kev 73e8527
ignore test results
hahn-kev 53fcfe5
update ci to run snapshot tests
hahn-kev b85e0a2
add e2e workflow job
hahn-kev 48734fc
cleanup a bunch of junk from the AI
hahn-kev 26213dd
pre test the fw lite launcher
hahn-kev 6cb67d6
Merge branch 'develop' into e2e-test-fw-lite
hahn-kev 049787d
correct pnpm script in taskfile
hahn-kev b4f3058
don't hardcode the binary path for the launcher tests
hahn-kev af03204
ensure the correct path for permissions
hahn-kev f83dca4
Merge branch 'develop' into e2e-test-fw-lite
hahn-kev 85fd9ff
Handle null checks in `Directory.SetCurrentDirectory` to avoid potent…
hahn-kev dacc37f
Improve shutdown handling for FW Lite on Windows and add stdin-trigge…
hahn-kev 29404de
Upload Playwright test results and traces on failure in FW Lite workflow
hahn-kev e1166d3
log server output in playwright test output folder
hahn-kev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,278 @@ | ||
# Design Document | ||
|
||
## Overview | ||
|
||
The FW Lite E2E Testing Framework provides automated end-to-end testing for FW Lite integration with LexBox. The system uses Playwright for UI automation and integrates with the existing GitHub Actions CI/CD pipeline to ensure critical workflows continue to function after code changes. | ||
|
||
The framework follows the existing testing patterns established in the project, extending the current Playwright setup in `frontend/viewer` to include full application testing scenarios that span the entire FW Lite to LexBox integration workflow. | ||
|
||
## Architecture | ||
|
||
### High-Level Architecture | ||
|
||
```mermaid | ||
graph TB | ||
A[GitHub Actions Trigger] --> B[FW Lite Build Workflow] | ||
B --> C[E2E Test Workflow] | ||
C --> D[Test Environment Setup] | ||
D --> E[FW Lite Application Launch] | ||
E --> F[Playwright Test Execution] | ||
F --> G[Test Results & Artifacts] | ||
|
||
subgraph "Test Environment" | ||
H[FW Lite Linux Binary] | ||
I[Test Server Configuration] | ||
J[Test Data Setup] | ||
end | ||
|
||
subgraph "Test Scenarios" | ||
K[Project Download Test] | ||
L[Entry Creation Test] | ||
M[Data Persistence Test] | ||
N[Media File Test] | ||
O[Live Sync Test] | ||
end | ||
|
||
D --> H | ||
D --> I | ||
D --> J | ||
F --> K | ||
F --> L | ||
F --> M | ||
F --> N | ||
F --> O | ||
``` | ||
|
||
### Workflow Integration | ||
|
||
The E2E tests integrate with the existing CI/CD pipeline by: | ||
|
||
1. **Triggering after successful FW Lite builds** - Uses the `needs` dependency in GitHub Actions | ||
2. **Consuming build artifacts** - Downloads the Linux FW Lite binary from the previous workflow | ||
3. **Configurable server targeting** - Can run against different environments (local, staging, production) | ||
4. **Artifact preservation** - Uploads test results, screenshots, and logs for debugging | ||
|
||
### Test Environment Architecture | ||
|
||
```mermaid | ||
graph LR | ||
A[GitHub Runner] --> B[FW Lite Binary] | ||
A --> C[Playwright Browser] | ||
B --> D[LexBox Server] | ||
C --> B | ||
D --> E[Test Projects] | ||
D --> F[Test Users] | ||
``` | ||
|
||
## Components and Interfaces | ||
|
||
### 1. GitHub Actions Workflow (`fw-lite-e2e-tests.yaml`) | ||
|
||
**Purpose**: Orchestrates the E2E testing process | ||
**Location**: `.github/workflows/fw-lite-e2e-tests.yaml` | ||
|
||
**Key Features**: | ||
- Triggers after successful `publish-linux` job in fw-lite workflow | ||
- Downloads FW Lite Linux artifacts | ||
- Sets up test environment with configurable server endpoints | ||
- Executes Playwright tests | ||
- Uploads test results and failure artifacts | ||
|
||
**Configuration Interface**: | ||
```yaml | ||
env: | ||
TEST_SERVER_HOSTNAME: ${{ vars.TEST_SERVER_HOSTNAME || 'localhost:5137' }} | ||
TEST_PROJECT_CODE: 'sena-3' | ||
TEST_DEFAULT_PASSWORD: ${{ secrets.TEST_USER_PASSWORD || 'pass' }} | ||
FW_LITE_BINARY_PATH: './fw-lite-linux/linux-x64/FwLiteWeb' | ||
``` | ||
|
||
### 2. Playwright Test Suite | ||
|
||
**Purpose**: Implements the actual E2E test scenarios | ||
**Location**: `frontend/viewer/tests/e2e/` | ||
|
||
**Test Structure**: | ||
``` | ||
frontend/viewer/tests/e2e/ | ||
├── fw-lite-integration.test.ts # Main integration test | ||
├── helpers/ | ||
│ ├── fw-lite-launcher.ts # FW Lite application management | ||
│ ├── project-operations.ts # Project download/management helpers | ||
│ └── test-data.ts # Test data constants and utilities | ||
└── fixtures/ | ||
└── test-projects.json # Expected test project configurations | ||
``` | ||
|
||
### 3. FW Lite Application Manager | ||
|
||
**Purpose**: Manages FW Lite application lifecycle during tests | ||
**Location**: `frontend/viewer/tests/e2e/helpers/fw-lite-launcher.ts` | ||
|
||
**Interface**: | ||
```typescript | ||
interface FwLiteManager { | ||
launch(config: LaunchConfig): Promise<void> | ||
shutdown(): Promise<void> | ||
isRunning(): boolean | ||
getBaseUrl(): string | ||
} | ||
|
||
interface LaunchConfig { | ||
binaryPath: string | ||
serverUrl: string | ||
port?: number | ||
timeout?: number | ||
} | ||
``` | ||
|
||
### 4. Test Data Management | ||
|
||
**Purpose**: Provides consistent test data and expectations | ||
**Location**: `frontend/viewer/tests/e2e/helpers/test-data.ts` | ||
|
||
**Interface**: | ||
```typescript | ||
interface TestProject { | ||
code: string | ||
name: string | ||
expectedEntries: number | ||
testUser: string | ||
} | ||
|
||
interface TestEntry { | ||
lexeme: string | ||
definition: string | ||
partOfSpeech: string | ||
uniqueIdentifier: string | ||
} | ||
``` | ||
|
||
## Data Models | ||
|
||
### Test Configuration Model | ||
|
||
```typescript | ||
interface E2ETestConfig { | ||
server: { | ||
hostname: string | ||
protocol: 'http' | 'https' | ||
port?: number | ||
} | ||
fwLite: { | ||
binaryPath: string | ||
launchTimeout: number | ||
shutdownTimeout: number | ||
} | ||
testData: { | ||
projectCode: string | ||
testUser: string | ||
testPassword: string | ||
} | ||
timeouts: { | ||
projectDownload: number | ||
entryCreation: number | ||
dataSync: number | ||
} | ||
} | ||
``` | ||
|
||
### Test Result Model | ||
|
||
```typescript | ||
interface TestResult { | ||
testName: string | ||
status: 'passed' | 'failed' | 'skipped' | ||
duration: number | ||
error?: string | ||
screenshots: string[] | ||
logs: string[] | ||
} | ||
``` | ||
|
||
## Error Handling | ||
|
||
### Application Launch Failures | ||
|
||
- **Timeout handling**: If FW Lite fails to start within the configured timeout, the test fails with clear error messaging | ||
- **Port conflicts**: Automatic port detection and retry logic | ||
- **Binary validation**: Pre-flight checks to ensure the FW Lite binary exists and is executable | ||
|
||
### Network and Server Issues | ||
|
||
- **Connection retries**: Implement exponential backoff for server connection attempts | ||
- **Server availability checks**: Validate server endpoints before starting tests | ||
- **Graceful degradation**: Skip tests that require unavailable services with clear reporting | ||
|
||
### Test Data Issues | ||
|
||
- **Project availability**: Verify expected test projects exist before running tests | ||
- **User authentication**: Handle authentication failures with clear error messages | ||
- **Data conflicts**: Implement cleanup strategies for test data conflicts | ||
|
||
### Playwright-Specific Error Handling | ||
|
||
```typescript | ||
// Example error handling pattern | ||
try { | ||
await page.waitForSelector('[data-testid="project-list"]', { timeout: 30000 }) | ||
} catch (error) { | ||
await page.screenshot({ path: 'failure-project-list.png' }) | ||
throw new Error(`Project list failed to load: ${error.message}`) | ||
} | ||
``` | ||
|
||
## Testing Strategy | ||
|
||
### Test Categories | ||
|
||
1. **Smoke Tests**: Basic application launch and connectivity | ||
2. **Integration Tests**: Full workflow scenarios (download → modify → sync) | ||
3. **Data Persistence Tests**: Verify data survives application restarts | ||
4. **Media File Tests**: Ensure media files are properly handled | ||
5. **Live Sync Tests**: Verify real-time synchronization functionality | ||
|
||
### Test Data Strategy | ||
|
||
- **Predictable test projects**: Use known projects like 'sena-3' with expected data | ||
- **Unique test identifiers**: Generate unique identifiers for test entries to avoid conflicts | ||
- **Cleanup procedures**: Implement cleanup for test data after test completion | ||
- **Isolation**: Ensure tests don't interfere with each other | ||
|
||
### Parallel Execution Strategy | ||
|
||
- **Sequential execution**: Run E2E tests sequentially to avoid resource conflicts | ||
- **Test isolation**: Each test scenario operates on separate data sets | ||
- **Resource management**: Proper cleanup between test scenarios | ||
|
||
### Retry and Flaky Test Handling | ||
|
||
```typescript | ||
// Retry configuration for flaky operations | ||
const retryConfig = { | ||
projectDownload: { attempts: 3, delay: 5000 }, | ||
entryCreation: { attempts: 2, delay: 2000 }, | ||
dataSync: { attempts: 3, delay: 3000 } | ||
} | ||
``` | ||
|
||
### Test Environment Matrix | ||
|
||
The tests will be designed to run against multiple environments: | ||
|
||
- **Local Development**: `localhost:5137` | ||
- **Staging Environment**: Configured via environment variables | ||
- **Production Environment**: Limited test scenarios for critical path validation | ||
|
||
### Performance Considerations | ||
|
||
- **Test execution time**: Target total execution time under 15 minutes | ||
- **Resource usage**: Monitor memory and CPU usage during test execution | ||
- **Artifact size management**: Compress and limit screenshot/video artifacts | ||
|
||
### Reporting and Observability | ||
|
||
- **Test result aggregation**: Comprehensive test reports with pass/fail statistics | ||
- **Failure analysis**: Detailed logs and screenshots for failed tests | ||
- **Trend analysis**: Track test execution times and failure patterns over time | ||
- **Integration with existing reporting**: Leverage existing GitHub Actions test reporting |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.