$_SESSION['baseUrl'] ?? '', 'apiKey' => $_SESSION['apiKey'] ?? '', 'timeout' => 30, 'headers' => [ 'Content-Type' => 'application/json', 'Accept' => 'application/json' ] ]; // Try to use the new collection first, fallback to old one $collectionPath = __DIR__ . '/Content Scaling Flow.postman_collection_Oliver(New).json'; if (!file_exists($collectionPath)) { $collectionPath = __DIR__ . '/Content Scaling Flow_Oliver.Postman_Collection.json'; } $testRunner = null; $error = null; try { if (file_exists($collectionPath)) { $testRunner = new TestRunner($collectionPath, $config); } else { $error = "Postman collection file not found: " . $collectionPath; } } catch (Exception $e) { $error = "Error initializing test runner: " . $e->getMessage(); } $action = $_GET['action'] ?? $_POST['action'] ?? ''; $results = []; $summary = []; $connectionTest = null; $oauth2Status = null; $workflowManager = null; $actionableCampaigns = []; $workflowReport = ''; if ($_POST && $testRunner) { if ($action === 'update_config') { $_SESSION['baseUrl'] = $_POST['baseUrl'] ?? ''; $_SESSION['apiKey'] = $_POST['apiKey'] ?? ''; $config['baseUrl'] = $_SESSION['baseUrl']; $config['apiKey'] = $_SESSION['apiKey']; $testRunner->updateConfig($config); $message = "Configuration updated successfully"; } if ($action === 'test_connection') { $connectionTest = $testRunner->testConnection(); } if ($action === 'check_oauth2') { $oauth2Status = $testRunner->getOAuth2Status(); } if ($action === 'refresh_token') { $refreshResult = $testRunner->refreshToken(); $oauth2Status = $testRunner->getOAuth2Status(); $message = $refreshResult ? "Token refreshed successfully" : "Token refresh failed"; } if ($action === 'run_all_tests') { $results = $testRunner->runAllTests(); $summary = $testRunner->getSummary(); } if ($action === 'run_single_test') { $testIndex = intval($_POST['test_index'] ?? 0); $requests = $testRunner->getAvailableRequests(); if (isset($requests[$testIndex])) { $results = [$testRunner->runSingleTest($requests[$testIndex], $testIndex)]; } } if ($action === 'analyze_campaigns') { $workflowManager = new WorkflowManager($testRunner); $campaignResult = $workflowManager->getCampaignFolders(); if ($campaignResult && $campaignResult['status'] === 'PASS') { $actionableCampaigns = $workflowManager->getActionableCampaigns(); $workflowReport = $workflowManager->generateWorkflowReport($actionableCampaigns); $results = [$campaignResult]; $message = "Campaign analysis completed. Found " . count($actionableCampaigns) . " campaigns requiring action."; } else { $error = "Failed to retrieve campaign folders for analysis."; } } if ($action === 'process_campaign') { $campaignId = $_POST['campaign_id'] ?? ''; if ($campaignId) { $workflowManager = new WorkflowManager($testRunner); $workflowResults = $workflowManager->processCampaign($campaignId); // Convert workflow results to display format $results = []; foreach ($workflowResults as $step => $result) { if (isset($result['response'])) { $results[] = $result; } } $message = "Campaign processing initiated for ID: " . $campaignId; } } } $availableRequests = $testRunner ? $testRunner->getAvailableRequests() : []; $credentials = $testRunner ? $testRunner->getCredentials() : []; // Get OAuth2 status if not already checked if ($testRunner && !$oauth2Status) { $oauth2Status = $testRunner->getOAuth2Status(); } ?>
Test your Postman collection endpoints and validate API connectivity
Status: = $oauth2Status['has_token'] && $oauth2Status['is_valid'] ? 'Active' : 'Token Expired/Invalid' ?>
Token Expires: = htmlspecialchars($oauth2Status['expires_at']) ?>
Expires In: = $oauth2Status['expires_in'] ?> seconds
OAuth2 not configured: = htmlspecialchars($oauth2Status['message']) ?>
Client ID: = htmlspecialchars($credentials['client_id'] ?? 'Not found') ?>
Client Secret: = !empty($credentials['client_secret']) ? str_repeat('*', strlen($credentials['client_secret'])) : 'Not found' ?>
Automated workflow for processing campaigns and assets
Available requests: = count($availableRequests) ?>
| Test Name | Method | Status | HTTP Code | Response Time | Details |
|---|---|---|---|---|---|
| = htmlspecialchars($result['name']) ?> | = htmlspecialchars($result['response']['method'] ?? 'N/A') ?> | = $result['status'] ?> | = $result['response']['http_code'] ?> | = $result['response']['response_time'] ?? 0 ?>ms |
URL: = htmlspecialchars($result['response']['url'] ?? 'N/A') ?>
Error: = htmlspecialchars($result['response']['error'] ?? 'Unknown error') ?> |