-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-github-pages.html
More file actions
124 lines (115 loc) · 4.51 KB
/
test-github-pages.html
File metadata and controls
124 lines (115 loc) · 4.51 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GitHub Pages Test</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
line-height: 1.6;
}
.test-section {
margin: 20px 0;
padding: 15px;
border: 1px solid #ddd;
border-radius: 5px;
}
.success { background-color: #d4edda; border-color: #c3e6cb; }
.error { background-color: #f8d7da; border-color: #f5c6cb; }
.info { background-color: #d1ecf1; border-color: #bee5eb; }
button {
background-color: #007bff;
color: white;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
margin: 5px;
}
button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<h1>GitHub Pages Deployment Test</h1>
<div class="test-section info">
<h3>Test Instructions</h3>
<p>This page helps you test if your GitHub Pages deployment is working correctly.</p>
<ol>
<li>Deploy your changes to GitHub Pages</li>
<li>Test the main page: <a href="https://10s25.github.io/payetongreviste/" target="_blank">https://10s25.github.io/payetongreviste/</a></li>
<li>Test direct routes: <a href="https://10s25.github.io/payetongreviste/discover" target="_blank">https://10s25.github.io/payetongreviste/discover</a></li>
<li>Test 404 handling: <a href="https://10s25.github.io/payetongreviste/nonexistent" target="_blank">https://10s25.github.io/payetongreviste/nonexistent</a></li>
</ol>
</div>
<div class="test-section">
<h3>What was fixed:</h3>
<ul>
<li>✅ 404.html now includes the React app scripts</li>
<li>✅ 404.html includes the redirect script for proper routing</li>
<li>✅ All asset paths use the correct base path (/payetongreviste/)</li>
<li>✅ CSP headers updated to be more secure</li>
<li>✅ Redirect script improved to handle search params and hash</li>
</ul>
</div>
<div class="test-section">
<h3>Expected Behavior:</h3>
<ul>
<li><strong>Main page:</strong> Should load the React app normally</li>
<li><strong>Direct routes:</strong> Should load the React app and navigate to the correct route</li>
<li><strong>404 pages:</strong> Should load the React app and let React Router handle the routing</li>
<li><strong>No CSP errors:</strong> Console should be clean of Content Security Policy violations</li>
</ul>
</div>
<div class="test-section">
<h3>Deployment Commands:</h3>
<pre><code># Build the project
npm run build
# Commit and push changes
git add .
git commit -m "Fix GitHub Pages deployment issues"
git push origin master
# The GitHub Actions workflow should automatically deploy to Pages
</code></pre>
</div>
<script>
// Test if we can access the redirect script
function testRedirectScript() {
const script = document.createElement('script');
script.src = '/payetongreviste/redirect.js';
script.onload = () => {
console.log('✅ Redirect script loaded successfully');
};
script.onerror = () => {
console.error('❌ Failed to load redirect script');
};
document.head.appendChild(script);
}
// Test if we can access the main app script
function testAppScript() {
fetch('/payetongreviste/assets/index-DE_QOLij.js')
.then(response => {
if (response.ok) {
console.log('✅ Main app script accessible');
} else {
console.error('❌ Main app script not accessible:', response.status);
}
})
.catch(error => {
console.error('❌ Error testing app script:', error);
});
}
// Run tests when page loads
window.addEventListener('load', () => {
console.log('Running GitHub Pages deployment tests...');
testRedirectScript();
testAppScript();
});
</script>
</body>
</html>