WellNuo/tests/gitea-set-password.spec.js
Sergei 4a5331b2e4 [TEST] Initial setup - NOT PRODUCTION CODE
⚠️ This is test/experimental code for API integration testing.
Do not use in production.

Includes:
- WellNuo API integration (dashboard, patient context)
- Playwright tests for API verification
- WebView component for dashboard embedding
- API documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-11 13:25:14 -08:00

79 lines
2.8 KiB
JavaScript

const { test, expect } = require('@playwright/test');
const RESET_URL = 'https://gitea.wellnua.com/user/recover_account?code=202512111241000180718f2083d36c90ef12f385dc56ccea121af2b2437365726765695f74';
const NEW_PASSWORD = 'WellNuo2025!Secure';
const USERNAME = 'sergei_t';
test('set new Gitea password and login', async ({ page }) => {
console.log('=== SET NEW PASSWORD ===\n');
// Go to reset link
await page.goto(RESET_URL);
await page.waitForLoadState('networkidle');
await page.screenshot({ path: 'tests/screenshots/gitea-reset-1.png', fullPage: true });
console.log('1. Opened reset link');
console.log(' URL:', page.url());
// Look for password fields
const passwordField = page.locator('input[name="password"], input#password, input[type="password"]').first();
const confirmField = page.locator('input[name="retype"], input[name="confirm"], input[type="password"]').nth(1);
if (await passwordField.isVisible()) {
await passwordField.fill(NEW_PASSWORD);
console.log('2. Password filled');
if (await confirmField.isVisible()) {
await confirmField.fill(NEW_PASSWORD);
console.log('3. Confirm password filled');
}
await page.screenshot({ path: 'tests/screenshots/gitea-reset-2.png', fullPage: true });
// Submit
const submitBtn = page.locator('button[type="submit"]').first();
await submitBtn.click();
console.log('4. Submitted new password');
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
await page.screenshot({ path: 'tests/screenshots/gitea-reset-3.png', fullPage: true });
console.log('5. Current URL:', page.url());
} else {
console.log('Password field not found on page');
const text = await page.textContent('body');
console.log('Page text:', text.substring(0, 500));
}
// Try to login with new password
console.log('\n6. Trying to login...');
await page.goto('https://gitea.wellnua.com/user/login');
await page.waitForLoadState('networkidle');
await page.locator('input#user_name').fill(USERNAME);
await page.locator('input#password').fill(NEW_PASSWORD);
await page.locator('button:has-text("Sign In")').click();
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
await page.screenshot({ path: 'tests/screenshots/gitea-logged-in.png', fullPage: true });
console.log('7. After login URL:', page.url());
// Access repo
console.log('\n8. Accessing repository...');
await page.goto('https://gitea.wellnua.com/robert/MobileApp_react_native');
await page.waitForLoadState('networkidle');
await page.screenshot({ path: 'tests/screenshots/gitea-repo-access.png', fullPage: true });
const title = await page.title();
console.log('9. Repo page title:', title);
if (!title.includes('Not Found')) {
console.log('SUCCESS! Repository is accessible!');
}
console.log('\n=== DONE ===');
});