@grafana/e2e: generate JSON report file (#25033)

* Output JSON report from Cypress

* Updated lockfile
This commit is contained in:
Steven Vachon
2020-05-25 15:07:28 -04:00
committed by GitHub
parent a0e5f51d05
commit 68154cf98d
4 changed files with 92 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
{
"supportFile": "cypress/support/index.ts",
"projectId": "zb7k1c"
"projectId": "zb7k1c",
"supportFile": "cypress/support/index.ts"
}

View File

@@ -14,6 +14,10 @@ module.exports = async baseConfig => {
const projectConfig = {
fixturesFolder: `${CWD}/cypress/fixtures`,
integrationFolder: `${CWD}/cypress/integration`,
reporter: '@mochajs/json-file-reporter', // putting this in cypress.json caused weird errors
reporterOptions: {
output: `${CWD}/cypress/report.json`,
},
screenshotsFolder: `${CWD}/cypress/screenshots`,
videosFolder: `${CWD}/cypress/videos`,
};
@@ -46,14 +50,23 @@ module.exports = async baseConfig => {
.catch(error => {
if (error.code === 'ENOENT') {
// File is optional
return null;
return {};
} else {
// Unexpected error
throw error;
}
});
return { ...baseConfig, ...projectConfig, ...customProjectConfig };
return {
...baseConfig,
...projectConfig,
...customProjectConfig,
reporterOptions: {
...baseConfig.reporterOptions,
...projectConfig.reporterOptions,
...customProjectConfig.reporterOptions,
},
};
} else {
// Temporary legacy support for Grafana core (using `yarn start`)
return baseConfig;

View File

@@ -46,6 +46,7 @@
"@cypress/webpack-preprocessor": "4.1.3",
"@grafana/e2e-selectors": "7.1.0-pre.0",
"@grafana/tsconfig": "^1.0.0-rc1",
"@mochajs/json-file-reporter": "^1.2.0",
"blink-diff": "1.0.13",
"commander": "5.0.0",
"cypress": "4.5.0",