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'); }); });