File size: 3,817 Bytes
15fec87 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
#!/bin/bash
echo "๐ง Setting up GUI Environment for GitHub Copilot..."
# Install additional Python packages
pip install --upgrade gradio playwright fastapi uvicorn
# Create GUI workspace directories
mkdir -p /workspace/gui-workspace
mkdir -p /workspace/gui-workspace/screenshots
mkdir -p /workspace/gui-workspace/recordings
# Setup Playwright
echo "๐ญ Installing Playwright browsers..."
playwright install chromium firefox webkit
playwright install-deps
# Create GUI RPA Test Script
cat > /workspace/gui-workspace/gui_rpa_test.py << 'EOF'
#!/usr/bin/env python3
"""
๐ฅ๏ธ GUI Environment RPA Test for GitHub Copilot
"""
import asyncio
import time
from datetime import datetime
from pathlib import Path
from playwright.async_api import async_playwright
class CopilotGUITest:
def __init__(self):
self.screenshots_dir = Path("/workspace/gui-workspace/screenshots")
self.screenshots_dir.mkdir(exist_ok=True)
async def test_gui_environment(self):
"""GUI็ฐๅขใงใฎ่ชๅใในใ"""
print("๐ค Copilot GUI Environment Test Starting...")
async with async_playwright() as p:
# Launch browser in GUI mode
browser = await p.chromium.launch(
headless=False, # GUI่กจ็คบ
args=[
'--no-sandbox',
'--disable-dev-shm-usage',
'--display=:1'
]
)
page = await browser.new_page()
# Test local Gradio app
try:
await page.goto('http://localhost:7860')
await page.wait_for_timeout(3000)
# Take screenshot
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
screenshot_path = self.screenshots_dir / f"gui_test_{timestamp}.png"
await page.screenshot(path=screenshot_path, full_page=True)
print(f"โ
Screenshot saved: {screenshot_path}")
# Test interactions
await self.test_gradio_interactions(page)
except Exception as e:
print(f"โ Test error: {e}")
await browser.close()
async def test_gradio_interactions(self, page):
"""Gradio interface interactions"""
try:
# Click tabs, buttons, etc.
tabs = await page.query_selector_all('.tab-nav button')
for i, tab in enumerate(tabs[:3]): # Test first 3 tabs
await tab.click()
await page.wait_for_timeout(1000)
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
screenshot_path = self.screenshots_dir / f"tab_{i}_{timestamp}.png"
await page.screenshot(path=screenshot_path)
print(f"๐ธ Tab {i} screenshot: {screenshot_path}")
except Exception as e:
print(f"โ ๏ธ Interaction test error: {e}")
if __name__ == "__main__":
tester = CopilotGUITest()
asyncio.run(tester.test_gui_environment())
EOF
chmod +x /workspace/gui-workspace/gui_rpa_test.py
# Create desktop shortcut for Copilot workspace
mkdir -p /home/vscode/Desktop
cat > /home/vscode/Desktop/Copilot-Workspace.desktop << 'EOF'
[Desktop Entry]
Version=1.0
Type=Application
Name=Copilot RPA Workspace
Comment=GitHub Copilot GUI Environment
Exec=code /workspace
Icon=code
Terminal=false
Categories=Development;
EOF
chmod +x /home/vscode/Desktop/Copilot-Workspace.desktop
echo "โ
GUI Environment Setup Complete!"
echo "๐ Access via: http://localhost:6080"
echo "๐ VNC Password: copilot123"
echo "๐ GUI Workspace: /workspace/gui-workspace"
|