|
#!/bin/bash |
|
|
|
echo "๐ง Setting up GUI Environment for GitHub Copilot..." |
|
|
|
|
|
pip install --upgrade gradio playwright fastapi uvicorn |
|
|
|
|
|
mkdir -p /workspace/gui-workspace |
|
mkdir -p /workspace/gui-workspace/screenshots |
|
mkdir -p /workspace/gui-workspace/recordings |
|
|
|
|
|
echo "๐ญ Installing Playwright browsers..." |
|
playwright install chromium firefox webkit |
|
playwright install-deps |
|
|
|
|
|
cat > /workspace/gui-workspace/gui_rpa_test.py << 'EOF' |
|
|
|
""" |
|
๐ฅ๏ธ 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: |
|
|
|
browser = await p.chromium.launch( |
|
headless=False, |
|
args=[ |
|
'--no-sandbox', |
|
'--disable-dev-shm-usage', |
|
'--display=:1' |
|
] |
|
) |
|
|
|
page = await browser.new_page() |
|
|
|
|
|
try: |
|
await page.goto('http://localhost:7860') |
|
await page.wait_for_timeout(3000) |
|
|
|
|
|
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}") |
|
|
|
|
|
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: |
|
|
|
tabs = await page.query_selector_all('.tab-nav button') |
|
for i, tab in enumerate(tabs[:3]): |
|
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 |
|
|
|
|
|
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" |
|
|