Skip to content

Extra content in output folder

Ramon Klein edited this page Sep 25, 2018 · 2 revisions

Copying additional content to the e2e output folder

The are valid reasons for putting extra files into the output folder (the folder where the reporter result files are copied).

Edit your protractor.conf and put some extra "requires" on top

const fs = require("fs");
const path = require("path");

//use you actual output dir you have configuration for the HtmlReporter
const e2eOutputDir = "dist/e2e/screenshots"; 

Edit the config of your HtmlReporter so it looks like this:

new HtmlReporter({
      baseDirectory: e2eOutputDir
    });

Then go after the onPrepare(){} bracket and add:

,  onComplete() {
    // first argument is source file, second argument is destination file
    fs.copyFileSync("e2e/your-custom-style.css", path.join(e2eOutputDir,"assets","your-custom-style.css"));
    fs.copyFileSync("e2e/your-super-logo.png", path.join(e2eOutputDir,"assets","your-super-logo.png"));
  }

The onComplete method will be called from protractor after all test have finished.

Note: The CSS file is not included yet in the report. If you want to do that look at Custom-css-in-e2e-report