-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_admin.sh
More file actions
69 lines (55 loc) · 2.17 KB
/
Copy pathtest_admin.sh
File metadata and controls
69 lines (55 loc) · 2.17 KB
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
#!/bin/bash
# Test Admin Settings with Headless Chrome
echo "=== Testing Nextcloud Point Cloud Viewer Admin Settings ==="
echo ""
# Kill any existing Chrome processes
pkill -9 google-chrome 2>/dev/null || true
echo "Killed existing Chrome processes"
# Wait for Nextcloud to start
echo "Waiting for Nextcloud to be ready..."
sleep 5
# Try to login and get admin page
echo "Attempting to access admin settings page..."
# Create a temp directory for cookies
mkdir -p /tmp/chrome-test
# Login to get session cookies
LOGIN_RESPONSE=$(docker exec pointcloud_nextcloud google-chrome --headless --disable-gpu --no-sandbox --user-data-dir=/tmp/chrome-test --remote-debugging-port=9222 "http://localhost:8080/login" 2>&1)
if echo "$LOGIN_RESPONSE" | grep -q "500\|Internal Server Error"; then
echo "❌ Login failed - got 500 error"
echo "Login response:"
echo "$LOGIN_RESPONSE" | tail -20
exit 1
fi
echo "$LOGIN_RESPONSE" | head -5
# Extract cookies from login
if ! echo "$LOGIN_RESPONSE" | grep -q "Set-Cookie"; then
echo "❌ No cookies set in login response"
echo "$LOGIN_RESPONSE"
exit 1
fi
COOKIE_HEADER=$(echo "$LOGIN_RESPONSE" | grep "Set-Cookie.*oc_sessionPassphrase" | head -1)
if [ -z "$COOKIE_HEADER" ]; then
echo "❌ Could not extract cookie"
exit 1
fi
# Access admin settings page with cookies
ADMIN_RESPONSE=$(docker exec pointcloud_nextcloud google-chrome --headless --disable-gpu --no-sandbox --user-data-dir=/tmp/chrome-test --remote-debugging-port=9222 \
--header="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8,*/*" \
"$COOKIE_HEADER" \
--screenshot=/tmp/admin-test.png \
http://localhost:8080/settings/admin/files_pointcloudviewer 2>&1)
echo "Admin page response:"
echo "$ADMIN_RESPONSE" | head -30
# Check if admin settings loaded (not default page)
if echo "$ADMIN_RESPONSE" | grep -q "Point Cloud Viewer"; then
echo "✅ SUCCESS: Admin settings page loaded!"
echo "Admin page is accessible"
echo ""
echo "Screenshot saved to /tmp/admin-test.png"
exit 0
else
echo "❌ FAILED: Admin settings did not load"
echo "Response:"
echo "$ADMIN_RESPONSE" | tail -20
exit 1
fi