0

I'm running API tests using GitHub Actions and I want to upload to the report generated by Mochawesome to Google Cloud so I can see failures clearly without digging through CI logs. I have the upload part working but when I view the html file on Google Cloud it doesn't load, I just get a blank white page. I'm uploading the css files too so why isn't the html file loading?

enter image description here enter image description here

George
  • 322
  • 1
  • 6
  • 25

2 Answers2

0

Using cdn for assets resolves the isssue .mocharc.js:

module.exports = {
    reporter: 'node_modules/mochawesome',
    'reporter-option': [
        'cdn=true',
        'timestamp=true'    
    ],
};
George
  • 322
  • 1
  • 6
  • 25
0

When you're creating a file using the Cloud Storage API , set the mime_type to 'text/html' and skip the content_disposition. You can manually edit the metadata to set the proper type, which is text/css for CSS files. If the type is neither specified nor auto-detected at upload time, Google Cloud Storage serves files as binary/octet-stream which may prevent the browser from properly rendering it.
Alternatively, you can also specify the MIME type in HTML, e.g.,

<link rel="stylesheet" href="css/theme.css" type="text/css"> to make sure that the browser handles it appropriately.

Here are a few examples with similar implementation:

  1. Run HTML file from Google Cloud URL
  2. Serve HTML file
  3. Website host HTML file page
Vaidehi Jamankar
  • 1,232
  • 1
  • 2
  • 10