diff --git a/app/sessionStore.js b/app/sessionStore.js index 46c4915439..6fb7821f66 100644 --- a/app/sessionStore.js +++ b/app/sessionStore.js @@ -348,6 +348,34 @@ module.exports.cleanSessionDataOnShutdown = () => { return p } +/** + * version information (shown on about:brave) + */ +const setVersionInformation = (data) => { + try { + const os = require('os') + const versionInformation = [ + {name: 'Brave', version: app.getVersion()}, + {name: 'Muon', version: process.versions['atom-shell']}, + {name: 'libchromiumcontent', version: process.versions['chrome']}, + {name: 'V8', version: process.versions.v8}, + {name: 'Node.js', version: process.versions.node}, + {name: 'Update Channel', version: Channel.channel()}, + {name: 'os.platform', version: os.platform()}, + {name: 'os.release', version: os.release()}, + {name: 'os.arch', version: os.arch()} + // TODO(bsclifton): read the latest commit hash from a file, etc. + ] + data.about = data.about || {} + data.about.brave = { + versionInformation: versionInformation + } + } catch (e) { + console.log('ERROR calling sessionStore::setVersionInformation(): ', e) + } + return data +} + /** * Loads the browser state from storage. * @@ -434,30 +462,13 @@ module.exports.loadAppState = () => { return } } - - // version information (shown on about:brave) - const os = require('os') - const versionInformation = [ - {name: 'Brave', version: app.getVersion()}, - {name: 'Muon', version: process.versions['atom-shell']}, - {name: 'libchromiumcontent', version: process.versions['chrome']}, - {name: 'V8', version: process.versions.v8}, - {name: 'Node.js', version: process.versions.node}, - {name: 'Update Channel', version: Channel.channel()}, - {name: 'os.platform', version: os.platform()}, - {name: 'os.release', version: os.release()}, - {name: 'os.arch', version: os.arch()} - // TODO(bsclifton): read the latest commit hash from a file, etc. - ] - data.about = data.about || {} - data.about.brave = { - versionInformation: versionInformation - } + data = setVersionInformation(data) } catch (e) { // TODO: Session state is corrupted, maybe we should backup this // corrupted value for people to report into support. console.log('could not parse data: ', data) data = exports.defaultAppState() + data = setVersionInformation(data) } locale.init(data.settings[settings.LANGUAGE]).then((locale) => { app.setLocale(locale) diff --git a/test/about/braveTest.js b/test/about/braveTest.js new file mode 100644 index 0000000000..cf4ea5e2bd --- /dev/null +++ b/test/about/braveTest.js @@ -0,0 +1,52 @@ +/* global describe, it, before */ + +const Brave = require('../lib/brave') +const {urlInput} = require('../lib/selectors') +const {getTargetAboutUrl} = require('../../js/lib/appUrlUtil') + +describe('about:brave tests', function () { + Brave.beforeAll(this) + before(function * () { + const url = getTargetAboutUrl('about:brave') + yield this.app.client + .waitForUrl(Brave.newTabUrl) + .waitForBrowserWindow() + .waitForVisible(urlInput) + .waitForExist('.tab[data-frame-key="1"]') + .tabByIndex(0) + .loadUrl(url) + }) + + describe('when showing versions', function () { + it('lists Brave', function * () { + yield this.app.client + .waitUntil(function () { + return this.getText('table.sortableTable td[data-sort="Brave"]') + .then((textValue) => { + console.log(textValue) + return textValue && String(textValue).length > 0 && String(textValue) !== 'null' + }) + }) + }) + it('lists Muon', function * () { + yield this.app.client + .waitUntil(function () { + return this.getText('table.sortableTable td[data-sort="Muon"]') + .then((textValue) => { + console.log(textValue) + return textValue && String(textValue).length > 0 && String(textValue) !== 'null' + }) + }) + }) + it('lists Update Channel', function * () { + yield this.app.client + .waitUntil(function () { + return this.getText('table.sortableTable td[data-sort="Update Channel"]') + .then((textValue) => { + console.log(textValue) + return textValue && String(textValue).length > 0 && String(textValue) !== 'null' + }) + }) + }) + }) +})