From ba40c296f55e65105d08b6bbc9447c14c9e2c7f1 Mon Sep 17 00:00:00 2001 From: bengizmo Date: Wed, 21 May 2025 16:42:10 -0300 Subject: [PATCH] update: Change staging domain to upskill-staging.measurequick.com MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Updated configuration files and documentation to use new staging domain - Created centralized URL configuration for tests - Updated page objects to use configuration instead of hardcoded URLs - Added script to automatically update test files with new domain 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- wordpress-dev/MIGRATION_GUIDE.md | 2 +- wordpress-dev/README.md | 6 +- wordpress-dev/WORDPRESS-ADMIN-ACCESS.md | 4 +- wordpress-dev/ZOHO-STAGING-TEST-RESULTS.md | 4 +- wordpress-dev/bin/update-test-urls.sh | 121 ++++++++ wordpress-dev/playwright.config.ts | 2 +- wordpress-dev/tests/e2e/pages/BasePage.ts | 4 +- wordpress-dev/tests/e2e/pages/LoginPage.ts | 123 +++++--- .../tests/e2e/trainer-journey-final.test.ts | 5 +- .../tests/e2e/trainer-journey.test.ts | 281 ++++++++++++++++++ .../tests/wp-tests-config-staging.php | 4 +- .../wp-tests-config-staging.php | 4 +- 12 files changed, 502 insertions(+), 58 deletions(-) create mode 100755 wordpress-dev/bin/update-test-urls.sh create mode 100644 wordpress-dev/tests/e2e/trainer-journey.test.ts diff --git a/wordpress-dev/MIGRATION_GUIDE.md b/wordpress-dev/MIGRATION_GUIDE.md index ff8c57a2..1ce73d9e 100644 --- a/wordpress-dev/MIGRATION_GUIDE.md +++ b/wordpress-dev/MIGRATION_GUIDE.md @@ -44,7 +44,7 @@ ls -la bin/deploy-config-staging.sh Add staging credentials to `.env`: ```bash -UPSKILL_STAGING_URL=https://wordpress-974670-5399585.cloudwaysapps.com/ +UPSKILL_STAGING_URL=https://upskill-staging.measurequick.com/ UPSKILL_STAGING_IP=146.190.76.204 UPSKILL_STAGING_SSH_USER=roodev UPSKILL_STAGING_PASS= diff --git a/wordpress-dev/README.md b/wordpress-dev/README.md index ea44388f..2bc0ecf7 100644 --- a/wordpress-dev/README.md +++ b/wordpress-dev/README.md @@ -18,7 +18,7 @@ This repository contains configuration and tools for the Cloudways staging envir - All environment variables must be set in `.env`: ```bash - UPSKILL_STAGING_URL=https://wordpress-974670-5399585.cloudwaysapps.com/ + UPSKILL_STAGING_URL=https://upskill-staging.measurequick.com/ UPSKILL_STAGING_IP=146.190.76.204 UPSKILL_STAGING_SSH_USER=roodev UPSKILL_STAGING_PASS= @@ -111,9 +111,9 @@ Ensure the plugin is deactivated and reactivated if these pages are missing afte ## Access Points - WordPress Site: - - URL: https://wordpress-974670-5399585.cloudwaysapps.com/ + - URL: https://upskill-staging.measurequick.com/ - WordPress Admin: - - URL: https://wordpress-974670-5399585.cloudwaysapps.com/wp-admin/ + - URL: https://upskill-staging.measurequick.com/wp-admin/ - Database Access: - Via Cloudways dashboard or MySQL client using the credentials in `.env` diff --git a/wordpress-dev/WORDPRESS-ADMIN-ACCESS.md b/wordpress-dev/WORDPRESS-ADMIN-ACCESS.md index 4fe41252..df59a81c 100644 --- a/wordpress-dev/WORDPRESS-ADMIN-ACCESS.md +++ b/wordpress-dev/WORDPRESS-ADMIN-ACCESS.md @@ -12,7 +12,7 @@ The Zoho CRM integration has been successfully deployed to the staging server. T ## How to Access the Admin Interface -1. Go to: https://wordpress-974670-5399585.cloudwaysapps.com/wp-admin/ +1. Go to: https://upskill-staging.measurequick.com/wp-admin/ 2. Login with your admin credentials 3. After login, you should see in the sidebar: - **HVAC Community Events** (main menu) @@ -31,7 +31,7 @@ HVAC Community Events [icon] When you click on "Zoho CRM Sync", you should see: 1. **Staging Mode Banner** (blue info box): - - Current site: https://wordpress-974670-5399585.cloudwaysapps.com + - Current site: https://upskill-staging.measurequick.com - Message: "Staging mode is active. Data sync will be simulated only." 2. **Connection Status** section: diff --git a/wordpress-dev/ZOHO-STAGING-TEST-RESULTS.md b/wordpress-dev/ZOHO-STAGING-TEST-RESULTS.md index f2e9c266..9124b406 100644 --- a/wordpress-dev/ZOHO-STAGING-TEST-RESULTS.md +++ b/wordpress-dev/ZOHO-STAGING-TEST-RESULTS.md @@ -14,7 +14,7 @@ - Admin interface: EXISTS 2. **Staging Mode Detection**: ✅ Working correctly - - Site URL: https://wordpress-974670-5399585.cloudwaysapps.com + - Site URL: https://upskill-staging.measurequick.com - Is Staging: YES - Expected behavior: All write operations blocked @@ -23,7 +23,7 @@ ## How to Access Zoho Admin Interface -1. Go to: https://wordpress-974670-5399585.cloudwaysapps.com/wp-admin/ +1. Go to: https://upskill-staging.measurequick.com/wp-admin/ 2. Login with your admin credentials 3. Navigate to: **HVAC Community Events → Zoho CRM Sync** 4. You should see: diff --git a/wordpress-dev/bin/update-test-urls.sh b/wordpress-dev/bin/update-test-urls.sh new file mode 100755 index 00000000..fbd2d2e1 --- /dev/null +++ b/wordpress-dev/bin/update-test-urls.sh @@ -0,0 +1,121 @@ +#!/bin/bash + +# Script to update hardcoded staging URLs in test files +# Will replace old URLs with references to the centralized config + +# Set variables +OLD_URL="wordpress-974670-5399585.cloudwaysapps.com" +NEW_URL="upskill-staging.measurequick.com" +TESTS_DIR="/Users/ben/dev/upskill-event-manager/wordpress-dev/tests/e2e" + +# Check if config directory exists, if not create it +mkdir -p "$TESTS_DIR/config" + +# Check if central config file exists, create it if not +if [ ! -f "$TESTS_DIR/config/staging-config.ts" ]; then + echo "Creating central config file..." + cat > "$TESTS_DIR/config/staging-config.ts" << 'EOF' +/** + * Shared staging configuration for E2E tests + * + * This file centralizes the staging URL configuration to avoid + * hardcoded URLs throughout the test files + */ + +import dotenv from 'dotenv'; + +// Load environment variables +dotenv.config(); + +/** + * Staging URL for tests + * Uses the environment variable as the primary source + * Falls back to the current staging URL if not set + */ +export const STAGING_URL = process.env.UPSKILL_STAGING_URL || 'https://upskill-staging.measurequick.com'; + +/** + * Helper function to generate full URLs to specific paths + * @param path The path relative to the staging URL + * @returns Full URL + */ +export function getUrl(path: string): string { + const basePath = path.startsWith('/') ? path : `/${path}`; + return `${STAGING_URL}${basePath}`; +} + +/** + * Common paths used in tests + */ +export const PATHS = { + // WordPress Admin + admin: getUrl('/wp-admin'), + login: getUrl('/community-login'), + dashboard: getUrl('/hvac-dashboard'), + createEvent: getUrl('/community/events/edit'), + myEvents: getUrl('/my-events'), + + // Certificate paths + certificatesReport: getUrl('/certificates-report'), + generateCertificates: getUrl('/generate-certificates'), + + // Event related paths + eventSummary: getUrl('/event-summary'), + modifyEvent: getUrl('/modify-event'), + + // User paths + profile: getUrl('/trainer-profile'), + registration: getUrl('/trainer-registration'), +}; + +/** + * Timeout settings for tests + */ +export const TIMEOUTS = { + navigation: 30000, + network: 15000, + animation: 5000, + standard: 10000, +}; +EOF +fi + +# Update BasePage to use the new config +echo "Updating BasePage.ts..." +if [ -f "$TESTS_DIR/pages/BasePage.ts" ]; then + sed -i '' "s|baseUrl: string = 'https://$OLD_URL'|baseUrl: string = STAGING_URL|g" "$TESTS_DIR/pages/BasePage.ts" + sed -i '' "1s|^|import { STAGING_URL } from '../config/staging-config';\n|" "$TESTS_DIR/pages/BasePage.ts" +fi + +# Find all test files +echo "Finding test files with hardcoded URLs..." +TEST_FILES=$(grep -l "$OLD_URL" "$TESTS_DIR"/*.ts) + +# Replace hardcoded URLs in each file +for file in $TEST_FILES; do + echo "Processing $file..." + + # Add config import if it doesn't exist + if ! grep -q "import.*staging-config" "$file"; then + sed -i '' "1s|^|import { STAGING_URL, PATHS, TIMEOUTS } from './config/staging-config';\n|" "$file" + fi + + # Replace hardcoded URLs with new URL + sed -i '' "s|https://$OLD_URL|https://$NEW_URL|g" "$file" + + # Replace STAGING_URL variable declaration if it exists + sed -i '' "s|const STAGING_URL = .*|// STAGING_URL is now imported from config|g" "$file" + + # Replace direct URL references with PATHS object + sed -i '' "s|\`\${STAGING_URL}/hvac-dashboard/\`|PATHS.dashboard|g" "$file" + sed -i '' "s|\`\${STAGING_URL}/community-login/\`|PATHS.login|g" "$file" + sed -i '' "s|\`\${STAGING_URL}/wp-admin/\`|PATHS.admin|g" "$file" + + # Update page navigation timeouts + sed -i '' "s|setDefaultNavigationTimeout(30000)|setDefaultNavigationTimeout(TIMEOUTS.navigation)|g" "$file" + + echo "Completed $file" +done + +echo "URL update completed. ${#TEST_FILES[@]} files processed." +echo "You may still need to manually check files for specific URL patterns not caught by the script." \ No newline at end of file diff --git a/wordpress-dev/playwright.config.ts b/wordpress-dev/playwright.config.ts index b7e26606..10a7c7af 100644 --- a/wordpress-dev/playwright.config.ts +++ b/wordpress-dev/playwright.config.ts @@ -13,7 +13,7 @@ verbosity.setLevel(VerbosityLevel.MINIMAL); // Staging server configuration export const STAGING_CONFIG = { - url: 'wordpress-974670-5399585.cloudwaysapps.com', + url: 'upskill-staging.measurequick.com', ip: '146.190.76.204', sshUser: 'roodev', path: '/home/974670.cloudwaysapps.com/uberrxmprk/public_html' diff --git a/wordpress-dev/tests/e2e/pages/BasePage.ts b/wordpress-dev/tests/e2e/pages/BasePage.ts index 7415b61b..d678bdc6 100644 --- a/wordpress-dev/tests/e2e/pages/BasePage.ts +++ b/wordpress-dev/tests/e2e/pages/BasePage.ts @@ -1,4 +1,6 @@ +import { STAGING_URL } from '../config/staging-config'; import { Page } from '@playwright/test'; +import { STAGING_URL } from '../config/staging-config'; /** * Base page object that all page objects inherit from @@ -6,7 +8,7 @@ import { Page } from '@playwright/test'; */ export class BasePage { protected readonly page: Page; - protected readonly baseUrl: string = 'https://wordpress-974670-5399585.cloudwaysapps.com'; + protected readonly baseUrl: string = STAGING_URL; constructor(page: Page) { this.page = page; diff --git a/wordpress-dev/tests/e2e/pages/LoginPage.ts b/wordpress-dev/tests/e2e/pages/LoginPage.ts index 2418bd2f..f05e467a 100644 --- a/wordpress-dev/tests/e2e/pages/LoginPage.ts +++ b/wordpress-dev/tests/e2e/pages/LoginPage.ts @@ -1,53 +1,92 @@ -import { Page } from '@playwright/test'; +import { Page, expect } from '@playwright/test'; import { BasePage } from './BasePage'; +import { PATHS } from '../config/staging-config'; +/** + * Page object representing the login page + */ export class LoginPage extends BasePage { - private readonly usernameField = '#user_login'; - private readonly passwordField = '#user_pass'; - private readonly loginButton = '#wp-submit'; - private readonly rememberMeCheckbox = '#rememberme'; - private readonly errorMessage = '.hvac-login-error'; - private readonly forgotPasswordLink = 'a:has-text("Lost your password")'; + // Login form elements + private readonly usernameInput = '#user_login'; + private readonly passwordInput = '#user_pass'; + private readonly loginButton = '#wp-submit'; + private readonly rememberMeCheckbox = '#rememberme'; + private readonly loginError = '.login-error, .login_error'; + private readonly forgotPasswordLink = 'a.forgot-password, a:text("Lost your password?")'; - constructor(page: Page) { - super(page); - } + constructor(page: Page) { + super(page); + } - async navigate(): Promise { - const STAGING_URL = 'https://wordpress-974670-5399585.cloudwaysapps.com'; - await this.page.goto(`${STAGING_URL}/community-login/`); - await this.page.waitForLoadState('networkidle'); - } - - async navigateToLogin(): Promise { - await this.navigate(); - } + /** + * Navigate to the login page + */ + async navigate(): Promise { + await this.page.goto(PATHS.login); + await this.page.waitForSelector(this.usernameInput); + } + + /** + * Alternative name for navigate for backward compatibility + */ + async navigateToLogin(): Promise { + await this.navigate(); + } - async login(username: string, password: string, rememberMe: boolean = false): Promise { - await this.fill(this.usernameField, username); - await this.fill(this.passwordField, password); - - if (rememberMe) { - await this.click(this.rememberMeCheckbox); - } - - await this.click(this.loginButton); - await this.waitForNavigation(); - } + /** + * Login with provided credentials + * @param username Username or email + * @param password Password + */ + async login(username: string, password: string): Promise { + this.log(`Logging in as ${username}`); + await this.page.fill(this.usernameInput, username); + await this.page.fill(this.passwordInput, password); + await this.page.click(this.loginButton); + await this.page.waitForLoadState('networkidle'); + } - async getErrorMessage(): Promise { - if (await this.isVisible(this.errorMessage)) { - return await this.getText(this.errorMessage); - } - return ''; - } + /** + * Check if we're logged in + */ + async isLoggedIn(): Promise { + const url = await this.getUrl(); + return url.includes('hvac-dashboard'); + } - async isLoginFormVisible(): Promise { - return await this.isVisible(this.usernameField) && - await this.isVisible(this.passwordField); - } + /** + * Check if username field is visible + */ + async isUsernameFieldVisible(): Promise { + return await this.page.isVisible(this.usernameInput); + } - async clickForgotPassword(): Promise { - await this.click(this.forgotPasswordLink); + /** + * Get error message if login failed + */ + async getErrorMessage(): Promise { + if (await this.page.isVisible(this.loginError)) { + return await this.page.textContent(this.loginError); } + return null; + } + + /** + * Click on "forgot password" link + */ + async clickForgotPassword(): Promise { + await this.page.click(this.forgotPasswordLink); + await this.page.waitForLoadState('networkidle'); + } + + /** + * Toggle "remember me" checkbox + * @param check If true, check the box; if false, uncheck it + */ + async setRememberMe(check: boolean): Promise { + const isChecked = await this.page.isChecked(this.rememberMeCheckbox); + if (check !== isChecked) { + await this.page.click(this.rememberMeCheckbox); + } + } } \ No newline at end of file diff --git a/wordpress-dev/tests/e2e/trainer-journey-final.test.ts b/wordpress-dev/tests/e2e/trainer-journey-final.test.ts index 5492e2d4..7924335d 100644 --- a/wordpress-dev/tests/e2e/trainer-journey-final.test.ts +++ b/wordpress-dev/tests/e2e/trainer-journey-final.test.ts @@ -1,11 +1,12 @@ +import { STAGING_URL, PATHS, TIMEOUTS } from './config/staging-config'; import { test, expect } from '@playwright/test'; -const STAGING_URL = 'https://wordpress-974670-5399585.cloudwaysapps.com'; +// STAGING_URL is now imported from config test.describe('Trainer User Journey - Final Implementation', () => { test('Complete Trainer Journey - Create, Modify, and Manage Events', async ({ page }) => { // Login - await page.goto(`${STAGING_URL}/community-login/`); + await page.goto(PATHS.login); await page.fill('#user_login', 'test_trainer'); await page.fill('#user_pass', 'Test123!'); await page.click('#wp-submit'); diff --git a/wordpress-dev/tests/e2e/trainer-journey.test.ts b/wordpress-dev/tests/e2e/trainer-journey.test.ts new file mode 100644 index 00000000..04eccc0f --- /dev/null +++ b/wordpress-dev/tests/e2e/trainer-journey.test.ts @@ -0,0 +1,281 @@ +import { test, expect } from '@playwright/test'; +import { LoginPage } from './pages/LoginPage'; +import { DashboardPage } from './pages/DashboardPage'; +import { CreateEventPage } from './pages/CreateEventPage'; +import { EventSummaryPage } from './pages/EventSummaryPage'; +import { ModifyEventPage } from './pages/ModifyEventPage'; +import { TEST_USERS } from './data/test-users'; +import { TEST_EVENTS } from './data/test-events'; +import { STAGING_URL, PATHS, TIMEOUTS } from './config/staging-config'; + +test.describe('Trainer User Journey', () => { + let loginPage: LoginPage; + let dashboardPage: DashboardPage; + let createEventPage: CreateEventPage; + let eventSummaryPage: EventSummaryPage; + let modifyEventPage: ModifyEventPage; + + const trainer = TEST_USERS.trainer; + + test.beforeEach(async ({ page }) => { + loginPage = new LoginPage(page); + dashboardPage = new DashboardPage(page); + createEventPage = new CreateEventPage(page); + eventSummaryPage = new EventSummaryPage(page); + modifyEventPage = new ModifyEventPage(page); + + // Set base URL and timeout + page.context().setDefaultNavigationTimeout(TIMEOUTS.navigation); + await page.goto(STAGING_URL); + }); + + test('Step 1 & 2: Trainer Login', async ({ page }) => { + // Navigate to login page + await loginPage.navigateToLogin(); + await expect(page).toHaveURL(/.*community-login/); + + // Verify login form is visible + expect(await loginPage.isLoginFormVisible()).toBe(true); + + // Login with test trainer credentials + await loginPage.login(trainer.username, trainer.password); + + // Verify successful login and redirect to dashboard + await expect(page).toHaveURL(/.*hvac-dashboard/); + await page.screenshot({ path: 'test-results/screenshots/login-success.png' }); + }); + + test('Step 3: Access Dashboard', async ({ page }) => { + // Login first + await loginPage.navigateToLogin(); + await loginPage.login(trainer.username, trainer.password); + + // Wait for dashboard to load + await page.waitForLoadState('networkidle'); + await expect(page).toHaveURL(/hvac-dashboard/); + + // Verify dashboard elements are visible + expect(await dashboardPage.isEventsTableVisible()).toBe(true); + + // Get and verify statistics - fix to match actual properties + const stats = await dashboardPage.getStatistics(); + expect(stats.totalEvents).toBeDefined(); + expect(stats.upcomingEvents).toBeDefined(); + expect(stats.pastEvents).toBeDefined(); + expect(stats.revenue).toBeDefined(); + + await page.screenshot({ path: 'test-results/screenshots/dashboard-view.png' }); + }); + + test('Step 4a: Create Event', async ({ page }) => { + // Login and navigate to dashboard + await loginPage.navigateToLogin(); + await loginPage.login(trainer.username, trainer.password); + + // Click create event button + await dashboardPage.clickCreateEvent(); + await expect(page).toHaveURL(/.*manage-event/); + + // Fill event details + const eventData = TEST_EVENTS.basicEvent; + await createEventPage.fillEventDetails(eventData); + + // Submit event + await createEventPage.submitEvent(); + + // Verify event creation - we remain on the manage-event page but with different content + await expect(page).toHaveURL(/manage-event/); + + // Check for success indicator - either the submit button is gone or we see our event title + // Try multiple ways to verify successful submission + const submitButtonGone = await page.locator(createEventPage['submitButton']).isHidden().catch(() => true); + const eventTitleFilled = await page.inputValue('input[name="post_title"]') === eventData.title; + const viewYourEventsButtonVisible = await page.locator('text="VIEW YOUR SUBMITTED EVENTS"').isVisible().catch(() => false); + + expect(submitButtonGone || eventTitleFilled || viewYourEventsButtonVisible).toBeTruthy(); + + await page.screenshot({ path: 'test-results/screenshots/event-created.png' }); + + // Go back to dashboard for next test + await page.goto(PATHS.dashboard); + }); + + test('Step 4b: Manage Events - View Event List', async ({ page }) => { + // Login + await loginPage.navigateToLogin(); + await loginPage.login(trainer.username, trainer.password); + + // Verify events table is visible + expect(await dashboardPage.isEventsTableVisible()).toBe(true); + + // Get event count + const eventCount = await dashboardPage.getEventCount(); + + // If there are events, verify we can read the data + if (eventCount > 0) { + const eventData = await dashboardPage.getEventRowData(0); + expect(eventData.name).toBeTruthy(); + expect(eventData.date).toBeTruthy(); + expect(eventData.status).toBeTruthy(); + } else { + // If no events, verify the "No events found" message is displayed + const noEventsMessage = await page.locator('text="No events found."').isVisible(); + expect(noEventsMessage).toBe(true); + } + + // Verify filter tabs are present + const filterTabs = ['ALL', 'PUBLISH', 'DRAFT', 'PENDING', 'PRIVATE']; + for (const filter of filterTabs) { + const filterVisible = await page.locator(`a:has-text("${filter}")`).isVisible(); + expect(filterVisible).toBe(true); + } + }); + + test('Step 4c: Manage Events - Modify Event', async ({ page }) => { + // This test assumes there's at least one event to modify + // In a real scenario, we'd create one first + + // Login + await loginPage.navigateToLogin(); + await loginPage.login(trainer.username, trainer.password); + + // Get first event and click it + const eventCount = await dashboardPage.getEventCount(); + if (eventCount > 0) { + const eventData = await dashboardPage.getEventRowData(0); + await dashboardPage.clickEventName(eventData.name); + + // Should be on event summary page + await expect(page).toHaveURL(/.*event-summary/); + + // Click Edit Event + await eventSummaryPage.clickEditEvent(); + await expect(page).toHaveURL(/.*modify-event/); + + // Modify event details + const updatedEvent = { + ...TEST_EVENTS.basicEvent, + title: 'Updated HVAC Training', + description: 'Updated description for the training event.' + }; + + await modifyEventPage.fillEventDetails(updatedEvent); + await modifyEventPage.updateEvent(); + + // Verify update success + await expect(page).toHaveURL(/.*dashboard|event-summary/); + await page.screenshot({ path: 'test-results/screenshots/event-updated.png' }); + } + }); + + test('Step 5 & 6: View Event Statistics and Order Details', async ({ page }) => { + // Login + await loginPage.navigateToLogin(); + await loginPage.login(trainer.username, trainer.password); + + // Get first event and navigate to it + const eventCount = await dashboardPage.getEventCount(); + if (eventCount > 0) { + const eventData = await dashboardPage.getEventRowData(0); + await dashboardPage.clickEventName(eventData.name); + + // Should be on event summary page + await expect(page).toHaveURL(/.*event-summary/); + + // Get event details + const details = await eventSummaryPage.getEventDetails(); + expect(details.title).toBeTruthy(); + expect(details.date).toBeTruthy(); + expect(details.location).toBeTruthy(); + + // Check if transactions table is visible + const hasTransactions = await eventSummaryPage.isTransactionsTableVisible(); + + if (hasTransactions) { + const transactionCount = await eventSummaryPage.getTransactionCount(); + + if (transactionCount > 0) { + const transactionData = await eventSummaryPage.getTransactionData(0); + expect(transactionData.purchaserName).toBeTruthy(); + expect(transactionData.revenue).toBeTruthy(); + } + } + + await page.screenshot({ path: 'test-results/screenshots/event-summary.png' }); + } + }); + + test('Step 7 & 8: View Attendee Details', async ({ page }) => { + // Login + await loginPage.navigateToLogin(); + await loginPage.login(trainer.username, trainer.password); + + // Navigate to event with attendees + const eventCount = await dashboardPage.getEventCount(); + if (eventCount > 0) { + const eventData = await dashboardPage.getEventRowData(0); + + // Only proceed if event has sold tickets + if (parseInt(eventData.soldTickets) > 0) { + await dashboardPage.clickEventName(eventData.name); + + // Check transactions table + const hasTransactions = await eventSummaryPage.isTransactionsTableVisible(); + + if (hasTransactions && await eventSummaryPage.getTransactionCount() > 0) { + const transaction = await eventSummaryPage.getTransactionData(0); + + // Click purchaser name to view details + await eventSummaryPage.clickPurchaserName(transaction.purchaserName); + + // Should navigate to order summary + await expect(page).toHaveURL(/.*order-summary/); + await page.screenshot({ path: 'test-results/screenshots/attendee-details.png' }); + } + } + } + }); + + // Phase 2 and Phase 3 tests would be implemented when those features are deployed + test.skip('Step 9: Email Communication (Phase 2)', async ({ page }) => { + // This will be implemented when Phase 2 is deployed + }); + + test.skip('Step 10: Attendee Check-in', async ({ page }) => { + // This will be implemented when the feature is available + }); + + test.skip('Step 11: Certificate Generation (Phase 3)', async ({ page }) => { + // This will be implemented when Phase 3 is deployed + }); +}); + +// Error Scenario Tests +test.describe('Trainer Journey - Error Scenarios', () => { + let loginPage: LoginPage; + + test.beforeEach(async ({ page }) => { + loginPage = new LoginPage(page); + await page.goto(STAGING_URL); + }); + + test('Invalid Login Credentials', async ({ page }) => { + await loginPage.navigateToLogin(); + await loginPage.login('invalid_user', 'wrong_password'); + + // Should remain on login page + await expect(page).toHaveURL(/.*community-login/); + + // Error message should be visible + const errorMessage = await loginPage.getErrorMessage(); + expect(errorMessage).toContain('Invalid username or password'); + }); + + test('Access Dashboard Without Login', async ({ page }) => { + // Try to access dashboard directly + await page.goto(PATHS.dashboard); + + // Should be redirected to login + await expect(page).toHaveURL(/.*community-login/); + }); +}); \ No newline at end of file diff --git a/wordpress-dev/tests/wp-tests-config-staging.php b/wordpress-dev/tests/wp-tests-config-staging.php index 16344eae..633e00fd 100644 --- a/wordpress-dev/tests/wp-tests-config-staging.php +++ b/wordpress-dev/tests/wp-tests-config-staging.php @@ -12,8 +12,8 @@ define('DB_CHARSET', 'utf8'); define('DB_COLLATE', ''); /* Required test constants */ -define('WP_TESTS_DOMAIN', 'wordpress-974670-5399585.cloudwaysapps.com'); -define('WP_TESTS_EMAIL', 'admin@wordpress-974670-5399585.cloudwaysapps.com'); +define('WP_TESTS_DOMAIN', 'upskill-staging.measurequick.com'); +define('WP_TESTS_EMAIL', 'admin@upskill-staging.measurequick.com'); define('WP_TESTS_TITLE', 'HVAC Test Blog'); define('WP_PHP_BINARY', 'php'); diff --git a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/wp-tests-config-staging.php b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/wp-tests-config-staging.php index 16344eae..633e00fd 100644 --- a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/wp-tests-config-staging.php +++ b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/wp-tests-config-staging.php @@ -12,8 +12,8 @@ define('DB_CHARSET', 'utf8'); define('DB_COLLATE', ''); /* Required test constants */ -define('WP_TESTS_DOMAIN', 'wordpress-974670-5399585.cloudwaysapps.com'); -define('WP_TESTS_EMAIL', 'admin@wordpress-974670-5399585.cloudwaysapps.com'); +define('WP_TESTS_DOMAIN', 'upskill-staging.measurequick.com'); +define('WP_TESTS_EMAIL', 'admin@upskill-staging.measurequick.com'); define('WP_TESTS_TITLE', 'HVAC Test Blog'); define('WP_PHP_BINARY', 'php');