playwright-ai-reporter 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1183 -0
- package/dist/colors.d.ts +54 -0
- package/dist/colors.js +57 -0
- package/dist/examples/ReporterWorkflow.d.ts +54 -0
- package/dist/examples/ReporterWorkflow.js +307 -0
- package/dist/providers/ProviderRegistry.d.ts +79 -0
- package/dist/providers/ProviderRegistry.js +195 -0
- package/dist/providers/ai/AIProviderFactory.d.ts +33 -0
- package/dist/providers/ai/AIProviderFactory.js +82 -0
- package/dist/providers/ai/AnthropicProvider.d.ts +15 -0
- package/dist/providers/ai/AnthropicProvider.js +128 -0
- package/dist/providers/ai/AzureOpenAIProvider.d.ts +20 -0
- package/dist/providers/ai/AzureOpenAIProvider.js +158 -0
- package/dist/providers/ai/GoogleAIProvider.d.ts +17 -0
- package/dist/providers/ai/GoogleAIProvider.js +154 -0
- package/dist/providers/ai/MistralProvider.d.ts +16 -0
- package/dist/providers/ai/MistralProvider.js +137 -0
- package/dist/providers/ai/OpenAIProvider.d.ts +16 -0
- package/dist/providers/ai/OpenAIProvider.js +141 -0
- package/dist/providers/bugTrackers/AzureDevOpsBugTracker.d.ts +32 -0
- package/dist/providers/bugTrackers/AzureDevOpsBugTracker.js +295 -0
- package/dist/providers/bugTrackers/GitHubBugTracker.d.ts +28 -0
- package/dist/providers/bugTrackers/GitHubBugTracker.js +241 -0
- package/dist/providers/bugTrackers/JiraBugTracker.d.ts +29 -0
- package/dist/providers/bugTrackers/JiraBugTracker.js +279 -0
- package/dist/providers/databases/MySQLProvider.d.ts +32 -0
- package/dist/providers/databases/MySQLProvider.js +274 -0
- package/dist/providers/databases/SQLiteProvider.d.ts +28 -0
- package/dist/providers/databases/SQLiteProvider.js +272 -0
- package/dist/providers/factories/BugTrackerFactory.d.ts +20 -0
- package/dist/providers/factories/BugTrackerFactory.js +50 -0
- package/dist/providers/factories/DatabaseFactory.d.ts +28 -0
- package/dist/providers/factories/DatabaseFactory.js +71 -0
- package/dist/providers/factories/NotificationFactory.d.ts +24 -0
- package/dist/providers/factories/NotificationFactory.js +64 -0
- package/dist/providers/factories/PRProviderFactory.d.ts +20 -0
- package/dist/providers/factories/PRProviderFactory.js +45 -0
- package/dist/providers/index.d.ts +28 -0
- package/dist/providers/index.js +55 -0
- package/dist/providers/interfaces/IAIProvider.d.ts +59 -0
- package/dist/providers/interfaces/IAIProvider.js +5 -0
- package/dist/providers/interfaces/IBugTrackerProvider.d.ts +70 -0
- package/dist/providers/interfaces/IBugTrackerProvider.js +20 -0
- package/dist/providers/interfaces/IDatabaseProvider.d.ts +90 -0
- package/dist/providers/interfaces/IDatabaseProvider.js +5 -0
- package/dist/providers/interfaces/INotificationProvider.d.ts +59 -0
- package/dist/providers/interfaces/INotificationProvider.js +13 -0
- package/dist/providers/interfaces/IPRProvider.d.ts +82 -0
- package/dist/providers/interfaces/IPRProvider.js +5 -0
- package/dist/providers/notifications/EmailNotificationProvider.d.ts +29 -0
- package/dist/providers/notifications/EmailNotificationProvider.js +290 -0
- package/dist/providers/pr/AzureDevOpsPRProvider.d.ts +30 -0
- package/dist/providers/pr/AzureDevOpsPRProvider.js +263 -0
- package/dist/providers/pr/GitHubPRProvider.d.ts +29 -0
- package/dist/providers/pr/GitHubPRProvider.js +320 -0
- package/dist/reporter.d.ts +138 -0
- package/dist/reporter.js +787 -0
- package/dist/types/index.d.ts +168 -0
- package/dist/types/index.js +2 -0
- package/dist/utils/buildInfoUtils.d.ts +26 -0
- package/dist/utils/buildInfoUtils.js +125 -0
- package/dist/utils/configValidator.d.ts +67 -0
- package/dist/utils/configValidator.js +454 -0
- package/dist/utils/fileHandlerUtils.d.ts +42 -0
- package/dist/utils/fileHandlerUtils.js +136 -0
- package/dist/utils/genaiUtils.d.ts +38 -0
- package/dist/utils/genaiUtils.js +178 -0
- package/dist/utils/historyUtils.d.ts +49 -0
- package/dist/utils/historyUtils.js +118 -0
- package/dist/utils/utils.d.ts +104 -0
- package/dist/utils/utils.js +371 -0
- package/docs/API.md +591 -0
- package/docs/ENV_CONFIG_GUIDE.md +444 -0
- package/docs/IMPLEMENTATION_SUMMARY.md +285 -0
- package/docs/PROVIDERS.md +261 -0
- package/docs/QUICKSTART.md +350 -0
- package/docs/README.md +253 -0
- package/docs/TROUBLESHOOTING.md +577 -0
- package/docs/design.md +384 -0
- package/docs/logo.png +0 -0
- package/examples/README.md +326 -0
- package/examples/VALIDATION.md +68 -0
- package/examples/env-configs/.env.anthropic-minimal +40 -0
- package/examples/env-configs/.env.azure-stack +71 -0
- package/examples/env-configs/.env.example +32 -0
- package/examples/env-configs/.env.github-stack +57 -0
- package/examples/env-configs/.env.google-mysql +61 -0
- package/examples/env-configs/.env.ms-auth-examples +56 -0
- package/examples/env-configs/.env.openai-jira +64 -0
- package/examples/package.json +22 -0
- package/package.json +70 -0
- package/playwright-ai-reporter-0.0.4.tgz +0 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# Playwright AI Test Reporter - Provider-Based Architecture
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This reporter has been refactored into a generalized provider-based framework that supports multiple implementations for each service type. This architecture allows you to easily switch between different service providers without changing the core reporter code.
|
|
6
|
+
|
|
7
|
+
## Provider Types
|
|
8
|
+
|
|
9
|
+
### 1. AI Providers
|
|
10
|
+
|
|
11
|
+
The reporter supports multiple AI providers for generating test failure suggestions and auto-healing:
|
|
12
|
+
|
|
13
|
+
- **Azure OpenAI** - Uses Azure's OpenAI service with managed identity or PAT authentication
|
|
14
|
+
- **OpenAI** - Direct integration with OpenAI's API
|
|
15
|
+
- **Anthropic** - Claude models for AI suggestions
|
|
16
|
+
- **Google AI** - Gemini models
|
|
17
|
+
- **Mistral AI** - Mistral's AI models
|
|
18
|
+
|
|
19
|
+
**Configuration:**
|
|
20
|
+
|
|
21
|
+
```env
|
|
22
|
+
AI_PROVIDER=azure-openai # or: openai, anthropic, google-ai, mistral
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2. Bug Tracker Providers
|
|
26
|
+
|
|
27
|
+
Create bugs/issues automatically for failing tests:
|
|
28
|
+
|
|
29
|
+
- **Azure DevOps** - Create work items in Azure DevOps
|
|
30
|
+
- **GitHub** - Create issues in GitHub repositories
|
|
31
|
+
- **Jira** - Create tickets in Jira
|
|
32
|
+
|
|
33
|
+
**Configuration:**
|
|
34
|
+
|
|
35
|
+
```env
|
|
36
|
+
BUG_TRACKER_PROVIDER=github # or: azure-devops, jira
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 3. Database Providers
|
|
40
|
+
|
|
41
|
+
Store test run and test result data:
|
|
42
|
+
|
|
43
|
+
- **SQLite** - Lightweight local database
|
|
44
|
+
- **MySQL** - MySQL database
|
|
45
|
+
- **PostgreSQL** - PostgreSQL database (coming soon)
|
|
46
|
+
|
|
47
|
+
**Configuration:**
|
|
48
|
+
|
|
49
|
+
```env
|
|
50
|
+
DATABASE_PROVIDER=sqlite # or: mysql, postgresql
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 4. PR Providers
|
|
54
|
+
|
|
55
|
+
Auto-generate pull requests with fixes:
|
|
56
|
+
|
|
57
|
+
- **GitHub** - Create PRs in GitHub repositories
|
|
58
|
+
- **Azure DevOps** - Create PRs in Azure Repos
|
|
59
|
+
|
|
60
|
+
**Configuration:**
|
|
61
|
+
|
|
62
|
+
```env
|
|
63
|
+
PR_PROVIDER=github # or: azure-devops
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 5. Notification Providers
|
|
67
|
+
|
|
68
|
+
Send notifications about test results:
|
|
69
|
+
|
|
70
|
+
- **Email** - Send email notifications
|
|
71
|
+
- **Slack** - Post to Slack channels (coming soon)
|
|
72
|
+
- **Microsoft Teams** - Post to Teams channels (coming soon)
|
|
73
|
+
|
|
74
|
+
**Configuration:**
|
|
75
|
+
|
|
76
|
+
```env
|
|
77
|
+
NOTIFICATION_PROVIDER=email # or: slack, teams
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Usage
|
|
81
|
+
|
|
82
|
+
### Basic Setup
|
|
83
|
+
|
|
84
|
+
1. Copy `.env.example` to `.env`:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
cp examples/env-configs/.env.example .env
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
2. Configure your providers in `.env`:
|
|
91
|
+
|
|
92
|
+
```env
|
|
93
|
+
AI_PROVIDER=azure-openai
|
|
94
|
+
BUG_TRACKER_PROVIDER=github
|
|
95
|
+
DATABASE_PROVIDER=sqlite
|
|
96
|
+
PR_PROVIDER=github
|
|
97
|
+
NOTIFICATION_PROVIDER=email
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
3. Add provider-specific configuration (API keys, endpoints, etc.)
|
|
101
|
+
|
|
102
|
+
### Programmatic Configuration
|
|
103
|
+
|
|
104
|
+
You can also configure providers programmatically:
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import {ProviderRegistry} from './providers/ProviderRegistry';
|
|
108
|
+
|
|
109
|
+
// Initialize with custom configuration
|
|
110
|
+
await ProviderRegistry.initialize({
|
|
111
|
+
ai: {
|
|
112
|
+
type: 'openai',
|
|
113
|
+
config: {apiKey: 'your-api-key'},
|
|
114
|
+
},
|
|
115
|
+
bugTracker: {
|
|
116
|
+
type: 'github',
|
|
117
|
+
config: {token: 'your-token'},
|
|
118
|
+
},
|
|
119
|
+
database: {
|
|
120
|
+
type: 'sqlite',
|
|
121
|
+
config: {dbPath: './test-results.db'},
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Get providers
|
|
126
|
+
const aiProvider = await ProviderRegistry.getAIProvider();
|
|
127
|
+
const bugTracker = await ProviderRegistry.getBugTrackerProvider();
|
|
128
|
+
const database = await ProviderRegistry.getDatabaseProvider();
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Using Individual Factories
|
|
132
|
+
|
|
133
|
+
You can also use individual factories directly:
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import {AIProviderFactory, AIProviderType} from './providers/ai/AIProviderFactory';
|
|
137
|
+
|
|
138
|
+
// Create a specific provider
|
|
139
|
+
const aiProvider = await AIProviderFactory.createProvider(AIProviderType.OpenAI);
|
|
140
|
+
|
|
141
|
+
// Or create from environment variable
|
|
142
|
+
const aiProvider = await AIProviderFactory.createFromEnv('AI_PROVIDER');
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Architecture
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
src/
|
|
149
|
+
├── providers/
|
|
150
|
+
│ ├── interfaces/ # Provider interfaces
|
|
151
|
+
│ │ ├── IAIProvider.ts
|
|
152
|
+
│ │ ├── IBugTrackerProvider.ts
|
|
153
|
+
│ │ ├── IDatabaseProvider.ts
|
|
154
|
+
│ │ ├── INotificationProvider.ts
|
|
155
|
+
│ │ └── IPRProvider.ts
|
|
156
|
+
│ ├── ai/ # AI provider implementations
|
|
157
|
+
│ │ ├── AzureOpenAIProvider.ts
|
|
158
|
+
│ │ ├── OpenAIProvider.ts
|
|
159
|
+
│ │ ├── AnthropicProvider.ts
|
|
160
|
+
│ │ ├── GoogleAIProvider.ts
|
|
161
|
+
│ │ ├── MistralProvider.ts
|
|
162
|
+
│ │ └── AIProviderFactory.ts
|
|
163
|
+
│ ├── bugTrackers/ # Bug tracker implementations
|
|
164
|
+
│ │ ├── AzureDevOpsBugTracker.ts
|
|
165
|
+
│ │ ├── GitHubBugTracker.ts
|
|
166
|
+
│ │ └── JiraBugTracker.ts
|
|
167
|
+
│ ├── databases/ # Database implementations
|
|
168
|
+
│ │ ├── SQLiteProvider.ts
|
|
169
|
+
│ │ └── MySQLProvider.ts
|
|
170
|
+
│ ├── notifications/ # Notification implementations
|
|
171
|
+
│ │ └── EmailNotificationProvider.ts
|
|
172
|
+
│ ├── pr/ # PR provider implementations
|
|
173
|
+
│ │ ├── GitHubPRProvider.ts
|
|
174
|
+
│ │ └── AzureDevOpsPRProvider.ts
|
|
175
|
+
│ ├── factories/ # Factory classes
|
|
176
|
+
│ │ ├── BugTrackerFactory.ts
|
|
177
|
+
│ │ ├── DatabaseFactory.ts
|
|
178
|
+
│ │ ├── NotificationFactory.ts
|
|
179
|
+
│ │ └── PRProviderFactory.ts
|
|
180
|
+
│ ├── ProviderRegistry.ts # Central provider registry
|
|
181
|
+
│ └── index.ts # Provider exports
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Adding New Providers
|
|
185
|
+
|
|
186
|
+
### 1. Create Provider Implementation
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
// src/providers/ai/NewAIProvider.ts
|
|
190
|
+
import {IAIProvider, AIMessage, AIModelConfig, AIResponse} from '../interfaces/IAIProvider';
|
|
191
|
+
|
|
192
|
+
export class NewAIProvider implements IAIProvider {
|
|
193
|
+
getName(): string {
|
|
194
|
+
return 'New AI Provider';
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async initialize(): Promise<void> {
|
|
198
|
+
// Initialize connection, load config, etc.
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
async generateCompletion(messages: AIMessage[], config?: AIModelConfig): Promise<AIResponse> {
|
|
202
|
+
// Implementation
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
async generateText(prompt: string, config?: AIModelConfig): Promise<string> {
|
|
206
|
+
// Implementation
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async testConnection(): Promise<boolean> {
|
|
210
|
+
// Test the connection
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 2. Update Factory
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
// Add to AIProviderFactory.ts
|
|
219
|
+
import { NewAIProvider } from './NewAIProvider';
|
|
220
|
+
|
|
221
|
+
export enum AIProviderType {
|
|
222
|
+
// ... existing types
|
|
223
|
+
NewProvider = 'new-provider',
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// Add case in createProvider method
|
|
227
|
+
case AIProviderType.NewProvider:
|
|
228
|
+
provider = new NewAIProvider();
|
|
229
|
+
break;
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### 3. Update Documentation
|
|
233
|
+
|
|
234
|
+
Add the new provider to `.env.example` and this README.
|
|
235
|
+
|
|
236
|
+
## Environment Variables Reference
|
|
237
|
+
|
|
238
|
+
See example files in `examples/env-configs/` for a complete list of all supported environment variables for each provider type.
|
|
239
|
+
|
|
240
|
+
## Features
|
|
241
|
+
|
|
242
|
+
- **Flexible Provider System**: Easily switch between different service providers
|
|
243
|
+
- **Factory Pattern**: Centralized provider creation and management
|
|
244
|
+
- **Lazy Initialization**: Providers are only initialized when needed
|
|
245
|
+
- **Type Safety**: Full TypeScript support with proper interfaces
|
|
246
|
+
- **Environment-Based Config**: Configure via environment variables or programmatically
|
|
247
|
+
- **Extensible**: Easy to add new providers without changing existing code
|
|
248
|
+
|
|
249
|
+
## Testing
|
|
250
|
+
|
|
251
|
+
Each provider can be tested independently:
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
const provider = await AIProviderFactory.createProvider('openai');
|
|
255
|
+
const isConnected = await provider.testConnection();
|
|
256
|
+
console.log(`Connection status: ${isConnected}`);
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## License
|
|
260
|
+
|
|
261
|
+
See LICENSE file for details.
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
# Quick Start Guide - Playwright AI Test Reporter
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @azure/identity
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Configuration
|
|
10
|
+
|
|
11
|
+
### 1. Create Environment File
|
|
12
|
+
|
|
13
|
+
Copy one of the pre-configured example files:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# For GitHub users (recommended for open source)
|
|
17
|
+
cp examples/env-configs/.env.github-stack .env
|
|
18
|
+
|
|
19
|
+
# For Azure users (recommended for enterprise)
|
|
20
|
+
cp examples/env-configs/.env.azure-stack .env
|
|
21
|
+
|
|
22
|
+
# For Jira users
|
|
23
|
+
cp examples/env-configs/.env.openai-jira .env
|
|
24
|
+
|
|
25
|
+
# For minimal setup
|
|
26
|
+
cp examples/env-configs/.env.anthropic-minimal .env
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 2. Configure Your Providers
|
|
30
|
+
|
|
31
|
+
Edit `.env` and set your provider choices:
|
|
32
|
+
|
|
33
|
+
```env
|
|
34
|
+
# Minimal configuration for getting started
|
|
35
|
+
AI_PROVIDER=azure-openai
|
|
36
|
+
BUG_TRACKER_PROVIDER=github
|
|
37
|
+
DATABASE_PROVIDER=sqlite
|
|
38
|
+
|
|
39
|
+
# Enable features
|
|
40
|
+
ENABLE_BUG_CREATION=true
|
|
41
|
+
ENABLE_DATABASE_LOGGING=true
|
|
42
|
+
ENABLE_AUTO_HEALING=true
|
|
43
|
+
ENABLE_PR_CREATION=false
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 3. Add Provider-Specific Configuration
|
|
47
|
+
|
|
48
|
+
#### For Azure OpenAI (Recommended for Enterprise)
|
|
49
|
+
|
|
50
|
+
```env
|
|
51
|
+
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
|
|
52
|
+
AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4
|
|
53
|
+
AZURE_OPENAI_API_VERSION=2024-02-01
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Uses Azure managed identity - no API key needed!
|
|
57
|
+
|
|
58
|
+
#### For OpenAI (Quick Start)
|
|
59
|
+
|
|
60
|
+
```env
|
|
61
|
+
AI_PROVIDER=openai
|
|
62
|
+
OPENAI_API_KEY=sk-...
|
|
63
|
+
OPENAI_MODEL=gpt-4o
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### For GitHub Bug Tracking
|
|
67
|
+
|
|
68
|
+
```env
|
|
69
|
+
GITHUB_TOKEN=ghp_...
|
|
70
|
+
GITHUB_OWNER=your-username
|
|
71
|
+
GITHUB_REPO=your-repo
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 4. Validate Configuration
|
|
75
|
+
|
|
76
|
+
Run the configuration validator:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm run validate:config
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This will check all your provider configurations and test connections.
|
|
83
|
+
|
|
84
|
+
## Usage
|
|
85
|
+
|
|
86
|
+
### Basic Setup in Playwright Config
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
// playwright.config.ts
|
|
90
|
+
import {defineConfig} from '@playwright/test';
|
|
91
|
+
|
|
92
|
+
export default defineConfig({
|
|
93
|
+
reporter: [
|
|
94
|
+
[
|
|
95
|
+
'./src/reporter.ts',
|
|
96
|
+
{
|
|
97
|
+
// Reporter options
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
],
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Using the Provider Framework
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import {ProviderRegistry} from './src/providers/ProviderRegistry';
|
|
108
|
+
|
|
109
|
+
// Initialize providers (loads from .env)
|
|
110
|
+
await ProviderRegistry.initialize();
|
|
111
|
+
|
|
112
|
+
// Get AI provider
|
|
113
|
+
const ai = await ProviderRegistry.getAIProvider();
|
|
114
|
+
const response = await ai.generateText('Analyze this test failure...');
|
|
115
|
+
|
|
116
|
+
// Get bug tracker
|
|
117
|
+
const bugTracker = await ProviderRegistry.getBugTrackerProvider();
|
|
118
|
+
await bugTracker.createBug({
|
|
119
|
+
title: 'Test Failed',
|
|
120
|
+
description: 'Details...',
|
|
121
|
+
priority: BugPriority.High,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Get database
|
|
125
|
+
const db = await ProviderRegistry.getDatabaseProvider();
|
|
126
|
+
await db.saveTestRun({
|
|
127
|
+
name: 'Test Run',
|
|
128
|
+
timestamp: new Date(),
|
|
129
|
+
totalTests: 10,
|
|
130
|
+
passedTests: 8,
|
|
131
|
+
failedTests: 2,
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Using Individual Factories
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
import {AIProviderFactory} from './src/providers/ai/AIProviderFactory';
|
|
139
|
+
|
|
140
|
+
// Create specific provider
|
|
141
|
+
const ai = await AIProviderFactory.createProvider('openai');
|
|
142
|
+
|
|
143
|
+
// Or create from environment
|
|
144
|
+
const ai = await AIProviderFactory.createFromEnv('AI_PROVIDER');
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Supported Providers
|
|
148
|
+
|
|
149
|
+
### AI Providers
|
|
150
|
+
|
|
151
|
+
- ✅ Azure OpenAI (recommended for enterprise)
|
|
152
|
+
- ✅ OpenAI
|
|
153
|
+
- ✅ Anthropic (Claude)
|
|
154
|
+
- ✅ Google AI (Gemini)
|
|
155
|
+
- ✅ Mistral AI
|
|
156
|
+
|
|
157
|
+
### Bug Trackers
|
|
158
|
+
|
|
159
|
+
- ✅ GitHub Issues
|
|
160
|
+
- ✅ Azure DevOps Work Items
|
|
161
|
+
- ✅ Jira
|
|
162
|
+
|
|
163
|
+
### Databases
|
|
164
|
+
|
|
165
|
+
- ✅ SQLite (default, no setup needed)
|
|
166
|
+
- ✅ MySQL
|
|
167
|
+
- ⏳ PostgreSQL (coming soon)
|
|
168
|
+
|
|
169
|
+
### Notifications
|
|
170
|
+
|
|
171
|
+
- ✅ Email (SMTP)
|
|
172
|
+
- ⏳ Slack (coming soon)
|
|
173
|
+
- ⏳ Microsoft Teams (coming soon)
|
|
174
|
+
|
|
175
|
+
### PR Providers
|
|
176
|
+
|
|
177
|
+
- ✅ GitHub
|
|
178
|
+
- ✅ Azure DevOps
|
|
179
|
+
|
|
180
|
+
## Common Configurations
|
|
181
|
+
|
|
182
|
+
### Minimal Setup (SQLite + OpenAI)
|
|
183
|
+
|
|
184
|
+
```env
|
|
185
|
+
AI_PROVIDER=openai
|
|
186
|
+
OPENAI_API_KEY=sk-...
|
|
187
|
+
DATABASE_PROVIDER=sqlite
|
|
188
|
+
ENABLE_DATABASE_LOGGING=true
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### GitHub Integration
|
|
192
|
+
|
|
193
|
+
```env
|
|
194
|
+
AI_PROVIDER=openai
|
|
195
|
+
OPENAI_API_KEY=sk-...
|
|
196
|
+
|
|
197
|
+
BUG_TRACKER_PROVIDER=github
|
|
198
|
+
GITHUB_TOKEN=ghp_...
|
|
199
|
+
GITHUB_OWNER=your-username
|
|
200
|
+
GITHUB_REPO=your-repo
|
|
201
|
+
|
|
202
|
+
PR_PROVIDER=github
|
|
203
|
+
# Uses same GITHUB_* vars
|
|
204
|
+
|
|
205
|
+
ENABLE_BUG_CREATION=true
|
|
206
|
+
ENABLE_PR_CREATION=false
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Azure DevOps Integration
|
|
210
|
+
|
|
211
|
+
```env
|
|
212
|
+
AI_PROVIDER=azure-openai
|
|
213
|
+
AZURE_OPENAI_ENDPOINT=https://...
|
|
214
|
+
AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4
|
|
215
|
+
|
|
216
|
+
BUG_TRACKER_PROVIDER=azure-devops
|
|
217
|
+
AZURE_DEVOPS_ORG_URL=https://dev.azure.com/your-org
|
|
218
|
+
AZURE_DEVOPS_PROJECT=YourProject
|
|
219
|
+
AZURE_DEVOPS_PAT=your-pat
|
|
220
|
+
|
|
221
|
+
PR_PROVIDER=azure-devops
|
|
222
|
+
# Uses same AZURE_DEVOPS_* vars
|
|
223
|
+
|
|
224
|
+
ENABLE_BUG_CREATION=true
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Enterprise Setup (Azure + MySQL)
|
|
228
|
+
|
|
229
|
+
```env
|
|
230
|
+
AI_PROVIDER=azure-openai
|
|
231
|
+
AZURE_OPENAI_ENDPOINT=https://...
|
|
232
|
+
AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4
|
|
233
|
+
|
|
234
|
+
DATABASE_PROVIDER=mysql
|
|
235
|
+
MYSQL_HOST=mysql.example.com
|
|
236
|
+
MYSQL_USER=testuser
|
|
237
|
+
MYSQL_PASSWORD=secure-password
|
|
238
|
+
MYSQL_DATABASE=test_results
|
|
239
|
+
|
|
240
|
+
BUG_TRACKER_PROVIDER=azure-devops
|
|
241
|
+
AZURE_DEVOPS_ORG_URL=https://dev.azure.com/enterprise
|
|
242
|
+
AZURE_DEVOPS_PROJECT=QA
|
|
243
|
+
|
|
244
|
+
NOTIFICATION_PROVIDER=email
|
|
245
|
+
EMAIL_HOST=smtp.office365.com
|
|
246
|
+
EMAIL_USER=notifications@company.com
|
|
247
|
+
EMAIL_PASSWORD=app-password
|
|
248
|
+
EMAIL_FROM=notifications@company.com
|
|
249
|
+
EMAIL_TO=qa-team@company.com
|
|
250
|
+
|
|
251
|
+
ENABLE_BUG_CREATION=true
|
|
252
|
+
ENABLE_DATABASE_LOGGING=true
|
|
253
|
+
ENABLE_NOTIFICATIONS=true
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Running Tests
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
# Run Playwright tests with the reporter
|
|
260
|
+
npm run test:e2e
|
|
261
|
+
|
|
262
|
+
# With UI
|
|
263
|
+
npm run test:e2e:ui
|
|
264
|
+
|
|
265
|
+
# With debugging
|
|
266
|
+
npm run test:e2e:debug
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Workflow Example
|
|
270
|
+
|
|
271
|
+
See `src/examples/ReporterWorkflow.ts` for a complete example of:
|
|
272
|
+
|
|
273
|
+
1. Generating AI fix suggestions
|
|
274
|
+
2. Creating bugs for failures
|
|
275
|
+
3. Auto-generating PRs with fixes
|
|
276
|
+
4. Saving results to database
|
|
277
|
+
5. Sending notifications
|
|
278
|
+
|
|
279
|
+
## Troubleshooting
|
|
280
|
+
|
|
281
|
+
### Configuration Issues
|
|
282
|
+
|
|
283
|
+
Run the validator:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
npm run validate:config
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Provider Connection Failed
|
|
290
|
+
|
|
291
|
+
Check:
|
|
292
|
+
|
|
293
|
+
1. API keys are correct
|
|
294
|
+
2. Endpoints are accessible
|
|
295
|
+
3. Network/firewall settings
|
|
296
|
+
4. Service status (Azure/OpenAI/etc.)
|
|
297
|
+
|
|
298
|
+
### Azure OpenAI Authentication
|
|
299
|
+
|
|
300
|
+
Ensure you're logged in with Azure CLI:
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
az login
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Or Azure PowerShell:
|
|
307
|
+
|
|
308
|
+
```powershell
|
|
309
|
+
Connect-AzAccount
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Database Connection Issues
|
|
313
|
+
|
|
314
|
+
For SQLite:
|
|
315
|
+
|
|
316
|
+
- No setup needed, file created automatically
|
|
317
|
+
|
|
318
|
+
For MySQL:
|
|
319
|
+
|
|
320
|
+
- Check host, port, credentials
|
|
321
|
+
- Ensure database exists
|
|
322
|
+
- Verify network access
|
|
323
|
+
|
|
324
|
+
## Next Steps
|
|
325
|
+
|
|
326
|
+
1. ✅ Validate configuration with `npm run validate:config`
|
|
327
|
+
2. ✅ Run a test to verify reporter works
|
|
328
|
+
3. ✅ Check test-results directory for output
|
|
329
|
+
4. ✅ Review generated prompts and fixes
|
|
330
|
+
5. ✅ Configure additional providers as needed
|
|
331
|
+
|
|
332
|
+
## Documentation
|
|
333
|
+
|
|
334
|
+
- [PROVIDERS.md](./PROVIDERS.md) - Detailed provider documentation
|
|
335
|
+
- [IMPLEMENTATION_SUMMARY.md](./IMPLEMENTATION_SUMMARY.md) - Architecture overview
|
|
336
|
+
- [examples/env-configs/](../examples/env-configs/) - Pre-configured environment files
|
|
337
|
+
- [examples/tests/](../examples/tests/) - Sample test files
|
|
338
|
+
|
|
339
|
+
## Support
|
|
340
|
+
|
|
341
|
+
For issues or questions:
|
|
342
|
+
|
|
343
|
+
1. Check the documentation
|
|
344
|
+
2. Run configuration validator
|
|
345
|
+
3. Review example workflow
|
|
346
|
+
4. Check provider-specific documentation
|
|
347
|
+
|
|
348
|
+
## License
|
|
349
|
+
|
|
350
|
+
See LICENSE file for details.
|