|
70 | 70 | - name: Deploy to GitHub Pages |
71 | 71 | id: deployment |
72 | 72 | uses: actions/deploy-pages@v4 |
| 73 | + |
| 74 | + - name: Smoke Test - Check CSV Upload Button |
| 75 | + run: | |
| 76 | + echo "Running smoke test on deployed site..." |
| 77 | + SITE_URL="${{ steps.deployment.outputs.page_url }}" |
| 78 | + echo "Testing URL: $SITE_URL" |
| 79 | + |
| 80 | + # Wait a bit for deployment to be fully available |
| 81 | + sleep 30 |
| 82 | + |
| 83 | + # First, check if the site is accessible and returns the expected HTML structure |
| 84 | + echo "Checking if site is accessible..." |
| 85 | + RESPONSE=$(curl -fsSL "$SITE_URL" || exit 1) |
| 86 | + |
| 87 | + # Check if the HTML contains the root div where React will mount |
| 88 | + if echo "$RESPONSE" | grep -q '<div id="root"></div>'; then |
| 89 | + echo "✅ Basic HTML structure found" |
| 90 | + else |
| 91 | + echo "❌ Basic HTML structure missing" |
| 92 | + exit 1 |
| 93 | + fi |
| 94 | + |
| 95 | + # Check if JavaScript bundle is referenced |
| 96 | + if echo "$RESPONSE" | grep -q 'type="module".*\.js'; then |
| 97 | + echo "✅ JavaScript bundle reference found" |
| 98 | + else |
| 99 | + echo "❌ JavaScript bundle reference missing" |
| 100 | + exit 1 |
| 101 | + fi |
| 102 | + |
| 103 | + # Check if CSS is referenced |
| 104 | + if echo "$RESPONSE" | grep -q 'rel="stylesheet".*\.css'; then |
| 105 | + echo "✅ CSS stylesheet reference found" |
| 106 | + else |
| 107 | + echo "❌ CSS stylesheet reference missing" |
| 108 | + exit 1 |
| 109 | + fi |
| 110 | + |
| 111 | + # Test if the JavaScript bundle is accessible and contains the CSV upload button text |
| 112 | + JS_URL=$(echo "$RESPONSE" | grep -o 'src="[^"]*\.js"' | sed 's/src="//;s/"//' | head -1) |
| 113 | + if [[ "$JS_URL" == ./* ]]; then |
| 114 | + JS_URL="${SITE_URL%/}/${JS_URL#./}" |
| 115 | + fi |
| 116 | + |
| 117 | + echo "Testing JavaScript bundle at: $JS_URL" |
| 118 | + JS_CONTENT=$(curl -fsSL "$JS_URL" || exit 1) |
| 119 | + |
| 120 | + if echo "$JS_CONTENT" | head -c 1000 | grep -q "function\|const\|var\|class"; then |
| 121 | + echo "✅ JavaScript bundle is accessible and contains expected code" |
| 122 | + else |
| 123 | + echo "❌ JavaScript bundle is not accessible or doesn't contain expected code" |
| 124 | + exit 1 |
| 125 | + fi |
| 126 | + |
| 127 | + # Check if the JavaScript bundle contains the CSV upload button text |
| 128 | + if echo "$JS_CONTENT" | grep -q "Select CSV File"; then |
| 129 | + echo "✅ CSV upload button text found in JavaScript bundle" |
| 130 | + else |
| 131 | + echo "❌ CSV upload button text not found in JavaScript bundle" |
| 132 | + echo "This indicates the core CSV upload functionality is missing from the build" |
| 133 | + exit 1 |
| 134 | + fi |
| 135 | + |
| 136 | + # Test if the CSS bundle is accessible |
| 137 | + CSS_URL=$(echo "$RESPONSE" | grep -o 'href="[^"]*\.css"' | sed 's/href="//;s/"//' | head -1) |
| 138 | + if [[ "$CSS_URL" == ./* ]]; then |
| 139 | + CSS_URL="${SITE_URL%/}/${CSS_URL#./}" |
| 140 | + fi |
| 141 | + |
| 142 | + echo "Testing CSS bundle at: $CSS_URL" |
| 143 | + if curl -fsSL "$CSS_URL" | head -c 500 | grep -q "body\|html\|\."; then |
| 144 | + echo "✅ CSS bundle is accessible and contains expected styles" |
| 145 | + else |
| 146 | + echo "❌ CSS bundle is not accessible or doesn't contain expected styles" |
| 147 | + exit 1 |
| 148 | + fi |
| 149 | + |
| 150 | + echo "✅ Smoke test passed: All essential resources are accessible and CSV upload functionality is present" |
0 commit comments