Fix ps e2e (#5262)

* fix ps e2e

* fix upload unit report

* fix cspell

* Update cspell.json

* fix e2e

* remove extra space

* fix e2e increase resolution

* try add a sleep before to cehck sorted in order to give datable time to refresh

* log order

* fix log

* change async ins ort

* remove sort testcase
This commit is contained in:
Eugenio Romano
2019-11-21 10:12:52 +00:00
committed by Denys Vuika
parent 1ec827a90c
commit c61de922af
21 changed files with 882 additions and 566 deletions

View File

@@ -2,7 +2,7 @@ const htmlReporter = require('protractor-html-reporter-2');
const fs = require('fs');
const rimraf = require('rimraf');
const path = require('path');
const projectRoot = path.resolve(__dirname,'../../');
const projectRoot = path.resolve(__dirname, '../../');
let FOLDER = process.env.FOLDER || '';
@@ -115,35 +115,40 @@ async function saveReport(alfrescoJsApi, retryCount) {
let temporaryHtmlPath = savePath + 'html/temporaryHtml/';
let lastFileName = '';
let files = fs.readdirSync(savePath);
try {
let files = fs.readdirSync(savePath);
if (files && files.length > 0) {
for (const fileName of files) {
const testConfigReport = {
reportTitle: 'Protractor Test Execution Report',
outputPath: temporaryHtmlPath,
outputFilename: Math.random().toString(36).substr(2, 5) + filenameReport,
};
if (files && files.length > 0) {
for (const fileName of files) {
const testConfigReport = {
reportTitle: 'Protractor Test Execution Report',
outputPath: temporaryHtmlPath,
outputFilename: Math.random().toString(36).substr(2, 5) + filenameReport,
};
let filePath = `${projectRoot}/e2e-output/junit-report/` + fileName;
let filePath = `${projectRoot}/e2e-output/junit-report/` + fileName;
new htmlReporter().from(filePath, testConfigReport);
lastFileName = testConfigReport.outputFilename;
new htmlReporter().from(filePath, testConfigReport);
lastFileName = testConfigReport.outputFilename;
}
}
let lastHtmlFile = temporaryHtmlPath + lastFileName + '.html';
if (!(fs.lstatSync(lastHtmlFile).isDirectory())) {
output = output + fs.readFileSync(lastHtmlFile);
}
let fileName = savePath + 'html/' + filenameReport + '.html';
fs.writeFileSync(fileName, output, 'utf8');
await uploadReport(alfrescoJsApi, filenameReport);
} catch (e) {
console.log('Not possible upload junit report');
}
let lastHtmlFile = temporaryHtmlPath + lastFileName + '.html';
if (!(fs.lstatSync(lastHtmlFile).isDirectory())) {
output = output + fs.readFileSync(lastHtmlFile);
}
let fileName = savePath + 'html/' + filenameReport + '.html';
fs.writeFileSync(fileName, output, 'utf8');
await uploadReport(alfrescoJsApi, filenameReport);
rimraf(`${projectRoot}/e2e-output/screenshots/`, function () {
console.log('done delete screenshot');
});