Skip to content

Commit 0bcdf1c

Browse files
Browser List Log Format change
1 parent d74d8fd commit 0bcdf1c

File tree

4 files changed

+36
-29
lines changed

4 files changed

+36
-29
lines changed

bin/helpers/capabilityHelper.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,20 @@ const caps = (bsConfig, zip) => {
2020

2121
// Browser list
2222
let osBrowserArray = [];
23+
let browsersList = [];
2324
if (bsConfig.browsers) {
2425
bsConfig.browsers.forEach((element) => {
2526
osBrowser = element.os + "-" + element.browser;
27+
osAndBrowser = element.os + " / " + Utils.capitalizeFirstLetter(element.browser);
2628
element.versions.forEach((version) => {
2729
osBrowserArray.push(osBrowser + version);
30+
browsersList.push(`${osAndBrowser} (${version})`);
2831
});
2932
});
3033
}
3134
obj.devices = osBrowserArray;
3235
if (obj.devices.length == 0) reject(Constants.validationMessages.EMPTY_BROWSER_LIST);
33-
logger.info(`Browsers list: ${osBrowserArray.toString()}`);
36+
logger.info(`Browsers list: ${browsersList.join(", ")}`);
3437

3538
// Test suite
3639
if (zip.zip_url && zip.zip_url.split("://")[1].length !== 0) {

bin/helpers/fileHelpers.js

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
const fs = require('fs-extra'),
33
path = require('path');
44

5-
const logger = require("./logger").winstonLogger,
6-
Constants = require("../helpers/constants"),
7-
config = require("../helpers/config");
5+
const logger = require('./logger').winstonLogger,
6+
Constants = require('../helpers/constants'),
7+
config = require('../helpers/config');
88

9-
exports.write = function(f, message, args, cb) {
9+
exports.write = function (f, message, args, cb) {
1010
message = message || 'Creating';
11-
fs.writeFile(f.path, f.file, function() {
12-
logger.info(message + " file: " + f.path);
13-
cb && cb(args)
11+
fs.writeFile(f.path, f.file, function () {
12+
logger.info(message + ' file: ' + f.path);
13+
cb && cb(args);
1414
});
15-
}
15+
};
1616

1717
exports.fileExists = function (filePath, cb) {
1818
fs.access(filePath, fs.F_OK, (err) => {
@@ -25,21 +25,20 @@ exports.fileExists = function (filePath, cb) {
2525
};
2626

2727
exports.deleteZip = () => {
28-
return fs.unlink(config.fileName, function (err) {
29-
if (err) {
30-
logger.info(Constants.userMessages.ZIP_DELETE_FAILED);
31-
return 1;
32-
} else {
33-
logger.info(Constants.userMessages.ZIP_DELETED);
34-
return 0;
35-
}
36-
});
37-
}
28+
try {
29+
fs.unlinkSync(config.fileName);
30+
logger.info(Constants.userMessages.ZIP_DELETED);
31+
return 0;
32+
} catch (err) {
33+
logger.info(Constants.userMessages.ZIP_DELETE_FAILED);
34+
return 1;
35+
}
36+
};
3837

3938
exports.dirExists = function (filePath, cb) {
4039
let exists = false;
4140
if (fs.existsSync(path.dirname(filePath), cb)) {
4241
exists = true;
4342
}
4443
cb && cb(exists);
45-
}
44+
};

bin/helpers/sync/syncSpecsLogs.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,25 @@ let getOptions = (auth, build_id) => {
3232
let getTableConfig = () => {
3333
return {
3434
border: getBorderConfig(),
35-
singleLine: true,
3635
columns: {
37-
0: { alignment: 'right' }
36+
1: {alignment: 'center', width: 1},
37+
2: {alignment: 'left', width: 30}
3838
},
3939
columnDefault: {
40-
width: 50
40+
width: 25,
4141
},
42-
columnCount: 2
42+
columnCount: 3,
4343
};
4444
}
4545

4646
let getBorderConfig = () => {
4747
return {
48-
topBody: `-`,
48+
topBody: ``,
4949
topJoin: ``,
5050
topLeft: ``,
5151
topRight: ``,
5252

53-
bottomBody: `-`,
53+
bottomBody: ``,
5454
bottomJoin: ``,
5555
bottomLeft: ``,
5656
bottomRight: ``,
@@ -81,7 +81,6 @@ let printSpecsStatus = (bsConfig, buildDetails) => {
8181
},
8282
function(err, result) { // when loop ends
8383
specSummary.duration = endTime - startTime
84-
logger.info();
8584
resolve(specSummary)
8685
}
8786
);
@@ -105,6 +104,7 @@ let whileProcess = (whilstCallback) => {
105104
whileLoop = false;
106105
endTime = Date.now();
107106
showSpecsStatus(body);
107+
logger.info("\n--------------------------------------------------------------------------------")
108108
return whilstCallback(null, body);
109109
default:
110110
whileLoop = false;
@@ -127,6 +127,7 @@ let showSpecsStatus = (data) => {
127127
let printInitialLog = () => {
128128
startTime = Date.now();
129129
logger.info(`\n${Constants.syncCLI.LOGS.INIT_LOG}`)
130+
logger.info("--------------------------------------------------------------------------------")
130131
n = Constants.syncCLI.INITIAL_DELAY_MULTIPLIER
131132
}
132133

@@ -138,7 +139,7 @@ let printSpecData = (data) => {
138139
}
139140

140141
let writeToTable = (combination, specName, status) => {
141-
stream.write([combination + ":", `${specName} ${status}`]);
142+
stream.write([combination , ":", `${specName} ${status}`]);
142143
}
143144

144145
let addSpecToSummary = (specName, status, combination, session_id) => {
@@ -152,7 +153,7 @@ let addSpecToSummary = (specName, status, combination, session_id) => {
152153
}
153154

154155
let getCombinationName = (spec) => {
155-
return `${spec["os"]} ${spec["osVersion"]} / ${spec["browser"]} ${spec["browserVersion"]}`
156+
return `${utils.capitalizeFirstLetter(spec['browser'])} ${spec['browserVersion']} (${spec['os']} ${spec['osVersion']})`;
156157
}
157158

158159
let getStatus = (status) => {

bin/helpers/utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,3 +314,7 @@ exports.setLocalIdentifier = (bsConfig) => {
314314
);
315315
}
316316
};
317+
318+
exports.capitalizeFirstLetter = (stringToCapitalize) => {
319+
return stringToCapitalize && (stringToCapitalize[0].toUpperCase() + stringToCapitalize.slice(1));
320+
};

0 commit comments

Comments
 (0)