@testivai/witness-playwright 0.1.1 → 0.1.2

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/README.md CHANGED
@@ -25,9 +25,10 @@ To use the reporter, you need to configure it in your `playwright.config.ts` fil
25
25
  ```bash
26
26
  # Create .env file
27
27
  echo "TESTIVAI_API_KEY=tstvai-your-key-here" > .env
28
- echo "TESTIVAI_API_URL=https://core-api-147980626268.us-central1.run.app" >> .env
29
28
  ```
30
29
 
30
+ **Note:** The SDK automatically uses the production API URL. You only need to set `TESTIVAI_API_KEY`.
31
+
31
32
  ```typescript
32
33
  // playwright.config.ts
33
34
  import { defineConfig } from '@playwright/test';
package/dist/cli/init.js CHANGED
@@ -126,9 +126,8 @@ async function createConfigFile() {
126
126
  console.log('📁 Config file:', configPath);
127
127
  console.log('');
128
128
  console.log('📖 Next steps:');
129
- console.log(' 1. Set up environment variables:');
129
+ console.log(' 1. Set up your API key:');
130
130
  console.log(' TESTIVAI_API_KEY=tstvai-your-key-here');
131
- console.log(' TESTIVAI_API_URL=https://core-api-147980626268.us-central1.run.app');
132
131
  console.log('');
133
132
  console.log(' 2. Update your playwright.config.ts to use TestivAI reporter:');
134
133
  console.log(' reporter: [[\'@testivai/witness-playwright/reporter\']]');
@@ -137,6 +136,7 @@ async function createConfigFile() {
137
136
  console.log(' 4. Run your tests: npx playwright test');
138
137
  console.log('');
139
138
  console.log('💡 Get your API key from: https://dashboard-147980626268.us-central1.run.app');
139
+ console.log('💡 The SDK automatically connects to the production API - no URL configuration needed!');
140
140
  }
141
141
  catch (error) {
142
142
  console.error('❌ Failed to create configuration file:', error);
package/dist/reporter.js CHANGED
@@ -49,13 +49,14 @@ class TestivAIPlaywrightReporter {
49
49
  this.runId = null;
50
50
  this.tempDir = path.join(process.cwd(), '.testivai', 'temp');
51
51
  this.options = {
52
- apiUrl: options.apiUrl || process.env.TESTIVAI_API_URL,
52
+ apiUrl: options.apiUrl || process.env.TESTIVAI_API_URL || 'https://core-api-147980626268.us-central1.run.app',
53
53
  apiKey: options.apiKey || process.env.TESTIVAI_API_KEY,
54
54
  };
55
55
  }
56
56
  async onBegin(config, suite) {
57
- if (!this.options.apiUrl || !this.options.apiKey) {
58
- console.error('Testivai Reporter: API URL or API Key is not configured. Disabling reporter.');
57
+ if (!this.options.apiKey) {
58
+ console.error('Testivai Reporter: API Key is not configured. Disabling reporter.');
59
+ console.error('Set TESTIVAI_API_KEY environment variable or pass apiKey in reporter options.');
59
60
  this.options.apiUrl = undefined; // Disable reporter
60
61
  return;
61
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testivai/witness-playwright",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Playwright sensor for Testivai Visual Regression Test system",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/cli/init.ts CHANGED
@@ -96,9 +96,8 @@ async function createConfigFile(): Promise<void> {
96
96
  console.log('📁 Config file:', configPath);
97
97
  console.log('');
98
98
  console.log('📖 Next steps:');
99
- console.log(' 1. Set up environment variables:');
99
+ console.log(' 1. Set up your API key:');
100
100
  console.log(' TESTIVAI_API_KEY=tstvai-your-key-here');
101
- console.log(' TESTIVAI_API_URL=https://core-api-147980626268.us-central1.run.app');
102
101
  console.log('');
103
102
  console.log(' 2. Update your playwright.config.ts to use TestivAI reporter:');
104
103
  console.log(' reporter: [[\'@testivai/witness-playwright/reporter\']]');
@@ -107,6 +106,7 @@ async function createConfigFile(): Promise<void> {
107
106
  console.log(' 4. Run your tests: npx playwright test');
108
107
  console.log('');
109
108
  console.log('💡 Get your API key from: https://dashboard-147980626268.us-central1.run.app');
109
+ console.log('💡 The SDK automatically connects to the production API - no URL configuration needed!');
110
110
 
111
111
  } catch (error) {
112
112
  console.error('❌ Failed to create configuration file:', error);
package/src/reporter.ts CHANGED
@@ -20,14 +20,15 @@ export class TestivAIPlaywrightReporter implements Reporter {
20
20
 
21
21
  constructor(options: TestivaiReporterOptions = {}) {
22
22
  this.options = {
23
- apiUrl: options.apiUrl || process.env.TESTIVAI_API_URL,
23
+ apiUrl: options.apiUrl || process.env.TESTIVAI_API_URL || 'https://core-api-147980626268.us-central1.run.app',
24
24
  apiKey: options.apiKey || process.env.TESTIVAI_API_KEY,
25
25
  };
26
26
  }
27
27
 
28
28
  async onBegin(config: FullConfig, suite: Suite): Promise<void> {
29
- if (!this.options.apiUrl || !this.options.apiKey) {
30
- console.error('Testivai Reporter: API URL or API Key is not configured. Disabling reporter.');
29
+ if (!this.options.apiKey) {
30
+ console.error('Testivai Reporter: API Key is not configured. Disabling reporter.');
31
+ console.error('Set TESTIVAI_API_KEY environment variable or pass apiKey in reporter options.');
31
32
  this.options.apiUrl = undefined; // Disable reporter
32
33
  return;
33
34
  }