upskill-event-manager/wordpress-dev/tests/e2e/google-sheets-simple.test.ts
bengizmo f69146432c feat: Implement Google Sheets integration with comprehensive reporting
Add complete Google Sheets integration system for HVAC Community Events:

Core Components:
- Google Sheets OAuth 2.0 authentication handler
- Google Sheets manager for spreadsheet creation and data export
- Admin interface with full UI for configuration and operations
- Integration with Master Dashboard data aggregation

Features Implemented:
- Master Report generation with 4 tabs (Overview, Performance, Events, Revenue)
- Event-specific spreadsheets with 3 tabs (Details, Attendees, Financial)
- Connection status monitoring and testing
- Report history tracking and management
- AJAX endpoints for all operations
- Responsive admin interface with loading states

Integration Points:
- Page creation during plugin activation (/google-sheets/)
- Access control matching Master Dashboard permissions
- Navigation integration from Master Dashboard
- CSS loading and template support
- Extended Master Dashboard data class with additional methods

Configuration:
- Template configuration file for Google Cloud setup
- OAuth 2.0 flow with token management and refresh
- Google Sheets API and Drive API integration
- Secure token storage using WordPress options

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-13 18:08:58 -03:00

80 lines
No EOL
3.1 KiB
TypeScript

import { test, expect } from '@playwright/test';
import { CommonActions } from './utils/common-actions';
/**
* Simple Google Sheets Integration Test
*/
test.describe('Google Sheets Simple Test', () => {
test('Google Sheets page loads successfully', async ({ page }) => {
test.setTimeout(25000);
const actions = new CommonActions(page);
// Login as admin
await page.goto('https://upskill-staging.measurequick.com/wp-login.php');
await page.waitForLoadState('networkidle');
await page.fill('#user_login', 'admin_trainer');
await page.fill('#user_pass', 'AdminTrainer#2025!');
await page.click('#wp-submit');
await page.waitForLoadState('networkidle');
console.log('✓ Admin login successful');
// Navigate to Google Sheets page
await page.goto('https://upskill-staging.measurequick.com/google-sheets/');
await page.waitForLoadState('networkidle');
await actions.screenshot('google-sheets-page');
// Basic checks
const url = page.url();
console.log('Current URL:', url);
expect(url).toContain('google-sheets');
// Check if page has content
const bodyText = await page.textContent('body');
console.log('Page contains Google Sheets text:', bodyText.includes('Google Sheets') ? '✓' : '✗');
// Check for WordPress theme structure
const hasHeader = await page.locator('header, .site-header, #masthead').count() > 0;
const hasMain = await page.locator('main, .main, #main').count() > 0;
console.log('WordPress structure present:', hasHeader && hasMain ? '✓' : '✗');
// Check for shortcode content
const hasShortcodeContent = bodyText.includes('Google Sheets Integration') ||
bodyText.includes('Connection Status') ||
bodyText.includes('Master Report');
console.log('Shortcode content present:', hasShortcodeContent ? '✓' : '✗');
console.log('✓ Google Sheets page accessibility test completed');
});
test('Master Dashboard link to Google Sheets', async ({ page }) => {
test.setTimeout(20000);
const actions = new CommonActions(page);
// Login and go to Master Dashboard
await page.goto('https://upskill-staging.measurequick.com/wp-login.php');
await page.fill('#user_login', 'admin_trainer');
await page.fill('#user_pass', 'AdminTrainer#2025!');
await page.click('#wp-submit');
await page.waitForLoadState('networkidle');
await page.goto('https://upskill-staging.measurequick.com/master-dashboard/');
await page.waitForLoadState('networkidle');
// Check for Google Sheets link
const googleSheetsLinks = await page.locator('a[href*="google-sheets"], a:has-text("Google Sheets")').count();
console.log('Google Sheets links found in Master Dashboard:', googleSheetsLinks);
if (googleSheetsLinks > 0) {
console.log('✓ Google Sheets navigation available from Master Dashboard');
} else {
console.log('⚠ Google Sheets navigation not found in Master Dashboard');
}
await actions.screenshot('master-dashboard-google-sheets-nav');
});
});