This repository was archived by the owner on Feb 24, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheck-all-fixtures.js
More file actions
245 lines (221 loc) Β· 13.7 KB
/
check-all-fixtures.js
File metadata and controls
245 lines (221 loc) Β· 13.7 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
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
// Comprehensive script to test React app page rendering for all GeoBlacklight test fixtures
// Run this in your browser's developer console while on your React app (e.g., http://localhost:5173)
// This will open each resource page in a new tab and check if it renders properly
const allFixtures = [
{ id: 'mit-001145244', name: 'actual-papermap1', description: 'Nondigitized paper map with library catalog link' },
{ id: 'nyu-2451-34564', name: 'actual-point1', description: 'Point dataset with WMS and WFS' },
{ id: 'tufts-cambridgegrid100-04', name: 'actual-polygon1', description: 'Polygon dataset with WFS, WMS, and FGDC metadata' },
{ id: 'stanford-dp018hs9766', name: 'actual-raster1', description: 'Restricted raster layer with WMS and metadata' },
{ id: 'nyu_2451_34635', name: 'baruch_ancestor1', description: 'SQLite Database with documentation download (parent)' },
{ id: 'nyu_2451_34636', name: 'baruch_ancestor2', description: 'Geodatabase with documentation download (parent)' },
{ id: 'nyu_2451_34502', name: 'baruch_documentation_download', description: 'Point dataset with WMS, WFS, documentation download, and parent records' },
{ id: 'princeton-sx61dn82p', name: 'bbox-spans-180', description: 'Scanned map with IIIF spanning 180th meridian' },
{ id: 'c8b46b52-0846-4abb-ba56-b484064f84ac', name: 'complex-geom', description: 'Scanned map with MULTIPOLYGON geometry' },
{ id: 'cugir-007741', name: 'cornell_html_metadata', description: 'Point dataset with WMS, WFS, direct download, and FGDC metadata XML and HTML' },
{ id: '90f14ff4-1359-4beb-b931-5cb41d20ab90', name: 'esri-dynamic-layer-all-layers', description: 'Esri Rest Web Map Service (top level, no specific layer)' },
{ id: '4669301e-b4b2-4c8b-bf40-01b968a2865b', name: 'esri-dynamic-layer-single-layer', description: 'ArcGIS Dynamic Map Layer with single layer' },
{ id: 'f406332e63eb4478a9560ad86ae90327_18', name: 'esri-feature-layer', description: 'ArcGIS Feature Layer - point dataset' },
{ id: '32653ed6-8d83-4692-8a06-bf13ffe2c018', name: 'esri-image-map-layer', description: 'ArcGIS Image Map Layer with GeoTIFF direct download' },
{ id: '31567cf1-bad8-4bc5-8d57-44b96c207ecc', name: 'esri-tiled_map_layer', description: 'ArcGIS tiled map layer' },
{ id: 'purdue-urn-f082acb1-b01e-4a08-9126-fd62a23fd9aa', name: 'esri-wms-layer', description: 'Dataset with ArcGIS Dynamic Map Layer, ArcGIS WMS, and direct download' },
{ id: 'harvard-g7064-s2-1834-k3', name: 'harvard_raster', description: 'Georeferenced raster image of historic paper map' },
{ id: '57f0f116-b64e-4773-8684-96ba09afb549', name: 'iiif-eastern-hemisphere', description: 'Eastern hemisphere scanned map with IIIF manifest' },
{ id: 'cornell-ny-aerial-photos-1960s', name: 'index_map_point', description: 'GeoJSON index map of points' },
{ id: 'cugir-008186-no-downloadurl', name: 'index-map-polygon', description: 'GeoJSON index map of polygons, with downloadUrl for index' },
{ id: 'cugir-008186', name: 'index-map-polygon-no-downloadurl', description: 'GeoJSON index map of polygons, lacking downloadUrl for index' },
{ id: 'stanford-fb897vt9938', name: 'index-map-stanford', description: 'Old-style (pre-GeoJSON) index map of rectangular polygons' },
{ id: 'ark:-77981-gmgscj87k49', name: 'index-map-v1-complex', description: 'OpenIndexMap with complex geometry using specification version 1.0.0' },
{ id: '05d-p16022coll246-noGeo', name: 'metadata_no_geom', description: 'Collection level record without spatial coordinates' },
{ id: '99-0001-noprovider', name: 'metadata_no_provider', description: 'Website record without Provider' },
{ id: 'cugir-007950', name: 'multiple-downloads', description: 'Test record with additional download formats (PDF and KMZ)' },
{ id: '05d-03-noGeomType', name: 'no_locn_geometry', description: 'Collection level record without spatial coordinates or Geometry Type' },
{ id: 'aster-global-emissivity-dataset-1-kilometer-v003-ag1kmcad20', name: 'no_spatial', description: 'File without geometry type or locn_geometry' },
{ id: 'stanford-dc482zx1528', name: 'oembed', description: 'Record with Oembed reference link' },
{ id: 'princeton-n009w382v', name: 'princeton-child1', description: 'Child record for testing gbl_suppressed_b property' },
{ id: 'princeton-jq085m62x', name: 'princeton-child2', description: 'Child record for testing gbl_suppressed_b property' },
{ id: 'princeton-n009w382v-fake1', name: 'princeton-child3', description: 'Child record for testing gbl_suppressed_b property' },
{ id: 'princeton-n009w382v-fake2', name: 'princeton-child4', description: 'Child record for testing gbl_suppressed_b property' },
{ id: 'princeton-1r66j405w', name: 'princeton-parent', description: 'Parent record for testing gbl_suppressed_b property' },
{ id: 'stanford-cz128vq0535', name: 'public_direct_download', description: 'Includes tentative dcat_distribution_sm property' },
{ id: 'princeton-02870w62c', name: 'public_iiif_princeton', description: 'Scanned map with IIIF' },
{ id: 'mit-f6rqs4ucovjk2', name: 'public_polygon_mit', description: 'Polygon shapefile with WMS and WFS' },
{ id: 'stanford-cg357zz0321', name: 'restricted-line', description: 'Restricted line layer with WFS, WMS and metadata' },
{ id: 'cugir-007957', name: 'tms', description: 'Includes reference to TMS web service' },
{ id: '02236876-9c21-42f6-9870-d2562da8e44f', name: 'umn_metro_result1', description: 'Bounding box of metropolitan area and ArcGIS Dynamic Feature Service' },
{ id: '2eddde2f-c222-41ca-bd07-2fd74a21f4de', name: 'umn_state_result1', description: 'Bounding box of state area and static image in references' },
{ id: 'e9c71086-6b25-4950-8e1c-84c2794e3382', name: 'umn_state_result2', description: 'Bounding box of state area and raster download' },
{ id: 'uva-Norfolk:police_point', name: 'uva_slug_colon', description: 'Multipoint dataset with WMS and WFS and colon in slug and layer ID' },
{ id: 'princeton-fk4db9hn29', name: 'wmts-multiple', description: 'Raster dataset with gbl_wxsIdentifier_s and WMTS service supporting multiple layers' },
{ id: 'princeton-fk4544658v-wmts', name: 'wmts-single-layer', description: 'Raster mosaic dataset with WMTS service supporting one layer' },
{ id: '6f47b103-9955-4bbe-a364-387039623106-xyz', name: 'xyz', description: 'Line shapefile with XYZ tile service reference' }
];
console.log('π Testing React app page rendering for all GeoBlacklight test fixtures...\n');
console.log('This will open each resource page in a new tab to test rendering.\n');
console.log('Make sure you are on your React app (e.g., http://localhost:5173)\n');
const results = {
renders: [],
errors: [],
notFound: []
};
// Function to test a single resource page
async function testResourcePage(fixture) {
return new Promise((resolve) => {
const resourceUrl = `${window.location.origin}/resources/${fixture.id}`;
console.log(`Testing: ${fixture.name} (${fixture.id})`);
console.log(`URL: ${resourceUrl}`);
// Open in new tab
const newTab = window.open(resourceUrl, '_blank');
// Wait for tab to load, then check content
setTimeout(() => {
try {
// Check if the new tab loaded successfully
if (newTab && !newTab.closed) {
// Try to access the new tab's content
try {
const newTabDoc = newTab.document;
// Check if page loaded (not a 404 or error)
if (newTabDoc.readyState === 'complete') {
const titleElement = newTabDoc.querySelector('h1');
const errorElement = newTabDoc.querySelector('[class*="error"]');
const loadingElement = newTabDoc.querySelector('[class*="loading"]');
if (errorElement) {
results.errors.push({
...fixture,
error: 'Error element found on page'
});
console.log(`β Error: ${fixture.name} - Error element detected`);
} else if (loadingElement) {
results.errors.push({
...fixture,
error: 'Page stuck in loading state'
});
console.log(`β οΈ Loading: ${fixture.name} - Page still loading`);
} else if (titleElement && titleElement.textContent.trim()) {
results.renders.push({
...fixture,
title: titleElement.textContent.trim()
});
console.log(`β
Renders: ${fixture.name} - "${titleElement.textContent.trim()}"`);
} else {
results.errors.push({
...fixture,
error: 'No title element found'
});
console.log(`β Error: ${fixture.name} - No title element found`);
}
} else {
results.errors.push({
...fixture,
error: 'Page did not load completely'
});
console.log(`β οΈ Error: ${fixture.name} - Page did not load completely`);
}
} catch (crossOriginError) {
// Cross-origin error - can't access new tab content
// This is expected behavior, so we'll assume it loaded
results.renders.push({
...fixture,
title: 'Cross-origin (assumed success)'
});
console.log(`β
Renders: ${fixture.name} - Cross-origin access (assumed success)`);
}
// Close the tab
newTab.close();
} else {
results.errors.push({
...fixture,
error: 'Failed to open new tab'
});
console.log(`β Error: ${fixture.name} - Failed to open new tab`);
}
} catch (error) {
results.errors.push({ ...fixture, error: error.message });
console.log(`π₯ Exception: ${fixture.name} - ${error.message}`);
}
resolve();
}, 3000); // Wait 3 seconds for page to load
});
}
async function testReactAppRendering() {
console.log('Starting page rendering tests...\n');
// Test a few key fixtures first
const keyFixtures = allFixtures.slice(0, 5);
for (const fixture of keyFixtures) {
await testResourcePage(fixture);
// Small delay between tests
await new Promise(resolve => setTimeout(resolve, 1000));
}
console.log('\nπ― Quick test complete! Testing more fixtures...\n');
// Test remaining fixtures
for (const fixture of allFixtures.slice(5)) {
await testResourcePage(fixture);
// Small delay between tests
await new Promise(resolve => setTimeout(resolve, 500));
}
// Print comprehensive summary
console.log('\n' + '='.repeat(80));
console.log('π REACT APP RENDERING SUMMARY');
console.log('='.repeat(80));
console.log(`β
Renders successfully: ${results.renders.length}/${allFixtures.length} (${Math.round(results.renders.length/allFixtures.length*100)}%)`);
console.log(`β Not found: ${results.notFound.length}`);
console.log(`β οΈ Errors: ${results.errors.length}`);
if (results.renders.length > 0) {
console.log('\nπ SUCCESSFULLY RENDERS:');
console.log('-'.repeat(80));
results.renders.forEach((item, index) => {
console.log(`${index + 1}. ${item.name} (${item.id})`);
console.log(` Title: ${item.title}`);
console.log(` Purpose: ${item.description}`);
console.log('');
});
}
if (results.notFound.length > 0) {
console.log('\nβ NOT FOUND (404s):');
console.log('-'.repeat(80));
results.notFound.forEach((item, index) => {
console.log(`${index + 1}. ${item.name} (${item.id})`);
console.log(` Purpose: ${item.description}`);
console.log('');
});
}
if (results.errors.length > 0) {
console.log('\nβ οΈ RENDERING ERRORS:');
console.log('-'.repeat(80));
results.errors.forEach((item, index) => {
console.log(`${index + 1}. ${item.name} (${item.id})`);
console.log(` Error: ${item.error}`);
console.log(` Purpose: ${item.description}`);
console.log('');
});
}
// Categorize by data type
console.log('\nπ BY DATA TYPE:');
console.log('-'.repeat(80));
const categories = {
'Point Data': results.renders.filter(f => f.description.toLowerCase().includes('point')),
'Polygon Data': results.renders.filter(f => f.description.toLowerCase().includes('polygon')),
'Raster Data': results.renders.filter(f => f.description.toLowerCase().includes('raster')),
'Scanned Maps': results.renders.filter(f => f.description.toLowerCase().includes('scanned') || f.description.toLowerCase().includes('iiif')),
'Index Maps': results.renders.filter(f => f.description.toLowerCase().includes('index')),
'Esri Services': results.renders.filter(f => f.description.toLowerCase().includes('esri') || f.description.toLowerCase().includes('arcgis')),
'Web Services': results.renders.filter(f => f.description.toLowerCase().includes('wms') || f.description.toLowerCase().includes('wfs') || f.description.toLowerCase().includes('wmts')),
'Restricted': results.renders.filter(f => f.description.toLowerCase().includes('restricted')),
'Collections': results.renders.filter(f => f.description.toLowerCase().includes('collection'))
};
Object.entries(categories).forEach(([category, items]) => {
if (items.length > 0) {
console.log(`${category}: ${items.length} resources`);
items.forEach(item => console.log(` - ${item.name} (${item.id})`));
console.log('');
}
});
return results;
}
// Run the test
testReactAppRendering().then(results => {
console.log('\nπ React app rendering test complete!');
console.log(`Total fixtures tested: ${allFixtures.length}`);
console.log(`Successfully renders: ${results.renders.length}`);
console.log(`Not found (404s): ${results.notFound.length}`);
console.log(`Rendering errors: ${results.errors.length}`);
});