Eugenio Romano a630cfb390
Fix e2e (#6087)
* fix protractor conf

* remove update env

* fix cli error script cs

* change screenshot plugin

* remove unused param

* fix

* fix

* fix

* moment comment nvm

* fix

* fix

* fix

* fix

* remove adf redirect

* fix

* fix

* save remote report

* report fix

* improve save result

* fix folder save

* fix folder save

* fix placeholder pointer , they needs refactor later

* fix

* fix lint

* fix

* remove test already covered by unit
fix the test in core needed
exclude the one impossible to make it works without APS basic support

* lint

* fix some logout missing

* fix

* Fix the custom-tasks-filters.e2e

* fix lint

* fix

* fix

* fix

* Fix wait on start process  and on process definition options

* Fix logout before login again

* fix uplaod test

* fix

* Fix infodrawer with check detail and sleep

* lint

* increase list of excluded test

* fix

* fix lint

* change wait method datatable

* fix

* fix

* revert check value

* fix

* fix

* change tag test

Co-authored-by: maurizio vitale <maurizio.vitale@alfresco.com>
2020-09-04 13:27:55 +01:00

70 lines
2.1 KiB
JavaScript

const fs = require('fs');
const rimraf = require('rimraf');
const path = require('path');
const TestConfig = require('../test.config');
const AlfrescoApi = require('@alfresco/js-api').AlfrescoApiCompatibility;
function buildNumber() {
let buildNumber = process.env.TRAVIS_BUILD_NUMBER;
if (!buildNumber) {
process.env.TRAVIS_BUILD_NUMBER = Date.now();
}
return process.env.TRAVIS_BUILD_NUMBER;
}
async function uploadScreenshot(retryCount, suffixFileName) {
console.log(`Start uploading report ${retryCount}`);
let alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: TestConfig.screenshot.url
});
await alfrescoJsApi.login(TestConfig.screenshot.username, TestConfig.screenshot.password);
let folderNode;
try {
folderNode = await alfrescoJsApi.nodes.addNode('-my-', {
'name': `retry-${retryCount}`,
'relativePath': `Builds/${buildNumber()}/`,
'nodeType': 'cm:folder'
}, {}, {
'overwrite': true
});
} catch (error) {
folderNode = await alfrescoJsApi.nodes.getNode('-my-', {
'relativePath': `Builds/${buildNumber()}/retry-${retryCount}`,
'nodeType': 'cm:folder'
}, {}, {
'overwrite': true
});
}
fs.renameSync(path.resolve(__dirname, '../../e2e-output/'), path.resolve(__dirname, `../../e2e-output-${retryCount}/`))
const child_process = require("child_process");
child_process.execSync(` tar -czvf ../e2e-result-${suffixFileName}-${retryCount}.tar .`, {
cwd: path.resolve(__dirname, `../../e2e-output-${retryCount}/`)
});
let pathFile = path.join(__dirname, `../../e2e-result-${suffixFileName}-${retryCount}.tar`);
let file = fs.createReadStream(pathFile);
await alfrescoJsApi.upload.uploadFile(
file,
'',
folderNode.entry.id,
null,
{
'name': `e2e-result-${suffixFileName}-${retryCount}.tar`,
'nodeType': 'cm:content',
'autoRename': true
}
);
}
module.exports = {
uploadScreenshot: uploadScreenshot
};