Browse Source

Some optimizations and tests

tags/v1.4.4
Ivan Bravo Bravo 1 year ago
parent
commit
b26040c0f8

+ 5
- 0
src/.env-cmdrc.js View File

@@ -16,6 +16,11 @@ module.exports = {
"NODE_ENV": "production",
"LOG": "info"
},
"test": {
"name": "test",
"NODE_ENV": "test",
"LOG": "debug"
},
"preview": {
"DEVTOOLS": true,
"ROLLBAR_ACCESS_TOKEN": "6ccfcf317ca54e67830b41570ce23d2a"

+ 9
- 6
src/.eslintrc.js View File

@@ -3,7 +3,8 @@ module.exports = {
browser: true,
es2020: true,
node: true,
"shared-node-browser": true
"shared-node-browser": true,
mocha: true
},
extends: [
"@nuxtjs",
@@ -13,11 +14,11 @@ module.exports = {
"plugin:promise/recommended",
"plugin:lodash/recommended",
"plugin:vue/recommended",
"plugin:nuxt/recommended"
"plugin:nuxt/recommended",
"plugin:mocha/recommended"
],
globals: {
$provider: false,
Logger: false,
AppError: false
},
parserOptions: {
@@ -27,7 +28,8 @@ module.exports = {
"import",
"promise",
"lodash",
"vue"
"vue",
"mocha"
],
root: true,
rules: {
@@ -54,12 +56,13 @@ module.exports = {
"lodash/prefer-lodash-typecheck": "warn",
"lodash/prefer-noop": "off",
"max-len": "off",
"func-names": "off",
"no-await-in-loop": "warn",
"no-console": "off",
"no-console": "warn",
"no-continue": "off",
"no-debugger": "error",
"no-lone-blocks": "error",
"no-param-reassign": "error",
"no-param-reassign": "off",
"no-restricted-globals": "warn",
"no-restricted-syntax": "off",
"no-shadow": "off",

+ 1
- 1
src/electron/src/modules/services/nucleus.js View File

@@ -51,7 +51,7 @@ export class NucleusService extends BaseService {
disableTracking: settings.telemetry.enabled === false,
disableErrorReports: true,
userId: settings.user,
version: process.env.APP_VERSION,
version: process.env.npm_package_version,
persist: true,
}


+ 1
- 4
src/nuxt.config.js View File

@@ -71,10 +71,7 @@ module.exports = {
/*
** Nuxt.js modules
*/
modules: [
// '@nuxtjs/pwa',
'@nuxtjs/dotenv',
],
modules: [],

/*
** Axios module configuration

+ 5
- 16
src/package.json View File

@@ -17,6 +17,7 @@
},
"scripts": {
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"test": "env-cmd -e default,test mocha",
"development": "env-cmd -e default,development --no-override",
"production": "env-cmd -e default,production --no-override",
"start:nuxt": "yarn development nuxt",
@@ -55,12 +56,9 @@
"@fortawesome/free-regular-svg-icons": "^5.11.2",
"@fortawesome/free-solid-svg-icons": "^5.11.2",
"@fortawesome/vue-fontawesome": "^0.1.8",
"@nuxtjs/dotenv": "^1.4.1",
"@nuxtjs/pwa": "^2.6.0",
"axios": "^0.19.0",
"better-queue": "^3.8.10",
"better-queue-memory": "^1.0.4",
"clipboard": "^2.0.4",
"compare-versions": "^3.5.1",
"cropperjs": "^1.5.6",
"cryptr": "^6.0.1",
@@ -72,8 +70,6 @@
"filesize": "^6.0.1",
"form-data": "^3.0.0",
"fs-extra": "^8.1.0",
"gpu-info": "^0.0.1",
"gsap": "^3.0.1",
"image-js": "^0.21.8",
"instagram-save": "^1.3.2",
"is-online": "^8.2.0",
@@ -81,27 +77,19 @@
"js-event-bus": "^1.0.0",
"lodash": "^4.17.15",
"logplease": "^1.2.15",
"markdown": "^0.5.0",
"md5": "^2.2.1",
"md5-file": "^4.0.0",
"mime-types": "^2.1.25",
"moment": "^2.24.0",
"node-7z": "^2.0.3",
"node-graceful-shutdown": "^1.0.3",
"nucleus-nodejs": "^3.0.1",
"nuxt": "^2.10.2",
"p-queue": "^6.2.1",
"patch-package": "^6.2.0",
"popmotion": "^8.7.1",
"postinstall-postinstall": "^2.0.0",
"promise-worker": "^2.0.1",
"randomcolor": "^0.5.4",
"randomstring": "^1.1.5",
"raw-loader": "^3.1.0",
"regedit": "^3.0.3",
"rollbar": "^2.14.4",
"semver-regex": "^3.1.0",
"supports-color": "^7.1.0",
"sweetalert2": "^9.4.0",
"systeminformation": "^4.15.3",
"tippy.js": "^5.1.1",
@@ -128,7 +116,6 @@
"electron": "^7.1.1",
"electron-builder": "^22.1.0",
"electron-devtools-installer": "^2.2.4",
"electron-rebuild": "^1.8.6",
"env-cmd": "^10.0.1",
"eslint": "^6.6.0",
"eslint-config-airbnb-base": "^14.0.0",
@@ -139,6 +126,7 @@
"eslint-plugin-import": ">=2.18.2",
"eslint-plugin-jest": ">=23.0.4",
"eslint-plugin-lodash": "^6.0.0",
"eslint-plugin-mocha": "^6.2.2",
"eslint-plugin-node": ">=10.0.0",
"eslint-plugin-nuxt": ">=0.5.0",
"eslint-plugin-promise": ">=4.2.1",
@@ -146,14 +134,15 @@
"eslint-plugin-vue": "^6.0.1",
"husky": "^3.0.9",
"lint-staged": "^9.4.3",
"mocha": "^6.2.2",
"node-sass": "^4.13.0",
"nodemon": "^1.19.4",
"nuxtjs-electron": "^0.1.10",
"nyc": "^14.1.1",
"rollbar-sourcemap-webpack-plugin": "^2.5.1",
"sass-loader": "^8.0.0",
"spectron": "^9.0.0",
"tailwindcss": "^1.1.3",
"tailwindcss-alpha": "hacknug/tailwindcss-alpha#feature/tests",
"webpack-cli": "^3.3.10",
"worker-loader": "^2.0.0"
}
}

+ 80
- 0
src/test/feature/launch.js View File

@@ -0,0 +1,80 @@
// DreamTime.
// Copyright (C) DreamNet. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License 3.0 as published by
// the Free Software Foundation. See <https://www.gnu.org/licenses/gpl-3.0.html>
//
// Written by Ivan Bravo Bravo <ivan@dreamnet.tech>, 2019.

/* eslint arrow-body-style: ["error", "never"] */
/* eslint prefer-arrow-callback: "off" */
/* eslint consistent-return: "off" */

const { Application } = require('spectron')
const assert = require('assert')
const electronPath = require('electron')
const { join } = require('path')
const { existsSync } = require('fs-extra')

describe('Application launch', function () {
this.timeout(3000)

before(async function () {
this.timeout(10000)

this.app = new Application({
path: electronPath,
args: [join(__dirname, '..', '..')],
})

await this.app.start()

this.client = this.app.client
this.electron = this.app.electron.remote
this.browserWindow = this.app.browserWindow

await this.app.client.waitUntilWindowLoaded()
})

after(function () {
if (this.app && this.app.isRunning()) {
return this.app.stop()
}
})

describe('initial files', function () {
before(async function () {
this.userData = await this.electron.app.getPath('userData')
})

it('dreamtime.log', function () {
assert.ok(existsSync(join(this.userData, 'dreamtime.log')))
})

it('settings.json', function () {
assert.ok(existsSync(join(this.userData, 'settings.json')))
})
})

describe('window', function () {
it('shows', async function () {
assert.strict.equal(await this.client.getWindowCount(), 1)
})

it('is visible', async function () {
assert.ok(await this.browserWindow.isVisible())
})

it('is maximized', async function () {
assert.ok(await this.browserWindow.isMaximized())
})

it('is >= 1200x700', async function () {
const { width, height } = await this.browserWindow.getBounds()

assert.ok(width >= 1200)
assert.ok(height >= 700)
})
})
})

+ 57
- 0
src/test/feature/nudify.js View File

@@ -0,0 +1,57 @@
// DreamTime.
// Copyright (C) DreamNet. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License 3.0 as published by
// the Free Software Foundation. See <https://www.gnu.org/licenses/gpl-3.0.html>
//
// Written by Ivan Bravo Bravo <ivan@dreamnet.tech>, 2019.

/* eslint arrow-body-style: ["error", "never"] */
/* eslint prefer-arrow-callback: "off" */
/* eslint consistent-return: "off" */

const { Application } = require('spectron')
const assert = require('assert')
const electronPath = require('electron')
const { join } = require('path')

describe('Nudify', function () {
before(async function () {
this.timeout(10000)

this.app = new Application({
path: electronPath,
args: [join(__dirname, '..', '..')],
})

await this.app.start()

this.client = this.app.client
this.electron = this.app.electron.remote
this.browserWindow = this.app.browserWindow

await this.app.client.waitUntilWindowLoaded()
})

after(function () {
if (this.app && this.app.isRunning()) {
return this.app.stop()
}
})

describe('File selector', function () {
before(async function () {
this.inputFile = await this.client.$('.uploader__alt input[type="file"]')
console.log(this.inputFile)
})

it('single photo', function () {
return true
})

it('multiple photos', function () {
return true
})
})
})

+ 5
- 0
src/test/mocha.opts View File

@@ -0,0 +1,5 @@
--reporter spec
--colors
--recursive
--exit
--slow 1000

Loading…
Cancel
Save