Skip to content

Commit 337069e

Browse files
committed
Add E2E tests with workflow execution support
Implements comprehensive E2E testing framework for foundry-sample-functions-python with workflow execution capabilities. Features: - Workflow execution via Fusion SOAR UI - Navigation through hamburger menu to workflows - Execute workflows with optional input parameters - Verify workflow execution completion - Support for workflows requiring inputs (host-details) - Separate rendering vs execution (ServiceNow workflow) Test Coverage: - ✅ Test hello function workflow - Executed successfully - ✅ Test log-event function workflow - Executed successfully - ✅ Test servicenow function workflow - Render only (dummy credentials) - ⏭️ Hello UI extension - Skipped (tab structure needs investigation) - ⏭️ Test host-details function - Skipped (host ID implementation needed) New Components: - WorkflowsPage: Full workflow execution methods - HostManagementPage: For retrieving host IDs (ready for future use) - HelloExtensionPage: Socket-based extension testing - Updated test suite with serial execution Configuration: - List reporter (no browser popup) - App installation/uninstallation setup/teardown - Environment-based configuration Results: 6 tests passed, 2 skipped in ~45s
1 parent a300ca4 commit 337069e

25 files changed

+2575
-0
lines changed

e2e/.env.sample

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Falcon Authentication
2+
FALCON_USERNAME=your.email@company.com
3+
FALCON_PASSWORD=your-password
4+
FALCON_AUTH_SECRET=your-totp-secret
5+
FALCON_BASE_URL=https://falcon.us-2.crowdstrike.com
6+
7+
# App Configuration
8+
APP_NAME=foundry-sample-functions-python

e2e/.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# .dotenvx
2+
.env
3+
.env.keys
4+
5+
# IntelliJ IDEA
6+
.idea
7+
8+
# Playwright
9+
node_modules/
10+
/test-results/
11+
/playwright/
12+
/playwright-report/
13+
/blob-report/
14+
/playwright/.cache/

e2e/README.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Foundry E2E Tests
2+
3+
End-to-end tests for the foundry-sample-category-blocking application using Playwright.
4+
5+
## Prerequisites
6+
7+
1. **Environment Setup**: Create a `.env` file with your Falcon credentials:
8+
```bash
9+
FALCON_USERNAME=your.email@company.com
10+
FALCON_PASSWORD=your-password
11+
FALCON_AUTH_SECRET=your-totp-secret
12+
FALCON_BASE_URL=https://falcon.us-2.crowdstrike.com
13+
APP_NAME=foundry-sample-category-blocking
14+
```
15+
16+
2. **App Deployment**: Ensure the app is deployed to your Falcon environment:
17+
```bash
18+
foundry apps deploy
19+
foundry apps release
20+
```
21+
22+
## Running Tests
23+
24+
### Basic Test Execution
25+
```bash
26+
# Run all tests
27+
npm test
28+
29+
# Run with list reporter (cleaner output)
30+
npm test -- --reporter=list
31+
```
32+
33+
### Debug Modes
34+
35+
#### 1. Verbose Logging Mode
36+
Shows detailed debug information including element states, wait conditions, and context:
37+
```bash
38+
npm run test:verbose
39+
```
40+
41+
#### 2. Playwright Debug Mode
42+
Opens browser in debug mode with step-by-step controls:
43+
```bash
44+
npm run test:debug
45+
```
46+
47+
#### 3. Manual Debug Environment
48+
Set debug flag manually:
49+
```bash
50+
DEBUG=true npm test
51+
```
52+
53+
#### 4. UI Mode
54+
Interactive test runner with visual debugging:
55+
```bash
56+
npm run test:ui
57+
```
58+
59+
### Debug Mode Features
60+
61+
When debug mode is enabled (`DEBUG=true`), you'll see:
62+
- **Element Wait Details**: Timeout values, element states, retry attempts
63+
- **Screenshot Context**: Detailed information about captured screenshots
64+
- **Navigation Context**: Page timing and URL patterns
65+
- **Interaction Context**: Click attempts, element visibility checks
66+
- **Error Context**: Enhanced error messages with debugging information
67+
68+
### Common Debug Scenarios
69+
70+
#### App Not Found
71+
If tests fail with "App not found":
72+
1. Verify app deployment: `foundry apps list-deployments`
73+
2. Check APP_NAME matches deployed app name
74+
3. Run with debug mode to see navigation attempts
75+
76+
#### Element Interaction Failures
77+
If clicks timeout or fail:
78+
1. Use `npm run test:debug` to step through interactions
79+
2. Check for element interception issues in debug logs
80+
3. Verify iframe loading and content accessibility
81+
82+
#### Authentication Issues
83+
If login fails:
84+
1. Verify `.env` credentials are correct
85+
2. Check TOTP secret is current and valid
86+
3. Run single test with debug mode to isolate issue
87+
88+
## Test Structure
89+
90+
- **authenticate.setup.ts**: Handles Falcon login with MFA
91+
- **foundry.spec.ts**: Main test suite with app installation and interaction tests
92+
- **Page Objects**: Structured page interactions in `src/pages/`
93+
- **Configuration**: Environment-specific settings in `src/config/TestConfig.ts`
94+
95+
## Available Test Commands
96+
97+
| Command | Description |
98+
|---------|-------------|
99+
| `npm test` | Run all tests with default settings |
100+
| `npm run test:verbose` | Run with debug logging enabled |
101+
| `npm run test:debug` | Run in Playwright debug mode |
102+
| `npm run test:ui` | Run with interactive UI mode |
103+
104+
## Troubleshooting
105+
106+
- **Tests hang**: Check for modal dialogs or authentication prompts
107+
- **Navigation failures**: Verify app is installed and accessible in Custom Apps menu
108+
- **Element not found**: Use debug mode to inspect page structure and timing
109+
- **Timeout errors**: Check network conditions and increase timeouts if needed
110+
111+
For more debugging tips, see the test logs and enable verbose mode for detailed information.

e2e/constants/AuthFile.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const AuthFile = 'playwright/.auth/user.json';

0 commit comments

Comments
 (0)