#424 Plus tests fixes
This commit is contained in:
parent
e1a7567648
commit
f89cb0e661
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"salixHost": "localhost",
|
|
||||||
"salixPort": "3306",
|
|
||||||
"salixUser": "root",
|
|
||||||
"salixPassword": "root"
|
|
||||||
}
|
|
|
@ -26,7 +26,7 @@ rules:
|
||||||
bracketSpacing: 0
|
bracketSpacing: 0
|
||||||
space-infix-ops: 1
|
space-infix-ops: 1
|
||||||
prefer-const: 0
|
prefer-const: 0
|
||||||
curly: [error, multi, consitent]
|
curly: [error, multi-or-nest]
|
||||||
indent: [error, 4]
|
indent: [error, 4]
|
||||||
arrow-parens: [error, as-needed]
|
arrow-parens: [error, as-needed]
|
||||||
jasmine/no-focused-tests: 0
|
jasmine/no-focused-tests: 0
|
|
@ -5,14 +5,10 @@ env.COMPOSER_HTTP_TIMEOUT = 300;
|
||||||
switch (env.BRANCH_NAME) {
|
switch (env.BRANCH_NAME) {
|
||||||
case 'test':
|
case 'test':
|
||||||
env.NODE_ENV = 'test';
|
env.NODE_ENV = 'test';
|
||||||
env.salixHost = env.testSalixHost;
|
|
||||||
env.salixPort = env.testSalixPort;
|
|
||||||
break;
|
break;
|
||||||
case 'master':
|
case 'master':
|
||||||
env.NODE_ENV = 'production'
|
env.NODE_ENV = 'production'
|
||||||
env.salixHost = env.productionSalixHost;
|
env.DOCKER_HOST = 'tcp://vch1.verdnatura.es:2376';
|
||||||
env.salixPort = env.productionSalixPort;
|
|
||||||
env.DOCKER_HOST = 'tcp://vch1.verdnatura.es:2375';
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import ngModule from '../module';
|
||||||
import './item-client';
|
import './item-client';
|
||||||
|
|
||||||
export default class Controller {
|
export default class Controller {
|
||||||
constructor($scope) {
|
constructor($scope, $stateParams) {
|
||||||
this.$ = $scope;
|
this.$ = $scope;
|
||||||
this.clientSelected = null;
|
this.clientSelected = null;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ export default class Controller {
|
||||||
this.$.dialogSummaryClient.show();
|
this.$.dialogSummaryClient.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Controller.$inject = ['$scope'];
|
Controller.$inject = ['$scope', '$stateParams'];
|
||||||
|
|
||||||
ngModule.component('vnClientIndex', {
|
ngModule.component('vnClientIndex', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
|
|
|
@ -21,26 +21,40 @@ export default class Controller extends Component {
|
||||||
super($element, $scope);
|
super($element, $scope);
|
||||||
this.$compile = $compile;
|
this.$compile = $compile;
|
||||||
this.$state = $state;
|
this.$state = $state;
|
||||||
this.deregisterCallback = $transitions.onStart({},
|
|
||||||
transition => this.changeState(transition));
|
|
||||||
|
|
||||||
this.filter = {};
|
let criteria = {to: this.$state.current.name};
|
||||||
|
this.deregisterCallback = $transitions.onSuccess(criteria,
|
||||||
|
() => this.onStateChange());
|
||||||
|
|
||||||
|
this._filter = null;
|
||||||
this.searchString = '';
|
this.searchString = '';
|
||||||
this.autoLoad = false;
|
this.autoLoad = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$onInit() {
|
$postLink() {
|
||||||
if (this.$state.params.q)
|
if (this.filter === null)
|
||||||
this.filter = JSON.parse(decodeURIComponent(this.$state.params.q));
|
this.onStateChange();
|
||||||
|
|
||||||
this.refreshString();
|
|
||||||
|
|
||||||
if (this.autoLoad || !angular.equals({}, this.filter))
|
|
||||||
this.doSearch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
changeState(transition) {
|
set filter(value) {
|
||||||
return transition._targetState._identifier.name !== this.$state.current.name;
|
this._filter = value;
|
||||||
|
this.pushFilterToState(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
get filter() {
|
||||||
|
return this._filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
onStateChange() {
|
||||||
|
this._filter = null;
|
||||||
|
|
||||||
|
if (this.$state.params.q) {
|
||||||
|
try {
|
||||||
|
this._filter = JSON.parse(this.$state.params.q);
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.doSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
openPanel(event) {
|
openPanel(event) {
|
||||||
|
@ -49,7 +63,7 @@ export default class Controller extends Component {
|
||||||
|
|
||||||
this.$panel = this.$compile(`<${this.panel}/>`)(this.$.$new());
|
this.$panel = this.$compile(`<${this.panel}/>`)(this.$.$new());
|
||||||
let panel = this.$panel.isolateScope().$ctrl;
|
let panel = this.$panel.isolateScope().$ctrl;
|
||||||
panel.filter = this.filter;
|
panel.filter = this._filter;
|
||||||
panel.onSubmit = filter => this.onPanelSubmit(filter);
|
panel.onSubmit = filter => this.onPanelSubmit(filter);
|
||||||
|
|
||||||
this.$.popover.parent = this.element;
|
this.$.popover.parent = this.element;
|
||||||
|
@ -72,85 +86,78 @@ export default class Controller extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
this.refreshString();
|
|
||||||
this.doSearch();
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshString() {
|
|
||||||
this.searchString = this.getStringFromObject(this.filter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
this.filter = this.getObjectFromString(this.searchString);
|
this.filter = this.getObjectFromString(this.searchString);
|
||||||
this.doSearch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
doSearch() {
|
doSearch() {
|
||||||
this.pushFilterToState(this.filter);
|
let filter = this._filter;
|
||||||
|
|
||||||
|
if (filter === null && this.autoload)
|
||||||
|
filter = {};
|
||||||
|
|
||||||
|
this.searchString = this.getStringFromObject(filter);
|
||||||
|
|
||||||
if (this.onSearch)
|
if (this.onSearch)
|
||||||
this.onSearch({$params: this.filter});
|
this.onSearch({$params: filter});
|
||||||
|
|
||||||
if (this.model) {
|
if (this.model) {
|
||||||
let where = buildFilter(this.filter,
|
if (filter !== null) {
|
||||||
(param, value) => this.exprBuilder({param, value}));
|
let where = buildFilter(filter,
|
||||||
|
(param, value) => this.exprBuilder({param, value}));
|
||||||
|
|
||||||
let userParams = {};
|
let userParams = {};
|
||||||
let hasParams = false;
|
let hasParams = false;
|
||||||
|
|
||||||
if (this.paramBuilder) {
|
if (this.paramBuilder) {
|
||||||
for (let param in this.filter) {
|
for (let param in filter) {
|
||||||
let value = this.filter[param];
|
let value = filter[param];
|
||||||
if (value == null) continue;
|
if (value == null) continue;
|
||||||
let expr = this.paramBuilder({param, value});
|
let expr = this.paramBuilder({param, value});
|
||||||
if (expr) {
|
if (expr) {
|
||||||
Object.assign(userParams, expr);
|
Object.assign(userParams, expr);
|
||||||
hasParams = true;
|
hasParams = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
this.model.applyFilter(
|
this.model.applyFilter(
|
||||||
where ? {where} : null,
|
where ? {where} : null,
|
||||||
hasParams ? userParams : null
|
hasParams ? userParams : null
|
||||||
);
|
);
|
||||||
|
} else
|
||||||
|
this.model.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exprBuilder(param, value) {
|
|
||||||
return {[param]: value};
|
|
||||||
}
|
|
||||||
|
|
||||||
pushFilterToState(filter) {
|
pushFilterToState(filter) {
|
||||||
let state = window.location.hash.split('?')[0];
|
|
||||||
let keys = Object.keys(filter);
|
let keys = Object.keys(filter);
|
||||||
|
let search = {};
|
||||||
|
|
||||||
if (keys.length) {
|
if (keys.length) {
|
||||||
let hashFilter = {};
|
|
||||||
|
|
||||||
keys.forEach(key => {
|
keys.forEach(key => {
|
||||||
let value = filter[key];
|
let value = filter[key];
|
||||||
|
|
||||||
if (value instanceof Date)
|
if (value instanceof Date)
|
||||||
hashFilter[key] = value;
|
search[key] = value;
|
||||||
else {
|
else {
|
||||||
switch (typeof value) {
|
switch (typeof value) {
|
||||||
|
case 'boolean':
|
||||||
case 'number':
|
case 'number':
|
||||||
case 'string':
|
case 'string':
|
||||||
case 'boolean':
|
search[key] = value;
|
||||||
hashFilter[key] = value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let search = encodeURIComponent(JSON.stringify(hashFilter));
|
|
||||||
state += `?q=${search}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!window.history)
|
this.$state.go('.', {q: JSON.stringify(search)});
|
||||||
throw new Error('Browser incompatibility: window.history not found');
|
}
|
||||||
|
|
||||||
window.history.pushState({}, null, state);
|
exprBuilder(param, value) {
|
||||||
|
return {[param]: value};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -58,4 +58,5 @@ Botanical: Botánico
|
||||||
Barcodes: Códigos de barras
|
Barcodes: Códigos de barras
|
||||||
Diary: Registro
|
Diary: Registro
|
||||||
Item diary: Registro de compra-venta
|
Item diary: Registro de compra-venta
|
||||||
Last entries: Últimas entradas
|
Last entries: Últimas entradas
|
||||||
|
Tags: Etiquetas
|
|
@ -25,7 +25,7 @@
|
||||||
</vn-auto>
|
</vn-auto>
|
||||||
<vn-one margin-medium>
|
<vn-one margin-medium>
|
||||||
<vn-vertical name="basicData">
|
<vn-vertical name="basicData">
|
||||||
<h5 translate>Basic data (I)</h5>
|
<h5 translate>Basic data</h5>
|
||||||
<vn-label-value label="Name"
|
<vn-label-value label="Name"
|
||||||
value="{{$ctrl.summary.item.name}}">
|
value="{{$ctrl.summary.item.name}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
|
@ -50,8 +50,8 @@
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
<vn-one margin-medium>
|
<vn-one margin-medium>
|
||||||
<vn-vertical name="basicData">
|
<vn-vertical name="otherData">
|
||||||
<h5 translate>Basic data (II)</h5>
|
<h5 translate>Other data</h5>
|
||||||
<vn-label-value label="Intrastat code"
|
<vn-label-value label="Intrastat code"
|
||||||
value="{{$ctrl.summary.item.intrastat.id}}">
|
value="{{$ctrl.summary.item.intrastat.id}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
Niche: Nichos
|
Niche: Nichos
|
||||||
Barcode: Códigos de barras
|
Barcode: Códigos de barras
|
||||||
|
Other data: Otros datos
|
|
@ -1,9 +1,10 @@
|
||||||
<vn-crud-model auto-load="false"
|
<vn-crud-model
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="/ticket/api/Tickets/filter"
|
url="/ticket/api/Tickets/filter"
|
||||||
limit="20"
|
limit="20"
|
||||||
data="tickets"
|
data="tickets"
|
||||||
order="shipped DESC">
|
order="shipped DESC"
|
||||||
|
auto-load="false">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<div margin-medium>
|
<div margin-medium>
|
||||||
<div class="vn-list">
|
<div class="vn-list">
|
||||||
|
@ -12,8 +13,7 @@
|
||||||
<vn-three>
|
<vn-three>
|
||||||
<vn-searchbar
|
<vn-searchbar
|
||||||
panel="vn-ticket-search-panel"
|
panel="vn-ticket-search-panel"
|
||||||
on-search="model.applyFilter(null, $params);"
|
on-search="$ctrl.onSearch($params)"
|
||||||
filter="$ctrl.filter"
|
|
||||||
vn-focus>
|
vn-focus>
|
||||||
</vn-searchbar>
|
</vn-searchbar>
|
||||||
</vn-three>
|
</vn-three>
|
||||||
|
|
|
@ -16,10 +16,19 @@ export default class Controller {
|
||||||
today.setTime(today.getTime() - offset);
|
today.setTime(today.getTime() - offset);
|
||||||
|
|
||||||
let tomorrow = new Date(today);
|
let tomorrow = new Date(today);
|
||||||
tomorrow.setHours(23, 59, 59, 59);
|
tomorrow.setHours(23, 59, 59, 999);
|
||||||
tomorrow.setTime(tomorrow.getTime() - offset);
|
tomorrow.setTime(tomorrow.getTime() - offset);
|
||||||
|
|
||||||
this.filter = {myTeam: true, from: today, to: tomorrow};
|
// FIXME: History loop
|
||||||
|
// let filter = {myTeam: true, from: today, to: tomorrow};
|
||||||
|
// $state.go('.', {q: JSON.stringify(filter)});
|
||||||
|
}
|
||||||
|
|
||||||
|
onSearch(params) {
|
||||||
|
if (params)
|
||||||
|
this.$.model.applyFilter(null, params);
|
||||||
|
else
|
||||||
|
this.$.model.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
goToTurns() {
|
goToTurns() {
|
||||||
|
|
15
db_tests.js
15
db_tests.js
|
@ -4,19 +4,16 @@ process.on('warning', warning => {
|
||||||
console.log(warning.stack);
|
console.log(warning.stack);
|
||||||
});
|
});
|
||||||
|
|
||||||
var verbose = false;
|
let verbose = false;
|
||||||
|
|
||||||
if (process.argv[2] === '--v') {
|
if (process.argv[2] === '--v')
|
||||||
verbose = true;
|
verbose = true;
|
||||||
}
|
|
||||||
servicesDir = `${__dirname}/services/db`;
|
servicesDir = `${__dirname}/services/db`;
|
||||||
|
|
||||||
var Jasmine = require('jasmine');
|
let Jasmine = require('jasmine');
|
||||||
var jasmine = new Jasmine();
|
let jasmine = new Jasmine();
|
||||||
var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
|
let SpecReporter = require('jasmine-spec-reporter').SpecReporter;
|
||||||
let environment = require('gulp-env');
|
|
||||||
|
|
||||||
environment(".env.json");
|
|
||||||
|
|
||||||
let serviceSpecs = [
|
let serviceSpecs = [
|
||||||
'db/tests/**/*[sS]pec.js'
|
'db/tests/**/*[sS]pec.js'
|
||||||
|
|
|
@ -1,43 +1,41 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import createNightmare from '../../helpers/nightmare';
|
||||||
|
|
||||||
describe('Ticket', () => {
|
describe('Ticket Create notes path', () => {
|
||||||
describe('Create notes path', () => {
|
const nightmare = createNightmare();
|
||||||
const nightmare = createNightmare();
|
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
return nightmare
|
return nightmare
|
||||||
.loginAndModule('employee', 'ticket')
|
.loginAndModule('employee', 'ticket')
|
||||||
.accessToSearchResult('id:1')
|
.accessToSearchResult('id:1')
|
||||||
.accessToSection('ticket.card.observation');
|
.accessToSection('ticket.card.observation');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click create a new note and delete a former one`, async () => {
|
it(`should click create a new note and delete a former one`, async () => {
|
||||||
let result = await nightmare
|
let result = await nightmare
|
||||||
.waitToClick(selectors.ticketNotes.firstNoteRemoveButton)
|
.waitToClick(selectors.ticketNotes.firstNoteRemoveButton)
|
||||||
.waitToClick(selectors.ticketNotes.addNoteButton)
|
.waitToClick(selectors.ticketNotes.addNoteButton)
|
||||||
.waitToClick(selectors.ticketNotes.firstNoteSelect)
|
.waitToClick(selectors.ticketNotes.firstNoteSelect)
|
||||||
.waitToClick(selectors.ticketNotes.firstNoteSelectSecondOption)
|
.waitToClick(selectors.ticketNotes.firstNoteSelectSecondOption)
|
||||||
.type(selectors.ticketNotes.firstDescriptionInput, 'description')
|
.type(selectors.ticketNotes.firstDescriptionInput, 'description')
|
||||||
.click(selectors.ticketNotes.submitNotesButton)
|
.click(selectors.ticketNotes.submitNotesButton)
|
||||||
.waitForLastSnackbar();
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the note is the expected one`, async () => {
|
it(`should confirm the note is the expected one`, async () => {
|
||||||
let firstNoteSelect = await nightmare
|
let firstNoteSelect = await nightmare
|
||||||
.click(selectors.ticketPackages.packagesButton)
|
.click(selectors.ticketPackages.packagesButton)
|
||||||
.wait(selectors.ticketPackages.firstPackageSelect)
|
.wait(selectors.ticketPackages.firstPackageSelect)
|
||||||
.click(selectors.ticketNotes.notesButton)
|
.click(selectors.ticketNotes.notesButton)
|
||||||
.waitToGetProperty(selectors.ticketNotes.firstNoteSelect, 'value');
|
.waitToGetProperty(selectors.ticketNotes.firstNoteSelect, 'value');
|
||||||
|
|
||||||
expect(firstNoteSelect).toEqual('observation one');
|
expect(firstNoteSelect).toEqual('observation one');
|
||||||
|
|
||||||
let firstDescription = await nightmare
|
let firstDescription = await nightmare
|
||||||
.waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value');
|
.waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value');
|
||||||
|
|
||||||
expect(firstDescription).toEqual('description');
|
expect(firstDescription).toEqual('description');
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,28 +1,26 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import createNightmare from '../../helpers/nightmare';
|
||||||
|
|
||||||
describe('Ticket', () => {
|
describe('Ticket Delete expeditions path', () => {
|
||||||
describe('Delete expeditions path', () => {
|
const nightmare = createNightmare();
|
||||||
const nightmare = createNightmare();
|
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
return nightmare
|
return nightmare
|
||||||
.loginAndModule('production', 'ticket')
|
.loginAndModule('production', 'ticket')
|
||||||
.accessToSearchResult('id:1')
|
.accessToSearchResult('id:1')
|
||||||
.accessToSection('ticket.card.expedition');
|
.accessToSection('ticket.card.expedition');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async () => {
|
it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async () => {
|
||||||
const result = await nightmare
|
const result = await nightmare
|
||||||
.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton)
|
.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton)
|
||||||
.waitToClick(selectors.ticketExpedition.acceptDeleteRowButton)
|
.waitToClick(selectors.ticketExpedition.acceptDeleteRowButton)
|
||||||
.click(selectors.ticketPackages.packagesButton)
|
.click(selectors.ticketPackages.packagesButton)
|
||||||
.wait(selectors.ticketPackages.firstPackageSelect)
|
.wait(selectors.ticketPackages.firstPackageSelect)
|
||||||
.click(selectors.ticketExpedition.expeditionButton)
|
.click(selectors.ticketExpedition.expeditionButton)
|
||||||
.wait(selectors.ticketExpedition.expeditionRow)
|
.wait(selectors.ticketExpedition.expeditionRow)
|
||||||
.countElement(selectors.ticketExpedition.expeditionRow);
|
.countElement(selectors.ticketExpedition.expeditionRow);
|
||||||
|
|
||||||
expect(result).toEqual(3);
|
expect(result).toEqual(3);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,62 +1,60 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import createNightmare from '../../helpers/nightmare';
|
||||||
|
|
||||||
describe('Ticket', () => {
|
describe('Ticket Create new tracking state path', () => {
|
||||||
describe('Create new tracking state path', () => {
|
const nightmare = createNightmare();
|
||||||
const nightmare = createNightmare();
|
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
return nightmare
|
return nightmare
|
||||||
.loginAndModule('production', 'ticket')
|
.loginAndModule('production', 'ticket')
|
||||||
.accessToSearchResult('id:1')
|
.accessToSearchResult('id:1')
|
||||||
.accessToSection('ticket.card.tracking.index');
|
.accessToSection('ticket.card.tracking.index');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should access to the create state view by clicking the create floating button', async () => {
|
it('should access to the create state view by clicking the create floating button', async () => {
|
||||||
let url = await nightmare
|
let url = await nightmare
|
||||||
.waitToClick(selectors.ticketTracking.createStateButton)
|
.waitToClick(selectors.ticketTracking.createStateButton)
|
||||||
.wait(selectors.createStateView.stateInput)
|
.wait(selectors.createStateView.stateInput)
|
||||||
.parsedUrl();
|
.parsedUrl();
|
||||||
|
|
||||||
expect(url.hash).toContain('tracking/edit');
|
expect(url.hash).toContain('tracking/edit');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should attempt create a new state but receive an error if state is empty`, async () => {
|
it(`should attempt create a new state but receive an error if state is empty`, async () => {
|
||||||
let result = await nightmare
|
let result = await nightmare
|
||||||
.click(selectors.createStateView.saveStateButton)
|
.click(selectors.createStateView.saveStateButton)
|
||||||
.waitForLastSnackbar();
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toEqual('No changes to save');
|
expect(result).toEqual('No changes to save');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should attempt create a new state then clear and save it`, async () => {
|
it(`should attempt create a new state then clear and save it`, async () => {
|
||||||
let result = await nightmare
|
let result = await nightmare
|
||||||
.waitToClick(selectors.createStateView.stateInput)
|
.waitToClick(selectors.createStateView.stateInput)
|
||||||
.waitToClick(selectors.createStateView.stateInputOptionOne)
|
.waitToClick(selectors.createStateView.stateInputOptionOne)
|
||||||
.waitToClick(selectors.createStateView.clearStateInputButton)
|
.waitToClick(selectors.createStateView.clearStateInputButton)
|
||||||
.click(selectors.createStateView.saveStateButton)
|
.click(selectors.createStateView.saveStateButton)
|
||||||
.waitForLastSnackbar();
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should again access to the create state view by clicking the create floating button', async () => {
|
it('should again access to the create state view by clicking the create floating button', async () => {
|
||||||
let url = await nightmare
|
let url = await nightmare
|
||||||
.click(selectors.ticketTracking.createStateButton)
|
.click(selectors.ticketTracking.createStateButton)
|
||||||
.wait(selectors.createStateView.stateInput)
|
.wait(selectors.createStateView.stateInput)
|
||||||
.parsedUrl();
|
.parsedUrl();
|
||||||
|
|
||||||
expect(url.hash).toContain('tracking/edit');
|
expect(url.hash).toContain('tracking/edit');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should create a new state`, async () => {
|
it(`should create a new state`, async () => {
|
||||||
let result = await nightmare
|
let result = await nightmare
|
||||||
.waitToClick(selectors.createStateView.stateInput)
|
.waitToClick(selectors.createStateView.stateInput)
|
||||||
.waitToClick(selectors.createStateView.stateInputOptionOne)
|
.waitToClick(selectors.createStateView.stateInputOptionOne)
|
||||||
.click(selectors.createStateView.saveStateButton)
|
.click(selectors.createStateView.saveStateButton)
|
||||||
.waitForLastSnackbar();
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var webpackConfig = require('./webpack.config.js');
|
let webpackConfig = require('./webpack.config.js');
|
||||||
delete webpackConfig.entry;
|
delete webpackConfig.entry;
|
||||||
delete webpackConfig.output;
|
delete webpackConfig.output;
|
||||||
webpackConfig.devtool = 'inline-source-map';
|
webpackConfig.devtool = 'inline-source-map';
|
||||||
|
@ -10,19 +10,19 @@ webpackConfig.plugins = [];
|
||||||
module.exports = function(config) {
|
module.exports = function(config) {
|
||||||
let baseConfig = {
|
let baseConfig = {
|
||||||
|
|
||||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||||
basePath: '',
|
basePath: '',
|
||||||
|
|
||||||
// frameworks to use
|
// frameworks to use
|
||||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||||
frameworks: ['jasmine'],
|
frameworks: ['jasmine'],
|
||||||
|
|
||||||
// list of files / patterns to load in the browser
|
// list of files / patterns to load in the browser
|
||||||
files: [
|
files: [
|
||||||
{pattern: 'client/test_index.js', watched: false}
|
{pattern: 'client/test_index.js', watched: false}
|
||||||
],
|
],
|
||||||
|
|
||||||
// list of files to exclude
|
// list of files to exclude
|
||||||
exclude: [],
|
exclude: [],
|
||||||
|
|
||||||
webpack: webpackConfig,
|
webpack: webpackConfig,
|
||||||
|
@ -35,40 +35,40 @@ module.exports = function(config) {
|
||||||
noInfo: true
|
noInfo: true
|
||||||
},
|
},
|
||||||
|
|
||||||
// preprocess matching files before serving them to the browser
|
// preprocess matching files before serving them to the browser
|
||||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||||
preprocessors: {
|
preprocessors: {
|
||||||
'./client/test_index.js': ['webpack', 'sourcemap']
|
'./client/test_index.js': ['webpack', 'sourcemap']
|
||||||
},
|
},
|
||||||
|
|
||||||
// test results reporter to use
|
// test results reporter to use
|
||||||
// possible values: 'dots', 'progress'
|
// possible values: 'dots', 'progress'
|
||||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||||
reporters: ['progress'],
|
reporters: ['progress'],
|
||||||
|
|
||||||
// web server port
|
// web server port
|
||||||
port: 9876,
|
port: 9876,
|
||||||
|
|
||||||
// enable / disable colors in the output (reporters and logs)
|
// enable / disable colors in the output (reporters and logs)
|
||||||
colors: true,
|
colors: true,
|
||||||
|
|
||||||
// level of logging
|
// level of logging
|
||||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||||
logLevel: config.LOG_INFO,
|
logLevel: config.LOG_INFO,
|
||||||
|
|
||||||
// enable / disable watching file and executing tests whenever any file changes
|
// enable / disable watching file and executing tests whenever any file changes
|
||||||
autoWatch: true,
|
autoWatch: true,
|
||||||
|
|
||||||
// start these browsers
|
// start these browsers
|
||||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||||
browsers: [],
|
browsers: ['ChromeNoSandboxHeadless'],
|
||||||
|
|
||||||
// Continuous Integration mode
|
// Continuous Integration mode
|
||||||
// if true, Karma captures browsers, runs the tests and exits
|
// if true, Karma captures browsers, runs the tests and exits
|
||||||
singleRun: false,
|
singleRun: false,
|
||||||
|
|
||||||
// Concurrency level
|
// Concurrency level
|
||||||
// how many browser should be started simultaneous
|
// how many browser should be started simultaneous
|
||||||
concurrency: Infinity,
|
concurrency: Infinity,
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
|
@ -100,8 +100,6 @@ module.exports = function(config) {
|
||||||
|
|
||||||
if (process.env.FIREFOX_BIN)
|
if (process.env.FIREFOX_BIN)
|
||||||
baseConfig.browsers = ['FirefoxHeadless'];
|
baseConfig.browsers = ['FirefoxHeadless'];
|
||||||
else
|
|
||||||
baseConfig.browsers = ['ChromeNoSandboxHeadless'];
|
|
||||||
|
|
||||||
config.set(baseConfig);
|
config.set(baseConfig);
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,5 +20,6 @@
|
||||||
"The sales of this ticket can't be modified": "The sales of this ticket can't be modified",
|
"The sales of this ticket can't be modified": "The sales of this ticket can't be modified",
|
||||||
"Cannot check VIES and Equalization Tax": "Cannot check VIES and Equalization Tax",
|
"Cannot check VIES and Equalization Tax": "Cannot check VIES and Equalization Tax",
|
||||||
"Cannot check Equalization Tax in this NIF/CIF": "Cannot check Equalization Tax in this NIF/CIF",
|
"Cannot check Equalization Tax in this NIF/CIF": "Cannot check Equalization Tax in this NIF/CIF",
|
||||||
"You can't create an order for a frozen client": "You can't create an order for a frozen client"
|
"You can't create an order for a frozen client": "You can't create an order for a frozen client",
|
||||||
|
"This address doesn't exist": "This address doesn't exist"
|
||||||
}
|
}
|
|
@ -8,10 +8,14 @@ module.exports = Self => {
|
||||||
let model = this.app.models[this.modelName].definition;
|
let model = this.app.models[this.modelName].definition;
|
||||||
let properties = model.properties;
|
let properties = model.properties;
|
||||||
let columnName;
|
let columnName;
|
||||||
let tableName;
|
let tableName = this.modelName;
|
||||||
|
let schema = null;
|
||||||
|
|
||||||
if (model.settings && model.settings.mysql)
|
if (model.settings && model.settings.mysql) {
|
||||||
tableName = model.settings.mysql.table;
|
let tableSplit = model.settings.mysql.table.split('.');
|
||||||
|
tableName = tableSplit.pop();
|
||||||
|
schema = tableSplit.pop() || null;
|
||||||
|
}
|
||||||
|
|
||||||
if (properties[column]) {
|
if (properties[column]) {
|
||||||
columnName = column;
|
columnName = column;
|
||||||
|
@ -27,10 +31,13 @@ module.exports = Self => {
|
||||||
if (findColumn)
|
if (findColumn)
|
||||||
columnName = properties[findColumn].mysql.columnName;
|
columnName = properties[findColumn].mysql.columnName;
|
||||||
|
|
||||||
let type = await this.rawSql(`
|
let type = await this.rawSql(
|
||||||
SELECT DISTINCT column_type FROM information_schema.columns
|
`SELECT DISTINCT column_type FROM information_schema.columns
|
||||||
WHERE table_name = ?
|
WHERE table_name = ?
|
||||||
AND column_name = ?`, [tableName, columnName]);
|
AND table_schema = IFNULL(?, DATABASE())
|
||||||
|
AND column_name = ?`,
|
||||||
|
[tableName, schema, columnName]
|
||||||
|
);
|
||||||
|
|
||||||
if (!type) return;
|
if (!type) return;
|
||||||
|
|
||||||
|
|
|
@ -5,19 +5,16 @@ process.on('warning', warning => {
|
||||||
console.log(warning.stack);
|
console.log(warning.stack);
|
||||||
});
|
});
|
||||||
|
|
||||||
var verbose = false;
|
let verbose = false;
|
||||||
|
|
||||||
if (process.argv[2] === '--v') {
|
if (process.argv[2] === '--v')
|
||||||
verbose = true;
|
verbose = true;
|
||||||
}
|
|
||||||
servicesDir = `${__dirname}/services`;
|
servicesDir = `${__dirname}/services`;
|
||||||
|
|
||||||
var Jasmine = require('jasmine');
|
let Jasmine = require('jasmine');
|
||||||
var jasmine = new Jasmine();
|
let jasmine = new Jasmine();
|
||||||
var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
|
let SpecReporter = require('jasmine-spec-reporter').SpecReporter;
|
||||||
let environment = require('gulp-env');
|
|
||||||
|
|
||||||
environment(".env.json");
|
|
||||||
|
|
||||||
let serviceList = fs.readdirSync(servicesDir);
|
let serviceList = fs.readdirSync(servicesDir);
|
||||||
let serviceSpecs = [
|
let serviceSpecs = [
|
||||||
|
|
Loading…
Reference in New Issue