7a0da7932b
Backwards Compatibility / Verify Encryption Constants (push) Waiting to run
Backwards Compatibility / PyPI Version Compatibility (push) Waiting to run
Backwards Compatibility / Database Migration Tests (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-form] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-metrics] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-workflow] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-core] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-pages] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [history-news] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [library] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [link-analytics] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [mobile] (push) Blocked by required conditions
Docker Tests (Consolidated) / detect-changes (push) Waiting to run
Docker Tests (Consolidated) / Build Test Image (push) Waiting to run
Docker Tests (Consolidated) / All Pytest Tests + Coverage (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [accessibility] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [api-crud] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-login] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-pages] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-register] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-core] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-lifecycle] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [error-benchmark] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) (push) Blocked by required conditions
Docker Tests (Consolidated) / Accessibility Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / LLM Unit Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / LLM Example Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / Production Image Smoke Test (push) Blocked by required conditions
Docker Tests (Consolidated) / Infrastructure Tests (push) Blocked by required conditions
OSSF Scorecard / OSSF Security Scorecard Analysis (push) Waiting to run
OSV-Scanner (Scheduled) / scan-scheduled (push) Failing after 0s
Create Release / test-gate (push) Has been cancelled
Create Release / release-gate (push) Has been cancelled
Create Release / ci-gate (push) Has been cancelled
Create Release / version-check (push) Has been cancelled
Create Release / e2e-test-gate (push) Has been cancelled
Create Release / responsive-test-gate (push) Has been cancelled
Create Release / compat-test-gate (push) Has been cancelled
Create Release / compose-integration-gate (push) Has been cancelled
Create Release / vulture-gate (push) Has been cancelled
Create Release / build (push) Has been cancelled
Create Release / provenance (push) Has been cancelled
Create Release / prerelease-docker (push) Has been cancelled
Create Release / publish-docker (push) Has been cancelled
Create Release / create-release (push) Has been cancelled
Create Release / cleanup-changelog (push) Has been cancelled
Create Release / trigger-pypi (push) Has been cancelled
Create Release / monitor-pypi (push) Has been cancelled
Create Release / Clean up orphan prerelease tags and signatures (push) Has been cancelled
164 lines
5.6 KiB
JavaScript
164 lines
5.6 KiB
JavaScript
const puppeteer = require('puppeteer');
|
|
const AuthHelper = require('./auth_helper');
|
|
const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
|
|
|
|
// Simple test to verify settings save functionality
|
|
(async () => {
|
|
let browser;
|
|
|
|
try {
|
|
console.log('=== Simple Settings Save Test ===');
|
|
|
|
browser = await puppeteer.launch(getPuppeteerLaunchOptions());
|
|
|
|
const page = await browser.newPage();
|
|
await page.setViewport({ width: 1920, height: 1080 });
|
|
|
|
// Monitor API calls
|
|
await page.setRequestInterception(true);
|
|
const apiCalls = [];
|
|
|
|
page.on('request', request => {
|
|
const url = request.url();
|
|
if (url.includes('/settings/api/') && request.method() === 'PUT') {
|
|
apiCalls.push({
|
|
method: request.method(),
|
|
url,
|
|
body: request.postData()
|
|
});
|
|
console.log(`API ${request.method()}: ${url}`);
|
|
console.log(`Body: ${request.postData()}`);
|
|
}
|
|
request.continue();
|
|
});
|
|
|
|
const authHelper = new AuthHelper(page);
|
|
|
|
// Create and login user
|
|
const timestamp = Date.now();
|
|
const testUsername = `simple_test_${timestamp}`;
|
|
await authHelper.register(testUsername, 'testpass123');
|
|
|
|
console.log('User registered');
|
|
|
|
// Navigate to settings
|
|
await page.goto('http://localhost:5000/settings', { waitUntil: 'domcontentloaded' });
|
|
|
|
// Check if we're on settings page
|
|
const url = page.url();
|
|
if (url.includes('/auth/login')) {
|
|
console.log('Redirected to login, logging in...');
|
|
await authHelper.login(testUsername, 'testpass123');
|
|
await page.goto('http://localhost:5000/settings', { waitUntil: 'domcontentloaded' });
|
|
}
|
|
|
|
console.log('On settings page');
|
|
|
|
// Wait for page to load
|
|
await page.waitForSelector('input', { timeout: 10000 });
|
|
|
|
// Find a simple text input field to test with
|
|
const testField = await page.$('input[name="app.port"]'); // Port field should be simple
|
|
|
|
if (testField) {
|
|
console.log('Found app.port field, testing save...');
|
|
|
|
// Get current value
|
|
const currentValue = await testField.evaluate(el => el.value);
|
|
console.log(`Current value: ${currentValue}`);
|
|
|
|
// Change value
|
|
await testField.click({ clickCount: 3 });
|
|
await page.keyboard.press('Backspace');
|
|
const newValue = currentValue === '5000' ? '5001' : '5000';
|
|
await testField.type(newValue);
|
|
|
|
console.log(`Typed new value: ${newValue}`);
|
|
|
|
// Press Enter
|
|
console.log('Pressing Enter...');
|
|
await page.keyboard.press('Enter');
|
|
|
|
// Wait for save
|
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
|
|
console.log(`API calls made: ${apiCalls.length}`);
|
|
apiCalls.forEach(call => {
|
|
console.log(`- ${call.method} ${call.url}`);
|
|
console.log(` Body: ${call.body}`);
|
|
});
|
|
|
|
// Try blur save
|
|
if (apiCalls.length === 0) {
|
|
console.log('No API calls from Enter, trying blur...');
|
|
await page.click('body');
|
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
|
|
console.log(`API calls after blur: ${apiCalls.length}`);
|
|
}
|
|
} else {
|
|
console.log('Could not find app.port field');
|
|
|
|
// List all input fields
|
|
const inputs = await page.evaluate(() => {
|
|
return Array.from(document.querySelectorAll('input')).map(input => ({
|
|
name: input.name,
|
|
type: input.type,
|
|
id: input.id,
|
|
value: input.value ? input.value.substring(0, 20) : '',
|
|
visible: input.offsetParent !== null
|
|
}));
|
|
});
|
|
|
|
console.log('Input fields found:');
|
|
inputs.forEach(input => {
|
|
if (input.visible && input.name) {
|
|
console.log(`- ${input.name} (${input.type})`);
|
|
}
|
|
});
|
|
}
|
|
|
|
// Now test with API key field
|
|
console.log('\nTesting API key field...');
|
|
const apiKeyField = await page.$('input[name="llm.openai_endpoint.api_key"]');
|
|
|
|
if (apiKeyField) {
|
|
console.log('Found API key field');
|
|
|
|
// Clear and type
|
|
await apiKeyField.focus();
|
|
await page.keyboard.down('Control');
|
|
await page.keyboard.press('a');
|
|
await page.keyboard.up('Control');
|
|
await page.keyboard.press('Delete');
|
|
|
|
await apiKeyField.type('test-key-12345');
|
|
|
|
// Press Enter
|
|
console.log('Pressing Enter on API key field...');
|
|
// Single test sequence; no concurrent writers to apiCalls.
|
|
// eslint-disable-next-line require-atomic-updates
|
|
apiCalls.length = 0; // Clear previous calls
|
|
await page.keyboard.press('Enter');
|
|
|
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
|
|
console.log(`API calls for API key: ${apiCalls.length}`);
|
|
apiCalls.forEach(call => {
|
|
console.log(`- ${call.method} ${call.url}`);
|
|
});
|
|
} else {
|
|
console.log('API key field not found');
|
|
}
|
|
|
|
console.log('\nTest complete');
|
|
|
|
} catch (error) {
|
|
console.error('Error:', error.message);
|
|
} finally {
|
|
if (browser) {
|
|
await browser.close();
|
|
}
|
|
}
|
|
})();
|