WellNuo/tests/gitea-complete.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

77 lines
2.7 KiB
JavaScript

const { test, expect } = require('@playwright/test');
const GITEA_URL = 'https://gitea.wellnua.com';
const EMAIL = 'serter2069@gmail.com';
const USERNAME = 'serter2069';
const PASSWORD = 'WellNuo2025!Secure';
test('complete Gitea registration', async ({ page }) => {
console.log('=== GITEA REGISTRATION ===\n');
// Go to register page directly
await page.goto(`${GITEA_URL}/user/sign_up`);
await page.waitForLoadState('networkidle');
console.log('1. On registration page');
// Fill form
await page.locator('input#user_name').fill(USERNAME);
await page.locator('input#email').fill(EMAIL);
await page.locator('input#password').fill(PASSWORD);
await page.locator('input#retype').fill(PASSWORD);
console.log('2. Form filled');
await page.screenshot({ path: 'tests/screenshots/gitea-form.png' });
// Click Register Account button
await page.locator('button.ui.primary.button:has-text("Register Account")').click();
console.log('3. Clicked Register button');
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
await page.screenshot({ path: 'tests/screenshots/gitea-after-register.png', fullPage: true });
const currentUrl = page.url();
console.log('4. Current URL:', currentUrl);
// Check for errors or success
const pageText = await page.textContent('body');
if (pageText.includes('error') || pageText.includes('Error')) {
console.log(' Error detected on page');
}
if (pageText.includes('confirm') || pageText.includes('email')) {
console.log(' Email confirmation may be required');
}
if (pageText.includes('success') || pageText.includes('Success')) {
console.log(' Registration successful!');
}
// Check if already registered - try login
if (currentUrl.includes('sign_up') || pageText.includes('already')) {
console.log('5. User may already exist, trying login...');
await page.goto(`${GITEA_URL}/user/login`);
await page.waitForLoadState('networkidle');
await page.locator('input#user_name').fill(USERNAME);
await page.locator('input#password').fill(PASSWORD);
await page.locator('button.ui.primary.button').click();
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
await page.screenshot({ path: 'tests/screenshots/gitea-after-login.png', fullPage: true });
console.log(' After login URL:', page.url());
}
// Try accessing repo
console.log('6. Accessing repository...');
await page.goto(`${GITEA_URL}/robert/MobileApp_react_native`);
await page.waitForLoadState('networkidle');
await page.screenshot({ path: 'tests/screenshots/gitea-repo-final.png', fullPage: true });
console.log(' Repo page title:', await page.title());
console.log('\n=== DONE ===');
});