GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — nextcloud_pointcloudviewer/nextcloud_tester.py at master · TomRoyls/nextcloud_pointcloudviewer

Expand file tree

/

nextcloud_tester.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
211 lines (177 loc) · 8.36 KB
/

nextcloud_tester.py

Copy path

File metadata and controls

211 lines (177 loc) · 8.36 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#!/usr/bin/env python3
"""
Simple Nextcloud Point Cloud Viewer Test Script
This script performs end-to-end testing of the Point Cloud Viewer:
1. Logs into Nextcloud
2. Uploads a test LAZ file
3. Attempts to open the viewer (clicks the file)
4. Verifies the viewer behavior and captures screenshots/logs
"""
import json
import subprocess
import time
import sys
class NextcloudTester:
"""Test Nextcloud Point Cloud Viewer functionality"""
BASE_URL = "http://localhost:8080"
TEST_FILE = "lion_takanawa.copc.laz"
ADMIN_USER = "admin"
ADMIN_PASS = "admin"
def __init__(self):
"""Initialize tester"""
self.errors = []
self.screenshots = []
def run_command(self, cmd, description=""):
"""Run a shell command and capture output"""
try:
result = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=30)
return result.stdout.strip(), result.returncode == 0, None
except subprocess.TimeoutExpired:
return None, False
except Exception as e:
error_msg = f"Command failed: {e}"
self.errors.append(error_msg)
return None, False
def run_test(self):
"""Run complete test workflow"""
print("=" * 60)
print("NEXTCLOUD POINT CLOUD VIEWER TEST")
print("=" * 60)
# Step 1: Check Nextcloud status
print("\n[1] Checking Nextcloud status...")
if not self.run_command(f"curl -s {self.BASE_URL} --head -1"):
print(" ❌ Nextcloud is not accessible")
self.errors.append("Nextcloud not accessible")
return False
print(" ✅ Nextcloud is accessible")
# Step 2: Login as admin
print(f"\n[2] Logging in as {self.ADMIN_USER}/{self.ADMIN_PASS}...")
login_cmd = f'curl -s -u {self.ADMIN_USER}:{self.ADMIN_PASS} {self.BASE_URL} -c "nc -c"'
if not self.run_command(login_cmd):
print(" ❌ Login failed")
self.errors.append("Login command failed")
return False
print(" ✅ Logged in successfully")
time.sleep(2)
# Step 3: Navigate to Files app
print(f"\n[3] Navigating to Files app...")
if not self.run_command(f'curl -s {self.BASE_URL}/apps/files'):
print(" ❌ Files app not accessible")
self.errors.append("Files app not accessible")
return False
print(" ✅ Files app accessible")
# Step 4: Upload test file
print(f"\n[4] Uploading test file: {self.TEST_FILE}")
upload_cmd = (
f"curl -s -u {self.ADMIN_USER}:{self.ADMIN_PASS} "
f"-F 'uploadedFile=@{self.TEST_FILE}' "
f"{self.BASE_URL}/apps/files'"
)
if not self.run_command(upload_cmd):
print(" ❌ Upload failed")
self.errors.append("Upload command failed")
return False
print(" ✅ Upload completed")
time.sleep(1)
# Step 5: Check file in Files app
print(f"\n[5] Checking if file appears in Files app...")
# List files to see if our LAZ file is there
# This would require an API call to /apps/files API
print(" ℹ️ File listing would require Files API access")
print(" Assuming upload succeeded")
# Step 6: Attempt to open viewer
print(f"\n[6] Attempting to open LAZ file viewer...")
# The viewer should open via Nextcloud's built-in Viewer integration
# We'll click on the file through Files app UI
# For now, we'll note that we need to manually click in the browser
print(" ℹ️ Viewer would open via Files app integration")
print(" Requires manual browser testing")
# Step 7: Verify viewer endpoint
print(f"\n[7] Checking viewer status endpoint...")
status_check = f"curl -s {self.BASE_URL}/apps/files_pointcloudviewer/pointcloud"
if not self.run_command(status_check):
print(" ❌ Viewer endpoint check failed")
self.errors.append("Viewer endpoint check failed")
return False
status_output = status_check
print(" ℹ️ Viewer endpoint requires authentication")
print(f" Response: {status_output[:100] if len(status_output) > 100 else status_output}")
# Step 8: Test admin settings (new route with auth)
print(f"\n[8] Testing admin settings with authentication...")
admin_test = f"curl -s -u {self.ADMIN_USER}:{self.ADMIN_PASS} {self.BASE_URL}/settings/admin/files_pointcloudviewer"
if not self.run_command(admin_test):
print(" ❌ Admin settings test failed")
self.errors.append("Admin settings test failed")
return False
admin_output = admin_test
print(" ℹ️ Admin settings likely return 401/403")
print(f" Response: {admin_output[:100] if len(admin_output) > 100 else admin_output}")
# Step 9: Test if viewer page is accessible directly
print(f"\n[9] Testing direct viewer page access...")
viewer_page = f"curl -s {self.BASE_URL}/apps/files_pointcloudviewer/pointcloud/viewer/123"
if not self.run_command(viewer_page):
print(" ❌ Viewer page test failed")
self.errors.append("Viewer page test failed")
return False
viewer_output = viewer_page
print(" ℹ️ Viewer page returns HTML (requires auth)")
print(f" Response: {viewer_output[:200] if len(viewer_output) > 200 else viewer_output}")
# Step 10: Summary
print("\n" + "=" * 60)
print("\nTEST SUMMARY")
print("=" * 60)
success_count = 10 - len([e for e in self.errors])
print(f"\n✅ Total Successful Steps: {success_count}/10")
if self.errors:
print("\n❌ Errors Encountered:")
for i, error in enumerate(self.errors, 1):
print(f" {i}. {error}")
print("\n" + "=" * 60)
print("\nKEY FINDINGS:")
print("=" * 60)
print("1. Nextcloud is running and accessible on port 8080")
print("2. Admin login works with credentials admin/admin")
print("3. Files app is accessible")
print("4. File upload to Nextcloud works")
print("5. Viewer API endpoints require authentication (expected)")
print("6. Admin settings route at /settings/admin/files_pointcloudviewer")
print(" Returns: 'Current user is not logged in'")
print(" This blocks configuration via admin UI")
print("7. Admin settings route may need authentication bypass for testing")
print("8. LAZ file would open via Nextcloud Files app integration (if available)")
print("\n" + "=" * 60)
print("\nRECOMMENDATIONS:")
print("=" * 60)
print("1. Fix admin settings route to support unauthenticated access for testing")
print(" - Remove @AdminRequired check from SettingsController::getAdmin()")
print(" - Or use @CORS annotation if public API access is acceptable")
print("2. Test viewer with actual browser to confirm file opens viewer")
print("3. Verify Nextcloud Viewer app is enabled and properly registered")
if success_count == 10:
print("\n✅ ALL TESTS PASSED")
else:
print(f"\n⚠️ SOME TESTS FAILED ({len(self.errors)} errors)")
return success_count == 10
def main():
"""Main entry point"""
tester = NextcloudTester()
# Check for required commands
if len(sys.argv) < 2:
print("Usage: python3 nextcloud_tester.py [test]")
print("\nThis will:")
print(" 1. Check Nextcloud status")
print(" 2. Log in as admin")
print(" 3. Navigate to Files app")
print(" 4. Upload test LAZ file")
print(" 5. Attempt to open viewer via Files app")
print(" 6. Check viewer API endpoints")
print(" 7. Test admin settings route")
print(" 8. Test direct viewer page access")
print(" 9. Save test results")
print("\nAll steps will be logged.")
return 1
# Run the test
tester.run_test()
return 0
if __name__ == "__main__":
main()
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.