Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: enable set more settings options #165

Open
rebajz opened this issue Aug 22, 2019 · 1 comment
Open

FEATURE: enable set more settings options #165

rebajz opened this issue Aug 22, 2019 · 1 comment

Comments

@rebajz
Copy link

rebajz commented Aug 22, 2019

please add this new options for settings:

set own name for app.js file
set own name for combined.json
set folder for support src file (folders assets, fonts and file app.js)

add class to label tag (search input)

why?
for example we running test in loop for many different devices. Each device have own report.

And because tests running in loop, some files are automatically rewrited. And it is better have src files in one shared folders.

A must something as (not good way, but working):
let htmlCode;
let cssCode;
let reportFolder = 'someFolder';
let reportName = 'someName';
let reporterSupportFolder = 'src_files';
// change source code for generated html report
htmlCode = fs.readFileSync(reportFolder + '/' + reportName + '.html', 'utf-8');
htmlCode = htmlCode.replace(/src="/g, 'script src="' + reporterSupportFolder + '/');
htmlCode = htmlCode.replace('Protractor Screenshot Report', 'My_text_used_in_title');
htmlCode = htmlCode.replace(/rel="stylesheet" href="/g, 'rel="stylesheet" href="' + reporterSupportFolder + '/');
htmlCode = htmlCode.replace('type="image/x-icon" href="', 'type="image/x-icon" href="' + reporterSupportFolder + '/');
htmlCode = htmlCode.replace('<img class="screenshotImage" ng-script src="' + reporterSupportFolder + '/', '<img class="screenshotImage" ng-script src="');
htmlCode = htmlCode.replace('<img ng-script src="' + reporterSupportFolder + '/', '<img ng-script src="');
htmlCode = htmlCode.replace('app.js', 'app_' + params['runDevice'] + '.js');
htmlCode = htmlCode.replace('', '');
fs.writeFileSync(reportFolder + '/' + reportName + '.html', htmlCode);

        // change source code for css file used in html report (enable colors, hide some buttons and search input
        cssCode = fs.readFileSync(reportFolder + '/assets/bootstrap.css', 'utf-8');
        cssCode = cssCode.replace('background: transparent !important;', '/*! !background: transparent !important;');
        cssCode = cssCode.replace('text-shadow: none !important;', 'text-shadow: none !important;*/');
        cssCode = cssCode.replace('.navbar {', '.search {\n        display: none;\n    }\n' + '    .pull-right {\n        display: none;\n    }\n    ' + '.navbar {');
        cssCode = cssCode.replace('        background-color: #fff !important;', '        /*!background-color: #fff !important;*/');
        fs.unlinkSync(reportFolder + '/assets/bootstrap.css');
        fs.writeFileSync(reportFolder + '/assets/bootstrap.css', cssCode);

        // change directory for html report
        fs.moveSync(reportFolder + '/assets', reportFolder + '/' + reporterSupportFolder + '/assets');
        fs.moveSync(reportFolder + '/fonts', reportFolder + '/' + reporterSupportFolder + '/fonts');
        fs.moveSync(reportFolder + '/jsons', reportFolder + '/' + reporterSupportFolder + '/jsons');
        fs.moveSync(reportFolder + '/app.js', reportFolder + '/' + reporterSupportFolder + '/' + 'app_' + params['runDevice'] + '.js');
@miller45
Copy link
Collaborator

@rebajz In the "past" it would be easy to rename the files with options, but i did some refactoring so the are more files in the future which cannot be renamed because I use the as templates in angular code.
But to avoid overwriting you should just use different folders for each device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants