|
29 | 29 | DSPACE_CACHE_SERVERSIDE_ANONYMOUSCACHE_MAX: 0 |
30 | 30 | # Tell Cypress to run e2e tests using the same UI URL |
31 | 31 | CYPRESS_BASE_URL: http://127.0.0.1:4000 |
| 32 | + # Disable the cookie consent banner in e2e tests to avoid errors because of elements hidden by it |
| 33 | + DSPACE_INFO_ENABLECOOKIECONSENTPOPUP: false |
32 | 34 | # When Chrome version is specified, we pin to a specific version of Chrome |
33 | 35 | # Comment this out to use the latest release |
34 | 36 | #CHROME_VERSION: "116.0.5845.187-1" |
@@ -191,11 +193,107 @@ jobs: |
191 | 193 | # If it does, then SSR is working, as this tag is created by our MetadataService. |
192 | 194 | # This step also prints entire HTML of homepage for easier debugging if grep fails. |
193 | 195 | # TODO: enable this step once we have a CRIS back end to test against |
194 | | - # - name: Verify SSR (server-side rendering) |
195 | | - # run: | |
196 | | - # result=$(wget -O- -q http://127.0.0.1:4000/home) |
197 | | - # echo "$result" |
198 | | - # echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep DSpace |
| 196 | + # - name: Verify SSR (server-side rendering) on Homepage |
| 197 | + # run: | |
| 198 | + # result=$(wget -O- -q http://127.0.0.1:4000/home) |
| 199 | + # echo "$result" |
| 200 | + # echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep DSpace |
| 201 | + |
| 202 | + # Get a specific community in our test data and verify that the "<h1>" tag includes "Publications" (the community name). |
| 203 | + # If it does, then SSR is working. |
| 204 | + - name: Verify SSR on a Community page |
| 205 | + run: | |
| 206 | + result=$(wget -O- -q http://127.0.0.1:4000/communities/a30b75e4-1682-4b4d-85fd-a47fc78dbcf6) |
| 207 | + echo "$result" |
| 208 | + echo "$result" | grep -oE "<h1 [^>]*>[^><]*</h1>" | grep "CRIS Community" |
| 209 | +
|
| 210 | + # Get a specific collection in our test data and verify that the "<h1>" tag includes "Publications" (the collection name). |
| 211 | + # If it does, then SSR is working. |
| 212 | + - name: Verify SSR on a Collection page |
| 213 | + run: | |
| 214 | + result=$(wget -O- -q http://127.0.0.1:4000/collections/caf04bfa-b2f6-40d3-90d2-aa0b86d92f8d) |
| 215 | + echo "$result" |
| 216 | + echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Publications" |
| 217 | +
|
| 218 | + # Get a specific publication in our test data and verify that the <meta name="title"> tag includes |
| 219 | + # the title of this publication. If it does, then SSR is working. |
| 220 | + - name: Verify SSR on a Publication page |
| 221 | + run: | |
| 222 | + result=$(wget -O- -q http://127.0.0.1:4000/entities/publication/1df533fd-5385-4820-babd-b5fabdb82101) |
| 223 | + echo "$result" |
| 224 | + echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "test publication with pdf version 1" |
| 225 | +
|
| 226 | + # Get a specific person in our test data and verify that the <meta name="title"> tag includes |
| 227 | + # the name of the person. If it does, then SSR is working. |
| 228 | + - name: Verify SSR on a Person page |
| 229 | + run: | |
| 230 | + result=$(wget -O- -q http://127.0.0.1:4000/entities/person/98cea993-d448-4200-99d5-f6fab8967bf8) |
| 231 | + echo "$result" |
| 232 | + echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Submitter Dspace" |
| 233 | +
|
| 234 | + # Get a specific project in our test data and verify that the <meta name="title"> tag includes |
| 235 | + # the name of the project. If it does, then SSR is working. |
| 236 | + - name: Verify SSR on a Project page |
| 237 | + run: | |
| 238 | + result=$(wget -O- -q http://127.0.0.1:4000/entities/project/1e3451e4-60d7-46a8-962e-5b94b62c63ff) |
| 239 | + echo "$result" |
| 240 | + echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Test DSC-1819" |
| 241 | +
|
| 242 | + # Get a specific orgunit in our test data and verify that the <meta name="title"> tag includes |
| 243 | + # the name of the orgunit. If it does, then SSR is working. |
| 244 | + - name: Verify SSR on an OrgUnit page |
| 245 | + run: | |
| 246 | + result=$(wget -O- -q http://127.0.0.1:4000/entities/orgunit/6d4abaee-eedb-458d-a29b-35db82037dfa) |
| 247 | + echo "$result" |
| 248 | + echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "4Science" |
| 249 | +
|
| 250 | + # Get a specific journal in our test data and verify that the <meta name="title"> tag includes |
| 251 | + # the name of the journal. If it does, then SSR is working. |
| 252 | + - name: Verify SSR on a Journal page |
| 253 | + run: | |
| 254 | + result=$(wget -O- -q http://127.0.0.1:4000/entities/journal/f05c4530-b1b8-4459-a048-ea1c60089a1e) |
| 255 | + echo "$result" |
| 256 | + echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Journal 4S" |
| 257 | +
|
| 258 | + # Get a specific funding in our test data and verify that the <meta name="title"> tag includes |
| 259 | + # the name of the funding. If it does, then SSR is working. |
| 260 | + - name: Verify SSR on a Funding page |
| 261 | + run: | |
| 262 | + result=$(wget -O- -q http://127.0.0.1:4000/entities/funding/640d35ba-6172-44c0-9e11-bf5da417cdc8) |
| 263 | + echo "$result" |
| 264 | + echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "test funding" |
| 265 | +
|
| 266 | +
|
| 267 | + # Verify 301 Handle redirect behavior |
| 268 | + # Note: /handle/123456789/260 is the same test Publication used by our e2e tests |
| 269 | + - name: Verify 301 redirect from '/handle' URLs |
| 270 | + run: | |
| 271 | + result=$(wget --server-response --quiet http://127.0.0.1:4000/handle/123456789/71 2>&1 | head -1 | awk '{print $2}') |
| 272 | + echo "$result" |
| 273 | + [[ "$result" -eq "301" ]] |
| 274 | +
|
| 275 | + # Verify 403 error code behavior |
| 276 | + - name: Verify 403 error code from '/403' |
| 277 | + run: | |
| 278 | + result=$(wget --server-response --quiet http://127.0.0.1:4000/403 2>&1 | head -1 | awk '{print $2}') |
| 279 | + echo "$result" |
| 280 | + [[ "$result" -eq "403" ]] |
| 281 | +
|
| 282 | + # Verify 404 error code behavior |
| 283 | + - name: Verify 404 error code from '/404' and on invalid pages |
| 284 | + run: | |
| 285 | + result=$(wget --server-response --quiet http://127.0.0.1:4000/404 2>&1 | head -1 | awk '{print $2}') |
| 286 | + echo "$result" |
| 287 | + result2=$(wget --server-response --quiet http://127.0.0.1:4000/invalidurl 2>&1 | head -1 | awk '{print $2}') |
| 288 | + echo "$result2" |
| 289 | + [[ "$result" -eq "404" && "$result2" -eq "404" ]] |
| 290 | +
|
| 291 | + # Verify 500 error code behavior |
| 292 | + - name: Verify 500 error code from '/500' |
| 293 | + run: | |
| 294 | + result=$(wget --server-response --quiet http://127.0.0.1:4000/500 2>&1 | head -1 | awk '{print $2}') |
| 295 | + echo "$result" |
| 296 | + [[ "$result" -eq "500" ]] |
199 | 297 |
|
200 | 298 | - name: Stop running app |
201 | 299 | run: kill -9 $(lsof -t -i:4000) |
|
0 commit comments