merge
gitea/salix/1959-client_fiscal_data_check_phone There was a failure building this commit
Details
gitea/salix/1959-client_fiscal_data_check_phone There was a failure building this commit
Details
This commit is contained in:
commit
b743938fee
|
@ -2,8 +2,6 @@
|
|||
{
|
||||
// Carácter predeterminado de final de línea.
|
||||
"files.eol": "\n",
|
||||
"vsicons.presets.angular": false,
|
||||
"eslint.autoFixOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": true
|
||||
}
|
||||
|
|
|
@ -34,5 +34,5 @@ COPY \
|
|||
|
||||
CMD ["pm2-runtime", "./back/process.yml"]
|
||||
|
||||
HEALTHCHECK --interval=1m --timeout=10s \
|
||||
HEALTHCHECK --interval=15s --timeout=10s \
|
||||
CMD curl -f http://localhost:3000/api/Applications/status || exit 1
|
||||
|
|
|
@ -6,20 +6,13 @@ pipeline {
|
|||
disableConcurrentBuilds()
|
||||
}
|
||||
environment {
|
||||
PROJECT_NAME = 'salix'
|
||||
REGISTRY = 'registry.verdnatura.es'
|
||||
PORT_MASTER_FRONT = '5002'
|
||||
PORT_MASTER_BACK = '3001'
|
||||
PORT_TEST_FRONT = '5001'
|
||||
PORT_TEST_BACK = '4001'
|
||||
TAG = "${env.BRANCH_NAME}"
|
||||
PROJECT_NAME = 'salix'
|
||||
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||
}
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
script {
|
||||
env.STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||
|
||||
if (!env.GIT_COMMITTER_EMAIL) {
|
||||
env.COMMITTER_EMAIL = sh(
|
||||
script: 'git --no-pager show -s --format="%ae"',
|
||||
|
@ -29,16 +22,6 @@ pipeline {
|
|||
env.COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL;
|
||||
}
|
||||
|
||||
switch (env.BRANCH_NAME) {
|
||||
case 'master':
|
||||
env.PORT_FRONT = PORT_MASTER_FRONT
|
||||
env.PORT_BACK = PORT_MASTER_BACK
|
||||
break
|
||||
case 'test':
|
||||
env.PORT_FRONT = PORT_TEST_FRONT
|
||||
env.PORT_BACK = PORT_TEST_BACK
|
||||
break
|
||||
}
|
||||
switch (env.BRANCH_NAME) {
|
||||
case 'master':
|
||||
env.NODE_ENV = 'production'
|
||||
|
@ -48,6 +31,14 @@ pipeline {
|
|||
break
|
||||
}
|
||||
}
|
||||
|
||||
configFileProvider([
|
||||
configFile(fileId: "salix.groovy",
|
||||
variable: 'GROOVY_FILE')
|
||||
]) {
|
||||
load env.GROOVY_FILE
|
||||
}
|
||||
|
||||
sh 'printenv'
|
||||
}
|
||||
}
|
||||
|
@ -57,8 +48,8 @@ pipeline {
|
|||
}
|
||||
steps {
|
||||
nodejs('node-lts') {
|
||||
sh 'npm install --no-audit'
|
||||
sh 'gulp install'
|
||||
sh 'npm install --no-audit --prefer-offline'
|
||||
sh 'gulp install --ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,138 @@
|
|||
const request = require('request-promise-native');
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('send', {
|
||||
description: 'Send a RocketChat message',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
arg: 'to',
|
||||
type: 'String',
|
||||
required: true,
|
||||
description: 'User (@) or channel (#) to send the message'
|
||||
}, {
|
||||
arg: 'message',
|
||||
type: 'String',
|
||||
required: true,
|
||||
description: 'The message'
|
||||
}],
|
||||
returns: {
|
||||
type: 'Object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/send`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.send = async(ctx, to, message) => {
|
||||
const models = Self.app.models;
|
||||
const accessToken = ctx.req.accessToken;
|
||||
const sender = await models.Account.findById(accessToken.userId);
|
||||
const recipient = to.replace('@', '');
|
||||
|
||||
if (sender.name != recipient)
|
||||
return sendMessage(sender, to, `@${sender.name}: ${message} `);
|
||||
};
|
||||
|
||||
async function sendMessage(sender, channel, message) {
|
||||
const config = await getConfig();
|
||||
const avatar = `${config.host}/avatar/${sender.name}`;
|
||||
const uri = `${config.api}/chat.postMessage`;
|
||||
|
||||
return sendAuth(uri, {
|
||||
'channel': channel,
|
||||
'avatar': avatar,
|
||||
'text': message
|
||||
}).catch(async error => {
|
||||
if (error.statusCode === 401 && !this.resendAttempted) {
|
||||
this.resendAttempted = true;
|
||||
|
||||
return sendMessage(sender, channel, message);
|
||||
}
|
||||
|
||||
throw new Error(error.message);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a rocketchat token
|
||||
* @return {Object} userId and authToken
|
||||
*/
|
||||
async function getAuthToken() {
|
||||
if (!this.auth || this.auth && !this.auth.authToken) {
|
||||
const config = await getConfig();
|
||||
const uri = `${config.api}/login`;
|
||||
const res = await send(uri, {
|
||||
user: config.user,
|
||||
password: config.password
|
||||
});
|
||||
|
||||
this.auth = res.data;
|
||||
}
|
||||
|
||||
return this.auth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a rocketchat config
|
||||
* @return {Object} Auth config
|
||||
*/
|
||||
async function getConfig() {
|
||||
if (!this.chatConfig) {
|
||||
const models = Self.app.models;
|
||||
|
||||
this.chatConfig = await models.ChatConfig.findOne();
|
||||
}
|
||||
|
||||
return this.chatConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send unauthenticated request
|
||||
* @param {*} uri - Request uri
|
||||
* @param {*} body - Request params
|
||||
* @param {*} options - Request options
|
||||
*
|
||||
* @return {Object} Request response
|
||||
*/
|
||||
async function send(uri, body, options) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
return new Promise(resolve => {
|
||||
return resolve({statusCode: 200, message: 'Fake notification sent'});
|
||||
});
|
||||
}
|
||||
|
||||
const defaultOptions = {
|
||||
method: 'POST',
|
||||
uri: uri,
|
||||
body: body,
|
||||
headers: {'content-type': 'application/json'},
|
||||
json: true
|
||||
};
|
||||
|
||||
if (options) Object.assign(defaultOptions, options);
|
||||
|
||||
return request(defaultOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send authenticated request
|
||||
* @param {*} uri - Request uri
|
||||
* @param {*} body - Request params
|
||||
*
|
||||
* @return {Object} Request response
|
||||
*/
|
||||
async function sendAuth(uri, body) {
|
||||
const login = await getAuthToken();
|
||||
const options = {
|
||||
headers: {'content-type': 'application/json'}
|
||||
};
|
||||
|
||||
if (login) {
|
||||
options.headers['X-Auth-Token'] = login.authToken;
|
||||
options.headers['X-User-Id'] = login.userId;
|
||||
}
|
||||
|
||||
return send(uri, body, options);
|
||||
}
|
||||
};
|
|
@ -0,0 +1,53 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('sendCheckingPresence', {
|
||||
description: 'Sends a RocketChat message to a working worker or department channel',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
arg: 'workerId',
|
||||
type: 'Number',
|
||||
required: true,
|
||||
description: 'The worker id of the destinatary'
|
||||
}, {
|
||||
arg: 'message',
|
||||
type: 'String',
|
||||
required: true,
|
||||
description: 'The message'
|
||||
}],
|
||||
returns: {
|
||||
type: 'Object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/sendCheckingPresence`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.sendCheckingPresence = async(ctx, workerId, message) => {
|
||||
const models = Self.app.models;
|
||||
const account = await models.Account.findById(workerId);
|
||||
|
||||
const query = `SELECT worker_isWorking(?) isWorking`;
|
||||
const [result] = await Self.rawSql(query, [workerId]);
|
||||
|
||||
let room;
|
||||
if (result.isWorking)
|
||||
room = `@${account.name}`;
|
||||
else {
|
||||
const workerDepartment = await models.WorkerDepartment.findById(workerId, {
|
||||
include: {
|
||||
relation: 'department'
|
||||
}
|
||||
});
|
||||
const department = workerDepartment.department();
|
||||
const channelName = department.chatName;
|
||||
room = `#${channelName}`;
|
||||
|
||||
if (channelName)
|
||||
room = `#${channelName}`;
|
||||
else room = `@${account.name}`;
|
||||
}
|
||||
|
||||
return Self.send(ctx, room, message);
|
||||
};
|
||||
};
|
|
@ -1,4 +1,3 @@
|
|||
const request = require('request-promise-native');
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('sendMessage', {
|
||||
description: 'Send a RocketChat message',
|
||||
|
@ -24,115 +23,8 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
// FIXME: Deprecate this method #2019
|
||||
Self.sendMessage = async(ctx, to, message) => {
|
||||
const models = Self.app.models;
|
||||
const accessToken = ctx.req.accessToken;
|
||||
const sender = await models.Account.findById(accessToken.userId);
|
||||
const recipient = to.replace('@', '');
|
||||
|
||||
if (sender.name != recipient)
|
||||
return sendMessage(sender, to, `@${sender.name}: ${message} `);
|
||||
return Self.send(ctx, to, message);
|
||||
};
|
||||
|
||||
async function sendMessage(sender, channel, message) {
|
||||
const config = await getConfig();
|
||||
|
||||
const avatar = `${config.host}/avatar/${sender.name}`;
|
||||
const uri = `${config.api}/chat.postMessage`;
|
||||
return sendAuth(uri, {
|
||||
'channel': channel,
|
||||
'avatar': avatar,
|
||||
'text': message
|
||||
}).catch(async error => {
|
||||
if (error.statusCode === 401 && !this.resendAttempted) {
|
||||
this.resendAttempted = true;
|
||||
|
||||
return sendMessage(sender, channel, message);
|
||||
}
|
||||
|
||||
throw new Error(error.message);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a rocketchat token
|
||||
* @return {Object} userId and authToken
|
||||
*/
|
||||
async function getAuthToken() {
|
||||
if (!this.auth || this.auth && !this.auth.authToken) {
|
||||
const config = await getConfig();
|
||||
const uri = `${config.api}/login`;
|
||||
const res = await send(uri, {
|
||||
user: config.user,
|
||||
password: config.password
|
||||
});
|
||||
|
||||
this.auth = res.data;
|
||||
}
|
||||
|
||||
return this.auth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a rocketchat config
|
||||
* @return {Object} Auth config
|
||||
*/
|
||||
async function getConfig() {
|
||||
if (!this.chatConfig) {
|
||||
const models = Self.app.models;
|
||||
|
||||
this.chatConfig = await models.ChatConfig.findOne();
|
||||
}
|
||||
|
||||
return this.chatConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send unauthenticated request
|
||||
* @param {*} uri - Request uri
|
||||
* @param {*} body - Request params
|
||||
* @param {*} options - Request options
|
||||
*
|
||||
* @return {Object} Request response
|
||||
*/
|
||||
async function send(uri, body, options) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
return new Promise(resolve => {
|
||||
return resolve({statusCode: 200, message: 'Fake notification sent'});
|
||||
});
|
||||
}
|
||||
|
||||
const defaultOptions = {
|
||||
method: 'POST',
|
||||
uri: uri,
|
||||
body: body,
|
||||
headers: {'content-type': 'application/json'},
|
||||
json: true
|
||||
};
|
||||
|
||||
if (options) Object.assign(defaultOptions, options);
|
||||
|
||||
return request(defaultOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send authenticated request
|
||||
* @param {*} uri - Request uri
|
||||
* @param {*} body - Request params
|
||||
*
|
||||
* @return {Object} Request response
|
||||
*/
|
||||
async function sendAuth(uri, body) {
|
||||
const login = await getAuthToken();
|
||||
const options = {
|
||||
headers: {'content-type': 'application/json'}
|
||||
};
|
||||
|
||||
if (login) {
|
||||
options.headers['X-Auth-Token'] = login.authToken;
|
||||
options.headers['X-User-Id'] = login.userId;
|
||||
}
|
||||
|
||||
return send(uri, body, options);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
describe('chat sendMessage()', () => {
|
||||
describe('chat send()', () => {
|
||||
it('should return a "Fake notification sent" as response', async() => {
|
||||
let ctx = {req: {accessToken: {userId: 1}}};
|
||||
let response = await app.models.Chat.sendMessage(ctx, '@salesPerson', 'I changed something');
|
||||
let response = await app.models.Chat.send(ctx, '@salesPerson', 'I changed something');
|
||||
|
||||
expect(response.statusCode).toEqual(200);
|
||||
expect(response.message).toEqual('Fake notification sent');
|
||||
|
@ -11,7 +11,7 @@ describe('chat sendMessage()', () => {
|
|||
|
||||
it('should not return a response', async() => {
|
||||
let ctx = {req: {accessToken: {userId: 18}}};
|
||||
let response = await app.models.Chat.sendMessage(ctx, '@salesPerson', 'I changed something');
|
||||
let response = await app.models.Chat.send(ctx, '@salesPerson', 'I changed something');
|
||||
|
||||
expect(response).toBeUndefined();
|
||||
});
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
describe('chat sendCheckingPresence()', () => {
|
||||
const departmentId = 23;
|
||||
const workerId = 107;
|
||||
let timeEntry;
|
||||
|
||||
afterAll(async done => {
|
||||
const department = await app.models.Department.findById(departmentId);
|
||||
await department.updateAttribute('chatName', null);
|
||||
await app.models.WorkerTimeControl.destroyById(timeEntry.id);
|
||||
done();
|
||||
});
|
||||
|
||||
it(`should call to send() method with the worker username when no department channel is specified
|
||||
and then return a "Fake notification sent" as response`, async() => {
|
||||
const ctx = {req: {accessToken: {userId: 1}}};
|
||||
const chatModel = app.models.Chat;
|
||||
spyOn(chatModel, 'send').and.callThrough();
|
||||
|
||||
const response = await chatModel.sendCheckingPresence(ctx, workerId, 'I changed something');
|
||||
|
||||
expect(response.statusCode).toEqual(200);
|
||||
expect(response.message).toEqual('Fake notification sent');
|
||||
expect(chatModel.send).toHaveBeenCalledWith(ctx, '@HankPym', 'I changed something');
|
||||
});
|
||||
|
||||
it(`should call to send() method with the worker department channel if is specified
|
||||
and then return a "Fake notification sent" as response`, async() => {
|
||||
const ctx = {req: {accessToken: {userId: 1}}};
|
||||
const chatModel = app.models.Chat;
|
||||
spyOn(chatModel, 'send').and.callThrough();
|
||||
|
||||
const department = await app.models.Department.findById(departmentId);
|
||||
await department.updateAttribute('chatName', 'cooler');
|
||||
|
||||
const response = await chatModel.sendCheckingPresence(ctx, workerId, 'I changed something');
|
||||
|
||||
expect(response.statusCode).toEqual(200);
|
||||
expect(response.message).toEqual('Fake notification sent');
|
||||
expect(chatModel.send).toHaveBeenCalledWith(ctx, '#cooler', 'I changed something');
|
||||
});
|
||||
|
||||
it(`should call to send() method with the worker username when the worker is working`, async() => {
|
||||
const ctx = {req: {accessToken: {userId: 1}}};
|
||||
const chatModel = app.models.Chat;
|
||||
spyOn(chatModel, 'send').and.callThrough();
|
||||
|
||||
const today = new Date();
|
||||
today.setHours(6, 0);
|
||||
|
||||
timeEntry = await app.models.WorkerTimeControl.create({
|
||||
userFk: workerId,
|
||||
timed: today,
|
||||
manual: false,
|
||||
direction: 'in'
|
||||
});
|
||||
|
||||
const response = await chatModel.sendCheckingPresence(ctx, workerId, 'I changed something');
|
||||
|
||||
expect(response.statusCode).toEqual(200);
|
||||
expect(response.message).toEqual('Fake notification sent');
|
||||
expect(chatModel.send).toHaveBeenCalledWith(ctx, '@HankPym', 'I changed something');
|
||||
});
|
||||
});
|
|
@ -22,8 +22,10 @@ module.exports = Self => {
|
|||
|
||||
Self.removeFile = async(ctx, id) => {
|
||||
const models = Self.app.models;
|
||||
const trashDmsType = await models.DmsType.findOne({where: {code: 'trash'}});
|
||||
const dms = await models.Dms.findById(id);
|
||||
const trashDmsType = await models.DmsType.findOne({
|
||||
where: {code: 'trash'}
|
||||
});
|
||||
|
||||
const hasWriteRole = await models.DmsType.hasWriteRole(ctx, dms.dmsTypeFk);
|
||||
if (!hasWriteRole)
|
||||
|
|
|
@ -2,6 +2,7 @@ const app = require('vn-loopback/server/server');
|
|||
|
||||
describe('dms downloadFile()', () => {
|
||||
let dmsId = 1;
|
||||
|
||||
it('should return a response for an employee with text content-type', async() => {
|
||||
let workerId = 107;
|
||||
let ctx = {req: {accessToken: {userId: workerId}}};
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('send', {
|
||||
description: 'Send message to user',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
arg: 'data',
|
||||
type: 'object',
|
||||
required: true,
|
||||
description: 'recipientFk, message',
|
||||
http: {source: 'body'}
|
||||
}, {
|
||||
arg: 'context',
|
||||
type: 'object',
|
||||
http: function(ctx) {
|
||||
return ctx;
|
||||
}
|
||||
}],
|
||||
returns: {
|
||||
type: 'boolean',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/:recipient/send`,
|
||||
verb: 'post'
|
||||
}
|
||||
});
|
||||
|
||||
Self.send = async(ctx, data, options) => {
|
||||
const accessToken = ctx.options && ctx.options.accessToken || ctx.req && ctx.req.accessToken;
|
||||
const userId = accessToken.userId;
|
||||
const models = Self.app.models;
|
||||
const sender = await models.Account.findById(userId, null, options);
|
||||
const recipient = await models.Account.findById(data.recipientFk, null, options);
|
||||
|
||||
await Self.create({
|
||||
sender: sender.name,
|
||||
recipient: recipient.name,
|
||||
message: data.message
|
||||
}, options);
|
||||
|
||||
return await models.MessageInbox.create({
|
||||
sender: sender.name,
|
||||
recipient: recipient.name,
|
||||
finalRecipient: recipient.name,
|
||||
message: data.message
|
||||
}, options);
|
||||
};
|
||||
};
|
|
@ -1,14 +0,0 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
describe('message send()', () => {
|
||||
it('should return a response containing the same message in params', async() => {
|
||||
let ctx = {req: {accessToken: {userId: 1}}};
|
||||
let params = {
|
||||
recipientFk: 1,
|
||||
message: 'I changed something'
|
||||
};
|
||||
let response = await app.models.Message.send(ctx, params, {transaction: 'You'});
|
||||
|
||||
expect(response.message).toEqual(params.message);
|
||||
});
|
||||
});
|
|
@ -23,12 +23,6 @@
|
|||
"Delivery": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Message": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"MessageInbox": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Province": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
@ -59,12 +53,6 @@
|
|||
"Postcode": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"UserPhoneType": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"UserPhone": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"UserLog": {
|
||||
"dataSource": "vn"
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/chat/send')(Self);
|
||||
require('../methods/chat/sendMessage')(Self);
|
||||
require('../methods/chat/sendCheckingPresence')(Self);
|
||||
};
|
||||
|
|
|
@ -4,36 +4,39 @@
|
|||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "country"
|
||||
"table": "country"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
"type": "Number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"country": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"code": {
|
||||
"type": "string"
|
||||
"type": "string"
|
||||
},
|
||||
"isUeeMember": {
|
||||
"type": "Boolean"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"currency": {
|
||||
"type": "belongsTo",
|
||||
"model": "Currency",
|
||||
"foreignKey": "currencyFk"
|
||||
"type": "belongsTo",
|
||||
"model": "Currency",
|
||||
"foreignKey": "currencyFk"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "ALLOW"
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -3,6 +3,9 @@
|
|||
"name": "Dms",
|
||||
"description": "Documental Managment system",
|
||||
"base": "VnModel",
|
||||
"log": {
|
||||
"showField": "reference"
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "dms"
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
{
|
||||
"name": "MessageInbox",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "messageInbox"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"sender": {
|
||||
"type": "String",
|
||||
"required": true
|
||||
},
|
||||
"recipient": {
|
||||
"type": "String",
|
||||
"required": true
|
||||
},
|
||||
"finalRecipient": {
|
||||
"type": "String",
|
||||
"required": true
|
||||
},
|
||||
"message": {
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"remitter": {
|
||||
"type": "belongsTo",
|
||||
"model": "User",
|
||||
"foreignKey": "sender"
|
||||
},
|
||||
"receptor": {
|
||||
"type": "belongsTo",
|
||||
"model": "User",
|
||||
"foreignKey": "recipient"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/message/send')(Self);
|
||||
};
|
|
@ -1,39 +0,0 @@
|
|||
{
|
||||
"name": "Message",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "message"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"sender": {
|
||||
"type": "String",
|
||||
"required": true
|
||||
},
|
||||
"recipient": {
|
||||
"type": "String",
|
||||
"required": true
|
||||
},
|
||||
"message": {
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"remitter": {
|
||||
"type": "belongsTo",
|
||||
"model": "User",
|
||||
"foreignKey": "sender"
|
||||
},
|
||||
"receptor": {
|
||||
"type": "belongsTo",
|
||||
"model": "User",
|
||||
"foreignKey": "recipient"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"name": "UserPhoneType",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "userPhoneType"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"code": {
|
||||
"id": true,
|
||||
"type": "String"
|
||||
},
|
||||
"description": {
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
let UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.rewriteDbError(function(err) {
|
||||
if (err.code === 'ER_DUP_ENTRY')
|
||||
return new UserError(`This phone already exists`);
|
||||
return err;
|
||||
});
|
||||
};
|
|
@ -1,39 +0,0 @@
|
|||
{
|
||||
"name": "UserPhone",
|
||||
"base": "Loggable",
|
||||
"log": {
|
||||
"model":"UserLog",
|
||||
"relation": "user"
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "userPhone"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number"
|
||||
},
|
||||
"phone": {
|
||||
"type": "Number",
|
||||
"required": true
|
||||
},
|
||||
"typeFk": {
|
||||
"type": "String",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"user": {
|
||||
"type": "belongsTo",
|
||||
"model": "Account",
|
||||
"foreignKey": "userFk"
|
||||
},
|
||||
"type": {
|
||||
"type": "belongsTo",
|
||||
"model": "UserPhoneType",
|
||||
"foreignKey": "typeFk"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,4 +2,5 @@ apps:
|
|||
- script: ./loopback/server/server.js
|
||||
name: salix-back
|
||||
instances: 1
|
||||
max_restarts: 5
|
||||
max_restarts: 3
|
||||
restart_delay: 15000
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
CREATE TABLE `vn`.`zoneClosure` (
|
||||
`zoneFk` INT NOT NULL,
|
||||
`dated` DATE NOT NULL,
|
||||
`hour` TIME NOT NULL,
|
||||
PRIMARY KEY (`zoneFk`, `dated`));
|
|
@ -0,0 +1,50 @@
|
|||
|
||||
DROP procedure IF EXISTS vn.`zoneClosure_recalc`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE vn.`zoneClosure_recalc`()
|
||||
proc: BEGIN
|
||||
/**
|
||||
* Recalculates the delivery time (hour) for every zone in days + scope in future
|
||||
*/
|
||||
DECLARE vScope INT;
|
||||
DECLARE vCounter INT DEFAULT 0;
|
||||
DECLARE vShipped DATE DEFAULT CURDATE();
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
DO RELEASE_LOCK('vn.zoneClosure_recalc');
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
IF NOT GET_LOCK('vn.zoneClosure_recalc', 0) THEN
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
SELECT scope INTO vScope
|
||||
FROM zoneConfig;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.zone;
|
||||
CREATE TEMPORARY TABLE tmp.zone
|
||||
(INDEX (id))
|
||||
ENGINE = MEMORY
|
||||
SELECT id FROM zone;
|
||||
|
||||
TRUNCATE TABLE zoneClosure;
|
||||
|
||||
REPEAT
|
||||
CALL zone_getOptionsForShipment(vShipped);
|
||||
INSERT INTO zoneClosure(zoneFk, dated, `hour`)
|
||||
SELECT zoneFk, vShipped, `hour` FROM tmp.zoneOption;
|
||||
|
||||
SET vCounter = vCounter + 1;
|
||||
SET vShipped = TIMESTAMPADD(DAY, 1, vShipped);
|
||||
UNTIL vCounter > vScope
|
||||
END REPEAT;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.zone;
|
||||
DO RELEASE_LOCK('vn.zoneClosure_recalc');
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
CREATE TABLE `vn`.`zoneConfig` (
|
||||
`id` INT UNSIGNED NOT NULL,
|
||||
`scope` INT UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id`));
|
||||
|
||||
ALTER TABLE `vn`.`zoneConfig`
|
||||
CHANGE COLUMN `id` `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ;
|
||||
|
||||
INSERT INTO `vn`.`zoneConfig` (`scope`) VALUES ('1');
|
||||
|
||||
INSERT INTO `bs`.`nightTask` (`order`, `schema`, `procedure`) VALUES ('100', 'vn', 'zoneClosure_recalc');
|
|
@ -109,10 +109,10 @@ proc: BEGIN
|
|||
GROUP BY tc.itemFk, warehouseFk;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcb.warehouseFk, tcb.itemFk, vRecoveryComponent, ROUND(tcb.base * LEAST(cr.recobro, 0.25), 3)
|
||||
SELECT tcb.warehouseFk, tcb.itemFk, vRecoveryComponent, ROUND(tcb.base * LEAST(cr.priceIncreasing, 0.25), 3)
|
||||
FROM tmp.ticketComponentBase tcb
|
||||
JOIN bi.claims_ratio cr ON cr.Id_Cliente = vClientFk
|
||||
WHERE cr.recobro > 0.009;
|
||||
JOIN claimRatio cr ON cr.clientFk = vClientFk
|
||||
WHERE cr.priceIncreasing > 0.009;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcb.warehouseFk, tcb.itemFk, vManaAutoComponent, ROUND(base * (0.01 + wm.pricesModifierRate), 3) as manaAuto
|
||||
|
@ -125,13 +125,13 @@ proc: BEGIN
|
|||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcb.warehouseFk,
|
||||
tcb.itemFk,
|
||||
cr.id,
|
||||
GREATEST(IFNULL(ROUND(tcb.base * cr.tax, 4), 0), tcc.minPrice - tcc.rate3)
|
||||
c.id,
|
||||
GREATEST(IFNULL(ROUND(tcb.base * c.tax, 4), 0), tcc.minPrice - tcc.rate3)
|
||||
FROM tmp.ticketComponentBase tcb
|
||||
JOIN componentRate cr
|
||||
JOIN component c
|
||||
JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk
|
||||
LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk
|
||||
WHERE cr.id = vDiscountLastItemComponent AND cr.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL;
|
||||
WHERE c.id = vDiscountLastItemComponent AND c.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcc.warehouseFk, tcc.itemFk, vSellByPacketComponent, tcc.rate2 - tcc.rate3
|
||||
|
@ -147,7 +147,7 @@ proc: BEGIN
|
|||
vGeneralInflationCoefficient
|
||||
* ROUND((
|
||||
i.compression
|
||||
* r.cm3
|
||||
* ic.cm3
|
||||
* IF(am.deliveryMethodFk = 1, (GREATEST(i.density, vMinimumDensityWeight) / vMinimumDensityWeight), 1)
|
||||
* IFNULL((z.price - z.bonus)
|
||||
* 1/*amz.inflation*/ , 50)) / vBoxVolume, 4
|
||||
|
@ -156,8 +156,8 @@ proc: BEGIN
|
|||
JOIN item i ON i.id = tcc.itemFk
|
||||
JOIN zone z ON z.id = vZoneFk
|
||||
JOIN agencyMode am ON am.id = z.agencyModeFk
|
||||
LEFT JOIN bi.rotacion r ON r.warehouse_id = tcc.warehouseFk
|
||||
AND r.Id_Article = tcc.itemFk
|
||||
LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk
|
||||
AND ic.itemFk = tcc.itemFk
|
||||
HAVING cost <> 0;
|
||||
|
||||
IF (SELECT COUNT(*) FROM vn.addressForPackaging WHERE addressFk = vAddressFk) THEN
|
||||
|
@ -178,9 +178,9 @@ proc: BEGIN
|
|||
vSpecialPriceComponent,
|
||||
sp.value - SUM(tcc.cost) sumCost
|
||||
FROM tmp.ticketComponentCopy tcc
|
||||
JOIN componentRate cr ON cr.id = tcc.componentFk
|
||||
JOIN component c ON c.id = tcc.componentFk
|
||||
JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk
|
||||
WHERE cr.classRate IS NULL
|
||||
WHERE c.classRate IS NULL
|
||||
GROUP BY tcc.itemFk, tcc.warehouseFk
|
||||
HAVING ABS(sumCost) > 0.001;
|
||||
|
||||
|
@ -188,10 +188,10 @@ proc: BEGIN
|
|||
CREATE TEMPORARY TABLE tmp.ticketComponentSum
|
||||
(INDEX (itemFk, warehouseFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, cr.classRate
|
||||
SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, c.classRate
|
||||
FROM tmp.ticketComponent tc
|
||||
JOIN componentRate cr ON cr.id = tc.componentFk
|
||||
GROUP BY tc.itemFk, tc.warehouseFk, cr.classRate;
|
||||
JOIN component c ON c.id = tc.componentFk
|
||||
GROUP BY tc.itemFk, tc.warehouseFk, c.classRate;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
USE `vn`;
|
||||
DROP procedure IF EXISTS `timeControl_calculate`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `timeControl_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME)
|
||||
BEGIN
|
||||
SET @vIsOdd := TRUE;
|
||||
SET @vUser := NULL;
|
||||
SET @vDated := NULL;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp.timeControlCalculate
|
||||
SELECT userFk,
|
||||
dated,
|
||||
IF( timeWork >= 18000, @timeWork:=timeWork + 1200, @timeWork:=timeWork) timeWorkSeconds,
|
||||
SEC_TO_TIME(@timeWork ) timeWorkSexagesimal,
|
||||
@timeWork / 3600 timeWorkDecimal
|
||||
FROM (SELECT SUM(timeWork) timeWork,
|
||||
userFk,
|
||||
dated
|
||||
FROM (SELECT IF(@vUser = wtc.userFk, @vUser :=@vUser, @vUser := wtc.userFk ),
|
||||
IF(@vIsOdd, @vIsOdd := FALSE, @vIsOdd := TRUE ),
|
||||
IF(direction='in', @vIsOdd := TRUE, @vIsOdd := @vIsOdd ),
|
||||
IF(@vIsOdd, @vLastTimed:=UNIX_TIMESTAMP(timed),@vLastTimed:=@vLastTimed),
|
||||
IF(@vIsOdd, 0, UNIX_TIMESTAMP(timed)-@vLastTimed) timeWork,
|
||||
IF(direction='in', @vDated := DATE(wtc.timed), @vDated :=@vDated) dated,
|
||||
wtc.userFk,
|
||||
wtc.timed timed,
|
||||
direction
|
||||
FROM (SELECT * FROM workerTimeControl ORDER BY userFk, timed ASC) wtc
|
||||
JOIN tmp.`user` w ON w.userFk = wtc.userFk
|
||||
WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo
|
||||
ORDER BY userFk, timed ASC
|
||||
) sub
|
||||
GROUP BY userFk, dated
|
||||
ORDER BY userFk, dated
|
||||
)sub2;
|
||||
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Thermograph', '*', '*', 'ALLOW', 'ROLE', 'buyer');
|
||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('TravelThermograph', '*', '*', 'ALLOW', 'ROLE', 'buyer');
|
||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Entry', '*', '*', 'ALLOW', 'ROLE', 'buyer');
|
|
@ -0,0 +1,81 @@
|
|||
|
||||
DROP procedure IF EXISTS `vn`.`buy_afterUpsert`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`buy_afterUpsert`(vSelf INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Triggered actions when a buy is updated or inserted.
|
||||
*
|
||||
* @param vSelf The buy reference
|
||||
*/
|
||||
DECLARE vEntryFk INT;
|
||||
DECLARE vItemFk INT;
|
||||
DECLARE vStickers INT;
|
||||
DECLARE vPacking INT;
|
||||
DECLARE vWarehouse INT;
|
||||
DECLARE vWarehouseOut INT;
|
||||
DECLARE vIsMerchandise BOOL;
|
||||
DECLARE vIsFeedStock BOOL;
|
||||
DECLARE vLanded DATE;
|
||||
DECLARE vBuyerFk INT;
|
||||
DECLARE vItemName VARCHAR(50);
|
||||
|
||||
SELECT entryFk, itemFk, stickers, packing
|
||||
INTO vEntryFk, vItemFk, vStickers, vPacking
|
||||
FROM buy
|
||||
WHERE id = vSelf;
|
||||
|
||||
SELECT t.warehouseInFk, t.warehouseOutFk, t.landed
|
||||
INTO vWarehouse, vWarehouseOut, vLanded
|
||||
FROM entry e
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
WHERE e.id = vEntryFk;
|
||||
|
||||
SELECT k.merchandise, it.workerFk, i.longName
|
||||
INTO vIsMerchandise, vBuyerFk, vItemName
|
||||
FROM itemCategory k
|
||||
JOIN itemType it ON it.categoryFk = k.id
|
||||
JOIN item i ON i.typeFk = it.id
|
||||
WHERE i.id = vItemFk;
|
||||
|
||||
IF vIsMerchandise THEN
|
||||
REPLACE itemCost SET
|
||||
itemFk = vItemFk,
|
||||
warehouseFk = vWarehouse,
|
||||
cm3 = buy_getUnitVolume(vSelf);
|
||||
END IF;
|
||||
|
||||
SELECT isFeedStock INTO vIsFeedStock
|
||||
FROM warehouse WHERE id = vWarehouseOut AND id <> 13;
|
||||
|
||||
IF vIsFeedStock THEN
|
||||
INSERT IGNORE INTO producer(`name`)
|
||||
SELECT es.company_name
|
||||
FROM buy b
|
||||
JOIN edi.ekt be ON be.id = b.ektFk
|
||||
JOIN edi.supplier es ON es.supplier_id = be.pro
|
||||
WHERE b.id = vSelf;
|
||||
|
||||
IF buy_hasNotifyPassport(vSelf, vItemFk) THEN
|
||||
CALL vn.buy_notifyPassport(vSelf, vItemFk, vStickers, vPacking);
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
-- Aviso al comprador de modificacion de entrada en Barajas
|
||||
IF (SELECT isBuyerToBeEmailed FROM warehouse WHERE id = vWarehouse)
|
||||
AND vLanded = CURDATE()
|
||||
AND vBuyerFk != account.myUserGetId()
|
||||
THEN
|
||||
|
||||
CALL vn.mail_insert(CONCAT(account.userGetNameFromId(vBuyerFk),'@verdnatura.es'),
|
||||
CONCAT(account.myUserGetName(),'@verdnatura.es'),
|
||||
CONCAT('E ',vEntryFk,' Se ha modificado item ', vItemFk, ' ',vItemName),
|
||||
'Este email se ha generado automáticamente');
|
||||
|
||||
END IF;
|
||||
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`clientRisk_update`(vClientId INT, vCompanyId INT, vAmount DECIMAL(10,2))
|
||||
BEGIN
|
||||
IF vAmount IS NOT NULL
|
||||
THEN
|
||||
INSERT INTO clientRisk
|
||||
SET
|
||||
clientFk = vClientId,
|
||||
companyFk = vCompanyId,
|
||||
amount = vAmount
|
||||
ON DUPLICATE KEY UPDATE
|
||||
amount = amount + VALUES(amount);
|
||||
END IF;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE `vn`.`componentType`
|
||||
CHANGE COLUMN `base` `isBase` TINYINT(4) NOT NULL DEFAULT '0' COMMENT 'Marca aquellas series que se utilizan para calcular el precio base de las ventas, a efectos estadisticos' ;
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
DROP procedure IF EXISTS `bi`.`customer_risk_update`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `bi`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `bi`.`customer_risk_update`(v_customer INT, v_company INT, v_amount DECIMAL(10,2))
|
||||
BEGIN
|
||||
CALL vn.clientRisk_update(v_customer, v_company, v_amount);
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE `vn`.`department`
|
||||
ADD COLUMN `chatName` VARCHAR(45) NULL AFTER `path`;
|
|
@ -0,0 +1,155 @@
|
|||
|
||||
|
||||
DROP procedure IF EXISTS `vn`.`ticketComponentUpdateSale`;
|
||||
|
||||
DELIMITER $$
|
||||
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ticketComponentUpdateSale`(vOption INT)
|
||||
BEGIN
|
||||
/**
|
||||
* A partir de la tabla tmp.sale, crea los Movimientos_componentes
|
||||
* y modifica el campo Preu de la tabla Movimientos
|
||||
*
|
||||
* @param i_option integer tipo de actualizacion
|
||||
* @param table tmp.sale tabla memory con el campo saleFk, warehouseFk
|
||||
**/
|
||||
DECLARE vComponentFk INT;
|
||||
DECLARE vRenewComponents BOOLEAN;
|
||||
DECLARE vKeepPrices BOOLEAN;
|
||||
|
||||
CASE vOption
|
||||
WHEN 1 THEN
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = FALSE;
|
||||
WHEN 2 THEN
|
||||
SET vComponentFk = 17;
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
WHEN 3 THEN
|
||||
SET vComponentFk = 37;
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
WHEN 4 THEN
|
||||
SET vComponentFk = 34;
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
WHEN 5 THEN
|
||||
SET vComponentFk = 35;
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
WHEN 6 THEN
|
||||
SET vComponentFk = 36;
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
WHEN 7 THEN
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.8, 3)
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
AND sc.componentFk NOT IN (28, 29)
|
||||
GROUP BY s.id;
|
||||
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, 29, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.2, 3)
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
AND sc.componentFk NOT IN (28, 29)
|
||||
GROUP BY s.id;
|
||||
|
||||
SET vRenewComponents = FALSE;
|
||||
SET vKeepPrices = FALSE;
|
||||
WHEN 8 THEN
|
||||
DELETE sc.*
|
||||
FROM tmp.sale tmps JOIN saleComponent sc ON sc.saleFk = tmps.saleFk;
|
||||
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100)), 3)
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id;
|
||||
|
||||
SET vRenewComponents = FALSE;
|
||||
SET vKeepPrices = FALSE;
|
||||
WHEN 9 THEN
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
END CASE;
|
||||
|
||||
IF vRenewComponents THEN
|
||||
DELETE sc.*
|
||||
FROM tmp.sale tmps
|
||||
JOIN saleComponent sc ON sc.saleFk = tmps.saleFk
|
||||
JOIN `component` c ON c.id = sc.componentFk
|
||||
WHERE c.isRenewable;
|
||||
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, tc.componentFk, tc.cost
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
AND sc.componentFk = tc.componentFk
|
||||
LEFT JOIN `component` c ON c.id = tc.componentFk
|
||||
WHERE IF(sc.componentFk IS NULL AND NOT c.isRenewable, FALSE, TRUE);
|
||||
END IF;
|
||||
|
||||
IF vKeepPrices THEN
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, vComponentFk, ROUND((s.price * (100 - s.discount) / 100) - SUM(sc.value), 3) dif
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
WHERE sc.saleFk <> vComponentFk
|
||||
GROUP BY s.id
|
||||
HAVING dif <> 0;
|
||||
ELSE
|
||||
UPDATE sale s
|
||||
JOIN item i on i.id = s.itemFk
|
||||
JOIN itemType it on it.id = i.typeFk
|
||||
JOIN (SELECT SUM(sc.value) sumValue, sc.saleFk
|
||||
FROM saleComponent sc
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
|
||||
GROUP BY sc.saleFk) sc ON sc.saleFk = s.id
|
||||
SET s.price = sumValue
|
||||
WHERE it.code != 'PRT' ;
|
||||
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, 21, ROUND((s.price * (100 - s.discount) / 100) - SUM(value), 3) saleValue
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
WHERE sc.componentFk != 21
|
||||
GROUP BY s.id
|
||||
HAVING ROUND(saleValue, 4) <> 0;
|
||||
END IF;
|
||||
|
||||
UPDATE sale s
|
||||
JOIN (
|
||||
SELECT SUM(sc.value) sumValue, sc.saleFk
|
||||
FROM saleComponent sc
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
|
||||
JOIN `component` c ON c.id = sc.componentFk
|
||||
JOIN componentType ct on ct.id = c.typeFk AND ct.isBase
|
||||
GROUP BY sc.saleFk) sc ON sc.saleFk = s.id
|
||||
SET s.priceFixed = sumValue, s.isPriceFixed = 1;
|
||||
|
||||
DELETE sc.*
|
||||
FROM saleComponent sc
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
|
||||
JOIN sale s on s.id = sc.saleFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
WHERE it.code = 'PRT';
|
||||
|
||||
INSERT INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, 15, s.price
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
JOIN item i ON i.id = s.itemFK
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
WHERE it.code = 'PRT' AND s.price > 0;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
ALTER TABLE `vn`.`travelThermograph`
|
||||
ADD COLUMN `id` INT NOT NULL AUTO_INCREMENT FIRST,
|
||||
DROP PRIMARY KEY,
|
||||
ADD PRIMARY KEY (`id`);
|
||||
|
||||
ALTER TABLE `vn`.`travelThermograph`
|
||||
ADD UNIQUE INDEX `thermograph_created` (`thermographFk` ASC, `created` ASC) VISIBLE;
|
|
@ -0,0 +1,27 @@
|
|||
DROP TRIGGER IF EXISTS `vn`.`invoiceOut_afterInsert`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`invoiceOut_afterInsert` AFTER INSERT ON `vn`.`invoiceOut` FOR EACH ROW BEGIN
|
||||
CALL clientRisk_update(NEW.clientFk, NEW.companyFk, NEW.amount);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
||||
DROP TRIGGER IF EXISTS `vn`.`invoiceOut_beforeUpdate`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`invoiceOut_beforeUpdate` BEFORE UPDATE ON `vn`.`invoiceOut` FOR EACH ROW
|
||||
BEGIN
|
||||
CALL clientRisk_update (OLD.clientFk, OLD.companyFk, -OLD.amount);
|
||||
CALL clientRisk_update (NEW.clientFk, NEW.companyFk, NEW.amount);
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
||||
|
||||
DROP TRIGGER IF EXISTS `vn`.`invoiceOut_beforeDelete`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`invoiceOut_beforeDelete` BEFORE DELETE ON `invoiceOut` FOR EACH ROW BEGIN
|
||||
CALL clientRisk_update (OLD.clientFk, OLD.companyFk, -OLD.amount);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,20 @@
|
|||
DROP TRIGGER IF EXISTS `vn`.`receipt_afterInsert`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`receipt_afterInsert` AFTER INSERT ON `receipt` FOR EACH ROW
|
||||
CALL clientRisk_update(NEW.clientFk, NEW.companyFk, -NEW.amountPaid)$$
|
||||
DELIMITER ;
|
||||
DROP TRIGGER IF EXISTS `vn`.`receipt_beforeUpdate`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`receipt_beforeUpdate` BEFORE UPDATE ON `receipt` FOR EACH ROW BEGIN
|
||||
CALL clientRisk_update(OLD.clientFk, OLD.companyFk, OLD.amountPaid);
|
||||
CALL clientRisk_update(NEW.clientFk, NEW.companyFk, -NEW.amountPaid);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
DROP TRIGGER IF EXISTS `vn`.`receipt_beforeDelete`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`receipt_beforeDelete` BEFORE DELETE ON `receipt` FOR EACH ROW
|
||||
CALL clientRisk_update(OLD.clientFk, OLD.companyFk, OLD.amountPaid)$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,29 @@
|
|||
USE `bs`;
|
||||
DROP procedure IF EXISTS `weekWaste_getDetail`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `bs`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `weekWaste_getDetail`()
|
||||
BEGIN
|
||||
DECLARE vLastWeek DATE;
|
||||
DECLARE vWeek INT;
|
||||
DECLARE vYear INT;
|
||||
|
||||
SET vLastWeek = TIMESTAMPADD(WEEK,-1,CURDATE());
|
||||
SET vYear = YEAR(vLastWeek);
|
||||
SET vWeek = WEEK(vLastWeek, 1);
|
||||
|
||||
SELECT *, 100 * dwindle / total AS percentage
|
||||
FROM (
|
||||
SELECT buyer,
|
||||
ws.family,
|
||||
sum(ws.saleTotal) AS total,
|
||||
sum(ws.saleWaste) AS dwindle
|
||||
FROM bs.waste ws
|
||||
WHERE year = vYear AND week = vWeek
|
||||
GROUP BY buyer, family
|
||||
) sub
|
||||
ORDER BY percentage DESC;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
|
@ -0,0 +1,32 @@
|
|||
USE `vn`;
|
||||
DROP function IF EXISTS `worker_isWorking`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
CREATE DEFINER=`root`@`%` FUNCTION `worker_isWorking`(vWorkerFk INT) RETURNS tinyint(1)
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
/**
|
||||
* Comprueba si el trabajador está trabajando en el momento de la consulta
|
||||
* @return Devuelve TRUE en caso de que este trabajando. Si se encuentra en un descanso devolverá FALSE
|
||||
*/
|
||||
DECLARE vLastIn DATETIME ;
|
||||
|
||||
SELECT MAX(timed) INTO vLastIn
|
||||
FROM vn.workerTimeControl
|
||||
WHERE userFk = vWorkerFk AND
|
||||
direction = 'in';
|
||||
|
||||
IF (SELECT MOD(COUNT(*),2)
|
||||
FROM vn.workerTimeControl
|
||||
WHERE userFk = vWorkerFk AND
|
||||
timed >= vLastIn
|
||||
) THEN
|
||||
RETURN TRUE;
|
||||
ELSE
|
||||
RETURN FALSE;
|
||||
END IF;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,240 @@
|
|||
|
||||
DROP procedure IF EXISTS `hedera`.`order_confirmWithUser`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `hedera`.`order_confirmWithUser`(IN `vOrder` INT, IN `vUserId` INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Confirms an order, creating each of its tickets on the corresponding
|
||||
* date, store and user.
|
||||
*
|
||||
* @param vOrder The order identifier
|
||||
* @param vUser The user identifier
|
||||
*/
|
||||
DECLARE vOk BOOL;
|
||||
DECLARE vDone BOOL DEFAULT FALSE;
|
||||
DECLARE vWarehouse INT;
|
||||
DECLARE vShipment DATETIME;
|
||||
DECLARE vTicket INT;
|
||||
DECLARE vNotes VARCHAR(255);
|
||||
DECLARE vItem INT;
|
||||
DECLARE vConcept VARCHAR(30);
|
||||
DECLARE vAmount INT;
|
||||
DECLARE vPrice DECIMAL(10,2);
|
||||
DECLARE vSale INT;
|
||||
DECLARE vRate INT;
|
||||
DECLARE vRowId INT;
|
||||
DECLARE vDelivery DATE;
|
||||
DECLARE vAddress INT;
|
||||
DECLARE vIsConfirmed BOOL;
|
||||
DECLARE vClientId INT;
|
||||
DECLARE vCompanyId INT;
|
||||
DECLARE vAgencyModeId INT;
|
||||
|
||||
DECLARE TICKET_FREE INT DEFAULT 2;
|
||||
|
||||
DECLARE cDates CURSOR FOR
|
||||
SELECT zgs.shipped, r.warehouse_id
|
||||
FROM `order` o
|
||||
JOIN order_row r ON r.order_id = o.id
|
||||
LEFT JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = r.warehouse_id
|
||||
WHERE o.id = vOrder AND r.amount != 0
|
||||
GROUP BY r.warehouse_id;
|
||||
|
||||
DECLARE cRows CURSOR FOR
|
||||
SELECT r.id, r.item_id, i.name, r.amount, r.price, r.rate
|
||||
FROM order_row r
|
||||
JOIN vn.item i ON i.id = r.item_id
|
||||
WHERE r.amount != 0
|
||||
AND r.warehouse_id = vWarehouse
|
||||
AND r.order_id = vOrder
|
||||
ORDER BY r.rate DESC;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
||||
SET vDone = TRUE;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
ROLLBACK;
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
-- Carga los datos del pedido
|
||||
|
||||
SELECT o.date_send, o.address_id, o.note,
|
||||
o.confirmed, a.clientFk, o.company_id, o.agency_id
|
||||
INTO vDelivery, vAddress, vNotes,
|
||||
vIsConfirmed, vClientId, vCompanyId, vAgencyModeId
|
||||
FROM hedera.`order` o
|
||||
JOIN vn.address a ON a.id = o.address_id
|
||||
WHERE o.id = vOrder;
|
||||
|
||||
-- Comprueba que el pedido no está confirmado
|
||||
|
||||
IF vIsConfirmed THEN
|
||||
CALL util.throw ('ORDER_ALREADY_CONFIRMED');
|
||||
END IF;
|
||||
|
||||
-- Comprueba que el pedido no está vacío
|
||||
|
||||
SELECT COUNT(*) > 0 INTO vOk
|
||||
FROM order_row WHERE order_id = vOrder AND amount > 0;
|
||||
|
||||
IF !vOk THEN
|
||||
CALL util.throw ('ORDER_EMPTY');
|
||||
END IF;
|
||||
|
||||
-- Carga las fechas de salida de cada almacén
|
||||
|
||||
CALL vn.zone_getShippedWarehouse (vDelivery, vAddress, vAgencyModeId);
|
||||
|
||||
-- Trabajador que realiza la acción
|
||||
|
||||
IF vUserId IS NULL THEN
|
||||
SELECT employeeFk INTO vUserId FROM orderConfig;
|
||||
END IF;
|
||||
|
||||
-- Crea los tickets del pedido
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
OPEN cDates;
|
||||
|
||||
lDates:
|
||||
LOOP
|
||||
SET vTicket = NULL;
|
||||
SET vDone = FALSE;
|
||||
FETCH cDates INTO vShipment, vWarehouse;
|
||||
|
||||
IF vDone THEN
|
||||
LEAVE lDates;
|
||||
END IF;
|
||||
|
||||
-- Busca un ticket existente que coincida con los parametros
|
||||
|
||||
SELECT t.id INTO vTicket
|
||||
FROM vn.ticket t
|
||||
LEFT JOIN vn.ticketState tls on tls.ticket = t.id
|
||||
JOIN `order` o
|
||||
ON o.address_id = t.addressFk
|
||||
AND vWarehouse = t.warehouseFk
|
||||
AND o.agency_id = t.agencyModeFk
|
||||
AND o.date_send = t.landed
|
||||
AND vShipment = DATE(t.shipped)
|
||||
WHERE o.id = vOrder
|
||||
AND t.invoiceOutFk IS NULL
|
||||
AND IFNULL(tls.alertLevel,0) = 0
|
||||
AND t.clientFk <> 1118
|
||||
LIMIT 1;
|
||||
|
||||
-- Crea el ticket en el caso de no existir uno adecuado
|
||||
|
||||
IF vTicket IS NULL
|
||||
THEN
|
||||
CALL vn.ticketCreateWithUser(
|
||||
vClientId,
|
||||
IFNULL(vShipment, CURDATE()),
|
||||
vWarehouse,
|
||||
vCompanyId,
|
||||
vAddress,
|
||||
vAgencyModeId,
|
||||
NULL,
|
||||
vDelivery,
|
||||
vUserId,
|
||||
vTicket
|
||||
);
|
||||
ELSE
|
||||
INSERT INTO vncontrol.inter
|
||||
SET Id_Ticket = vTicket,
|
||||
Id_Trabajador = vUserId,
|
||||
state_id = TICKET_FREE;
|
||||
END IF;
|
||||
|
||||
INSERT IGNORE INTO vn.orderTicket
|
||||
SET orderFk = vOrder,
|
||||
ticketFk = vTicket;
|
||||
|
||||
-- Añade las notas
|
||||
|
||||
IF vNotes IS NOT NULL AND vNotes != ''
|
||||
THEN
|
||||
INSERT INTO vn.ticketObservation SET
|
||||
ticketFk = vTicket,
|
||||
observationTypeFk = 4 /* salesperson */ ,
|
||||
`description` = vNotes
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`description` = CONCAT(VALUES(`description`),'. ', `description`);
|
||||
END IF;
|
||||
|
||||
-- Añade los movimientos y sus componentes
|
||||
|
||||
OPEN cRows;
|
||||
|
||||
lRows:
|
||||
LOOP
|
||||
SET vDone = FALSE;
|
||||
FETCH cRows INTO vRowId, vItem, vConcept, vAmount, vPrice, vRate;
|
||||
|
||||
IF vDone THEN
|
||||
LEAVE lRows;
|
||||
END IF;
|
||||
|
||||
INSERT INTO vn.sale
|
||||
SET
|
||||
itemFk = vItem,
|
||||
ticketFk = vTicket,
|
||||
concept = vConcept,
|
||||
quantity = vAmount,
|
||||
price = vPrice,
|
||||
priceFixed = 0,
|
||||
isPriceFixed = TRUE;
|
||||
|
||||
SET vSale = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO vn.saleComponent
|
||||
(saleFk, componentFk, `value`)
|
||||
SELECT vSale, cm.component_id, cm.price
|
||||
FROM order_component cm
|
||||
JOIN vn.component c ON c.id = cm.component_id
|
||||
WHERE cm.order_row_id = vRowId
|
||||
GROUP BY vSale, cm.component_id;
|
||||
|
||||
UPDATE order_row SET Id_Movimiento = vSale
|
||||
WHERE id = vRowId;
|
||||
|
||||
END LOOP;
|
||||
|
||||
CLOSE cRows;
|
||||
|
||||
-- Fija el coste
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tComponents;
|
||||
CREATE TEMPORARY TABLE tComponents
|
||||
(INDEX (saleFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT SUM(sc.`value`) valueSum, sc.saleFk
|
||||
FROM vn.saleComponent sc
|
||||
JOIN vn.component c ON c.id = sc.componentFk
|
||||
JOIN vn.componentType ct ON ct.id = c.typeFk AND ct.isBase
|
||||
JOIN vn.sale s ON s.id = sc.saleFk
|
||||
WHERE s.ticketFk = vTicket
|
||||
GROUP BY sc.saleFk;
|
||||
|
||||
UPDATE vn.sale s
|
||||
JOIN tComponents mc ON mc.saleFk = s.id
|
||||
SET s.priceFixed = valueSum;
|
||||
|
||||
DROP TEMPORARY TABLE tComponents;
|
||||
END LOOP;
|
||||
|
||||
CLOSE cDates;
|
||||
|
||||
DELETE FROM basketOrder WHERE orderFk = vOrder;
|
||||
UPDATE `order` SET confirmed = TRUE, confirm_date = NOW()
|
||||
WHERE id = vOrder;
|
||||
|
||||
COMMIT;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
CREATE
|
||||
OR REPLACE ALGORITHM = UNDEFINED
|
||||
DEFINER = `root`@`%`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `bi`.`tarifa_componentes_series` AS
|
||||
SELECT
|
||||
`ct`.`id` AS `tarifa_componentes_series_id`,
|
||||
`ct`.`type` AS `Serie`,
|
||||
`ct`.`isBase` AS `base`,
|
||||
`ct`.`isMargin` AS `margen`
|
||||
FROM
|
||||
`vn`.`componentType` `ct`;
|
|
@ -0,0 +1 @@
|
|||
REPLACE INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('CustomsAgent', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,11 @@
|
|||
CREATE TABLE `vn`.`customsAgent` (
|
||||
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
`fiscalName` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`street` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`nif` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`phone` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`email` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
ALTER TABLE `vn`.`customsAgent`
|
||||
ADD UNIQUE KEY `nif_UNIQUE` (`nif`);
|
|
@ -0,0 +1,10 @@
|
|||
CREATE TABLE `vn`.`incoterms` (
|
||||
`code` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Internacional Commercial Terms';
|
||||
|
||||
ALTER TABLE `vn`.`incoterms`
|
||||
ADD PRIMARY KEY (`code`);
|
||||
|
||||
REPLACE INTO `vn`.`incoterms` (`code`, `name`) VALUES
|
||||
('FAS', 'Free Alongside Ship');
|
|
@ -0,0 +1,26 @@
|
|||
ALTER TABLE `vn`.`address`
|
||||
ADD COLUMN `customsAgentFk` INT NULL DEFAULT NULL AFTER `isEqualizated`;
|
||||
|
||||
ALTER TABLE `vn`.`address`
|
||||
ADD COLUMN `incotermsFk` VARCHAR(3) NULL DEFAULT NULL AFTER `customsAgentFk`;
|
||||
|
||||
|
||||
ALTER TABLE `vn`.`address`
|
||||
ADD INDEX `address_customsAgentFk_idx` (`customsAgentFk` ASC);
|
||||
|
||||
ALTER TABLE `vn`.`address`
|
||||
ADD INDEX `address_incotermsFk_idx` (`incotermsFk` ASC);
|
||||
|
||||
ALTER TABLE `vn`.`address`
|
||||
ADD CONSTRAINT `address_customsAgentFk`
|
||||
FOREIGN KEY (`customsAgentFk`)
|
||||
REFERENCES `vn`.`customsAgent` (`id`)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `vn`.`address`
|
||||
ADD CONSTRAINT `address_incotermsFk`
|
||||
FOREIGN KEY (`incotermsFk`)
|
||||
REFERENCES `vn`.`incoterms` (`code`)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE;
|
File diff suppressed because one or more lines are too long
|
@ -53,37 +53,38 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType`
|
|||
VALUES
|
||||
(1, 978, 1, 0, 2000, 9, 0);
|
||||
|
||||
INSERT INTO `account`.`user`(`id`,`name`,`password`,`role`,`active`,`email`,`lang`)
|
||||
INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`)
|
||||
VALUES
|
||||
(101, 'BruceWayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es'),
|
||||
(102, 'PetterParker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en'),
|
||||
(103, 'ClarkKent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr'),
|
||||
(104, 'TonyStark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'es'),
|
||||
(105, 'MaxEisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt'),
|
||||
(106, 'DavidCharlesHaller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'es'),
|
||||
(107, 'HankPym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'es'),
|
||||
(108, 'CharlesXavier', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'es'),
|
||||
(109, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'es'),
|
||||
(110, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'es'),
|
||||
(111, 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'),
|
||||
(112, 'Trash', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es');
|
||||
(101, 'BruceWayne', 'Bruce Wayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es'),
|
||||
(102, 'PetterParker', 'Petter Parker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en'),
|
||||
(103, 'ClarkKent', 'Clark Kent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr'),
|
||||
(104, 'TonyStark', 'Tony Stark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'es'),
|
||||
(105, 'MaxEisenhardt', 'Max Eisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt'),
|
||||
(106, 'DavidCharlesHaller', 'David Charles Haller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'es'),
|
||||
(107, 'HankPym', 'Hank Pym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'es'),
|
||||
(108, 'CharlesXavier', 'Charles Xavier', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'es'),
|
||||
(109, 'BruceBanner', 'Bruce Banner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'es'),
|
||||
(110, 'JessicaJones', 'Jessica Jones', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'es'),
|
||||
(111, 'Missing', 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'),
|
||||
(112, 'Trash', 'Trash', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es');
|
||||
|
||||
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`)
|
||||
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`)
|
||||
VALUES
|
||||
(106, 'LGN', 'David Charles', 'Haller', 106, 19),
|
||||
(107, 'ANT', 'Hank' , 'Pym' , 107, 19),
|
||||
(108, 'DCX', 'Charles' , 'Xavier', 108, 19),
|
||||
(109, 'HLK', 'Bruce' , 'Banner', 109, 19),
|
||||
(110, 'JJJ', 'Jessica' , 'Jones' , 110, 19);
|
||||
(106, 'LGN', 'David Charles', 'Haller', 106, 19, 432978106),
|
||||
(107, 'ANT', 'Hank' , 'Pym' , 107, 19, 432978107),
|
||||
(108, 'DCX', 'Charles' , 'Xavier', 108, 19, 432978108),
|
||||
(109, 'HLK', 'Bruce' , 'Banner', 109, 19, 432978109),
|
||||
(110, 'JJJ', 'Jessica' , 'Jones' , 110, 19, 432978110);
|
||||
|
||||
INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`)
|
||||
VALUES
|
||||
(1, 'España', 0, 'ES', 1, 24),
|
||||
(1, 'España', 1, 'ES', 1, 24),
|
||||
(2, 'Italia', 1, 'IT', 1, 27),
|
||||
(3, 'Alemania', 1, 'DE', 1, 22),
|
||||
(4, 'Rumania', 1, 'RO', 1, 24),
|
||||
(5, 'Holanda', 1, 'NL', 1, 18),
|
||||
(8, 'Portugal', 1, 'PT', 1, 27),
|
||||
(13,'Ecuador', 0, 'EC', 1, 24),
|
||||
(19,'Francia', 1, 'FR', 1, 27),
|
||||
(30,'Canarias', 1, 'IC', 1, 24);
|
||||
|
||||
|
@ -124,6 +125,13 @@ INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`,
|
|||
(1, 'Pay on receipt', '0000000000', 4, 0, 1, 1),
|
||||
(2, 'Cash', '1111111111', 1, 0, 1, 1);
|
||||
|
||||
INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
|
||||
VALUES
|
||||
(1, 'AGENCY', 'Agencia'),
|
||||
(2, 'DELIVERY', 'Reparto'),
|
||||
(3, 'PICKUP', 'Recogida'),
|
||||
(4, 'OTHER', 'Otros');
|
||||
|
||||
INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `isVolumetric`, `bankFk`, `warehouseAliasFk`)
|
||||
VALUES
|
||||
(1, 'inhouse pickup' , 1, 0, 1, 1),
|
||||
|
@ -181,8 +189,8 @@ INSERT INTO `vn`.`province`(`id`, `name`, `countryFk`, `warehouseFk`)
|
|||
(1, 'Province one', 1, NULL),
|
||||
(2, 'Province two', 1, NULL),
|
||||
(3, 'Province three', 1, NULL),
|
||||
(4, 'Province four', 1, NULL),
|
||||
(5, 'Province five', 1, NULL);
|
||||
(4, 'Province four', 2, NULL),
|
||||
(5, 'Province five', 13, NULL);
|
||||
|
||||
INSERT INTO `vn`.`town`(`id`, `name`, `provinceFk`)
|
||||
VALUES
|
||||
|
@ -216,21 +224,20 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
|
|||
(3, 'Daily Bugle'),
|
||||
(4, 'GCN Channel'),
|
||||
(5, 'The Newspaper');
|
||||
|
||||
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`fax`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`cplusTerIdNifFk`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`)
|
||||
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`fax`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`cplusTerIdNifFk`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`)
|
||||
VALUES
|
||||
(101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 333333333, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
|
||||
(102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 333333333, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
|
||||
(103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 333333333, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 19, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
|
||||
(104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 333333333, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
|
||||
(105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 333333333, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 8, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1),
|
||||
(106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 333333333, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1),
|
||||
(107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill', 'Silla', 46460, 333333333, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1),
|
||||
(108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 333333333, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1),
|
||||
(109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 333333333, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1),
|
||||
(110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 333333333, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1),
|
||||
(111, 'Missing', NULL, 'Missing man', 'Anton', 'The space', 'Silla', 46460, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1),
|
||||
(112, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city', 'Silla', 46460, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1);
|
||||
(101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
|
||||
(102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
|
||||
(103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 19, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
|
||||
(104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
|
||||
(105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 8, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1),
|
||||
(106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1),
|
||||
(107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1),
|
||||
(108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1),
|
||||
(109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1),
|
||||
(110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1),
|
||||
(111, 'Missing', NULL, 'Missing man', 'Anton', 'The space', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1),
|
||||
(112, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1);
|
||||
|
||||
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
|
||||
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'SILLA', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, CURDATE(), 1
|
||||
|
@ -404,11 +411,11 @@ INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`,
|
|||
|
||||
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`)
|
||||
VALUES
|
||||
(1, 'T', 1014.24, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 101, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1),
|
||||
(1, 'T', 1014.24, CURDATE(), 101, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
|
||||
(2, 'T', 121.36, CURDATE(), 102, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
|
||||
(3, 'T', 8.88, CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
|
||||
(4, 'T', 8.88, CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
|
||||
(5, 'A', 8.88, CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1);
|
||||
(5, 'A', 8.88, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 103, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1);
|
||||
|
||||
UPDATE `vn`.`invoiceOut` SET ref = 'T1111111' WHERE id = 1;
|
||||
UPDATE `vn`.`invoiceOut` SET ref = 'T2222222' WHERE id = 2;
|
||||
|
@ -460,21 +467,21 @@ INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaF
|
|||
('T', 'Española rapida', 1, 'NATIONAL', 0),
|
||||
('V', 'Intracomunitaria global', 0, 'CEE', 1);
|
||||
|
||||
INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, `price`, `bonus`)
|
||||
INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, `price`, `bonus`, `m3Max`)
|
||||
VALUES
|
||||
(1, 'Zone pickup A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0),
|
||||
(2, 'Zone pickup B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0),
|
||||
(3, 'Zone 247 A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 7, 1, 2, 0),
|
||||
(4, 'Zone 247 B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 7, 1, 2, 0),
|
||||
(5, 'Zone expensive A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 8, 1, 1000, 0),
|
||||
(6, 'Zone expensive B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 8, 1, 1000, 0),
|
||||
(7, 'Zone refund', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 23, 0, 0, 0),
|
||||
(8, 'Zone others', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 10, 0, 0, 0),
|
||||
(9, 'Zone superMan', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 0, 0, 0),
|
||||
(10, 'Zone teleportation', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 3, 0, 0, 0),
|
||||
(11, 'Zone pickup C', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0),
|
||||
(12, 'Zone entanglement', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 4, 0, 0, 0),
|
||||
(13, 'Zone quantum break', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 5, 0, 0, 0);
|
||||
(1, 'Zone pickup A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0, 30.50),
|
||||
(2, 'Zone pickup B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0, 30.50),
|
||||
(3, 'Zone 247 A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 7, 1, 2, 0, 40.50),
|
||||
(4, 'Zone 247 B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 7, 1, 2, 0, 40.50),
|
||||
(5, 'Zone expensive A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 8, 1, 1000, 0, 50.50),
|
||||
(6, 'Zone expensive B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 8, 1, 1000, 0, 50.50),
|
||||
(7, 'Zone refund', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 23, 0, 0, 0, 60.50),
|
||||
(8, 'Zone others', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 10, 0, 0, 0, 60.50),
|
||||
(9, 'Zone superMan', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 0, 0, 0, NULL),
|
||||
(10, 'Zone teleportation', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 3, 0, 0, 0, NULL),
|
||||
(11, 'Zone pickup C', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 0, 0, 0, NULL),
|
||||
(12, 'Zone entanglement', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 4, 0, 0, 0, NULL),
|
||||
(13, 'Zone quantum break', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 5, 0, 0, 0, NULL);
|
||||
|
||||
INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`)
|
||||
VALUES
|
||||
|
@ -643,7 +650,8 @@ INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk
|
|||
(2, 'ITG', 'Anthurium', 1, 31, 5, 0),
|
||||
(3, 'WPN', 'Paniculata', 2, 31, 5, 0),
|
||||
(4, 'PRT', 'Delivery ports', 3, NULL, 5, 1),
|
||||
(5, 'CON', 'Container', 3, NULL, 5, 1);
|
||||
(5, 'CON', 'Container', 3, NULL, 5, 1),
|
||||
(6, 'ALS', 'Alstroemeria', 1, 31, 5, 0);
|
||||
|
||||
INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`)
|
||||
VALUES
|
||||
|
@ -1127,13 +1135,26 @@ INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `companyFk`,
|
|||
(6, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 6, 442, 'Movement 6', 'this is the note six', 'observation six'),
|
||||
(7, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 7, 442, 'Movement 7', 'this is the note seven', 'observation seven');
|
||||
|
||||
INSERT INTO `bi`.`claims_ratio`(`id_Cliente`, `Consumo`, `Reclamaciones`, `Ratio`, `recobro`, `inflacion`)
|
||||
INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`)
|
||||
VALUES
|
||||
(101, 500, NULL, 0.00, 0.00, 1.00),
|
||||
(102, 1000, 2.00, 0.01, 0.05, 1.00),
|
||||
(103, 2000, 0.00, 0.00, 0.02, 1.00),
|
||||
(104, 2500, 150.00, 0.02, 0.10, 1.00);
|
||||
|
||||
INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `saleTotal`, `saleWaste`, `rate`)
|
||||
VALUES
|
||||
('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation', '1062', '51', '4.8'),
|
||||
('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Colombia', '35074', '687', '2.0'),
|
||||
('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Mini', '1777', '13', '0.7'),
|
||||
('CharlesXavier', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Short', '9182', '59', '0.6'),
|
||||
('DavidCharlesHaller', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Containers', '-74', '0', '0.0'),
|
||||
('DavidCharlesHaller', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Packagings', '-7', '0', '0.0'),
|
||||
('DavidCharlesHaller', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Freight', '1100', '0', '0.0'),
|
||||
('HankPym', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Funeral Accessories', '848', '-187', '-22.1'),
|
||||
('HankPym', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Miscellaneous Accessories', '186', '0', '0.0'),
|
||||
('HankPym', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Adhesives', '277', '0', '0.0');
|
||||
|
||||
INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packageFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`,`minPrice`,`producer`,`printedStickers`,`isChecked`,`isIgnored`, `created`)
|
||||
VALUES
|
||||
(1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
|
||||
|
@ -1152,13 +1173,6 @@ INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`package
|
|||
(14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 7.30, 7.00, 0.00, NULL, 0, 1, 0, CURDATE()),
|
||||
(15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, CURDATE());
|
||||
|
||||
INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
|
||||
VALUES
|
||||
(1, 'AGENCY', 'Agencia'),
|
||||
(2, 'DELIVERY', 'Reparto'),
|
||||
(3, 'PICKUP', 'Recogida'),
|
||||
(4, 'OTHER', 'Otros');
|
||||
|
||||
INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`, `date_make`, `first_row_stamp`, `confirm_date`)
|
||||
VALUES
|
||||
(1, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 3, 1, 121, 442, NULL, 'TPV', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||
|
@ -1549,7 +1563,7 @@ INSERT INTO `postgresql`.`profile`(`profile_id`, `person_id`, `profile_type_id`)
|
|||
FROM `postgresql`.`person` `p`;
|
||||
|
||||
INSERT INTO `postgresql`.`business`(`business_id`, `client_id`, `provider_id`, `date_start`, `date_end`, `workerBusiness`, `reasonEndFk`)
|
||||
SELECT p.profile_id, p.profile_id, 1000, CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-31'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL +1 YEAR)), '-01-01'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL
|
||||
SELECT p.profile_id, p.profile_id, 1000, CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL +1 YEAR)), '-01-25'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL
|
||||
FROM `postgresql`.`profile` `p`;
|
||||
|
||||
INSERT INTO `postgresql`.`business_labour`(`business_id`, `notes`, `department_id`, `professional_category_id`, `incentivo`, `calendar_labour_type_id`, `porhoras`, `labour_agreement_id`, `workcenter_id`)
|
||||
|
@ -1586,20 +1600,20 @@ INSERT INTO `postgresql`.`calendar_state` (`calendar_state_id`, `type`, `rgb`, `
|
|||
|
||||
INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`)
|
||||
VALUES
|
||||
(106, 1, DATE_ADD(CURDATE(), INTERVAL 10 DAY)),
|
||||
(106, 1, DATE_ADD(CURDATE(), INTERVAL 11 DAY)),
|
||||
(106, 1, DATE_ADD(CURDATE(), INTERVAL 12 DAY)),
|
||||
(106, 1, DATE_ADD(CURDATE(), INTERVAL 20 DAY)),
|
||||
(106, 2, DATE_ADD(CURDATE(), INTERVAL -10 DAY)),
|
||||
(106, 1, DATE_ADD(CURDATE(), INTERVAL -12 DAY)),
|
||||
(106, 2, DATE_ADD(CURDATE(), INTERVAL -20 DAY)),
|
||||
(107, 1, DATE_ADD(CURDATE(), INTERVAL 15 DAY)),
|
||||
(107, 1, DATE_ADD(CURDATE(), INTERVAL 16 DAY)),
|
||||
(107, 1, DATE_ADD(CURDATE(), INTERVAL 20 DAY)),
|
||||
(107, 1, DATE_ADD(CURDATE(), INTERVAL 30 DAY)),
|
||||
(107, 2, DATE_ADD(CURDATE(), INTERVAL -10 DAY)),
|
||||
(107, 1, DATE_ADD(CURDATE(), INTERVAL -12 DAY)),
|
||||
(107, 2, DATE_ADD(CURDATE(), INTERVAL -20 DAY));
|
||||
(106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL 10 DAY))),
|
||||
(106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -11 DAY), DATE_ADD(CURDATE(), INTERVAL 11 DAY))),
|
||||
(106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -12 DAY), DATE_ADD(CURDATE(), INTERVAL 12 DAY))),
|
||||
(106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -20 DAY), DATE_ADD(CURDATE(), INTERVAL 20 DAY))),
|
||||
(106, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -13 DAY), DATE_ADD(CURDATE(), INTERVAL 13 DAY))),
|
||||
(106, 1, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -14 DAY), DATE_ADD(CURDATE(), INTERVAL 14 DAY))),
|
||||
(106, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -15 DAY), DATE_ADD(CURDATE(), INTERVAL 15 DAY))),
|
||||
(107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL 10 DAY))),
|
||||
(107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -11 DAY), DATE_ADD(CURDATE(), INTERVAL 11 DAY))),
|
||||
(107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -12 DAY), DATE_ADD(CURDATE(), INTERVAL 12 DAY))),
|
||||
(107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -20 DAY), DATE_ADD(CURDATE(), INTERVAL 20 DAY))),
|
||||
(107, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -13 DAY), DATE_ADD(CURDATE(), INTERVAL 13 DAY))),
|
||||
(107, 1, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -14 DAY), DATE_ADD(CURDATE(), INTERVAL 14 DAY))),
|
||||
(107, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -15 DAY), DATE_ADD(CURDATE(), INTERVAL 15 DAY)));
|
||||
|
||||
INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`)
|
||||
VALUES
|
||||
|
@ -1866,12 +1880,12 @@ INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `dated`)
|
|||
(8, 'day', DATE_ADD(CURDATE(), INTERVAL +5 DAY)),
|
||||
(8, 'day', DATE_ADD(CURDATE(), INTERVAL +6 DAY));
|
||||
|
||||
INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `order`, `manual`, `direction`)
|
||||
INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`)
|
||||
VALUES
|
||||
(106, CONCAT(CURDATE(), ' 07:00'), 1, TRUE, 'in'),
|
||||
(106, CONCAT(CURDATE(), ' 10:00'), 2, TRUE, 'middle'),
|
||||
(106, CONCAT(CURDATE(), ' 10:10'), 3, TRUE, 'middle'),
|
||||
(106, CONCAT(CURDATE(), ' 15:00'), 4, TRUE, 'out');
|
||||
(106, CONCAT(CURDATE(), ' 07:00'), TRUE, 'in'),
|
||||
(106, CONCAT(CURDATE(), ' 10:00'), TRUE, 'middle'),
|
||||
(106, CONCAT(CURDATE(), ' 10:10'), TRUE, 'middle'),
|
||||
(106, CONCAT(CURDATE(), ' 15:00'), TRUE, 'out');
|
||||
|
||||
INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`, `code`)
|
||||
VALUES
|
||||
|
@ -1901,7 +1915,8 @@ INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `wa
|
|||
(1, 14, '1.txt', 'text/plain', 5, 1, 442, NULL, FALSE, 'Ticket:11', 'Ticket:11 dms for the ticket', CURDATE()),
|
||||
(2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:104', 'Client:104 dms for the client', CURDATE()),
|
||||
(3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 104', 'Client:104 readme', CURDATE()),
|
||||
(4, 3, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', CURDATE());
|
||||
(4, 3, '4.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', CURDATE()),
|
||||
(5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', CURDATE());
|
||||
|
||||
INSERT INTO `vn`.`ticketDms`(`ticketFk`, `dmsFk`)
|
||||
VALUES
|
||||
|
@ -1926,75 +1941,33 @@ INSERT INTO `vn`.`queuePriority`(`id`, `priority`)
|
|||
(2, 'Normal'),
|
||||
(3, 'Baja');
|
||||
|
||||
INSERT INTO `vn`.`userPhoneType` (`code`, `description`)
|
||||
VALUES
|
||||
('businessPhone', 'Telefono de empresa del usuario'),
|
||||
('personalPhone', 'Telefono personal del usuario');
|
||||
|
||||
INSERT INTO `vn`.`userPhone`(`id`, `userFk`, `typeFk`, `phone`)
|
||||
VALUES
|
||||
(1, 101, 'personalPhone', 1111111111),
|
||||
(2, 102, 'personalPhone', 1111111111),
|
||||
(3, 103, 'personalPhone', 1111111111),
|
||||
(4, 104, 'personalPhone', 1111111111),
|
||||
(5, 105, 'personalPhone', 1111111111),
|
||||
(6, 106, 'personalPhone', 1111111111),
|
||||
(7, 107, 'personalPhone', 1111111111),
|
||||
(8, 108, 'personalPhone', 1111111111),
|
||||
(9, 109, 'personalPhone', 1111111111),
|
||||
(10, 110, 'personalPhone', 1111111111),
|
||||
(11, 111, 'personalPhone', 1111111111),
|
||||
(12, 112, 'personalPhone', 1111111111),
|
||||
(13, 1, 'personalPhone', 623111111),
|
||||
(14, 2, 'personalPhone', 623111111),
|
||||
(15, 3, 'personalPhone', 623111111),
|
||||
(16, 5, 'personalPhone', 623111111),
|
||||
(17, 6, 'personalPhone', 623111111),
|
||||
(18, 9, 'personalPhone', 623111111),
|
||||
(19, 13, 'personalPhone', 623111111),
|
||||
(20, 15, 'personalPhone', 623111111),
|
||||
(21, 16, 'personalPhone', 623111111),
|
||||
(22, 17, 'personalPhone', 623111111),
|
||||
(23, 18, 'personalPhone', 623111111),
|
||||
(24, 19, 'personalPhone', 623111111),
|
||||
(26, 21, 'personalPhone', 623111111),
|
||||
(27, 22, 'personalPhone', 623111111),
|
||||
(28, 30, 'personalPhone', 623111111),
|
||||
(29, 31, 'personalPhone', 623111111),
|
||||
(30, 32, 'personalPhone', 623111111),
|
||||
(31, 34, 'personalPhone', 623111111),
|
||||
(32, 35, 'personalPhone', 623111111),
|
||||
(33, 36, 'personalPhone', 623111111),
|
||||
(34, 37, 'personalPhone', 623111111),
|
||||
(35, 38, 'personalPhone', 623111111),
|
||||
(36, 39, 'personalPhone', 623111111),
|
||||
(37, 40, 'personalPhone', 623111111),
|
||||
(38, 41, 'personalPhone', 623111111),
|
||||
(39, 42, 'personalPhone', 623111111),
|
||||
(40, 43, 'personalPhone', 623111111),
|
||||
(41, 44, 'personalPhone', 623111111),
|
||||
(42, 45, 'personalPhone', 623111111),
|
||||
(43, 47, 'personalPhone', 623111111),
|
||||
(44, 48, 'personalPhone', 623111111),
|
||||
(45, 50, 'personalPhone', 623111111),
|
||||
(46, 51, 'personalPhone', 623111111),
|
||||
(47, 52, 'personalPhone', 623111111),
|
||||
(48, 54, 'personalPhone', 623111111),
|
||||
(49, 55, 'personalPhone', 623111111),
|
||||
(50, 56, 'personalPhone', 623111111),
|
||||
(51, 57, 'personalPhone', 623111111),
|
||||
(52, 58, 'personalPhone', 623111111),
|
||||
(53, 59, 'personalPhone', 623111111),
|
||||
(54, 60, 'personalPhone', 623111111),
|
||||
(55, 61, 'personalPhone', 623111111),
|
||||
(56, 65, 'personalPhone', 623111111),
|
||||
(57, 66, 'personalPhone', 623111111),
|
||||
(65, 107, 'businessPhone', 700987987),
|
||||
(67, 106, 'businessPhone', 1111111112),
|
||||
(68, 106, 'personalPhone', 1111111113);
|
||||
|
||||
INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `weekScope`, `dayWorkMax`, `dayStayMax`)
|
||||
VALUES
|
||||
(1, 43200, 129600, 734400, 43200, 50400);
|
||||
|
||||
INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11');
|
||||
|
||||
INSERT INTO `vn`.`thermograph`(`id`, `model`)
|
||||
VALUES
|
||||
('TMM190901395', 'TEMPMATE'),
|
||||
('TL.BBA85422', 'TL30'),
|
||||
('TZ1905012010', 'DISPOSABLE'),
|
||||
('138350-0', 'DISPOSABLE');
|
||||
|
||||
INSERT INTO `vn`.`travelThermograph`(`thermographFk`, `created`, `warehouseFk`, `travelFk`, `temperature`, `result`, `dmsFk`)
|
||||
VALUES
|
||||
('TMM190901395', CURDATE(), 1, 1, 'WARM', 'Ok', NULL),
|
||||
('TL.BBA85422', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 2, 'COOL', 'Ok', NULL),
|
||||
('TL.BBA85422', CURDATE(), 2, 1, 'COOL', 'can not read the temperature', NULL),
|
||||
('TZ1905012010', CURDATE(), 1, 1, 'WARM', 'Temperature in range', 5),
|
||||
('138350-0', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 'WARM', NULL, 5),
|
||||
('138350-0', CURDATE(), 1, NULL, 'COOL', NULL, NULL);
|
||||
|
||||
REPLACE INTO `vn`.`incoterms` (`code`, `name`)
|
||||
VALUES
|
||||
('FAS', 'Free Alongside Ship');
|
||||
|
||||
REPLACE INTO `vn`.`customsAgent` (`id`, `fiscalName`, `street`, `nif`, `phone`, `email`)
|
||||
VALUES
|
||||
(1, 'Agent one', '1007 Mountain Drive, Gotham', 'N1111111111', '111111111', 'agentone@gotham.com'),
|
||||
(2, 'Agent two', '1007 Mountain Drive, Gotham', 'N2222222222', '222222222', 'agenttwo@gotham.com');
|
File diff suppressed because it is too large
Load Diff
|
@ -49,13 +49,8 @@ TABLES=(
|
|||
state
|
||||
sample
|
||||
department
|
||||
)
|
||||
dump_tables ${TABLES[@]}
|
||||
|
||||
TABLES=(
|
||||
bi
|
||||
tarifa_componentes
|
||||
tarifa_componentes_series
|
||||
component
|
||||
componentType
|
||||
)
|
||||
dump_tables ${TABLES[@]}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
SCHEMAS=(
|
||||
account
|
||||
bi
|
||||
bs
|
||||
cache
|
||||
edi
|
||||
hedera
|
||||
|
|
|
@ -48,7 +48,7 @@ describe('buyUltimate()', () => {
|
|||
expect(buyUltimateTable[1].buyFk).toEqual(4);
|
||||
expect(buyUltimateTable[0].buyFk).toEqual(3);
|
||||
expect(buyUltimateTable[2].buyFk).toEqual(5);
|
||||
expect(buyUltimateTable[3].buyFk).toEqual(8);
|
||||
expect(buyUltimateTable[3].buyFk).toEqual(9);
|
||||
expect(buyUltimateTable[4].buyFk).toEqual(6);
|
||||
expect(buyUltimateTable[5].buyFk).toEqual(7);
|
||||
});
|
||||
|
|
|
@ -1,28 +1,45 @@
|
|||
version: '3.5'
|
||||
version: '3.7'
|
||||
services:
|
||||
front:
|
||||
image: registry.verdnatura.es/salix-front:${TAG}
|
||||
restart: unless-stopped
|
||||
build:
|
||||
context: .
|
||||
dockerfile: front/Dockerfile
|
||||
ports:
|
||||
- ${PORT_FRONT}:80
|
||||
links:
|
||||
- back
|
||||
deploy:
|
||||
replicas: 3
|
||||
back:
|
||||
image: registry.verdnatura.es/salix-back:${TAG}
|
||||
restart: unless-stopped
|
||||
build: .
|
||||
ports:
|
||||
- ${PORT_BACK}:3000
|
||||
environment:
|
||||
- NODE_ENV
|
||||
volumes:
|
||||
- /mnt/storage/containers/salix:/etc/salix
|
||||
- /mnt/storage/pdfs:/var/lib/salix/pdfs
|
||||
- /mnt/storage/dms:/var/lib/salix/dms
|
||||
deploy:
|
||||
replicas: 6
|
||||
front:
|
||||
image: registry.verdnatura.es/salix-front:${BRANCH_NAME:?}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: front/Dockerfile
|
||||
ports:
|
||||
- 80
|
||||
deploy:
|
||||
replicas: 3
|
||||
back:
|
||||
image: registry.verdnatura.es/salix-back:${BRANCH_NAME:?}
|
||||
build: .
|
||||
ports:
|
||||
- 3000
|
||||
environment:
|
||||
- NODE_ENV
|
||||
configs:
|
||||
- source: datasources
|
||||
target: /etc/salix/datasources.json
|
||||
- source: datasources_local
|
||||
target: /etc/salix/datasources.local.json
|
||||
- source: print
|
||||
target: /etc/salix/print.json
|
||||
- source: print_local
|
||||
target: /etc/salix/print.local.json
|
||||
volumes:
|
||||
- /mnt/storage/pdfs:/var/lib/salix/pdfs
|
||||
- /mnt/storage/dms:/var/lib/salix/dms
|
||||
deploy:
|
||||
replicas: 6
|
||||
configs:
|
||||
datasources:
|
||||
external: true
|
||||
name: salix_datasources
|
||||
datasources_local:
|
||||
external: true
|
||||
name: salix-${BRANCH_NAME:?}_datasources
|
||||
print:
|
||||
external: true
|
||||
name: salix_print
|
||||
print_local:
|
||||
external: true
|
||||
name: salix-${BRANCH_NAME:?}_print
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/* eslint no-invalid-this: "off" */
|
||||
|
||||
import Nightmare from 'nightmare';
|
||||
import {URL} from 'url';
|
||||
import config from './config.js';
|
||||
|
||||
let currentUser;
|
||||
import {url as defaultURL} from './config';
|
||||
|
||||
let actions = {
|
||||
clickIfExists: async function(selector) {
|
||||
let exists = await this.exists(selector);
|
||||
if (exists) await this.click(selector);
|
||||
let exists;
|
||||
try {
|
||||
exists = await this.waitForSelector(selector, {timeout: 500});
|
||||
} catch (error) {
|
||||
exists = false;
|
||||
}
|
||||
if (exists) await this.waitToClick(selector);
|
||||
return exists;
|
||||
},
|
||||
|
||||
|
@ -26,54 +26,43 @@ let actions = {
|
|||
changeLanguageToEnglish: async function() {
|
||||
let langSelector = '.user-popover vn-autocomplete[ng-model="$ctrl.lang"]';
|
||||
|
||||
let lang = await this.waitToClick('#user')
|
||||
.wait(langSelector)
|
||||
.waitToGetProperty(`${langSelector} input`, 'value');
|
||||
await this.waitToClick('#user');
|
||||
await this.wait(langSelector);
|
||||
let lang = await this.waitToGetProperty(`${langSelector} input`, 'value');
|
||||
|
||||
if (lang !== 'English')
|
||||
await this.autocompleteSearch(langSelector, 'English');
|
||||
|
||||
await this.keyboard.press('Escape');
|
||||
await this.waitForSelector(langSelector, {hidden: true});
|
||||
},
|
||||
|
||||
doLogin: async function(userName, password) {
|
||||
if (password == null) password = 'nightmare';
|
||||
await this.wait(`vn-login [name=user]`)
|
||||
.clearInput(`vn-login [name=user]`)
|
||||
.write(`vn-login [name=user]`, userName)
|
||||
.write(`vn-login [name=password]`, password)
|
||||
.click(`vn-login button[type=submit]`);
|
||||
doLogin: async function(userName, password = 'nightmare') {
|
||||
await this.wait(`vn-login [ng-model="$ctrl.user"]`);
|
||||
await this.clearInput(`vn-login [ng-model="$ctrl.user"]`);
|
||||
await this.write(`vn-login [ng-model="$ctrl.user"]`, userName);
|
||||
await this.clearInput(`vn-login [ng-model="$ctrl.password"]`);
|
||||
await this.write(`vn-login [ng-model="$ctrl.password"]`, password);
|
||||
await this.click('vn-login button[type=submit]');
|
||||
},
|
||||
|
||||
login: async function(userName) {
|
||||
if (currentUser !== userName) {
|
||||
let accountClicked = await this.clickIfExists('#user');
|
||||
try {
|
||||
await this.waitForURL('#!/login');
|
||||
} catch (e) {
|
||||
await this.goto(`${defaultURL}/#!/login`);
|
||||
let dialog = await this.evaluate(() => {
|
||||
return document.querySelector('button[response="accept"]');
|
||||
});
|
||||
if (dialog)
|
||||
await this.waitToClick('button[response="accept"]');
|
||||
}
|
||||
|
||||
if (accountClicked) {
|
||||
let buttonSelector = '.vn-dialog.shown button[response=accept]';
|
||||
await this.waitToClick('#logout')
|
||||
.wait(buttonSelector => {
|
||||
return document.querySelector(buttonSelector) != null
|
||||
|| location.hash == '#!/login';
|
||||
}, buttonSelector);
|
||||
await this.clickIfExists(buttonSelector);
|
||||
}
|
||||
|
||||
try {
|
||||
await this.waitForURL('#!/login');
|
||||
} catch (e) {
|
||||
await this.goto(`${config.url}/#!/login`);
|
||||
}
|
||||
|
||||
await this.doLogin(userName, null)
|
||||
.waitForURL('#!/')
|
||||
.changeLanguageToEnglish();
|
||||
|
||||
currentUser = userName;
|
||||
} else
|
||||
await this.waitToClick('a[ui-sref=home]');
|
||||
},
|
||||
|
||||
waitForLogin: async function(userName) {
|
||||
await this.login(userName);
|
||||
await this.doLogin(userName);
|
||||
await this.wait(() => {
|
||||
return document.location.hash === '#!/';
|
||||
}, {});
|
||||
await this.changeLanguageToEnglish();
|
||||
},
|
||||
|
||||
selectModule: async function(moduleName) {
|
||||
|
@ -81,13 +70,14 @@ let actions = {
|
|||
return m[0] + '-' + m[1];
|
||||
}).toLowerCase();
|
||||
|
||||
await this.waitToClick(`vn-home a[ui-sref="${moduleName}.index"]`)
|
||||
.waitForURL(snakeName);
|
||||
let selector = `vn-home a[ui-sref="${moduleName}.index"]`;
|
||||
await this.waitToClick(selector);
|
||||
await this.waitForURL(snakeName);
|
||||
},
|
||||
|
||||
loginAndModule: async function(userName, moduleName) {
|
||||
await this.login(userName)
|
||||
.selectModule(moduleName);
|
||||
await this.login(userName);
|
||||
await this.selectModule(moduleName);
|
||||
},
|
||||
|
||||
datePicker: async function(selector, changeMonth, day) {
|
||||
|
@ -96,369 +86,434 @@ let actions = {
|
|||
date.setDate(day ? day : 16);
|
||||
date = date.toISOString().substr(0, 10);
|
||||
|
||||
await this.wait(selector)
|
||||
.evaluate((selector, date) => {
|
||||
let input = document.querySelector(selector).$ctrl.input;
|
||||
input.value = date;
|
||||
input.dispatchEvent(new Event('change'));
|
||||
}, selector, date);
|
||||
await this.wait(selector);
|
||||
await this.evaluate((selector, date) => {
|
||||
let input = document.querySelector(selector).$ctrl.input;
|
||||
input.value = date;
|
||||
input.dispatchEvent(new Event('change'));
|
||||
}, selector, date);
|
||||
},
|
||||
|
||||
pickTime: async function(selector, time) {
|
||||
await this.wait(selector)
|
||||
.evaluate((selector, time) => {
|
||||
let input = document.querySelector(selector).$ctrl.input;
|
||||
input.value = time;
|
||||
input.dispatchEvent(new Event('change'));
|
||||
}, selector, time);
|
||||
await this.wait(selector);
|
||||
await this.evaluate((selector, time) => {
|
||||
let input = document.querySelector(selector).$ctrl.input;
|
||||
input.value = time;
|
||||
input.dispatchEvent(new Event('change'));
|
||||
}, selector, time);
|
||||
},
|
||||
|
||||
clearTextarea: function(selector) {
|
||||
return this.wait(selector)
|
||||
.evaluate(inputSelector => {
|
||||
return document.querySelector(inputSelector).value = '';
|
||||
clearTextarea: async function(selector) {
|
||||
await this.wait(selector);
|
||||
await this.evaluate(inputSelector => {
|
||||
return document.querySelector(inputSelector).value = '';
|
||||
}, selector);
|
||||
},
|
||||
|
||||
clearInput: async function(selector) {
|
||||
await this.wait(selector);
|
||||
let field = await this.evaluate(selector => {
|
||||
return document.querySelector(`${selector} input`).closest('.vn-field').$ctrl.field;
|
||||
}, selector);
|
||||
if ((field != null && field != '') || field == '0') {
|
||||
let coords = await this.evaluate(selector => {
|
||||
let rect = document.querySelector(selector).getBoundingClientRect();
|
||||
return {x: rect.x + (rect.width / 2), y: rect.y + (rect.height / 2), width: rect.width};
|
||||
}, selector);
|
||||
await this.mouse.move(coords.x, coords.y);
|
||||
await this.waitForSelector(`${selector} [icon="clear"]`, {visible: true});
|
||||
await this.waitToClick(`${selector} [icon="clear"]`);
|
||||
}
|
||||
await this.evaluate(selector => {
|
||||
return document.querySelector(`${selector} input`).closest('.vn-field').$ctrl.field == '';
|
||||
}, selector);
|
||||
},
|
||||
|
||||
clearInput: function(selector) {
|
||||
return this.wait(selector)
|
||||
.evaluate(selector => {
|
||||
let $ctrl = document.querySelector(selector).closest('.vn-field').$ctrl;
|
||||
$ctrl.field = null;
|
||||
$ctrl.$.$apply();
|
||||
$ctrl.input.dispatchEvent(new Event('change'));
|
||||
}, selector);
|
||||
},
|
||||
|
||||
getProperty: function(selector, property) {
|
||||
return this.evaluate((selector, property) => {
|
||||
getProperty: async function(selector, property) {
|
||||
return await this.evaluate((selector, property) => {
|
||||
return document.querySelector(selector)[property].replace(/\s+/g, ' ').trim();
|
||||
}, selector, property);
|
||||
},
|
||||
|
||||
waitPropertyLength: function(selector, property, minLength) {
|
||||
return this.wait((selector, property, minLength) => {
|
||||
waitPropertyLength: async function(selector, property, minLength) {
|
||||
await this.wait((selector, property, minLength) => {
|
||||
const element = document.querySelector(selector);
|
||||
return element && element[property] != null && element[property] !== '' && element[property].length >= minLength;
|
||||
}, selector, property, minLength)
|
||||
.getProperty(selector, property);
|
||||
}, {}, selector, property, minLength);
|
||||
return await this.getProperty(selector, property);
|
||||
},
|
||||
|
||||
waitPropertyValue: function(selector, property, status) {
|
||||
return this.wait(selector)
|
||||
.wait((selector, property, status) => {
|
||||
const element = document.querySelector(selector);
|
||||
return element[property] === status;
|
||||
}, selector, property, status);
|
||||
},
|
||||
|
||||
waitToGetProperty: function(selector, property) {
|
||||
return this.wait((selector, property) => {
|
||||
waitPropertyValue: async function(selector, property, status) {
|
||||
await this.waitForSelector(selector);
|
||||
return await this.waitForFunction((selector, property, status) => {
|
||||
const element = document.querySelector(selector);
|
||||
|
||||
return element && element[property] != null && element[property] !== '';
|
||||
}, selector, property)
|
||||
.getProperty(selector, property);
|
||||
return element[property] === status;
|
||||
}, {}, selector, property, status);
|
||||
},
|
||||
|
||||
write: function(selector, text) {
|
||||
return this.wait(selector)
|
||||
.type(selector, text);
|
||||
waitToGetProperty: async function(selector, property) {
|
||||
try {
|
||||
await this.waitForFunction((selector, property) => {
|
||||
const element = document.querySelector(selector);
|
||||
|
||||
return element && element[property] != null && element[property] !== '';
|
||||
}, {}, selector, property);
|
||||
return await this.getProperty(selector, property);
|
||||
} catch (error) {
|
||||
throw new Error(`couldn't get property: ${property} of ${selector}`);
|
||||
}
|
||||
},
|
||||
|
||||
waitToClick: function(selector) {
|
||||
return this.wait(selector)
|
||||
.click(selector);
|
||||
write: async function(selector, text) {
|
||||
await this.waitForSelector(selector, {});
|
||||
await this.type(`${selector} input`, text);
|
||||
await this.waitForTextInInput(selector, text);
|
||||
},
|
||||
|
||||
focusElement: function(selector) {
|
||||
return this.wait(selector)
|
||||
.evaluate(selector => {
|
||||
let element = document.querySelector(selector);
|
||||
element.focus();
|
||||
}, selector);
|
||||
waitToClick: async function(selector) {
|
||||
await this.waitForSelector(selector, {});
|
||||
await this.click(selector, {waitUntil: 'domcontentloaded'});
|
||||
},
|
||||
|
||||
isVisible: function(selector) {
|
||||
return this.wait(selector)
|
||||
.evaluate(elementSelector => {
|
||||
let selectorMatches = document.querySelectorAll(elementSelector);
|
||||
let element = selectorMatches[0];
|
||||
|
||||
if (selectorMatches.length > 1)
|
||||
throw new Error(`Multiple matches of ${elementSelector} found`);
|
||||
|
||||
let isVisible = false;
|
||||
if (element) {
|
||||
let eventHandler = event => {
|
||||
event.preventDefault();
|
||||
isVisible = true;
|
||||
};
|
||||
element.addEventListener('mouseover', eventHandler);
|
||||
let rect = element.getBoundingClientRect();
|
||||
let x = rect.left + rect.width / 2;
|
||||
let y = rect.top + rect.height / 2;
|
||||
let elementInCenter = document.elementFromPoint(x, y);
|
||||
let elementInTopLeft = document.elementFromPoint(rect.left, rect.top);
|
||||
let elementInBottomRight = document.elementFromPoint(rect.right, rect.bottom);
|
||||
|
||||
let e = new MouseEvent('mouseover', {
|
||||
view: window,
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
});
|
||||
|
||||
if (elementInCenter)
|
||||
elementInCenter.dispatchEvent(e);
|
||||
|
||||
if (elementInTopLeft)
|
||||
elementInTopLeft.dispatchEvent(e);
|
||||
|
||||
if (elementInBottomRight)
|
||||
elementInBottomRight.dispatchEvent(e);
|
||||
|
||||
element.removeEventListener('mouseover', eventHandler);
|
||||
}
|
||||
return isVisible;
|
||||
}, selector);
|
||||
focusElement: async function(selector) {
|
||||
await this.wait(selector);
|
||||
return await this.evaluate(selector => {
|
||||
let element = document.querySelector(selector);
|
||||
element.focus();
|
||||
}, selector);
|
||||
},
|
||||
|
||||
waitImgLoad: function(selector) {
|
||||
return this.wait(selector)
|
||||
.wait(selector => {
|
||||
const imageReady = document.querySelector(selector).complete;
|
||||
return imageReady;
|
||||
}, selector);
|
||||
isVisible: async function(selector) {
|
||||
await this.wait(selector);
|
||||
return await this.evaluate(elementSelector => {
|
||||
let selectorMatches = document.querySelectorAll(elementSelector);
|
||||
let element = selectorMatches[0];
|
||||
|
||||
if (selectorMatches.length > 1)
|
||||
throw new Error(`Multiple matches of ${elementSelector} found`);
|
||||
|
||||
let isVisible = false;
|
||||
if (element) {
|
||||
let eventHandler = event => {
|
||||
event.preventDefault();
|
||||
isVisible = true;
|
||||
};
|
||||
element.addEventListener('mouseover', eventHandler);
|
||||
let rect = element.getBoundingClientRect();
|
||||
let x = rect.left + rect.width / 2;
|
||||
let y = rect.top + rect.height / 2;
|
||||
let elementInCenter = document.elementFromPoint(x, y);
|
||||
let elementInTopLeft = document.elementFromPoint(rect.left, rect.top);
|
||||
let elementInBottomRight = document.elementFromPoint(rect.right, rect.bottom);
|
||||
|
||||
let e = new MouseEvent('mouseover', {
|
||||
view: window,
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
});
|
||||
|
||||
if (elementInCenter)
|
||||
elementInCenter.dispatchEvent(e);
|
||||
|
||||
if (elementInTopLeft)
|
||||
elementInTopLeft.dispatchEvent(e);
|
||||
|
||||
if (elementInBottomRight)
|
||||
elementInBottomRight.dispatchEvent(e);
|
||||
|
||||
element.removeEventListener('mouseover', eventHandler);
|
||||
}
|
||||
return isVisible;
|
||||
}, selector);
|
||||
},
|
||||
|
||||
clickIfVisible: function(selector) {
|
||||
return this.wait(selector)
|
||||
.isVisible(selector)
|
||||
.then(visible => {
|
||||
if (visible)
|
||||
return this.click(selector);
|
||||
|
||||
throw new Error(`invisible selector: ${selector}`);
|
||||
});
|
||||
waitImgLoad: async function(selector) {
|
||||
await this.wait(selector);
|
||||
return await this.wait(selector => {
|
||||
const imageReady = document.querySelector(selector).complete;
|
||||
return imageReady;
|
||||
}, {}, selector);
|
||||
},
|
||||
|
||||
countElement: function(selector) {
|
||||
return this.evaluate(selector => {
|
||||
clickIfVisible: async function(selector) {
|
||||
await this.wait(selector);
|
||||
let isVisible = await this.isVisible(selector);
|
||||
|
||||
if (isVisible)
|
||||
return await this.click(selector);
|
||||
|
||||
throw new Error(`invisible selector: ${selector}`);
|
||||
},
|
||||
|
||||
countElement: async function(selector) {
|
||||
return await this.evaluate(selector => {
|
||||
return document.querySelectorAll(selector).length;
|
||||
}, selector);
|
||||
},
|
||||
|
||||
waitForNumberOfElements: function(selector, count) {
|
||||
return this.wait((selector, count) => {
|
||||
waitForNumberOfElements: async function(selector, count) {
|
||||
return await this.waitForFunction((selector, count) => {
|
||||
return document.querySelectorAll(selector).length === count;
|
||||
}, selector, count);
|
||||
}, {}, selector, count);
|
||||
},
|
||||
|
||||
waitForClassNotPresent: function(selector, className) {
|
||||
return this.wait(selector)
|
||||
.wait((selector, className) => {
|
||||
if (!document.querySelector(selector).classList.contains(className))
|
||||
return true;
|
||||
}, selector, className);
|
||||
waitForClassNotPresent: async function(selector, className) {
|
||||
await this.wait(selector);
|
||||
return await this.wait((selector, className) => {
|
||||
if (!document.querySelector(selector).classList.contains(className))
|
||||
return true;
|
||||
}, {}, selector, className);
|
||||
},
|
||||
|
||||
waitForClassPresent: function(selector, className) {
|
||||
return this.wait(selector)
|
||||
.wait((elementSelector, targetClass) => {
|
||||
if (document.querySelector(elementSelector).classList.contains(targetClass))
|
||||
return true;
|
||||
}, selector, className);
|
||||
waitForClassPresent: async function(selector, className) {
|
||||
await this.wait(selector);
|
||||
return await this.wait((elementSelector, targetClass) => {
|
||||
if (document.querySelector(elementSelector).classList.contains(targetClass))
|
||||
return true;
|
||||
}, {}, selector, className);
|
||||
},
|
||||
|
||||
waitForTextInElement: function(selector, text) {
|
||||
return this.wait(selector)
|
||||
.wait((selector, text) => {
|
||||
return document.querySelector(selector).innerText.toLowerCase().includes(text.toLowerCase());
|
||||
}, selector, text);
|
||||
waitForTextInElement: async function(selector, text) {
|
||||
await this.wait(selector);
|
||||
return await this.wait((selector, text) => {
|
||||
return document.querySelector(selector).innerText.toLowerCase().includes(text.toLowerCase());
|
||||
}, {}, selector, text);
|
||||
},
|
||||
|
||||
waitForTextInInput: function(selector, text) {
|
||||
return this.wait(selector)
|
||||
.wait((selector, text) => {
|
||||
return document.querySelector(selector).value.toLowerCase().includes(text.toLowerCase());
|
||||
}, selector, text);
|
||||
waitForTextInInput: async function(selector, text) {
|
||||
await this.wait(selector);
|
||||
return await this.wait((selector, text) => {
|
||||
return document.querySelector(`${selector} input`).value.toLowerCase().includes(text.toLowerCase());
|
||||
}, {}, selector, text);
|
||||
},
|
||||
|
||||
waitForInnerText: function(selector) {
|
||||
return this.wait(selector)
|
||||
.wait(selector => {
|
||||
const innerText = document.querySelector(selector).innerText;
|
||||
return innerText != null && innerText != '';
|
||||
}, selector)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).innerText;
|
||||
}, selector);
|
||||
waitForInnerText: async function(selector) {
|
||||
await this.waitForSelector(selector, {});
|
||||
await this.waitForFunction(selector => {
|
||||
const innerText = document.querySelector(selector).innerText;
|
||||
return innerText != null && innerText != '';
|
||||
}, {}, selector);
|
||||
return await this.evaluate(selector => {
|
||||
return document.querySelector(selector).innerText;
|
||||
}, selector);
|
||||
},
|
||||
|
||||
waitForEmptyInnerText: function(selector) {
|
||||
return this.wait(selector => {
|
||||
waitForEmptyInnerText: async function(selector) {
|
||||
return await this.wait(selector => {
|
||||
return document.querySelector(selector).innerText == '';
|
||||
}, selector);
|
||||
},
|
||||
|
||||
waitForURL: function(hashURL) {
|
||||
return this.wait(hash => {
|
||||
return document.location.hash.includes(hash);
|
||||
}, hashURL);
|
||||
waitForURL: async function(hashURL) {
|
||||
await this.waitForFunction(expectedHash => {
|
||||
return document.location.hash.includes(expectedHash);
|
||||
}, {}, hashURL);
|
||||
},
|
||||
|
||||
waitForShapes: function(selector) {
|
||||
return this.wait(selector)
|
||||
.evaluate(selector => {
|
||||
const shapes = document.querySelectorAll(selector);
|
||||
const shapesList = [];
|
||||
hideSnackbar: async function() {
|
||||
await this.waitToClick('#shapes .shown button');
|
||||
},
|
||||
|
||||
for (const shape of shapes)
|
||||
shapesList.push(shape.innerText);
|
||||
waitForLastShape: async function(selector) {
|
||||
await this.wait(selector);
|
||||
let snackBarText = await this.evaluate(selector => {
|
||||
const shape = document.querySelector(selector);
|
||||
|
||||
return shape.innerText;
|
||||
}, selector);
|
||||
await this.hideSnackbar();
|
||||
return snackBarText;
|
||||
},
|
||||
|
||||
return shapesList;
|
||||
waitForLastSnackbar: async function() {
|
||||
await this.wait(2000); // this needs a refactor to be somehow dynamic ie: page.waitForResponse(urlOrPredicate[, options]) or something to fire waitForLastShape once the request is completed
|
||||
await this.waitForSpinnerLoad();
|
||||
return await this.waitForLastShape('vn-snackbar .shown .text');
|
||||
},
|
||||
|
||||
accessToSearchResult: async function(searchValue) {
|
||||
await this.clearInput('vn-searchbar');
|
||||
await this.write('vn-searchbar', searchValue);
|
||||
await this.waitToClick('vn-searchbar vn-icon[icon="search"]');
|
||||
await this.waitForNumberOfElements('.search-result', 1);
|
||||
await this.waitFor(1000);
|
||||
await this.evaluate(() => {
|
||||
return document.querySelector('.search-result').click();
|
||||
});
|
||||
},
|
||||
|
||||
accessToSection: async function(sectionRoute) {
|
||||
await this.waitForSelector(`vn-left-menu`, {visible: true});
|
||||
let nested = await this.evaluate(sectionRoute => {
|
||||
return document.querySelector(`vn-left-menu li li > a[ui-sref="${sectionRoute}"]`) != null;
|
||||
}, sectionRoute);
|
||||
|
||||
if (nested) {
|
||||
await this.waitToClick('vn-left-menu vn-item-section > vn-icon[icon=keyboard_arrow_down]');
|
||||
await this.wait('vn-left-menu .expanded');
|
||||
}
|
||||
|
||||
await this.evaluate(sectionRoute => {
|
||||
let navButton = document.querySelector(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
||||
navButton.scrollIntoViewIfNeeded();
|
||||
return navButton.click();
|
||||
}, sectionRoute);
|
||||
await this.waitForNavigation({waitUntil: ['networkidle0']});
|
||||
},
|
||||
|
||||
autocompleteSearch: async function(selector, searchValue) {
|
||||
try {
|
||||
await this.waitToClick(`${selector} input`);
|
||||
await this.waitForSelector(selector => {
|
||||
document
|
||||
.querySelector(`${selector} vn-drop-down`).$ctrl.content
|
||||
.querySelectorAll('li');
|
||||
}, selector);
|
||||
},
|
||||
waitForSnackbar: function() {
|
||||
return this.wait(500)
|
||||
.waitForShapes('vn-snackbar .shape .text');
|
||||
},
|
||||
|
||||
waitForLastShape: function(selector) {
|
||||
return this.wait(selector)
|
||||
.evaluate(selector => {
|
||||
const shape = document.querySelector(selector);
|
||||
await this.write(`.vn-drop-down.shown`, searchValue);
|
||||
await this.waitForFunction((selector, searchValue) => {
|
||||
let element = document
|
||||
.querySelector(`${selector} vn-drop-down`).$ctrl.content
|
||||
.querySelector('li.active');
|
||||
if (element)
|
||||
return element.innerText.toLowerCase().includes(searchValue.toLowerCase());
|
||||
}, {}, selector, searchValue);
|
||||
|
||||
return shape.innerText;
|
||||
}, selector);
|
||||
},
|
||||
|
||||
waitForLastSnackbar: function() {
|
||||
return this.wait(500)
|
||||
.waitForSpinnerLoad()
|
||||
.waitForLastShape('vn-snackbar .shape .text');
|
||||
},
|
||||
|
||||
accessToSearchResult: function(searchValue) {
|
||||
return this.clearInput('vn-searchbar input')
|
||||
.write('vn-searchbar input', searchValue)
|
||||
.click('vn-searchbar vn-icon[icon="search"]')
|
||||
.wait(100)
|
||||
.waitForNumberOfElements('.search-result', 1)
|
||||
.evaluate(() => {
|
||||
return document.querySelector('ui-view vn-card vn-table') != null;
|
||||
})
|
||||
.then(result => {
|
||||
if (result)
|
||||
return this.waitToClick('ui-view vn-card vn-td');
|
||||
|
||||
return this.waitToClick('ui-view vn-card a');
|
||||
});
|
||||
},
|
||||
|
||||
accessToSection: function(sectionRoute) {
|
||||
return this.wait(`vn-left-menu`)
|
||||
.evaluate(sectionRoute => {
|
||||
return document.querySelector(`vn-left-menu li li > a[ui-sref="${sectionRoute}"]`) != null;
|
||||
}, sectionRoute)
|
||||
.then(nested => {
|
||||
if (nested) {
|
||||
this.waitToClick('vn-left-menu vn-item-section > vn-icon[icon=keyboard_arrow_down]')
|
||||
.wait('vn-left-menu .expanded');
|
||||
}
|
||||
|
||||
return this.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`)
|
||||
.waitForSpinnerLoad();
|
||||
});
|
||||
},
|
||||
|
||||
autocompleteSearch: function(autocompleteSelector, searchValue) {
|
||||
return this.waitToClick(`${autocompleteSelector} input`)
|
||||
.write(`.vn-drop-down.shown input`, searchValue)
|
||||
.waitToClick(`.vn-drop-down.shown li.active`)
|
||||
.wait((autocompleteSelector, searchValue) => {
|
||||
return document.querySelector(`${autocompleteSelector} input`).value
|
||||
.toLowerCase()
|
||||
await this.keyboard.press('Enter');
|
||||
await this.waitForFunction((selector, searchValue) => {
|
||||
return document.querySelector(`${selector} input`).value.toLowerCase()
|
||||
.includes(searchValue.toLowerCase());
|
||||
}, autocompleteSelector, searchValue);
|
||||
}, {}, selector, searchValue);
|
||||
} catch (error) {
|
||||
throw new Error(`${selector} failed to autocomplete ${searchValue}! ${error}`);
|
||||
}
|
||||
await this.waitForMutation(`.vn-drop-down`, 'childList');
|
||||
},
|
||||
|
||||
reloadSection: function(sectionRoute) {
|
||||
return this.waitToClick('vn-icon[icon="desktop_windows"]')
|
||||
.wait('vn-card.summary')
|
||||
.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
||||
reloadSection: async function(sectionRoute) {
|
||||
await this.waitFor(1000);
|
||||
await Promise.all([
|
||||
this.waitForNavigation({waitUntil: 'networkidle0'}),
|
||||
this.click('vn-icon[icon="desktop_windows"]', {}),
|
||||
]);
|
||||
|
||||
await Promise.all([
|
||||
this.waitForNavigation({waitUntil: 'networkidle0'}),
|
||||
this.click(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`, {}),
|
||||
]);
|
||||
},
|
||||
|
||||
forceReloadSection: function(sectionRoute) {
|
||||
return this.waitToClick('vn-icon[icon="desktop_windows"]')
|
||||
.waitToClick('button[response="accept"]')
|
||||
.wait('vn-card.summary')
|
||||
.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
||||
forceReloadSection: async function(sectionRoute) {
|
||||
await this.waitToClick('vn-icon[icon="desktop_windows"]');
|
||||
await this.waitToClick('button[response="accept"]');
|
||||
await this.wait('vn-card.summary');
|
||||
await this.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
||||
},
|
||||
|
||||
checkboxState: function(selector) {
|
||||
return this.wait(selector)
|
||||
.evaluate(selector => {
|
||||
let checkbox = document.querySelector(selector);
|
||||
switch (checkbox.$ctrl.field) {
|
||||
case null:
|
||||
return 'intermediate';
|
||||
case true:
|
||||
return 'checked';
|
||||
default:
|
||||
return 'unchecked';
|
||||
}
|
||||
}, selector);
|
||||
checkboxState: async function(selector) {
|
||||
await this.wait(selector);
|
||||
return await this.evaluate(selector => {
|
||||
let checkbox = document.querySelector(selector);
|
||||
switch (checkbox.$ctrl.field) {
|
||||
case null:
|
||||
return 'intermediate';
|
||||
case true:
|
||||
return 'checked';
|
||||
default:
|
||||
return 'unchecked';
|
||||
}
|
||||
}, selector);
|
||||
},
|
||||
|
||||
isDisabled: function(selector) {
|
||||
return this.wait(selector)
|
||||
.evaluate(selector => {
|
||||
let element = document.querySelector(selector);
|
||||
return element.$ctrl.disabled;
|
||||
}, selector);
|
||||
isDisabled: async function(selector) {
|
||||
await this.wait(selector);
|
||||
return await this.evaluate(selector => {
|
||||
let element = document.querySelector(selector);
|
||||
return element.$ctrl.disabled;
|
||||
}, selector);
|
||||
},
|
||||
|
||||
waitForStylePresent: function(selector, property, value) {
|
||||
return this.wait((selector, property, value) => {
|
||||
waitForStylePresent: async function(selector, property, value) {
|
||||
return await this.wait((selector, property, value) => {
|
||||
const element = document.querySelector(selector);
|
||||
return element.style[property] == value;
|
||||
}, selector, property, value);
|
||||
}, {}, selector, property, value);
|
||||
},
|
||||
|
||||
waitForSpinnerLoad: function() {
|
||||
return this.waitUntilNotPresent('vn-topbar vn-spinner');
|
||||
waitForSpinnerLoad: async function() {
|
||||
await this.waitUntilNotPresent('vn-topbar vn-spinner');
|
||||
},
|
||||
|
||||
waitForWatcherData: function(selector) {
|
||||
return this.wait(selector)
|
||||
.wait(selector => {
|
||||
const watcher = document.querySelector(selector);
|
||||
let orgData = watcher.$ctrl.orgData;
|
||||
return !angular.equals({}, orgData) && orgData != null;
|
||||
}, selector)
|
||||
.waitForSpinnerLoad();
|
||||
waitForWatcherData: async function(selector) {
|
||||
await this.wait(selector);
|
||||
await this.wait(selector => {
|
||||
let watcher = document.querySelector(selector);
|
||||
let orgData = watcher.$ctrl.orgData;
|
||||
return !angular.equals({}, orgData) && orgData != null;
|
||||
}, {}, selector);
|
||||
await this.waitForSpinnerLoad();
|
||||
},
|
||||
|
||||
waitForMutation: async function(selector, type) {
|
||||
try {
|
||||
await this.evaluate((selector, type) => {
|
||||
return new Promise(resolve => {
|
||||
const config = {attributes: true, childList: true, subtree: true};
|
||||
const target = document.querySelector(selector);
|
||||
|
||||
const onEnd = function(mutationsList, observer) {
|
||||
resolve();
|
||||
|
||||
observer.disconnect();
|
||||
};
|
||||
const observer = new MutationObserver(onEnd);
|
||||
observer.expectedType = type;
|
||||
|
||||
observer.observe(target, config);
|
||||
});
|
||||
}, selector, type);
|
||||
} catch (error) {
|
||||
throw new Error(`failed to wait for mutation type: ${type}`);
|
||||
}
|
||||
},
|
||||
|
||||
waitForTransitionEnd: async function(selector) {
|
||||
await this.evaluate(selector => {
|
||||
return new Promise(resolve => {
|
||||
const transition = document.querySelector(selector);
|
||||
const onEnd = function() {
|
||||
transition.removeEventListener('transitionend', onEnd);
|
||||
resolve();
|
||||
};
|
||||
transition.addEventListener('transitionend', onEnd);
|
||||
});
|
||||
}, selector);
|
||||
},
|
||||
|
||||
waitForContentLoaded: async function() {
|
||||
await this.waitFor(1000);
|
||||
// to be implemented in base of a directive loaded once al modules are done loading, further investigation required.
|
||||
// await this.waitForFunction(() => {
|
||||
// return new Promise(resolve => {
|
||||
// angular.element(document).ready(() => resolve());
|
||||
// const $rootScope = angular.element(document).find('ui-view').injector().get('$rootScope');
|
||||
// $rootScope.$$postDigest(resolve());
|
||||
// $rootScope.$on('$viewContentLoaded', resolve());
|
||||
// });
|
||||
// });
|
||||
}
|
||||
};
|
||||
|
||||
for (let name in actions) {
|
||||
Nightmare.action(name, function(...args) {
|
||||
let fnArgs = args.slice(0, args.length - 1);
|
||||
let done = args[args.length - 1];
|
||||
export function extendPage(page) {
|
||||
for (let name in actions) {
|
||||
page[name] = async(...args) => {
|
||||
return await actions[name].call(page, ...args);
|
||||
};
|
||||
}
|
||||
|
||||
actions[name].apply(this, fnArgs)
|
||||
.then(res => done(null, res))
|
||||
.catch(err => {
|
||||
let stringArgs = fnArgs
|
||||
.map(i => typeof i == 'function' ? 'Function' : i)
|
||||
.join(', ');
|
||||
page.wait = page.waitFor;
|
||||
|
||||
let orgMessage = err.message.startsWith('.wait()')
|
||||
? '.wait() timed out'
|
||||
: err.message;
|
||||
|
||||
done(new Error(`.${name}(${stringArgs}) failed: ${orgMessage}`));
|
||||
});
|
||||
});
|
||||
return page;
|
||||
}
|
||||
|
||||
export default actions;
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
const Nightmare = require('nightmare');
|
||||
const config = require('./config.js');
|
||||
|
||||
let nightmare;
|
||||
|
||||
module.exports = function createNightmare(width = 1280, height = 800) {
|
||||
if (nightmare)
|
||||
return nightmare;
|
||||
|
||||
nightmare = new Nightmare({
|
||||
show: process.env.E2E_SHOW,
|
||||
typeInterval: 10,
|
||||
x: 0,
|
||||
y: 0,
|
||||
waitTimeout: 2000,
|
||||
// openDevTools: {mode: 'detach'}
|
||||
}).viewport(width, height);
|
||||
|
||||
nightmare.on('console', (type, message, ...args) => {
|
||||
if (type === 'error') {
|
||||
console[type](message, ...args);
|
||||
throw new Error(message);
|
||||
} else
|
||||
console[type](message, ...args);
|
||||
});
|
||||
|
||||
nightmare.header('Accept-Language', 'en');
|
||||
return nightmare.goto(config.url);
|
||||
};
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
import Puppeteer from 'puppeteer';
|
||||
import {extendPage} from './extensions';
|
||||
import {url as defaultURL} from './config';
|
||||
|
||||
export async function getBrowser() {
|
||||
const browser = await Puppeteer.launch({
|
||||
args: [
|
||||
'--no-sandbox',
|
||||
`--window-size=${ 1920 },${ 1080 }`
|
||||
],
|
||||
defaultViewport: null,
|
||||
headless: false,
|
||||
slowMo: 0, // slow down by ms
|
||||
});
|
||||
let page = (await browser.pages())[0];
|
||||
page = extendPage(page);
|
||||
page.setDefaultTimeout(5000);
|
||||
await page.goto(defaultURL, {waitUntil: 'networkidle0'});
|
||||
return {page, close: browser.close.bind(browser)};
|
||||
}
|
||||
|
||||
export default getBrowser;
|
|
@ -15,29 +15,29 @@ export default {
|
|||
userLocalCompany: '.user-popover vn-autocomplete[ng-model="$ctrl.localCompanyFk"]',
|
||||
userWarehouse: '.user-popover vn-autocomplete[ng-model="$ctrl.warehouseFk"]',
|
||||
userCompany: '.user-popover vn-autocomplete[ng-model="$ctrl.companyFk"]',
|
||||
userConfigFirstAutocompleteClear: '#localWarehouse .icons > vn-icon[icon=clear]',
|
||||
userConfigSecondAutocompleteClear: '#localBank .icons > vn-icon[icon=clear]',
|
||||
userConfigThirdAutocompleteClear: '#localCompany .icons > vn-icon[icon=clear]',
|
||||
userConfigFirstAutocomplete: '#localWarehouse',
|
||||
userConfigSecondAutocomplete: '#localBank',
|
||||
userConfigThirdAutocomplete: '#localCompany',
|
||||
acceptButton: '.vn-confirm.shown button[response=accept]'
|
||||
},
|
||||
clientsIndex: {
|
||||
searchClientInput: `vn-textfield input`,
|
||||
searchClientInput: 'vn-topbar',
|
||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||
searchResult: 'vn-client-index .vn-item',
|
||||
createClientButton: `vn-float-button`,
|
||||
othersButton: 'vn-left-menu li[name="Others"] > a'
|
||||
},
|
||||
createClientView: {
|
||||
name: `vn-textfield input[name="name"]`,
|
||||
taxNumber: `vn-textfield input[name="fi"]`,
|
||||
socialName: `vn-textfield input[name="socialName"]`,
|
||||
street: `vn-textfield input[name="street"]`,
|
||||
postcode: `vn-textfield input[name="postcode"]`,
|
||||
city: `vn-textfield input[name="city"]`,
|
||||
name: `vn-client-create [ng-model="$ctrl.client.name"]`,
|
||||
taxNumber: 'vn-client-create [ng-model="$ctrl.client.fi"]',
|
||||
socialName: 'vn-client-create [ng-model="$ctrl.client.socialName"]',
|
||||
street: 'vn-client-create [ng-model="$ctrl.client.street"]',
|
||||
postcode: 'vn-client-create [ng-model="$ctrl.client.postcode"]',
|
||||
city: 'vn-client-create [ng-model="$ctrl.client.city"]',
|
||||
province: `vn-autocomplete[ng-model="$ctrl.client.provinceFk"]`,
|
||||
country: `vn-autocomplete[ng-model="$ctrl.client.countryFk"]`,
|
||||
userName: `vn-textfield input[name="userName"]`,
|
||||
email: `vn-textfield input[name="email"]`,
|
||||
userName: 'vn-client-create [ng-model="$ctrl.client.userName"]',
|
||||
email: 'vn-client-create [ng-model="$ctrl.client.email"]',
|
||||
salesPersonAutocomplete: `vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]`,
|
||||
createButton: `button[type=submit]`,
|
||||
cancelButton: 'vn-button[href="#!/client/index"]'
|
||||
|
@ -48,22 +48,24 @@ export default {
|
|||
},
|
||||
clientBasicData: {
|
||||
basicDataButton: 'vn-left-menu a[ui-sref="client.card.basicData"]',
|
||||
nameInput: 'vn-textfield[ng-model="$ctrl.client.name"] input',
|
||||
contactInput: 'vn-textfield[ng-model="$ctrl.client.contact"] input',
|
||||
emailInput: 'vn-textfield[ng-model="$ctrl.client.email"] input',
|
||||
nameInput: 'vn-client-basic-data [ng-model="$ctrl.client.name"]',
|
||||
contactInput: 'vn-client-basic-data [ng-model="$ctrl.client.contact"]',
|
||||
phoneInput: 'vn-client-basic-data [ng-model="$ctrl.client.phone"]',
|
||||
mobileInput: 'vn-client-basic-data [ng-model="$ctrl.client.mobile"]',
|
||||
emailInput: 'vn-client-basic-data [ng-model="$ctrl.client.email"]',
|
||||
salesPersonAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]',
|
||||
channelAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.contactChannelFk"]',
|
||||
saveButton: `button[type=submit]`
|
||||
},
|
||||
clientFiscalData: {
|
||||
fiscalDataButton: 'vn-left-menu a[ui-sref="client.card.fiscalData"]',
|
||||
socialNameInput: `vn-textfield input[name="socialName"]`,
|
||||
fiscalIdInput: `vn-textfield input[name="fi"]`,
|
||||
socialNameInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.socialName"]',
|
||||
fiscalIdInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.fi"]',
|
||||
equalizationTaxCheckbox: 'vn-check[ng-model="$ctrl.client.isEqualizated"]',
|
||||
acceptPropagationButton: '.vn-confirm.shown button[response=accept]',
|
||||
addressInput: `vn-textfield input[name="street"]`,
|
||||
postcodeInput: `vn-textfield input[name="postcode"]`,
|
||||
cityInput: `vn-textfield input[name="city"]`,
|
||||
addressInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.street"]',
|
||||
postcodeInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.postcode"]',
|
||||
cityInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.city"]',
|
||||
provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.provinceFk"]',
|
||||
countryAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.countryFk"]',
|
||||
activeCheckbox: 'vn-check[label="Active"]',
|
||||
|
@ -78,17 +80,17 @@ export default {
|
|||
},
|
||||
clientBillingData: {
|
||||
payMethodAutocomplete: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.payMethodFk"]',
|
||||
IBANInput: `vn-client-billing-data vn-textfield input[name="iban"]`,
|
||||
dueDayInput: `vn-client-billing-data vn-input-number input[name="dueDay"]`,
|
||||
IBANInput: 'vn-client-billing-data [ng-model="$ctrl.client.iban"]',
|
||||
dueDayInput: 'vn-client-billing-data [ng-model="$ctrl.client.dueDay"]',
|
||||
receivedCoreLCRCheckbox: 'vn-client-billing-data vn-check[label="Received LCR"]',
|
||||
receivedCoreVNLCheckbox: 'vn-client-billing-data vn-check[label="Received core VNL"]',
|
||||
receivedB2BVNLCheckbox: 'vn-client-billing-data vn-check[label="Received B2B VNL"]',
|
||||
swiftBicAutocomplete: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.bankEntityFk"]',
|
||||
clearswiftBicButton: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.bankEntityFk"] .icons > vn-icon[icon=clear]',
|
||||
newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button',
|
||||
newBankEntityName: '.vn-dialog.shown vn-textfield[label="Name"] input',
|
||||
newBankEntityBIC: '.vn-dialog.shown vn-textfield[label="Swift / BIC"] input',
|
||||
newBankEntityCode: '.vn-dialog.shown vn-textfield[label="Entity Code"] input',
|
||||
newBankEntityName: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.name"]',
|
||||
newBankEntityBIC: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.bic"]',
|
||||
newBankEntityCode: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.id"]',
|
||||
acceptBankEntityButton: '.vn-dialog.shown button[response="accept"]',
|
||||
saveButton: `button[type=submit]`,
|
||||
watcher: 'vn-client-billing-data vn-watcher'
|
||||
|
@ -97,26 +99,28 @@ export default {
|
|||
addressesButton: 'vn-left-menu a[ui-sref="client.card.address.index"]',
|
||||
createAddress: `vn-client-address-index vn-float-button`,
|
||||
defaultCheckboxInput: 'vn-check[label="Default"]',
|
||||
consigneeInput: `vn-textfield input[name="nickname"]`,
|
||||
streetAddressInput: `vn-textfield input[name="street"]`,
|
||||
postcodeInput: `vn-textfield input[name="postalCode"]`,
|
||||
cityInput: `vn-textfield input[name="city"]`,
|
||||
provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.provinceFk"]',
|
||||
agencyAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.agencyModeFk"]',
|
||||
phoneInput: `vn-textfield input[name="phone"]`,
|
||||
mobileInput: `vn-textfield input[name="mobile"]`,
|
||||
consigneeInput: '[ng-model="$ctrl.address.nickname"]',
|
||||
streetAddressInput: '[ng-model="$ctrl.address.street"]',
|
||||
postcodeInput: '[ng-model="$ctrl.address.postalCode"]',
|
||||
cityInput: '[ng-model="$ctrl.address.city"]',
|
||||
provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.provinceId"]',
|
||||
agencyAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.agencyModeId"]',
|
||||
phoneInput: '[ng-model="$ctrl.address.phone"]',
|
||||
mobileInput: '[ng-model="$ctrl.address.mobile"]',
|
||||
defaultAddress: 'vn-client-address-index div:nth-child(1) div[name="street"]',
|
||||
incotermsAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.incotermsId"]',
|
||||
customsAgentAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.customsAgentId"]',
|
||||
secondMakeDefaultStar: 'vn-client-address-index vn-card div:nth-child(2) vn-icon-button[icon="star_border"]',
|
||||
firstEditAddress: 'vn-client-address-index div:nth-child(1) > a',
|
||||
secondEditAddress: 'vn-client-address-index div:nth-child(2) > a',
|
||||
activeCheckbox: 'vn-check[label="Enabled"]',
|
||||
equalizationTaxCheckbox: 'vn-client-address-edit vn-check[label="Is equalizated"]',
|
||||
firstObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] :nth-child(1) [ng-model="observation.observationTypeFk"]',
|
||||
firstObservationDescriptionInput: 'vn-client-address-edit [name=observations] :nth-child(1) [ng-model="observation.description"] input',
|
||||
secondObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] :nth-child(2) [ng-model="observation.observationTypeFk"]',
|
||||
secondObservationDescriptionInput: 'vn-client-address-edit [name=observations] :nth-child(2) [ng-model="observation.description"] input',
|
||||
firstObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(1) [ng-model="observation.observationTypeFk"]',
|
||||
firstObservationDescriptionInput: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(1) [ng-model="observation.description"]',
|
||||
secondObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(2) [ng-model="observation.observationTypeFk"]',
|
||||
secondObservationDescriptionInput: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(2) [ng-model="observation.description"]',
|
||||
addObservationButton: 'vn-client-address-edit div[name="observations"] vn-icon-button[icon="add_circle"]',
|
||||
saveButton: `button[type=submit]`,
|
||||
saveButton: 'button[type=submit]',
|
||||
cancelCreateAddressButton: 'button[ui-sref="client.card.address.index"]',
|
||||
cancelEditAddressButton: 'vn-client-address-edit > form > vn-button-bar > vn-button > button',
|
||||
watcher: 'vn-client-address-edit vn-watcher'
|
||||
|
@ -124,27 +128,27 @@ export default {
|
|||
clientWebAccess: {
|
||||
webAccessButton: 'vn-left-menu a[ui-sref="client.card.webAccess"]',
|
||||
enableWebAccessCheckbox: 'vn-check[label="Enable web access"]',
|
||||
userNameInput: `vn-textfield input[name="name"]`,
|
||||
saveButton: `button[type=submit]`
|
||||
userNameInput: 'vn-client-web-access [ng-model="$ctrl.account.name"]',
|
||||
saveButton: 'button[type=submit]'
|
||||
},
|
||||
clientNotes: {
|
||||
addNoteFloatButton: `vn-float-button`,
|
||||
noteInput: 'vn-textarea[label="Note"]',
|
||||
saveButton: `button[type=submit]`,
|
||||
addNoteFloatButton: 'vn-float-button',
|
||||
noteInput: '[ng-model="$ctrl.note.text"]',
|
||||
saveButton: 'button[type=submit]',
|
||||
firstNoteText: 'vn-client-note .text'
|
||||
},
|
||||
clientCredit: {
|
||||
addCreditFloatButton: `vn-float-button`,
|
||||
creditInput: `vn-input-number input[name="credit"]`,
|
||||
saveButton: `button[type=submit]`,
|
||||
addCreditFloatButton: 'vn-float-button',
|
||||
creditInput: 'vn-client-credit-create [ng-model="$ctrl.client.credit"]',
|
||||
saveButton: 'button[type=submit]',
|
||||
firstCreditText: 'vn-client-credit-index vn-card vn-table vn-tbody > vn-tr'
|
||||
},
|
||||
clientGreuge: {
|
||||
addGreugeFloatButton: `vn-float-button`,
|
||||
amountInput: `vn-input-number input[name="amount"]`,
|
||||
descriptionInput: `vn-textfield input[name="description"]`,
|
||||
addGreugeFloatButton: 'vn-float-button',
|
||||
amountInput: 'vn-client-greuge-create [ng-model="$ctrl.greuge.amount"]',
|
||||
descriptionInput: 'vn-client-greuge-create [ng-model="$ctrl.greuge.description"]',
|
||||
typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.greuge.greugeTypeFk"]',
|
||||
saveButton: `button[type=submit]`,
|
||||
saveButton: 'button[type=submit]',
|
||||
firstGreugeText: 'vn-client-greuge-index vn-card vn-table vn-tbody > vn-tr'
|
||||
},
|
||||
clientMandate: {
|
||||
|
@ -162,10 +166,10 @@ export default {
|
|||
},
|
||||
clientBalance: {
|
||||
balanceButton: 'vn-left-menu a[ui-sref="client.card.balance.index"]',
|
||||
companyAutocomplete: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyFk"]',
|
||||
companyAutocomplete: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]',
|
||||
newPaymentButton: `vn-float-button`,
|
||||
newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]',
|
||||
newPaymentAmountInput: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.receipt.amountPaid"] input',
|
||||
newPaymentAmountInput: '.vn-dialog.shown [ng-model="$ctrl.receipt.amountPaid"]',
|
||||
saveButton: '.vn-dialog.shown vn-button[label="Save"]',
|
||||
firstBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)'
|
||||
|
||||
|
@ -187,7 +191,7 @@ export default {
|
|||
searchResultPreviewButton: 'vn-item-index .buttons > [icon="desktop_windows"]',
|
||||
searchResultCloneButton: 'vn-item-index .buttons > [icon="icon-clone"]',
|
||||
acceptClonationAlertButton: '.vn-confirm.shown [response="accept"]',
|
||||
searchItemInput: 'vn-searchbar vn-textfield input',
|
||||
searchItemInput: 'vn-searchbar',
|
||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||
closeItemSummaryPreview: '.vn-popup.shown',
|
||||
fieldsToShowButton: 'vn-item-index vn-table > div > div > vn-icon-button[icon="menu"]',
|
||||
|
@ -209,18 +213,18 @@ export default {
|
|||
saveFieldsButton: '.vn-dialog.shown vn-horizontal:nth-child(16) > vn-button > button'
|
||||
},
|
||||
itemCreateView: {
|
||||
temporalName: `vn-textfield input[name="provisionalName"]`,
|
||||
temporalName: 'vn-item-create [ng-model="$ctrl.item.provisionalName"]',
|
||||
typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]',
|
||||
intrastatAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]',
|
||||
originAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]',
|
||||
createButton: `button[type=submit]`,
|
||||
createButton: 'button[type=submit]',
|
||||
cancelButton: 'vn-button[ui-sref="item.index"]'
|
||||
},
|
||||
itemDescriptor: {
|
||||
goBackToModuleIndexButton: 'vn-item-descriptor a[href="#!/item/index"]',
|
||||
moreMenu: 'vn-item-descriptor vn-icon-menu[icon=more_vert]',
|
||||
moreMenuRegularizeButton: '.vn-drop-down.shown li[name="Regularize stock"]',
|
||||
regularizeQuantityInput: '.vn-dialog.shown tpl-body > div > vn-textfield input',
|
||||
regularizeQuantityInput: '.vn-dialog.shown [ng-model="$ctrl.quantity"]',
|
||||
regularizeWarehouseAutocomplete: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.warehouseFk"]',
|
||||
editButton: 'vn-item-descriptor vn-float-button[icon="edit"]',
|
||||
regularizeSaveButton: '.vn-dialog.shown tpl-buttons > button',
|
||||
|
@ -232,11 +236,11 @@ export default {
|
|||
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',
|
||||
typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]',
|
||||
intrastatAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]',
|
||||
nameInput: 'vn-textfield[label="Name"] input',
|
||||
relevancyInput: 'vn-input-number[ng-model="$ctrl.item.relevancy"] input',
|
||||
nameInput: 'vn-item-basic-data [ng-model="$ctrl.item.name"]',
|
||||
relevancyInput: 'vn-item-basic-data [ng-model="$ctrl.item.relevancy"]',
|
||||
originAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]',
|
||||
expenseAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.expenseFk"]',
|
||||
longNameInput: 'vn-textfield[ng-model="$ctrl.item.longName"] input',
|
||||
longNameInput: 'vn-textfield[ng-model="$ctrl.item.longName"]',
|
||||
isActiveCheckbox: 'vn-check[label="Active"]',
|
||||
priceInKgCheckbox: 'vn-check[label="Price in kg"]',
|
||||
submitBasicDataButton: `button[type=submit]`
|
||||
|
@ -245,47 +249,47 @@ export default {
|
|||
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',
|
||||
tagsButton: 'vn-left-menu a[ui-sref="item.card.tags"]',
|
||||
fourthTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(4) > vn-autocomplete[ng-model="itemTag.tagFk"]',
|
||||
fourthValueInput: 'vn-item-tags vn-horizontal:nth-child(4) > vn-textfield[label="Value"] input',
|
||||
fourthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(4) > vn-textfield[label="Relevancy"] input',
|
||||
fourthValueInput: 'vn-item-tags vn-horizontal:nth-child(4) [ng-model="itemTag.value"]',
|
||||
fourthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(4) [ng-model="itemTag.priority"]',
|
||||
fourthRemoveTagButton: 'vn-item-tags vn-horizontal:nth-child(4) vn-icon-button[icon="delete"]',
|
||||
fifthTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(5) > vn-autocomplete[ng-model="itemTag.tagFk"]',
|
||||
fifthValueInput: 'vn-item-tags vn-horizontal:nth-child(5) > vn-textfield[label="Value"] input',
|
||||
fifthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(5) > vn-textfield[label="Relevancy"] input',
|
||||
fifthValueInput: 'vn-item-tags vn-horizontal:nth-child(5) [ng-model="itemTag.value"]',
|
||||
fifthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(5) [ng-model="itemTag.priority"]',
|
||||
sixthTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(6) > vn-autocomplete[ng-model="itemTag.tagFk"]',
|
||||
sixthValueInput: 'vn-item-tags vn-horizontal:nth-child(6) > vn-textfield[label="Value"] input',
|
||||
sixthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(6) > vn-textfield[label="Relevancy"] input',
|
||||
sixthValueInput: 'vn-item-tags vn-horizontal:nth-child(6) [ng-model="itemTag.value"]',
|
||||
sixthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(6) [ng-model="itemTag.priority"]',
|
||||
seventhTagAutocomplete: 'vn-item-tags vn-horizontal:nth-child(7) > vn-autocomplete[ng-model="itemTag.tagFk"]',
|
||||
seventhValueInput: 'vn-item-tags vn-horizontal:nth-child(7) > vn-textfield[label="Value"] input',
|
||||
seventhRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(7) > vn-textfield[label="Relevancy"] input',
|
||||
seventhValueInput: 'vn-item-tags vn-horizontal:nth-child(7) [ng-model="itemTag.value"]',
|
||||
seventhRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(7) [ng-model="itemTag.priority"]',
|
||||
addItemTagButton: 'vn-item-tags vn-icon-button[icon="add_circle"]',
|
||||
submitItemTagsButton: `vn-item-tags button[type=submit]`
|
||||
submitItemTagsButton: 'vn-item-tags button[type=submit]'
|
||||
},
|
||||
itemTax: {
|
||||
undoChangesButton: 'vn-item-tax vn-button-bar > vn-button[label="Undo changes"]',
|
||||
firstClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(1) > vn-autocomplete[ng-model="tax.taxClassFk"]',
|
||||
secondClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(2) > vn-autocomplete[ng-model="tax.taxClassFk"]',
|
||||
thirdClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="tax.taxClassFk"]',
|
||||
submitTaxButton: `vn-item-tax button[type=submit]`
|
||||
submitTaxButton: 'vn-item-tax button[type=submit]'
|
||||
},
|
||||
itemBarcodes: {
|
||||
addBarcodeButton: 'vn-item-barcode vn-icon[icon="add_circle"]',
|
||||
thirdCodeInput: `vn-item-barcode vn-horizontal:nth-child(3) > vn-textfield input`,
|
||||
submitBarcodesButton: `vn-item-barcode button[type=submit]`,
|
||||
thirdCodeInput: 'vn-item-barcode vn-horizontal:nth-child(3) [ng-model="barcode.code"]',
|
||||
submitBarcodesButton: 'vn-item-barcode button[type=submit]',
|
||||
firstCodeRemoveButton: 'vn-item-barcode vn-horizontal vn-none vn-icon[icon="delete"]'
|
||||
},
|
||||
itemNiches: {
|
||||
addNicheButton: 'vn-item-niche vn-icon[icon="add_circle"]',
|
||||
firstWarehouseAutocomplete: 'vn-item-niche vn-autocomplete[ng-model="niche.warehouseFk"]',
|
||||
firstCodeInput: 'vn-item-niche vn-horizontal:nth-child(1) > vn-textfield[label="Code"] input',
|
||||
firstCodeInput: 'vn-item-niche vn-horizontal:nth-child(1) [ng-model="niche.code"]',
|
||||
secondWarehouseAutocomplete: 'vn-item-niche vn-horizontal:nth-child(2) > vn-autocomplete[ng-model="niche.warehouseFk"]',
|
||||
secondCodeInput: 'vn-item-niche vn-horizontal:nth-child(2) > vn-textfield[label="Code"] input',
|
||||
secondCodeInput: 'vn-item-niche vn-horizontal:nth-child(2) [ng-model="niche.code"]',
|
||||
secondNicheRemoveButton: 'vn-item-niche vn-horizontal:nth-child(2) > vn-none > vn-icon-button[icon="delete"]',
|
||||
thirdWarehouseAutocomplete: 'vn-item-niche vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="niche.warehouseFk"]',
|
||||
thirdCodeInput: 'vn-item-niche vn-horizontal:nth-child(3) > vn-textfield[label="Code"] input',
|
||||
submitNichesButton: `vn-item-niche button[type=submit]`
|
||||
thirdCodeInput: 'vn-item-niche vn-horizontal:nth-child(3) [ng-model="niche.code"]',
|
||||
submitNichesButton: 'vn-item-niche button[type=submit]'
|
||||
},
|
||||
itemBotanical: {
|
||||
botanicalInput: `vn-item-botanical vn-horizontal:nth-child(1) > vn-textfield input`,
|
||||
botanicalInput: 'vn-item-botanical vn-horizontal:nth-child(1) [ng-model="$ctrl.botanical.botanical"]',
|
||||
genusAutocomplete: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.genusFk"]',
|
||||
speciesAutocomplete: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.specieFk"]',
|
||||
submitBotanicalButton: `vn-item-botanical button[type=submit]`
|
||||
|
@ -326,20 +330,19 @@ export default {
|
|||
},
|
||||
ticketsIndex: {
|
||||
openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]',
|
||||
advancedSearchInvoiceOut: 'vn-ticket-search-panel vn-textfield[ng-model="filter.refFk"] input',
|
||||
advancedSearchInvoiceOut: 'vn-ticket-search-panel [ng-model="filter.refFk"]',
|
||||
newTicketButton: 'vn-ticket-index > a',
|
||||
searchResult: 'vn-ticket-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
|
||||
searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr',
|
||||
searchResultDate: 'vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(5)',
|
||||
searchTicketInput: `vn-searchbar input`,
|
||||
searchWeeklyTicketInput: `vn-searchbar input`,
|
||||
searchTicketInput: 'vn-searchbar',
|
||||
searchWeeklyClearInput: 'vn-searchbar vn-icon[icon=clear]',
|
||||
advancedSearchButton: 'vn-ticket-search-panel button[type=submit]',
|
||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||
searchWeeklyButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||
moreMenu: 'vn-ticket-index vn-icon-menu[icon=more_vert]',
|
||||
menuWeeklyTickets: 'vn-left-menu [ui-sref="ticket.weekly.index"]',
|
||||
sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6) vn-autocomplete[ng-model="weekly.weekDay"] input',
|
||||
sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6)',
|
||||
weeklyTicket: 'vn-ticket-weekly-index vn-table > div > vn-tbody > vn-tr',
|
||||
firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
|
||||
acceptDeleteTurn: '.vn-confirm.shown button[response="accept"]'
|
||||
|
@ -379,8 +382,8 @@ export default {
|
|||
firstNoteRemoveButton: 'vn-icon[icon="delete"]',
|
||||
addNoteButton: 'vn-icon[icon="add_circle"]',
|
||||
firstNoteTypeAutocomplete: 'vn-autocomplete[ng-model="observation.observationTypeFk"]',
|
||||
firstDescriptionInput: 'vn-textfield[label="Description"] input',
|
||||
submitNotesButton: `button[type=submit]`
|
||||
firstDescriptionInput: 'vn-ticket-observation [ng-model="observation.description"]',
|
||||
submitNotesButton: 'button[type=submit]'
|
||||
},
|
||||
ticketExpedition: {
|
||||
expeditionButton: 'vn-left-menu a[ui-sref="ticket.card.expedition"]',
|
||||
|
@ -391,7 +394,7 @@ export default {
|
|||
ticketPackages: {
|
||||
packagesButton: 'vn-left-menu a[ui-sref="ticket.card.package"]',
|
||||
firstPackageAutocomplete: 'vn-autocomplete[label="Package"]',
|
||||
firstQuantityInput: 'vn-input-number[ng-model="package.quantity"] input',
|
||||
firstQuantityInput: 'vn-ticket-package vn-horizontal:nth-child(1) [ng-model="package.quantity"]',
|
||||
firstRemovePackageButton: 'vn-icon-button[vn-tooltip="Remove package"]',
|
||||
addPackageButton: 'vn-icon-button[vn-tooltip="Add package"]',
|
||||
clearPackageAutocompleteButton: 'vn-autocomplete[label="Package"] .icons > vn-icon[icon=clear]',
|
||||
|
@ -410,7 +413,6 @@ export default {
|
|||
moreMenuReserve: '.vn-drop-down.shown li[name="Mark as reserved"]',
|
||||
moreMenuUnmarkReseved: '.vn-drop-down.shown li[name="Unmark as reserved"]',
|
||||
moreMenuUpdateDiscount: '.vn-drop-down.shown li[name="Update discount"]',
|
||||
moreMenuUpdateDiscountInput: '.vn-dialog.shown form vn-ticket-sale-edit-discount vn-input-number[ng-model="$ctrl.newDiscount"] input',
|
||||
transferQuantityInput: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable > span > text',
|
||||
transferQuantityCell: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable',
|
||||
firstSaleClaimIcon: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) vn-icon[icon="icon-claims"]',
|
||||
|
@ -418,15 +420,14 @@ export default {
|
|||
firstSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(1)',
|
||||
firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) vn-td:nth-child(3) > img',
|
||||
firstSaleZoomedImage: 'body > div > div > img',
|
||||
firstSaleQuantity: 'vn-input-number[ng-model="sale.quantity"]:nth-child(1) input',
|
||||
firstSaleQuantity: 'vn-ticket-sale [ng-model="sale.quantity"]',
|
||||
firstSaleQuantityCell: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td-editable:nth-child(5)',
|
||||
firstSaleQuantityClearInput: 'vn-textfield[ng-model="sale.quantity"] div.suffix > i',
|
||||
firstSaleIdAutocomplete: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > vn-autocomplete',
|
||||
idAutocompleteFirstResult: '.vn-drop-down.shown li',
|
||||
firstSalePrice: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(7) > span',
|
||||
firstSalePriceInput: '.vn-popover.shown vn-input-number input',
|
||||
firstSalePriceInput: '.vn-popover.shown [ng-model="$ctrl.editedPrice"]',
|
||||
firstSaleDiscount: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(8) > span',
|
||||
firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount vn-input-number input',
|
||||
firstSaleDiscountInput: '.vn-popover.shown [ng-model="$ctrl.newDiscount"]',
|
||||
firstSaleImport: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(9)',
|
||||
firstSaleReservedIcon: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td:nth-child(2) > vn-icon:nth-child(3)',
|
||||
firstSaleColour: 'vn-ticket-sale vn-tr:nth-child(1) vn-fetched-tags section',
|
||||
|
@ -439,18 +440,18 @@ export default {
|
|||
secondSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(2)',
|
||||
secondSaleId: 'vn-ticket-sale:nth-child(2) vn-td-editable:nth-child(4) text > span',
|
||||
secondSaleIdCell: 'vn-ticket-sale vn-tr:nth-child(2) > vn-td-editable:nth-child(4)',
|
||||
secondSaleIdInput: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete input',
|
||||
secondSaleIdInput: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete',
|
||||
secondSaleIdAutocomplete: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete',
|
||||
secondSaleQuantity: 'vn-ticket-sale vn-table vn-tr:nth-child(2) vn-input-number input',
|
||||
secondSaleQuantity: 'vn-ticket-sale vn-table vn-tr:nth-child(2) vn-input-number',
|
||||
secondSaleConceptCell: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td-editable:nth-child(6) > div',
|
||||
secondSaleConceptInput: 'vn-ticket-sale vn-table vn-tr:nth-child(2) > vn-td-editable.ng-isolate-scope.selected vn-textfield input',
|
||||
secondSaleConceptInput: 'vn-ticket-sale vn-table vn-tr:nth-child(2) > vn-td-editable.ng-isolate-scope.selected vn-textfield',
|
||||
totalImport: 'vn-ticket-sale > vn-vertical > vn-card > vn-vertical > vn-horizontal > vn-one > p:nth-child(3) > strong',
|
||||
selectAllSalesCheckbox: 'vn-ticket-sale vn-thead vn-check',
|
||||
secondSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(2) vn-check[ng-model="sale.checked"]',
|
||||
thirdSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(3) vn-check[ng-model="sale.checked"]',
|
||||
deleteSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="delete"]',
|
||||
transferSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="call_split"]',
|
||||
moveToTicketInput: '.vn-popover.shown vn-textfield[ng-model="$ctrl.transfer.ticketId"] input',
|
||||
moveToTicketInput: '.vn-popover.shown vn-textfield[ng-model="$ctrl.transfer.ticketId"]',
|
||||
moveToTicketInputClearButton: '.vn-popover.shown i[title="Clear"]',
|
||||
moveToTicketButton: '.vn-popover.shown vn-icon[icon="arrow_forward_ios"]',
|
||||
moveToNewTicketButton: '.vn-popover.shown vn-button[label="New ticket"]',
|
||||
|
@ -482,13 +483,13 @@ export default {
|
|||
ticketRequests: {
|
||||
addRequestButton: 'vn-ticket-request-index > a > vn-float-button > button',
|
||||
request: 'vn-ticket-request-index vn-table vn-tr',
|
||||
descriptionInput: 'vn-ticket-request-create > form > div > vn-card > vn-horizontal:nth-child(1) > vn-textfield input',
|
||||
descriptionInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.description"]',
|
||||
atenderAutocomplete: 'vn-ticket-request-create vn-autocomplete[ng-model="$ctrl.ticketRequest.attenderFk"]',
|
||||
quantityInput: 'vn-ticket-request-create vn-input-number input[name=quantity]',
|
||||
priceInput: 'vn-ticket-request-create vn-input-number input[name=price]',
|
||||
quantityInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.quantity"]',
|
||||
priceInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.price"]',
|
||||
firstRemoveRequestButton: 'vn-ticket-request-index vn-icon[icon="delete"]:nth-child(1)',
|
||||
saveButton: 'vn-ticket-request-create button[type=submit]',
|
||||
firstDescription: 'vn-ticket-request-index vn-table vn-tr:nth-child(1) > vn-td:nth-child(2)',
|
||||
firstDescription: 'vn-ticket-request-index vn-table vn-tr:nth-child(1) > vn-td:nth-child(2) vn-textfield',
|
||||
|
||||
},
|
||||
ticketLog: {
|
||||
|
@ -501,11 +502,11 @@ export default {
|
|||
addServiceButton: 'vn-ticket-service vn-icon-button[vn-tooltip="Add service"] > button',
|
||||
firstAddServiceTypeButton: 'vn-ticket-service vn-icon-button[vn-tooltip="New service type"]',
|
||||
firstServiceTypeAutocomplete: 'vn-ticket-service vn-autocomplete[ng-model="service.ticketServiceTypeFk"]',
|
||||
firstQuantityInput: 'vn-ticket-service vn-input-number[label="Quantity"] input',
|
||||
firstPriceInput: 'vn-ticket-service vn-input-number[label="Price"] input',
|
||||
firstQuantityInput: 'vn-ticket-service [ng-model="service.quantity"]',
|
||||
firstPriceInput: 'vn-ticket-service [ng-model="service.price"]',
|
||||
firstVatTypeAutocomplete: 'vn-ticket-service vn-autocomplete[label="Tax class"]',
|
||||
fistDeleteServiceButton: 'vn-ticket-service form vn-horizontal:nth-child(1) vn-icon-button[icon="delete"]',
|
||||
newServiceTypeNameInput: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newServiceType.name"] input',
|
||||
newServiceTypeNameInput: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newServiceType.name"]',
|
||||
newServiceTypeExpenseAutocomplete: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.newServiceType.expenseFk"]',
|
||||
serviceLine: 'vn-ticket-service > form > vn-card > vn-one:nth-child(2) > vn-horizontal',
|
||||
saveServiceButton: `button[type=submit]`,
|
||||
|
@ -518,7 +519,7 @@ export default {
|
|||
saveStateButton: `button[type=submit]`
|
||||
},
|
||||
claimsIndex: {
|
||||
searchClaimInput: `vn-searchbar input`,
|
||||
searchClaimInput: 'vn-searchbar',
|
||||
searchResult: 'vn-claim-index vn-card > vn-table > div > vn-tbody > a',
|
||||
searchButton: 'vn-searchbar vn-icon[icon="search"]'
|
||||
},
|
||||
|
@ -548,12 +549,11 @@ export default {
|
|||
},
|
||||
claimDetail: {
|
||||
secondItemDiscount: 'vn-claim-detail > vn-vertical > vn-card > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(6) > span',
|
||||
discountInput: '.vn-popover.shown vn-input-number[ng-model="$ctrl.newDiscount"] input',
|
||||
discountInput: '.vn-popover.shown [ng-model="$ctrl.newDiscount"]',
|
||||
discoutPopoverMana: '.vn-popover.shown .content > div > vn-horizontal > h5',
|
||||
addItemButton: 'vn-claim-detail a vn-float-button',
|
||||
firstClaimableSaleFromTicket: '.vn-dialog.shown vn-tbody > vn-tr',
|
||||
claimDetailLine: 'vn-claim-detail > vn-vertical > vn-card > vn-vertical > vn-table > div > vn-tbody > vn-tr',
|
||||
firstItemQuantityInput: 'vn-claim-detail vn-tr:nth-child(1) vn-input-number[ng-model="saleClaimed.quantity"] input',
|
||||
totalClaimed: 'vn-claim-detail > vn-vertical > vn-card > vn-vertical > vn-horizontal > div > vn-label-value:nth-child(2) > section > span',
|
||||
secondItemDeleteButton: 'vn-claim-detail > vn-vertical > vn-card > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(8) > vn-icon-button > button > vn-icon > i'
|
||||
},
|
||||
|
@ -570,7 +570,7 @@ export default {
|
|||
secondClaimResponsibleAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimResponsibleFk"]',
|
||||
secondClaimWorkerAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.workerFk"]',
|
||||
secondClaimRedeliveryAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimRedeliveryFk"]',
|
||||
saveDevelopmentButton: `button[type=submit]`
|
||||
saveDevelopmentButton: 'button[type=submit]'
|
||||
},
|
||||
claimAction: {
|
||||
importClaimButton: 'vn-claim-action vn-button[label="Import claim"]',
|
||||
|
@ -585,9 +585,8 @@ export default {
|
|||
searchResult: 'vn-order-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
|
||||
searchResultDate: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)',
|
||||
searchResultAddress: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(6)',
|
||||
searchOrderInput: `vn-order-index vn-textfield input`,
|
||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||
createOrderButton: `vn-float-button`,
|
||||
createOrderButton: 'vn-float-button',
|
||||
},
|
||||
orderDescriptor: {
|
||||
returnToModuleIndexButton: 'vn-order-descriptor a[ui-sref="order.index"]',
|
||||
|
@ -598,21 +597,21 @@ export default {
|
|||
addressAutocomplete: 'vn-autocomplete[label="Address"]',
|
||||
agencyAutocomplete: 'vn-autocomplete[label="Agency"]',
|
||||
landedDatePicker: 'vn-date-picker[label="Landed"]',
|
||||
createButton: `button[type=submit]`,
|
||||
createButton: 'button[type=submit]',
|
||||
cancelButton: 'vn-button[href="#!/client/index"]'
|
||||
},
|
||||
orderCatalog: {
|
||||
orderByAutocomplete: 'vn-autocomplete[label="Order by"]',
|
||||
plantRealmButton: 'vn-order-catalog > vn-side-menu vn-icon[icon="icon-plant"]',
|
||||
typeAutocomplete: 'vn-autocomplete[data="$ctrl.itemTypes"]',
|
||||
itemIdInput: 'vn-catalog-filter vn-textfield[ng-model="$ctrl.itemFk"] input',
|
||||
itemTagValueInput: 'vn-catalog-filter vn-textfield[ng-model="$ctrl.value"] input',
|
||||
openTagSearch: 'vn-catalog-filter > div > vn-vertical > vn-textfield[ng-model="$ctrl.value"] .append i',
|
||||
itemIdInput: 'vn-order-catalog > vn-side-menu vn-textfield[ng-model="$ctrl.itemId"]',
|
||||
itemTagValueInput: 'vn-order-catalog > vn-side-menu vn-textfield[ng-model="$ctrl.value"]',
|
||||
openTagSearch: 'vn-order-catalog > vn-side-menu > div > vn-vertical > vn-textfield[ng-model="$ctrl.value"] .append i',
|
||||
tagAutocomplete: 'vn-order-catalog-search-panel vn-autocomplete[ng-model="filter.tagFk"]',
|
||||
tagValueInput: 'vn-order-catalog-search-panel vn-textfield[ng-model="filter.value"] input',
|
||||
tagValueInput: 'vn-order-catalog-search-panel [ng-model="filter.value"]',
|
||||
searchTagButton: 'vn-order-catalog-search-panel button[type=submit]',
|
||||
thirdFilterRemoveButton: 'vn-catalog-filter .chips > vn-chip:nth-child(3) vn-icon[icon=cancel]',
|
||||
fourthFilterRemoveButton: 'vn-catalog-filter .chips > vn-chip:nth-child(4) vn-icon[icon=cancel]',
|
||||
thirdFilterRemoveButton: 'vn-order-catalog > vn-side-menu .chips > vn-chip:nth-child(3) vn-icon[icon=cancel]',
|
||||
fourthFilterRemoveButton: 'vn-order-catalog > vn-side-menu .chips > vn-chip:nth-child(4) vn-icon[icon=cancel]',
|
||||
},
|
||||
orderBasicData: {
|
||||
clientAutocomplete: 'vn-autocomplete[label="Client"]',
|
||||
|
@ -636,7 +635,7 @@ export default {
|
|||
createdDatePicker: 'vn-route-create vn-date-picker[ng-model="$ctrl.route.created"]',
|
||||
vehicleAutoComplete: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]',
|
||||
agencyAutoComplete: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]',
|
||||
descriptionInput: 'vn-route-create vn-textfield[ng-model="$ctrl.route.description"] input',
|
||||
descriptionInput: 'vn-route-create [ng-model="$ctrl.route.description"]',
|
||||
submitButton: 'vn-route-create button[type=submit]'
|
||||
},
|
||||
routeDescriptor: {
|
||||
|
@ -649,26 +648,26 @@ export default {
|
|||
workerAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.workerFk"]',
|
||||
vehicleAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]',
|
||||
agencyAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]',
|
||||
kmStartInput: 'vn-route-basic-data vn-input-number[ng-model="$ctrl.route.kmStart"] input',
|
||||
kmEndInput: 'vn-route-basic-data vn-input-number[ng-model="$ctrl.route.kmEnd"] input',
|
||||
kmStartInput: 'vn-route-basic-data [ng-model="$ctrl.route.kmStart"]',
|
||||
kmEndInput: 'vn-route-basic-data [ng-model="$ctrl.route.kmEnd"]',
|
||||
createdDateInput: 'vn-route-basic-data vn-date-picker[ng-model="$ctrl.route.created"]',
|
||||
startedHourInput: 'vn-route-basic-data vn-input-time[ng-model="$ctrl.route.started"] input',
|
||||
finishedHourInput: 'vn-route-basic-data vn-input-time[ng-model="$ctrl.route.finished"] input',
|
||||
startedHourInput: 'vn-route-basic-data [ng-model="$ctrl.route.started"]',
|
||||
finishedHourInput: 'vn-route-basic-data [ng-model="$ctrl.route.finished"]',
|
||||
saveButton: 'vn-route-basic-data button[type=submit]'
|
||||
},
|
||||
routeTickets: {
|
||||
firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) vn-textfield[ng-model="ticket.priority"] input',
|
||||
secondTicketPriority: 'vn-route-tickets vn-tr:nth-child(2) vn-textfield[ng-model="ticket.priority"] input',
|
||||
thirdTicketPriority: 'vn-route-tickets vn-tr:nth-child(3) vn-textfield[ng-model="ticket.priority"] input',
|
||||
fourthTicketPriority: 'vn-route-tickets vn-tr:nth-child(4) vn-textfield[ng-model="ticket.priority"] input',
|
||||
eleventhTicketPriority: 'vn-route-tickets vn-tr:nth-child(11) vn-textfield[ng-model="ticket.priority"] input',
|
||||
firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) vn-textfield[ng-model="ticket.priority"]',
|
||||
secondTicketPriority: 'vn-route-tickets vn-tr:nth-child(2) vn-textfield[ng-model="ticket.priority"]',
|
||||
thirdTicketPriority: 'vn-route-tickets vn-tr:nth-child(3) vn-textfield[ng-model="ticket.priority"]',
|
||||
fourthTicketPriority: 'vn-route-tickets vn-tr:nth-child(4) vn-textfield[ng-model="ticket.priority"]',
|
||||
eleventhTicketPriority: 'vn-route-tickets vn-tr:nth-child(11) vn-textfield[ng-model="ticket.priority"]',
|
||||
firstTicketCheckbox: 'vn-route-tickets vn-tr:nth-child(1) vn-check',
|
||||
buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]',
|
||||
firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]',
|
||||
confirmButton: '.vn-confirm.shown button[response="accept"]'
|
||||
},
|
||||
workerPbx: {
|
||||
extensionInput: 'vn-worker-pbx vn-textfield[ng-model="$ctrl.worker.sip.extension"] input',
|
||||
extensionInput: 'vn-worker-pbx [ng-model="$ctrl.worker.sip.extension"]',
|
||||
saveButton: 'vn-worker-pbx button[type=submit]'
|
||||
},
|
||||
workerTimeControl: {
|
||||
|
@ -724,7 +723,7 @@ export default {
|
|||
acceptDeleteDialog: '.vn-confirm.shown button[response="accept"]'
|
||||
},
|
||||
invoiceOutIndex: {
|
||||
searchInvoiceOutInput: `vn-searchbar input`,
|
||||
searchInvoiceOutInput: 'vn-searchbar',
|
||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||
searchResult: 'vn-invoice-out-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
|
||||
},
|
||||
|
|
|
@ -1,37 +1,42 @@
|
|||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Login path', () => {
|
||||
const nightmare = createNightmare();
|
||||
describe('Login path', async() => {
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should receive an error when the username is incorrect', async() => {
|
||||
const result = await nightmare
|
||||
.doLogin('badUser', null)
|
||||
.waitForLastSnackbar();
|
||||
await page.doLogin('badUser', '');
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should receive an error when the username is blank', async() => {
|
||||
const result = await nightmare
|
||||
.doLogin('', null)
|
||||
.waitForLastSnackbar();
|
||||
await page.doLogin('', '');
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should receive an error when the password is incorrect', async() => {
|
||||
const result = await nightmare
|
||||
.doLogin('employee', 'badPassword')
|
||||
.waitForLastSnackbar();
|
||||
await page.doLogin('employee', 'badPassword');
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should log in', async() => {
|
||||
const url = await nightmare
|
||||
.doLogin('employee', null)
|
||||
.wait('#user')
|
||||
.parsedUrl();
|
||||
await page.doLogin('employee', 'nightmare');
|
||||
await page.waitForNavigation();
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/');
|
||||
});
|
||||
|
|
|
@ -1,90 +1,90 @@
|
|||
import selectors from '../../helpers/selectors';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client create path', () => {
|
||||
const nightmare = createNightmare();
|
||||
describe('Client create path', async() => {
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should search for the user Carol Danvers to confirm it isn't created yet`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
|
||||
.waitToClick(selectors.clientsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0)
|
||||
.countElement(selectors.clientsIndex.searchResult);
|
||||
await page.write(selectors.clientsIndex.searchClientInput, 'Carol Danvers');
|
||||
await page.waitToClick(selectors.clientsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0);
|
||||
const result = await page.countElement(selectors.clientsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(0);
|
||||
});
|
||||
|
||||
it('should now access to the create client view by clicking the create-client floating button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientsIndex.createClientButton)
|
||||
.wait(selectors.createClientView.createButton)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientsIndex.createClientButton);
|
||||
await page.wait(selectors.createClientView.createButton);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/client/create');
|
||||
});
|
||||
|
||||
it('should receive an error when clicking the create button having all the form fields empty', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.createClientView.createButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it('should receive an error when clicking the create button having name and Business name fields empty', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.createClientView.taxNumber, '74451390E')
|
||||
.write(selectors.createClientView.userName, 'CaptainMarvel')
|
||||
.write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es')
|
||||
.autocompleteSearch(selectors.createClientView.salesPersonAutocomplete, 'replenisher')
|
||||
.waitToClick(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.createClientView.taxNumber, '74451390E');
|
||||
await page.write(selectors.createClientView.userName, 'CaptainMarvel');
|
||||
await page.write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es');
|
||||
await page.autocompleteSearch(selectors.createClientView.salesPersonAutocomplete, 'replenisher');
|
||||
await page.waitToClick(selectors.createClientView.createButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it(`should attempt to create a new user with all it's data but wrong email`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.createClientView.name, 'Carol Danvers')
|
||||
.write(selectors.createClientView.socialName, 'AVG tax')
|
||||
.write(selectors.createClientView.street, 'Many places')
|
||||
.autocompleteSearch(selectors.createClientView.country, 'España')
|
||||
.autocompleteSearch(selectors.createClientView.province, 'Province one')
|
||||
.write(selectors.createClientView.city, 'Valencia')
|
||||
.write(selectors.createClientView.postcode, '46000')
|
||||
.clearInput(selectors.createClientView.email)
|
||||
.write(selectors.createClientView.email, 'incorrect email format')
|
||||
.waitToClick(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.createClientView.name, 'Carol Danvers');
|
||||
await page.write(selectors.createClientView.socialName, 'AVG tax');
|
||||
await page.write(selectors.createClientView.street, 'Many places');
|
||||
await page.waitForContentLoaded();
|
||||
await page.autocompleteSearch(selectors.createClientView.country, 'España');
|
||||
await page.autocompleteSearch(selectors.createClientView.province, 'Province one');
|
||||
await page.write(selectors.createClientView.city, 'Valencia');
|
||||
await page.write(selectors.createClientView.postcode, '46000');
|
||||
await page.clearInput(selectors.createClientView.email);
|
||||
await page.write(selectors.createClientView.email, 'incorrect email format');
|
||||
await page.waitToClick(selectors.createClientView.createButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it(`should attempt to create a new user with all it's data but wrong postal code`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.createClientView.email)
|
||||
.write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es')
|
||||
.clearInput(selectors.createClientView.postcode)
|
||||
.write(selectors.createClientView.postcode, '479999')
|
||||
.waitToClick(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.createClientView.email);
|
||||
await page.write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es');
|
||||
await page.clearInput(selectors.createClientView.postcode);
|
||||
await page.write(selectors.createClientView.postcode, '479999');
|
||||
await page.waitToClick(selectors.createClientView.createButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(`The postcode doesn't exists. Ensure you put the correct format`);
|
||||
expect(result).toEqual(`The postcode doesn't exist. Please enter a correct one`);
|
||||
});
|
||||
|
||||
it(`should check for autocompleted city, province and country`, async() => {
|
||||
const clientCity = await nightmare
|
||||
.waitToGetProperty(`${selectors.createClientView.city}`, 'value');
|
||||
const clientCity = await page
|
||||
.waitToGetProperty(`${selectors.createClientView.city} input`, 'value');
|
||||
|
||||
const clientProvince = await nightmare
|
||||
const clientProvince = await page
|
||||
.waitToGetProperty(`${selectors.createClientView.province} input`, 'value');
|
||||
|
||||
const clientCountry = await nightmare
|
||||
const clientCountry = await page
|
||||
.waitToGetProperty(`${selectors.createClientView.country} input`, 'value');
|
||||
|
||||
expect(clientCity).toEqual('Valencia');
|
||||
|
@ -93,33 +93,31 @@ describe('Client create path', () => {
|
|||
});
|
||||
|
||||
it(`should create a new user with all correct data`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.createClientView.postcode)
|
||||
.write(selectors.createClientView.postcode, '46000')
|
||||
.waitToClick(selectors.createClientView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.createClientView.postcode);
|
||||
await page.write(selectors.createClientView.postcode, '46000');
|
||||
await page.waitToClick(selectors.createClientView.createButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should click on the Clients button of the top bar menu', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.clientsButton)
|
||||
.wait(selectors.clientsIndex.createClientButton)
|
||||
.parsedUrl();
|
||||
await page.waitFor(500);
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await page.waitToClick(selectors.globalItems.clientsButton);
|
||||
await page.wait(selectors.clientsIndex.createClientButton);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/client/index');
|
||||
});
|
||||
|
||||
it(`should search for the user Carol Danvers to confirm it exists`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
|
||||
.waitToClick(selectors.clientsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
||||
.countElement(selectors.clientsIndex.searchResult);
|
||||
await page.waitForContentLoaded();
|
||||
await page.accessToSearchResult('Carol Danvers');
|
||||
await page.waitForURL('#!/client/114/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(result).toEqual(1);
|
||||
expect(url.hash).toEqual('#!/client/114/summary');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,65 +1,68 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Edit basicData path', () => {
|
||||
const nightmare = createNightmare();
|
||||
describe('as employee', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Bruce Wayne')
|
||||
.accessToSection('client.card.basicData');
|
||||
});
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Bruce Wayne');
|
||||
await page.accessToSection('client.card.basicData');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as employee', () => {
|
||||
it('should not be able to change the salesPerson', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientBasicData.nameInput)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.clientBasicData.salesPersonAutocomplete} input`);
|
||||
await page.wait(selectors.clientBasicData.nameInput);
|
||||
const result = await page.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.clientBasicData.salesPersonAutocomplete} input`);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should edit the client basic data but leave salesPerson untainted', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientBasicData.nameInput)
|
||||
.write(selectors.clientBasicData.nameInput, 'Ptonomy Wallace')
|
||||
.clearInput(selectors.clientBasicData.contactInput)
|
||||
.write(selectors.clientBasicData.contactInput, 'David Haller')
|
||||
.clearInput(selectors.clientBasicData.emailInput)
|
||||
.write(selectors.clientBasicData.emailInput, 'PWallace@verdnatura.es')
|
||||
.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Rumors on the streets')
|
||||
.waitToClick(selectors.clientBasicData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientBasicData.nameInput);
|
||||
await page.write(selectors.clientBasicData.nameInput, 'Ptonomy Wallace');
|
||||
await page.clearInput(selectors.clientBasicData.contactInput);
|
||||
await page.write(selectors.clientBasicData.contactInput, 'David Haller');
|
||||
await page.clearInput(selectors.clientBasicData.emailInput);
|
||||
await page.write(selectors.clientBasicData.emailInput, 'PWallace@verdnatura.es');
|
||||
await page.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Rumors on the streets');
|
||||
await page.waitToClick(selectors.clientBasicData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('client.card.basicData')
|
||||
.waitToGetProperty(selectors.clientBasicData.nameInput, 'value');
|
||||
await page.reloadSection('client.card.basicData');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientBasicData.nameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Ptonomy Wallace');
|
||||
});
|
||||
|
||||
it('should confirm the contact name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientBasicData.contactInput, 'value');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.contactInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('David Haller');
|
||||
});
|
||||
|
||||
it('should confirm the email have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientBasicData.emailInput, 'value');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.emailInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('PWallace@verdnatura.es');
|
||||
});
|
||||
|
||||
it('should confirm the channel have been selected', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.channelAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Rumors on the streets');
|
||||
|
@ -67,70 +70,66 @@ describe('Client Edit basicData path', () => {
|
|||
});
|
||||
|
||||
describe('as salesAssistant', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesASsistant', 'client')
|
||||
.accessToSearchResult('Ptonomy Wallace')
|
||||
.accessToSection('client.card.basicData');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('salesASsistant', 'client');
|
||||
await page.accessToSearchResult('Ptonomy Wallace');
|
||||
await page.accessToSection('client.card.basicData');
|
||||
});
|
||||
|
||||
it('should be able to change the salesPerson', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientBasicData.nameInput)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.clientBasicData.salesPersonAutocomplete} input`);
|
||||
await page.wait(selectors.clientBasicData.nameInput);
|
||||
const result = await page.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.clientBasicData.salesPersonAutocomplete} input`);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should edit the client basic data including salesPerson', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientBasicData.nameInput)
|
||||
.write(selectors.clientBasicData.nameInput, 'Ororo Munroe')
|
||||
.clearInput(selectors.clientBasicData.contactInput)
|
||||
.write(selectors.clientBasicData.contactInput, 'Black Panther')
|
||||
.clearInput(selectors.clientBasicData.emailInput)
|
||||
.write(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es')
|
||||
.autocompleteSearch(selectors.clientBasicData.salesPersonAutocomplete, 'replenisherNick')
|
||||
.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Metropolis newspaper')
|
||||
.waitToClick(selectors.clientBasicData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientBasicData.nameInput);
|
||||
await page.write(selectors.clientBasicData.nameInput, 'Ororo Munroe');
|
||||
await page.clearInput(selectors.clientBasicData.contactInput);
|
||||
await page.write(selectors.clientBasicData.contactInput, 'Black Panther');
|
||||
await page.clearInput(selectors.clientBasicData.emailInput);
|
||||
await page.write(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es');
|
||||
await page.autocompleteSearch(selectors.clientBasicData.salesPersonAutocomplete, 'replenisherNick');
|
||||
await page.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Metropolis newspaper');
|
||||
await page.waitToClick(selectors.clientBasicData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should now confirm the name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('client.card.basicData')
|
||||
.waitToGetProperty(selectors.clientBasicData.nameInput, 'value');
|
||||
await page.reloadSection('client.card.basicData');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientBasicData.nameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Ororo Munroe');
|
||||
});
|
||||
|
||||
it('should now confirm the contact name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientBasicData.contactInput, 'value');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.contactInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Black Panther');
|
||||
});
|
||||
|
||||
it('should now confirm the email have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientBasicData.emailInput, 'value');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.emailInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Storm@verdnatura.es');
|
||||
});
|
||||
|
||||
it('should confirm the sales person have been selected', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.salesPersonAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('replenisherNick');
|
||||
});
|
||||
|
||||
it('should now confirm the channel have been selected', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.clientBasicData.channelAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Metropolis newspaper');
|
||||
|
|
|
@ -1,314 +1,287 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Edit fiscalData path', () => {
|
||||
const nightmare = createNightmare();
|
||||
describe('as employee', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.address.index');
|
||||
});
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.address.index');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as employee', () => {
|
||||
// Confirms all addresses have EQtax false for future propagation test step 1
|
||||
it(`should click on the 1st edit icon to check EQtax isnt checked`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||
const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
// Confirms all addresses have EQtax false for future propagation test step 2
|
||||
it(`should go back to addresses then select the second one and confirm the EQtax isnt checked`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitToClick(selectors.clientAddresses.secondEditAddress)
|
||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.addressesButton);
|
||||
await page.waitToClick(selectors.clientAddresses.secondEditAddress);
|
||||
const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it(`should click on the fiscal data button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.waitForURL('fiscal-data')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientFiscalData.fiscalDataButton);
|
||||
await page.waitForURL('fiscal-data');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('fiscal-data');
|
||||
});
|
||||
|
||||
it('should not be able to edit the verified data checkbox', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.verifiedDataCheckbox)
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
await page.wait(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('as administrative', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('administrative', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it(`should edit the fiscal data but fail as the fiscal id ain't valid`, async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'SMASH')
|
||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
||||
.write(selectors.clientFiscalData.fiscalIdInput, 'INVALID!')
|
||||
.clearInput(selectors.clientFiscalData.addressInput)
|
||||
.write(selectors.clientFiscalData.addressInput, 'Somewhere edited')
|
||||
.autocompleteSearch(selectors.clientFiscalData.countryAutocomplete, 'España')
|
||||
.autocompleteSearch(selectors.clientFiscalData.provinceAutocomplete, 'Province one')
|
||||
.clearInput(selectors.clientFiscalData.cityInput)
|
||||
.write(selectors.clientFiscalData.cityInput, 'Valencia')
|
||||
.clearInput(selectors.clientFiscalData.postcodeInput)
|
||||
.write(selectors.clientFiscalData.postcodeInput, '46000')
|
||||
.waitToClick(selectors.clientFiscalData.activeCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.frozenCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.hasToInvoiceCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.viesCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.invoiceByMailCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.wait(selectors.clientFiscalData.socialNameInput);
|
||||
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||
await page.write(selectors.clientFiscalData.socialNameInput, 'SMASH');
|
||||
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);
|
||||
await page.write(selectors.clientFiscalData.fiscalIdInput, 'INVALID!');
|
||||
await page.clearInput(selectors.clientFiscalData.addressInput);
|
||||
await page.write(selectors.clientFiscalData.addressInput, 'Somewhere edited');
|
||||
await page.autocompleteSearch(selectors.clientFiscalData.countryAutocomplete, 'España');
|
||||
await page.autocompleteSearch(selectors.clientFiscalData.provinceAutocomplete, 'Province one');
|
||||
await page.clearInput(selectors.clientFiscalData.cityInput);
|
||||
await page.write(selectors.clientFiscalData.cityInput, 'Valencia');
|
||||
await page.clearInput(selectors.clientFiscalData.postcodeInput);
|
||||
await page.write(selectors.clientFiscalData.postcodeInput, '46000');
|
||||
await page.waitToClick(selectors.clientFiscalData.activeCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.frozenCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.hasToInvoiceCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.viesCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.invoiceByMailCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Invalid Tax number');
|
||||
});
|
||||
}, 15000);
|
||||
|
||||
it(`should edit the fiscal this time with a valid fiscal id`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
||||
.write(selectors.clientFiscalData.fiscalIdInput, '94980061C')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);
|
||||
await page.write(selectors.clientFiscalData.fiscalIdInput, '94980061C');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should propagate the Equalization tax', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.acceptPropagationButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientFiscalData.acceptPropagationButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Equivalent tax spreaded');
|
||||
});
|
||||
|
||||
it('should receive an error if the fiscal id contains A or B at the beginning', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.viesCheckbox)
|
||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
||||
.write(selectors.clientFiscalData.fiscalIdInput, 'A94980061C')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientFiscalData.viesCheckbox);
|
||||
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);
|
||||
await page.write(selectors.clientFiscalData.fiscalIdInput, 'A94980061C');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Cannot check Equalization Tax in this NIF/CIF');
|
||||
});
|
||||
|
||||
it('should finally edit the fixcal data correctly as VIES isnt checked and fiscal id is valid for EQtax', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
||||
.write(selectors.clientFiscalData.fiscalIdInput, '94980061C')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);
|
||||
await page.write(selectors.clientFiscalData.fiscalIdInput, '94980061C');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
// confirm all addresses have now EQtax checked step 1
|
||||
it(`should click on the addresses button to access to the client's addresses`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitForURL('/address/index')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientAddresses.addressesButton);
|
||||
await page.waitForURL('/address/index');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/address/index');
|
||||
});
|
||||
|
||||
// confirm all addresses have now EQtax checked step 2
|
||||
it(`should click on the 1st edit icon to confirm EQtax is checked`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.waitForWatcherData(selectors.clientAddresses.watcher)
|
||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||
await page.waitForWatcherData(selectors.clientAddresses.watcher);
|
||||
const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
// confirm all addresses have now EQtax checked step 3
|
||||
it(`should go back to addresses then select the second one and confirm the EQtax is checked`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitToClick(selectors.clientAddresses.secondEditAddress)
|
||||
.waitForWatcherData(selectors.clientAddresses.watcher)
|
||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.addressesButton);
|
||||
await page.waitToClick(selectors.clientAddresses.secondEditAddress);
|
||||
await page.waitForWatcherData(selectors.clientAddresses.watcher);
|
||||
const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
it('should navigate back to fiscal data and uncheck EQtax then check VIES', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.waitToClick(selectors.clientFiscalData.viesCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientFiscalData.fiscalDataButton);
|
||||
await page.waitToClick(selectors.clientFiscalData.viesCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should propagate the Equalization tax changes', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.acceptPropagationButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientFiscalData.acceptPropagationButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Equivalent tax spreaded');
|
||||
});
|
||||
|
||||
it('should confirm its name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
await page.waitToClick(selectors.clientFiscalData.fiscalDataButton);
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('SMASH');
|
||||
});
|
||||
|
||||
it('should confirm the fiscal id have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientFiscalData.fiscalIdInput, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.fiscalIdInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('94980061C');
|
||||
});
|
||||
|
||||
it('should confirm the address have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientFiscalData.addressInput, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.addressInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Somewhere edited');
|
||||
});
|
||||
|
||||
it('should confirm the postcode have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientFiscalData.postcodeInput}`, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.postcodeInput} input`, 'value');
|
||||
|
||||
expect(result).toContain('46000');
|
||||
});
|
||||
|
||||
it('should confirm the city have been autocompleted', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientFiscalData.cityInput}`, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.cityInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Valencia');
|
||||
});
|
||||
|
||||
|
||||
it(`should confirm the province have been autocompleted`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientFiscalData.provinceAutocomplete} input`, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.provinceAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Province one');
|
||||
});
|
||||
|
||||
it('should confirm the country have been autocompleted', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientFiscalData.countryAutocomplete} input`, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.countryAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('España');
|
||||
});
|
||||
|
||||
it('should confirm active checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.activeCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.activeCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm frozen checkbox is checked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.frozenCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.frozenCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
it('should confirm Has to invoice checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.hasToInvoiceCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.hasToInvoiceCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm Vies checkbox is checked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.viesCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.viesCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
it('should confirm Invoice by mail checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.invoiceByMailCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.invoiceByMailCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm invoice by address checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm Equalization tax checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.equalizationTaxCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm Verified data checkbox is checked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 1
|
||||
it(`should click on the addresses button to access to the client's addresses`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitForURL('/address/index')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientAddresses.addressesButton);
|
||||
await page.waitForURL('/address/index');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/address/index');
|
||||
});
|
||||
|
||||
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 2
|
||||
it(`should click on the 1st edit icon to access the address details and uncheck EQtax checkbox`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.waitForTextInInput(selectors.clientAddresses.cityInput, 'Silla')
|
||||
.waitToClick(selectors.clientAddresses.equalizationTaxCheckbox)
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||
await page.waitForTextInInput(selectors.clientAddresses.cityInput, 'Silla');
|
||||
await page.waitToClick(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 3
|
||||
it('should navigate back to fiscal data to confirm invoice by address is now checked', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.waitForWatcherData(selectors.clientFiscalData.watcher)
|
||||
.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.fiscalDataButton);
|
||||
await page.waitForWatcherData(selectors.clientFiscalData.watcher);
|
||||
const result = await page.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
|
|
@ -1,121 +1,105 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Edit billing data path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('administrative', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.billingData');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.billingData');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should attempt to edit the billing data without an IBAN but fail`, async() => {
|
||||
const snackbarMessage = await nightmare
|
||||
.autocompleteSearch(selectors.clientBillingData.payMethodAutocomplete, 'PayMethod with IBAN')
|
||||
.autocompleteSearch(selectors.clientBillingData.swiftBicAutocomplete, 'BBKKESMMMMM')
|
||||
.clearInput(selectors.clientBillingData.dueDayInput)
|
||||
.write(selectors.clientBillingData.dueDayInput, '60')
|
||||
.waitForTextInInput(selectors.clientBillingData.dueDayInput, '60')
|
||||
.waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox)
|
||||
.waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox)
|
||||
.waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox)
|
||||
.waitToClick(selectors.clientBillingData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.clientBillingData.payMethodAutocomplete, 'PayMethod with IBAN');
|
||||
await page.autocompleteSearch(selectors.clientBillingData.swiftBicAutocomplete, 'BBKKESMMMMM');
|
||||
await page.clearInput(selectors.clientBillingData.dueDayInput);
|
||||
await page.write(selectors.clientBillingData.dueDayInput, '60');
|
||||
await page.waitForTextInInput(selectors.clientBillingData.dueDayInput, '60');
|
||||
await page.waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox);
|
||||
await page.waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox);
|
||||
await page.waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox);
|
||||
await page.waitToClick(selectors.clientBillingData.saveButton);
|
||||
let snackbarMessage = await page.waitForLastSnackbar();
|
||||
|
||||
expect(snackbarMessage).toEqual('That payment method requires an IBAN');
|
||||
});
|
||||
|
||||
it(`should add the IBAN but fail as it requires a BIC code`, async() => {
|
||||
const snackbarMessage = await nightmare
|
||||
.waitToClick(selectors.clientBillingData.clearswiftBicButton)
|
||||
.clearInput(selectors.clientBillingData.IBANInput)
|
||||
.write(selectors.clientBillingData.IBANInput, 'FR9121000418450200051332')
|
||||
.waitForTextInInput(selectors.clientBillingData.IBANInput, 'FR9121000418450200051332')
|
||||
.wait(1000)
|
||||
.waitToClick(selectors.clientBillingData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(snackbarMessage).toEqual('That payment method requires a BIC');
|
||||
});
|
||||
|
||||
it(`should create a new BIC code`, async() => {
|
||||
const newcode = await nightmare
|
||||
.waitToClick(selectors.clientBillingData.newBankEntityButton)
|
||||
.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank')
|
||||
.write(selectors.clientBillingData.newBankEntityCode, 9999)
|
||||
.write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT')
|
||||
.waitToClick(selectors.clientBillingData.acceptBankEntityButton)
|
||||
.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
await page.waitToClick(selectors.clientBillingData.newBankEntityButton);
|
||||
await page.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank');
|
||||
await page.write(selectors.clientBillingData.newBankEntityCode, '9999');
|
||||
await page.write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT');
|
||||
await page.waitToClick(selectors.clientBillingData.acceptBankEntityButton);
|
||||
await page.waitForTextInInput(selectors.clientBillingData.swiftBicAutocomplete, 'Gotham City Bank');
|
||||
let newcode = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
|
||||
expect(newcode).toEqual('GTHMCT Gotham City Bank');
|
||||
});
|
||||
|
||||
it(`should confirm the IBAN pay method is sucessfully saved`, async() => {
|
||||
const payMethod = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientBillingData.payMethodAutocomplete} input`, 'value');
|
||||
it(`should confirm the IBAN pay method was sucessfully saved`, async() => {
|
||||
let payMethod = await page.waitToGetProperty(`${selectors.clientBillingData.payMethodAutocomplete} input`, 'value');
|
||||
|
||||
expect(payMethod).toEqual('PayMethod with IBAN');
|
||||
});
|
||||
|
||||
it(`should clear the BIC code field, update the IBAN to see how he BIC code autocompletes`, async() => {
|
||||
const AutomaticCode = await nightmare
|
||||
.clearInput(selectors.clientBillingData.IBANInput)
|
||||
.write(selectors.clientBillingData.IBANInput, 'ES9121000418450200051332')
|
||||
.waitForTextInInput(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'caixesbb')
|
||||
.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
await page.write(selectors.clientBillingData.IBANInput, 'ES9121000418450200051332');
|
||||
await page.keyboard.press('Tab');
|
||||
await page.keyboard.press('Tab');
|
||||
await page.waitForTextInInput(selectors.clientBillingData.swiftBicAutocomplete, 'caixesbb');
|
||||
let automaticCode = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
|
||||
expect(AutomaticCode).toEqual('CAIXESBB Caixa Bank');
|
||||
expect(automaticCode).toEqual('CAIXESBB Caixa Bank');
|
||||
});
|
||||
|
||||
it(`should save the form with all its new data`, async() => {
|
||||
const snackbarMessages = await nightmare
|
||||
.waitForWatcherData(selectors.clientBillingData.watcher)
|
||||
.waitToClick(selectors.clientBillingData.saveButton)
|
||||
.waitForSnackbar();
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitForWatcherData(selectors.clientBillingData.watcher);
|
||||
await page.waitToClick(selectors.clientBillingData.saveButton);
|
||||
let snackbarMessage = await page.waitForLastSnackbar();
|
||||
|
||||
expect(snackbarMessages).toEqual(jasmine.arrayContaining(['Data saved!']));
|
||||
expect(snackbarMessage).toEqual('Notification sent!');
|
||||
});
|
||||
|
||||
it('should confirm the due day have been edited', async() => {
|
||||
const dueDate = await nightmare
|
||||
.waitToGetProperty(selectors.clientBillingData.dueDayInput, 'value');
|
||||
let dueDate = await page.waitToGetProperty(`${selectors.clientBillingData.dueDayInput} input`, 'value');
|
||||
|
||||
expect(dueDate).toEqual('60');
|
||||
});
|
||||
|
||||
it('should confirm the IBAN was saved', async() => {
|
||||
const IBAN = await nightmare
|
||||
.waitToGetProperty(selectors.clientBillingData.IBANInput, 'value');
|
||||
let IBAN = await page.waitToGetProperty(`${selectors.clientBillingData.IBANInput} input`, 'value');
|
||||
|
||||
expect(IBAN).toEqual('ES9121000418450200051332');
|
||||
});
|
||||
|
||||
it('should confirm the swift / BIC code was saved', async() => {
|
||||
const code = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
let code = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||
|
||||
expect(code).toEqual('CAIXESBB Caixa Bank');
|
||||
});
|
||||
|
||||
it('should confirm Received LCR checkbox is checked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox);
|
||||
let result = await page.checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
it('should confirm Received core VNL checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientBillingData.receivedCoreVNLCheckbox);
|
||||
let result = await page.checkboxState(selectors.clientBillingData.receivedCoreVNLCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm Received B2B VNL checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox);
|
||||
let result = await page.checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
|
|
@ -1,119 +1,112 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Add address path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.address.index');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.address.index');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should click on the add new address button to access to the new address form`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.createAddress)
|
||||
.waitForURL('address/create')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientAddresses.createAddress);
|
||||
await page.waitForURL('address/create');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('address/create');
|
||||
});
|
||||
|
||||
it('should receive an error after clicking save button as consignee, street and town fields are empty', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.defaultCheckboxInput)
|
||||
.clearInput(selectors.clientAddresses.streetAddressInput)
|
||||
.autocompleteSearch(selectors.clientAddresses.provinceAutocomplete, 'Province one')
|
||||
.clearInput(selectors.clientAddresses.cityInput)
|
||||
.write(selectors.clientAddresses.cityInput, 'Valencia')
|
||||
.clearInput(selectors.clientAddresses.postcodeInput)
|
||||
.write(selectors.clientAddresses.postcodeInput, '46000')
|
||||
.autocompleteSearch(selectors.clientAddresses.agencyAutocomplete, 'Entanglement')
|
||||
.write(selectors.clientAddresses.phoneInput, '999887744')
|
||||
.write(selectors.clientAddresses.mobileInput, '999887744')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientAddresses.defaultCheckboxInput);
|
||||
await page.autocompleteSearch(selectors.clientAddresses.provinceAutocomplete, 'Province five');
|
||||
await page.write(selectors.clientAddresses.cityInput, 'Valencia');
|
||||
await page.write(selectors.clientAddresses.postcodeInput, '46000');
|
||||
await page.autocompleteSearch(selectors.clientAddresses.agencyAutocomplete, 'Entanglement');
|
||||
await page.write(selectors.clientAddresses.phoneInput, '999887744');
|
||||
await page.write(selectors.clientAddresses.mobileInput, '999887744');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it('should confirm the postcode have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientAddresses.postcodeInput}`, 'value');
|
||||
|
||||
expect(result).toContain('46000');
|
||||
it(`should receive an error after clicking save button as consignee, incoterms and customsAgent are empty`, async() => {
|
||||
await page.write(selectors.clientAddresses.consigneeInput, 'Bruce Bunner');
|
||||
await page.write(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York');
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Incoterms is required for a non UEE member');
|
||||
});
|
||||
|
||||
it('should confirm the city have been autocompleted', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientAddresses.cityInput}`, 'value');
|
||||
it(`should receive an error after clicking save button as consignee, incoterms and customsAgent are empty`, async() => {
|
||||
await page.autocompleteSearch(selectors.clientAddresses.incotermsAutocomplete, 'Free Alongside Ship');
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Valencia');
|
||||
});
|
||||
|
||||
|
||||
it(`should confirm the province have been autocompleted`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.clientAddresses.provinceAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Province one');
|
||||
expect(result).toEqual('Customs agent is required for a non UEE member');
|
||||
});
|
||||
|
||||
it(`should create a new address with all it's data`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.clientAddresses.consigneeInput, 'Bruce Bunner')
|
||||
.write(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York')
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.clientAddresses.customsAgentAutocomplete, 'Agent one');
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should click on the addresses button confirm the new address exists and it's the default one`, async() => {
|
||||
const result = await nightmare
|
||||
// .waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
||||
it(`should click on the first address button to confirm the new address exists and it's the default one`, async() => {
|
||||
const result = await page.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
||||
|
||||
expect(result).toContain('320 Park Avenue New York');
|
||||
});
|
||||
|
||||
it(`should click on the make default icon of the second address then confirm it is the default one now`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.secondMakeDefaultStar)
|
||||
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
|
||||
.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
||||
it(`should click on the make default icon of the second address`, async() => {
|
||||
await page.waitToClick(selectors.clientAddresses.secondMakeDefaultStar);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the default address is the expected one`, async() => {
|
||||
await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand');
|
||||
const result = await page.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
||||
|
||||
expect(result).toContain('Somewhere in Thailand');
|
||||
});
|
||||
|
||||
it(`should click on the edit icon of the default address`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.waitForURL('/edit')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand');
|
||||
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||
await page.waitForURL('/edit');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/edit');
|
||||
});
|
||||
|
||||
it(`should click on the active checkbox and receive an error to save it because it is the default address`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForWatcherData(selectors.clientAddresses.watcher)
|
||||
.waitToClick(selectors.clientAddresses.activeCheckbox)
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForWatcherData(selectors.clientAddresses.watcher);
|
||||
await page.waitToClick(selectors.clientAddresses.activeCheckbox);
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('The default consignee can not be unchecked');
|
||||
});
|
||||
|
||||
// this "it" should be removed if the watcher doesn't prevent the navigation upon state changes
|
||||
it(`should go back to the addreses section by clicking the cancel button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.cancelEditAddressButton)
|
||||
.waitToClick('.vn-confirm.shown button[response="accept"]')
|
||||
.waitForURL('address/index')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientAddresses.cancelEditAddressButton);
|
||||
await page.waitToClick('.vn-confirm.shown button[response="accept"]');
|
||||
await page.waitForURL('address/index');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('address/index');
|
||||
});
|
||||
|
|
|
@ -1,54 +1,55 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client add address notes path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Petter Parker');
|
||||
await page.accessToSection('client.card.address.index');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Petter Parker')
|
||||
.accessToSection('client.card.address.index');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should click on the edit icon of the default address`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street')
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.waitForURL('/edit')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street');
|
||||
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||
await page.waitForURL('/edit');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/edit');
|
||||
});
|
||||
|
||||
it('should not save a description without observation type', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addObservationButton)
|
||||
.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientAddresses.addObservationButton);
|
||||
await page.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description');
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it('should not save an observation type without description', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientAddresses.firstObservationDescriptionInput)
|
||||
.autocompleteSearch(selectors.clientAddresses.firstObservationTypeAutocomplete, 'comercial')
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientAddresses.firstObservationDescriptionInput);
|
||||
await page.autocompleteSearch(selectors.clientAddresses.firstObservationTypeAutocomplete, 'comercial');
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it('should create two new observations', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
|
||||
.waitToClick(selectors.clientAddresses.addObservationButton)
|
||||
.autocompleteSearch(selectors.clientAddresses.secondObservationTypeAutocomplete, 'observation one')
|
||||
.write(selectors.clientAddresses.secondObservationDescriptionInput, 'second description')
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description');
|
||||
await page.waitToClick(selectors.clientAddresses.addObservationButton);
|
||||
await page.autocompleteSearch(selectors.clientAddresses.secondObservationTypeAutocomplete, 'observation one');
|
||||
await page.write(selectors.clientAddresses.secondObservationDescriptionInput, 'second description');
|
||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
|
|
@ -1,41 +1,43 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Edit web access path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.webAccess');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.webAccess');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should uncheck the Enable web access checkbox and update the name`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox)
|
||||
.clearInput(selectors.clientWebAccess.userNameInput)
|
||||
.write(selectors.clientWebAccess.userNameInput, 'Hulk')
|
||||
.waitToClick(selectors.clientWebAccess.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox);
|
||||
await page.clearInput(selectors.clientWebAccess.userNameInput);
|
||||
await page.write(selectors.clientWebAccess.userNameInput, 'Hulk');
|
||||
await page.waitToClick(selectors.clientWebAccess.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm web access is now unchecked', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientBasicData.basicDataButton)
|
||||
.wait(selectors.clientBasicData.nameInput)
|
||||
.waitToClick(selectors.clientsIndex.othersButton)
|
||||
.waitToClick(selectors.clientWebAccess.webAccessButton)
|
||||
.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox);
|
||||
await page.waitToClick(selectors.clientBasicData.basicDataButton);
|
||||
await page.wait(selectors.clientBasicData.nameInput);
|
||||
await page.waitToClick(selectors.clientsIndex.othersButton);
|
||||
await page.waitToClick(selectors.clientWebAccess.webAccessButton);
|
||||
const result = await page.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm web access name have been updated', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientWebAccess.userNameInput, 'value');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientWebAccess.userNameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Hulk');
|
||||
});
|
||||
|
|
|
@ -1,37 +1,40 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Add notes path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Bruce Banner');
|
||||
await page.accessToSection('client.card.note.index');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Bruce Banner')
|
||||
.accessToSection('client.card.note.index');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should click on the add note button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientNotes.addNoteFloatButton)
|
||||
.waitForURL('/note/create')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientNotes.addNoteFloatButton);
|
||||
await page.waitForURL('/note/create');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/note/create');
|
||||
});
|
||||
|
||||
it(`should create a note`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.clientNotes.noteInput, 'Meeting with Black Widow 21st 9am')
|
||||
.waitToClick(selectors.clientNotes.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitFor(selectors.clientNotes.noteInput);
|
||||
await page.type(`${selectors.clientNotes.noteInput} textarea`, 'Meeting with Black Widow 21st 9am');
|
||||
await page.waitToClick(selectors.clientNotes.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the note was created', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientNotes.firstNoteText, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.clientNotes.firstNoteText, 'innerText');
|
||||
|
||||
expect(result).toEqual('Meeting with Black Widow 21st 9am');
|
||||
});
|
||||
|
|
|
@ -1,38 +1,42 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Add credit path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesAssistant', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.credit.index');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesAssistant', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.credit.index');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should click on the add credit button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientCredit.addCreditFloatButton)
|
||||
.waitForURL('/credit/create')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientCredit.addCreditFloatButton);
|
||||
await page.waitForURL('/credit/create');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/credit/create');
|
||||
});
|
||||
|
||||
it(`should edit the credit`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientCredit.creditInput)
|
||||
.write(selectors.clientCredit.creditInput, 999)
|
||||
.waitToClick(selectors.clientCredit.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForContentLoaded();
|
||||
await page.clearInput(selectors.clientCredit.creditInput);
|
||||
await page.write(selectors.clientCredit.creditInput, '999');
|
||||
await page.waitToClick(selectors.clientCredit.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the credit was updated', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText');
|
||||
await page.waitForContentLoaded();
|
||||
const result = await page.waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText');
|
||||
|
||||
expect(result).toContain(999);
|
||||
expect(result).toContain('salesAssistant');
|
||||
|
|
|
@ -1,48 +1,49 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client Add greuge path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesAssistant', 'client');
|
||||
await page.accessToSearchResult('Petter Parker');
|
||||
await page.accessToSection('client.card.greuge.index');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesAssistant', 'client')
|
||||
.accessToSearchResult('Petter Parker')
|
||||
.accessToSection('client.card.greuge.index');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should click on the add greuge button`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientGreuge.addGreugeFloatButton)
|
||||
.waitForURL('greuge/create')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientGreuge.addGreugeFloatButton);
|
||||
await page.waitForURL('greuge/create');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('greuge/create');
|
||||
});
|
||||
|
||||
it(`should receive an error if all fields are empty but date and type on submit`, async() => {
|
||||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.clientGreuge.typeAutocomplete, 'Diff')
|
||||
.waitToClick(selectors.clientGreuge.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.clientGreuge.typeAutocomplete, 'Diff');
|
||||
await page.waitToClick(selectors.clientGreuge.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it(`should create a new greuge with all its data`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.clientGreuge.amountInput, 999)
|
||||
.waitForTextInInput(selectors.clientGreuge.amountInput, '999')
|
||||
.write(selectors.clientGreuge.descriptionInput, 'new armor for Batman!')
|
||||
.waitToClick(selectors.clientGreuge.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.clientGreuge.amountInput, '999');
|
||||
await page.waitForTextInInput(selectors.clientGreuge.amountInput, '999');
|
||||
await page.write(selectors.clientGreuge.descriptionInput, 'new armor for Batman!');
|
||||
await page.waitToClick(selectors.clientGreuge.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the greuge was added to the list', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText');
|
||||
|
||||
expect(result).toContain(999);
|
||||
expect(result).toContain('new armor for Batman!');
|
||||
|
|
|
@ -1,18 +1,23 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client mandate path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesPerson', 'client');
|
||||
await page.accessToSearchResult('Petter Parker');
|
||||
await page.accessToSection('client.card.mandate');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'client')
|
||||
.accessToSearchResult('Petter Parker')
|
||||
.accessToSection('client.card.mandate');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should confirm the client has a mandate of the CORE type', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.clientMandate.firstMandateText, 'innerText');
|
||||
|
||||
expect(result).toContain('1');
|
||||
|
|
|
@ -1,180 +1,167 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client lock verified data path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesPerson', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as salesPerson', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it('should confirm verified data button is disabled for salesPerson', async() => {
|
||||
const result = await nightmare
|
||||
.wait(200)
|
||||
.wait(selectors.clientFiscalData.verifiedDataCheckbox)
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
await page.wait(200);
|
||||
await page.wait(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should edit the social name', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'Captain America Civil War')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.wait(selectors.clientFiscalData.socialNameInput);
|
||||
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||
await page.write(selectors.clientFiscalData.socialNameInput, 'Captain America Civil War');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the social name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('client.card.fiscalData')
|
||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
await page.reloadSection('client.card.fiscalData');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Captain America Civil War');
|
||||
});
|
||||
});
|
||||
|
||||
describe('as administrative', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('administrative', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it('should confirm verified data button is enabled for administrative', async() => {
|
||||
const result = await nightmare
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should check the Verified data checkbox', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox)
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm Verified data checkbox is checked', async() => {
|
||||
const isChecked = await nightmare
|
||||
.reloadSection('client.card.fiscalData')
|
||||
.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
await page.reloadSection('client.card.fiscalData');
|
||||
const isChecked = await page.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(isChecked).toEqual('checked');
|
||||
});
|
||||
|
||||
it('should again edit the social name', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'Ant man and the Wasp')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.wait(selectors.clientFiscalData.socialNameInput);
|
||||
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||
await page.write(selectors.clientFiscalData.socialNameInput, 'Ant man and the Wasp');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should again confirm the social name have been edited', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('client.card.fiscalData')
|
||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
await page.reloadSection('client.card.fiscalData');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Ant man and the Wasp');
|
||||
});
|
||||
});
|
||||
|
||||
describe('as salesPerson second run', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('salesPerson', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it('should confirm verified data button is disabled once again for salesPerson', async() => {
|
||||
const isDisabled = await nightmare
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(isDisabled).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should not be able to save change throwing a verified data error', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'This wont happen')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForSnackbar();
|
||||
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||
await page.write(selectors.clientFiscalData.socialNameInput, 'This wont happen');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(jasmine.arrayContaining([`You can't make changes on a client with verified data`]));
|
||||
});
|
||||
});
|
||||
|
||||
describe('as salesAssistant', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.forceReloadSection('client.card.fiscalData')
|
||||
.loginAndModule('salesAssistant', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
beforeAll(async() => {
|
||||
await page.forceReloadSection('client.card.fiscalData');
|
||||
await page.loginAndModule('salesAssistant', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it('should confirm verified data button is enabled for salesAssistant', async() => {
|
||||
const isDisabled = await nightmare
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(isDisabled).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should now edit the social name', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'new social name edition')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||
await page.write(selectors.clientFiscalData.socialNameInput, 'new social name edition');
|
||||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should now confirm the social name have been edited once and for all', async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('client.card.fiscalData')
|
||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
await page.reloadSection('client.card.fiscalData');
|
||||
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('new social name edition');
|
||||
});
|
||||
});
|
||||
|
||||
describe('as salesPerson third run', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'client')
|
||||
.accessToSearchResult('Hank Pym')
|
||||
.accessToSection('client.card.fiscalData');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('salesPerson', 'client');
|
||||
await page.accessToSearchResult('Hank Pym');
|
||||
await page.accessToSection('client.card.fiscalData');
|
||||
});
|
||||
|
||||
it('should confirm verified data button is enabled once again', async() => {
|
||||
const isDisabled = await nightmare
|
||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
const isDisabled = await page;
|
||||
await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(isDisabled).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should confirm the form is enabled for salesPerson', async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, 'vn-textfield[ng-model="$ctrl.client.socialName"] > div');
|
||||
await page.wait(selectors.clientFiscalData.socialNameInput);
|
||||
const result = await page.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, 'vn-textfield[ng-model="$ctrl.client.socialName"] > div');
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
|
|
@ -1,48 +1,51 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client log path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('DavidCharlesHaller');
|
||||
await page.accessToSection('client.card.basicData');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('DavidCharlesHaller')
|
||||
.accessToSection('client.card.basicData');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should update the clients name', async() => {
|
||||
let result = await nightmare
|
||||
.clearInput(selectors.clientBasicData.nameInput)
|
||||
.write(selectors.clientBasicData.nameInput, 'this is a test')
|
||||
.waitToClick(selectors.clientBasicData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.clientBasicData.nameInput);
|
||||
await page.write(selectors.clientBasicData.nameInput, 'this is a test');
|
||||
await page.waitToClick(selectors.clientBasicData.saveButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should navigate to the log section', async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.clientLog.logButton)
|
||||
.waitForURL('log')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.clientLog.logButton);
|
||||
await page.waitForURL('log');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('log');
|
||||
});
|
||||
|
||||
it('should check the previous value of the last logged change', async() => {
|
||||
let lastModificationPreviousValue = await nightmare
|
||||
let lastModificationPreviousValue = await page
|
||||
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
|
||||
|
||||
expect(lastModificationPreviousValue).toContain('DavidCharlesHaller');
|
||||
});
|
||||
|
||||
it('should check the current value of the last logged change', async() => {
|
||||
let lastModificationPreviousValue = await nightmare
|
||||
let lastModificationPreviousValue = await page
|
||||
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
|
||||
|
||||
let lastModificationCurrentValue = await nightmare
|
||||
.waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
|
||||
let lastModificationCurrentValue = await page.
|
||||
waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
|
||||
|
||||
|
||||
expect(lastModificationPreviousValue).toEqual('name: DavidCharlesHaller');
|
||||
|
|
|
@ -1,66 +1,71 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client balance path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('administrative', 'client');
|
||||
await page.accessToSearchResult('Petter Parker');
|
||||
}, 30000);
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'client')
|
||||
.accessToSearchResult('Petter Parker');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should now edit the local user config data', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs')
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs');
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should access to the balance section to check the data shown matches the local settings', async() => {
|
||||
let result = await nightmare
|
||||
.accessToSection('client.card.balance.index')
|
||||
.waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value');
|
||||
await page.accessToSection('client.card.balance.index');
|
||||
let result = await page.waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('CCs');
|
||||
});
|
||||
|
||||
it('should now clear the user local settings', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
.waitToClick(selectors.globalItems.userConfigThirdAutocompleteClear)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should click the new payment button', async() => {
|
||||
let url = await nightmare
|
||||
.reloadSection('client.card.balance.index')
|
||||
.waitToClick(selectors.clientBalance.newPaymentButton)
|
||||
.waitForURL('/balance')
|
||||
.parsedUrl();
|
||||
await page.keyboard.press('Escape');
|
||||
await page.reloadSection('client.card.balance.index');
|
||||
await page.waitForURL('/balance');
|
||||
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/balance');
|
||||
});
|
||||
|
||||
it('should create a new payment that clears the debt', async() => {
|
||||
let result = await nightmare
|
||||
.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt')
|
||||
.waitToClick(selectors.clientBalance.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await Promise.all([
|
||||
page.waitToClick(selectors.clientBalance.newPaymentButton),
|
||||
page.waitForSelector('.vn-dialog.vn-popup.shown', {visible: true})
|
||||
]);
|
||||
await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt');
|
||||
await page.waitToClick(selectors.clientBalance.saveButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should check balance is now 0 and the company is now VNL becouse the user local settings were removed', async() => {
|
||||
let company = await nightmare
|
||||
.waitForSpinnerLoad()
|
||||
await page.waitForSpinnerLoad();
|
||||
let company = await page
|
||||
.waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value');
|
||||
|
||||
let firstBalanceLine = await nightmare
|
||||
let firstBalanceLine = await page
|
||||
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
||||
|
||||
|
||||
|
@ -68,95 +73,75 @@ describe('Client balance path', () => {
|
|||
expect(firstBalanceLine).toContain('0.00');
|
||||
});
|
||||
|
||||
it('should now click the new payment button', async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.clientBalance.newPaymentButton)
|
||||
.waitForURL('/balance')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/balance');
|
||||
});
|
||||
|
||||
it('should create a new payment that sets the balance to positive value', async() => {
|
||||
let result = await nightmare
|
||||
.clearInput(selectors.clientBalance.newPaymentAmountInput)
|
||||
.write(selectors.clientBalance.newPaymentAmountInput, '100')
|
||||
.waitToClick(selectors.clientBalance.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientBalance.newPaymentButton);
|
||||
await page.waitFor(3000); // didn't manage to make this dynamic to allow clearInput to find the icon clear... :(
|
||||
await page.clearInput(selectors.clientBalance.newPaymentAmountInput);
|
||||
await page.write(selectors.clientBalance.newPaymentAmountInput, '100');
|
||||
await page.waitToClick(selectors.clientBalance.saveButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should check balance is now -100', async() => {
|
||||
let result = await nightmare
|
||||
let result = await page
|
||||
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
||||
|
||||
expect(result).toContain('-€100.00');
|
||||
});
|
||||
|
||||
it('should again click the new payment button', async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.clientBalance.newPaymentButton)
|
||||
.waitForURL('/balance')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/balance');
|
||||
});
|
||||
|
||||
it('should create a new payment that sets the balance back to the original negative value', async() => {
|
||||
let result = await nightmare
|
||||
.clearInput(selectors.clientBalance.newPaymentAmountInput)
|
||||
.write(selectors.clientBalance.newPaymentAmountInput, '-150')
|
||||
.waitToClick(selectors.clientBalance.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.clientBalance.newPaymentButton);
|
||||
await page.waitFor(3000); // didn't manage to make this dynamic to allow clearInput to find the icon clear... :(
|
||||
await page.waitForSelector('.vn-dialog.vn-popup.shown', {visible: true});
|
||||
await page.clearInput(selectors.clientBalance.newPaymentAmountInput);
|
||||
await page.write(selectors.clientBalance.newPaymentAmountInput, '-150');
|
||||
await page.waitToClick(selectors.clientBalance.saveButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should check balance is now 50', async() => {
|
||||
let result = await nightmare
|
||||
let result = await page
|
||||
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
||||
|
||||
expect(result).toEqual('€50.00');
|
||||
});
|
||||
|
||||
it('should now click on the Clients button of the top bar menu', async() => {
|
||||
let url = await nightmare
|
||||
.waitForLogin('employee')
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.clientsButton)
|
||||
.wait(selectors.clientsIndex.createClientButton)
|
||||
.parsedUrl();
|
||||
await page.login('employee');
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await page.waitToClick(selectors.globalItems.clientsButton);
|
||||
await page.wait(selectors.clientsIndex.createClientButton);
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/client/index');
|
||||
});
|
||||
|
||||
it('should now search for the user Petter Parker', async() => {
|
||||
let resultCount = await nightmare
|
||||
.write(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
||||
.waitToClick(selectors.clientsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
||||
.countElement(selectors.clientsIndex.searchResult);
|
||||
await page.write(selectors.clientsIndex.searchClientInput, 'Petter Parker');
|
||||
await page.waitToClick(selectors.clientsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1);
|
||||
let resultCount = await page.countElement(selectors.clientsIndex.searchResult);
|
||||
|
||||
expect(resultCount).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the client's balance`, async() => {
|
||||
let url = await nightmare
|
||||
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
||||
.waitToClick(selectors.clientsIndex.searchResult)
|
||||
.waitToClick(selectors.clientBalance.balanceButton)
|
||||
.waitForURL('/balance')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker');
|
||||
await page.waitToClick(selectors.clientsIndex.searchResult);
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.clientBalance.balanceButton);
|
||||
await page.waitForURL('/balance');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/balance');
|
||||
});
|
||||
|
||||
it('should not be able to click the new payment button as it isnt present', async() => {
|
||||
let result = await nightmare
|
||||
.exists(selectors.clientBalance.newPaymentButton);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
await page.waitFor(selectors.clientBalance.newPaymentButton, {hidden: true});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,30 +1,40 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('User config', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as salesPerson', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.waitForLogin('salesPerson');
|
||||
it('should login', async() => {
|
||||
await page.login('salesPerson');
|
||||
});
|
||||
|
||||
it('should now open the user config form to check the settings', async() => {
|
||||
let userLocalWarehouse = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
|
||||
let userLocalWarehouse = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
||||
|
||||
let userLocalBank = await nightmare
|
||||
|
||||
let userLocalBank = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalBank} input`, 'value');
|
||||
|
||||
let userLocalCompany = await nightmare
|
||||
let userLocalCompany = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalCompany} input`, 'value');
|
||||
|
||||
let userWarehouse = await nightmare
|
||||
let userWarehouse = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value');
|
||||
|
||||
let userCompany = await nightmare
|
||||
let userCompany = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value');
|
||||
|
||||
expect(userLocalWarehouse).toEqual('');
|
||||
|
@ -36,26 +46,25 @@ describe('User config', () => {
|
|||
});
|
||||
|
||||
describe('as employee', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.waitForLogin('employee');
|
||||
it('should log in', async() => {
|
||||
await page.login('employee');
|
||||
});
|
||||
|
||||
it('should open the user config form to check the settings', async() => {
|
||||
let userLocalWarehouse = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
let userLocalWarehouse = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
||||
|
||||
let userLocalBank = await nightmare
|
||||
let userLocalBank = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalBank} input`, 'value');
|
||||
|
||||
let userLocalCompany = await nightmare
|
||||
let userLocalCompany = await page
|
||||
.getProperty(`${selectors.globalItems.userLocalCompany} input`, 'value');
|
||||
|
||||
let userWarehouse = await nightmare
|
||||
let userWarehouse = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value');
|
||||
|
||||
let userCompany = await nightmare
|
||||
let userCompany = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value');
|
||||
|
||||
expect(userLocalWarehouse).toEqual('');
|
||||
|
@ -66,37 +75,35 @@ describe('User config', () => {
|
|||
});
|
||||
|
||||
it('should now edit the user config data', async() => {
|
||||
let result = await nightmare
|
||||
.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four')
|
||||
.autocompleteSearch(selectors.globalItems.userLocalBank, 'Pay on receipt')
|
||||
.autocompleteSearch(selectors.globalItems.userLocalCompany, 'VNL')
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four');
|
||||
await page.autocompleteSearch(selectors.globalItems.userLocalBank, 'Pay on receipt');
|
||||
await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'VNL');
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
});
|
||||
|
||||
describe('as salesPerson 2nd run', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.waitForLogin('salesPerson');
|
||||
it('should log in once more', async() => {
|
||||
await page.login('salesPerson');
|
||||
});
|
||||
|
||||
it('should again open the user config form to check the local settings', async() => {
|
||||
let userLocalWarehouse = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
let userLocalWarehouse = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
||||
|
||||
let userLocalBank = await nightmare
|
||||
let userLocalBank = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userLocalBank} input`, 'value');
|
||||
|
||||
let userLocalCompany = await nightmare
|
||||
let userLocalCompany = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userLocalCompany} input`, 'value');
|
||||
|
||||
let userWarehouse = await nightmare
|
||||
let userWarehouse = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value');
|
||||
|
||||
let userCompany = await nightmare
|
||||
let userCompany = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value');
|
||||
|
||||
expect(userLocalWarehouse).toContain('Warehouse Four');
|
||||
|
@ -107,12 +114,10 @@ describe('User config', () => {
|
|||
});
|
||||
|
||||
it('should now clear the local settings', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
.waitToClick(selectors.globalItems.userConfigFirstAutocompleteClear)
|
||||
.waitToClick(selectors.globalItems.userConfigSecondAutocompleteClear)
|
||||
.waitToClick(selectors.globalItems.userConfigThirdAutocompleteClear)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete);
|
||||
await page.clearInput(selectors.globalItems.userConfigSecondAutocomplete);
|
||||
await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
|
|
@ -1,40 +1,37 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client web Payment', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'client');
|
||||
await page.accessToSearchResult('Tony Stark');
|
||||
await page.accessToSection('client.card.webPayment');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as employee', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'client')
|
||||
.accessToSearchResult('Tony Stark')
|
||||
.accessToSection('client.card.webPayment');
|
||||
});
|
||||
|
||||
it('should not be able to confirm payments', async() => {
|
||||
let exists = await nightmare
|
||||
.exists(selectors.webPayment.confirmFirstPaymentButton);
|
||||
|
||||
expect(exists).toBeFalsy();
|
||||
await page.waitFor(selectors.webPayment.confirmFirstPaymentButton, {hidden: true});
|
||||
});
|
||||
});
|
||||
|
||||
describe('as administrative', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'client')
|
||||
.accessToSearchResult('Tony Stark')
|
||||
.accessToSection('client.card.webPayment');
|
||||
beforeAll(async() => {
|
||||
await page.loginAndModule('administrative', 'client');
|
||||
await page.accessToSearchResult('Tony Stark');
|
||||
await page.accessToSection('client.card.webPayment');
|
||||
});
|
||||
|
||||
it('should be able to confirm payments', async() => {
|
||||
let exists = await nightmare
|
||||
.waitToClick(selectors.webPayment.confirmFirstPaymentButton)
|
||||
.wait(selectors.webPayment.firstPaymentConfirmed)
|
||||
.exists(selectors.webPayment.firstPaymentConfirmed);
|
||||
|
||||
expect(exists).toBeTruthy();
|
||||
await page.waitToClick(selectors.webPayment.confirmFirstPaymentButton);
|
||||
await page.waitFor(selectors.webPayment.firstPaymentConfirmed, {hidden: true});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,31 +1,34 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Client DMS', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesPerson', 'client');
|
||||
await page.accessToSearchResult('Tony Stark');
|
||||
await page.accessToSection('client.card.dms.index');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as salesPerson', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'client')
|
||||
.accessToSearchResult('Tony Stark')
|
||||
.accessToSection('client.card.dms.index');
|
||||
});
|
||||
|
||||
it('should delete de first file', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.dms.deleteFileButton)
|
||||
.waitToClick(selectors.dms.acceptDeleteButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.dms.deleteFileButton);
|
||||
await page.waitToClick(selectors.dms.acceptDeleteButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should click on the first document line worker name making the descriptor visible`, async() => {
|
||||
const visible = await nightmare
|
||||
.waitToClick(selectors.dms.firstDocWorker)
|
||||
.wait(selectors.dms.firstDocWorkerDescriptor)
|
||||
.isVisible(selectors.dms.firstDocWorkerDescriptor);
|
||||
await page.waitToClick(selectors.dms.firstDocWorker);
|
||||
await page.wait(selectors.dms.firstDocWorkerDescriptor);
|
||||
const visible = await page.isVisible(selectors.dms.firstDocWorkerDescriptor);
|
||||
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
|
|
|
@ -1,32 +1,35 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Worker pbx path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('hr', 'worker');
|
||||
await page.accessToSearchResult('employee');
|
||||
await page.accessToSection('worker.card.pbx');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('hr', 'worker')
|
||||
.accessToSearchResult('employee')
|
||||
.accessToSection('worker.card.pbx');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should receive an error when the extension exceeds 4 characters', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.workerPbx.extensionInput, 55555)
|
||||
|
||||
.waitToClick(selectors.workerPbx.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForContentLoaded();
|
||||
await page.write(selectors.workerPbx.extensionInput, '55555');
|
||||
await page.waitToClick(selectors.workerPbx.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Extension format is invalid');
|
||||
});
|
||||
|
||||
it('should sucessfully save the changes', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.workerPbx.extensionInput)
|
||||
.write(selectors.workerPbx.extensionInput, 4444)
|
||||
.waitToClick(selectors.workerPbx.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.workerPbx.extensionInput);
|
||||
await page.write(selectors.workerPbx.extensionInput, '4444');
|
||||
await page.waitToClick(selectors.workerPbx.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved! User must access web');
|
||||
});
|
||||
|
|
|
@ -1,95 +1,102 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Worker time control path', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('hr', 'worker')
|
||||
.accessToSearchResult('HankPym')
|
||||
.accessToSection('worker.card.timeControl');
|
||||
// #2047 WorkerTimeControl no suma horas
|
||||
xdescribe('Worker time control path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesBoss', 'worker');
|
||||
await page.accessToSearchResult('HankPym');
|
||||
await page.accessToSection('worker.card.timeControl');
|
||||
});
|
||||
|
||||
describe('as HHRR', () => {
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as salesBoss', () => {
|
||||
describe('on Monday', () => {
|
||||
it('should scan in Hank Pym', async() => {
|
||||
const scanTime = '07:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should scan out Hank Pym for break`, async() => {
|
||||
const scanTime = '10:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should scan in Hank Pym for a wrong hour and forget to scan in from the break`, async() => {
|
||||
const scanTime = '18:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should delete the wrong entry for Hank Pym`, async() => {
|
||||
const wrongScanTime = '18:00';
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime)
|
||||
.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete)
|
||||
.waitToClick(selectors.workerTimeControl.acceptDeleteDialog)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete);
|
||||
await page.waitToClick(selectors.workerTimeControl.acceptDeleteDialog);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Entry removed');
|
||||
});
|
||||
|
||||
it(`should scan out Hank Pym to leave early`, async() => {
|
||||
const scanTime = '14:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should add the break's scan in for Hank Pym and be in the right order`, async() => {
|
||||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText');
|
||||
|
||||
expect(result).toEqual('14:00');
|
||||
});
|
||||
|
||||
it(`should the third entry be the scan in from break`, async() => {
|
||||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 hours`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '07:00 h.')
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '07:00 h.');
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.workerTimeControl.mondayWorkedHours, 'innerText');
|
||||
|
||||
expect(result).toEqual('07:00 h.');
|
||||
|
@ -99,52 +106,51 @@ describe('Worker time control path', () => {
|
|||
describe('on Tuesday', () => {
|
||||
it('should happily scan in Hank Pym', async() => {
|
||||
const scanTime = '08:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should happily scan out Hank Pym for break`, async() => {
|
||||
const scanTime = '10:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should happily scan in Hank Pym from the break`, async() => {
|
||||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should happily scan out Hank Pym for the day`, async() => {
|
||||
const scanTime = '16:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 happy hours`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '08:00 h.')
|
||||
.waitToGetProperty(selectors.workerTimeControl.tuesdayWorkedHours, 'innerText');
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '08:00 h.');
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.tuesdayWorkedHours, 'innerText');
|
||||
|
||||
expect(result).toEqual('08:00 h.');
|
||||
});
|
||||
|
@ -153,52 +159,51 @@ describe('Worker time control path', () => {
|
|||
describe('on Wednesday', () => {
|
||||
it('should cheerfully scan in Hank Pym', async() => {
|
||||
const scanTime = '09:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should cheerfully scan out Hank Pym for break`, async() => {
|
||||
const scanTime = '10:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should cheerfully scan in Hank Pym from the break`, async() => {
|
||||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should cheerfully scan out Hank Pym for the day`, async() => {
|
||||
const scanTime = '17:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 cheerfull hours`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '08:00 h.')
|
||||
.waitToGetProperty(selectors.workerTimeControl.wednesdayWorkedHours, 'innerText');
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '08:00 h.');
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.wednesdayWorkedHours, 'innerText');
|
||||
|
||||
expect(result).toEqual('08:00 h.');
|
||||
});
|
||||
|
@ -207,52 +212,48 @@ describe('Worker time control path', () => {
|
|||
describe('on Thursday', () => {
|
||||
it('should joyfully scan in Hank Pym', async() => {
|
||||
const scanTime = '09:59';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText');
|
||||
|
||||
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should joyfully scan out Hank Pym for break`, async() => {
|
||||
const scanTime = '10:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should joyfully scan in Hank Pym from the break`, async() => {
|
||||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should joyfully scan out Hank Pym for the day`, async() => {
|
||||
const scanTime = '17:59';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 joyfull hours`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '08:00 h.')
|
||||
.waitToGetProperty(selectors.workerTimeControl.thursdayWorkedHours, 'innerText');
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '08:00 h.');
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thursdayWorkedHours, 'innerText');
|
||||
|
||||
expect(result).toEqual('08:00 h.');
|
||||
});
|
||||
|
@ -261,93 +262,88 @@ describe('Worker time control path', () => {
|
|||
describe('on Friday', () => {
|
||||
it('should smilingly scan in Hank Pym', async() => {
|
||||
const scanTime = '07:30';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should smilingly scan out Hank Pym for break`, async() => {
|
||||
const scanTime = '10:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should smilingly scan in Hank Pym from the break`, async() => {
|
||||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should smilingly scan out Hank Pym for the day`, async() => {
|
||||
const scanTime = '15:30';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 hours with a smile on his face`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '08:00 h.')
|
||||
.waitToGetProperty(selectors.workerTimeControl.fridayWorkedHours, 'innerText');
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '08:00 h.');
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fridayWorkedHours, 'innerText');
|
||||
|
||||
expect(result).toEqual('08:00 h.');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('as hr', () => {
|
||||
describe('as HHRR', () => {
|
||||
describe('on Saturday', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('hr', 'worker')
|
||||
.accessToSearchResult('HankPym')
|
||||
.accessToSection('worker.card.timeControl');
|
||||
it('should log in and navigate to timeControl', async() => {
|
||||
await page.loginAndModule('hr', 'worker');
|
||||
await page.accessToSearchResult('HankPym');
|
||||
await Promise.all([
|
||||
page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}),
|
||||
page.waitForContentLoaded(),
|
||||
page.accessToSection('worker.card.timeControl')
|
||||
]);
|
||||
});
|
||||
|
||||
it('should lovingly scan in Hank Pym', async() => {
|
||||
const scanTime = '06:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should lovingly scan out Hank Pym for the day with no break to leave a bit early`, async() => {
|
||||
const scanTime = '13:40';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 hours with all his will`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '08:00 h.')
|
||||
.waitToGetProperty(selectors.workerTimeControl.saturdayWorkedHours, 'innerText');
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '08:00 h.');
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.saturdayWorkedHours, 'innerText');
|
||||
|
||||
expect(result).toEqual('08:00 h.');
|
||||
});
|
||||
|
@ -356,49 +352,48 @@ describe('Worker time control path', () => {
|
|||
describe('on Sunday', () => {
|
||||
it('should gladly scan in Hank Pym', async() => {
|
||||
const scanTime = '05:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.sundayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should gladly scan out Hank Pym for the day with no break to leave a bit early`, async() => {
|
||||
const scanTime = '12:40';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.sundayAddTimeButton)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText');
|
||||
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText');
|
||||
|
||||
expect(result).toEqual(scanTime);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8 glad hours`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '08:00 h.')
|
||||
.waitToGetProperty(selectors.workerTimeControl.sundayWorkedHours, 'innerText');
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '08:00 h.');
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.sundayWorkedHours, 'innerText');
|
||||
|
||||
expect(result).toEqual('08:00 h.');
|
||||
});
|
||||
|
||||
it(`should check Hank Pym doesn't have hours set on the next months first week`, async() => {
|
||||
const wholeWeekHours = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.nextMonthButton)
|
||||
.waitToClick(selectors.workerTimeControl.secondWeekDay)
|
||||
.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.')
|
||||
await page.waitToClick(selectors.workerTimeControl.nextMonthButton);
|
||||
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.');
|
||||
const wholeWeekHours = await page
|
||||
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
||||
|
||||
expect(wholeWeekHours).toEqual('00:00 h.');
|
||||
});
|
||||
|
||||
it(`should check he didn't scan in this week yet`, async() => {
|
||||
const wholeWeekHours = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.navigateBackToIndex)
|
||||
.accessToSearchResult('salesBoss')
|
||||
.accessToSection('worker.card.timeControl')
|
||||
await page.waitToClick(selectors.workerTimeControl.navigateBackToIndex);
|
||||
await page.accessToSearchResult('salesBoss');
|
||||
await page.accessToSection('worker.card.timeControl');
|
||||
await page.waitFor(1000);
|
||||
|
||||
const wholeWeekHours = await page
|
||||
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
||||
|
||||
expect(wholeWeekHours).toEqual('00:00 h.');
|
||||
|
@ -407,17 +402,15 @@ describe('Worker time control path', () => {
|
|||
});
|
||||
|
||||
describe('after all this amazing week', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('HankPym', 'worker')
|
||||
.accessToSearchResult('HankPym')
|
||||
.accessToSection('worker.card.timeControl');
|
||||
it('should log in Hank', async() => {
|
||||
await page.loginAndModule('HankPym', 'worker');
|
||||
await page.accessToSearchResult('HankPym');
|
||||
await page.accessToSection('worker.card.timeControl');
|
||||
});
|
||||
|
||||
it('should Hank Pym check his hours are alright', async() => {
|
||||
const wholeWeekHours = await nightmare
|
||||
.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '55:00 h.')
|
||||
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
||||
it('should check his hours are alright', async() => {
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '55:00 h.');
|
||||
const wholeWeekHours = await page.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
||||
|
||||
expect(wholeWeekHours).toEqual('55:00 h.');
|
||||
});
|
||||
|
|
|
@ -1,202 +1,175 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item summary path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'item');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'item');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should search for an item', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon longbow 2m')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||
await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon longbow 2m');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result summary button to open the item summary popup`, async() => {
|
||||
const isVisible = await nightmare
|
||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon longbow 2m')
|
||||
.waitToClick(selectors.itemsIndex.searchResultPreviewButton)
|
||||
.isVisible(selectors.itemSummary.basicData);
|
||||
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon longbow 2m');
|
||||
await page.waitToClick(selectors.itemsIndex.searchResultPreviewButton);
|
||||
const isVisible = await page.isVisible(selectors.itemSummary.basicData);
|
||||
|
||||
expect(isVisible).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should check the item summary preview shows fields from basic data`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.basicData, 'Ranged weapon longbow 2m')
|
||||
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.basicData, 'Ranged weapon longbow 2m');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
||||
|
||||
expect(result).toContain('Ranged weapon longbow 2m');
|
||||
});
|
||||
|
||||
it(`should check the item summary preview shows fields from tags`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.tags, 'Brown')
|
||||
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.tags, 'Brown');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
||||
|
||||
expect(result).toContain('Brown');
|
||||
});
|
||||
|
||||
it(`should check the item summary preview shows fields from niche`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.niche, 'A1')
|
||||
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.niche, 'A1');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
||||
|
||||
expect(result).toContain('A1');
|
||||
});
|
||||
|
||||
it(`should check the item summary preview shows fields from botanical`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.botanical, 'Hedera helix')
|
||||
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.botanical, 'Hedera helix');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
||||
|
||||
expect(result).toContain('Hedera helix');
|
||||
});
|
||||
|
||||
it(`should check the item summary preview shows fields from barcode`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.barcode, '1')
|
||||
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.barcode, '1');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
||||
|
||||
expect(result).toContain('1');
|
||||
});
|
||||
|
||||
it(`should close the summary popup`, async() => {
|
||||
const result = await nightmare
|
||||
.mousedown(selectors.itemsIndex.closeItemSummaryPreview)
|
||||
.waitUntilNotPresent(selectors.itemSummary.basicData)
|
||||
.visible(selectors.itemSummary.basicData);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
await page.keyboard.press('Escape');
|
||||
await page.waitUntilNotPresent(selectors.itemSummary.basicData);
|
||||
await page.waitFor(selectors.itemSummary.basicData, {hidden: true});
|
||||
});
|
||||
|
||||
it('should search for other item', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput('vn-searchbar input')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Melee weapon combat fist 15cm')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
await page.clearInput('vn-searchbar');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.write(selectors.itemsIndex.searchItemInput, 'Melee weapon combat fist 15cm');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should now click on the search result summary button to open the item summary popup`, async() => {
|
||||
const isVisible = await nightmare
|
||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Melee weapon combat fist 15cm')
|
||||
.waitToClick(selectors.itemsIndex.searchResultPreviewButton)
|
||||
.isVisible(selectors.itemSummary.basicData);
|
||||
|
||||
|
||||
expect(isVisible).toBeTruthy();
|
||||
await page.waitToClick(selectors.itemsIndex.searchResultPreviewButton);
|
||||
await page.waitForSelector(selectors.itemSummary.basicData, {visible: true});
|
||||
});
|
||||
|
||||
it(`should now check the item summary preview shows fields from basic data`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm')
|
||||
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
||||
|
||||
expect(result).toContain('Melee weapon combat fist 15cm');
|
||||
});
|
||||
|
||||
it(`should now check the item summary preview shows fields from tags`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.tags, 'Silver')
|
||||
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.tags, 'Silver');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
||||
|
||||
expect(result).toContain('Silver');
|
||||
});
|
||||
|
||||
it(`should now check the item summary preview shows fields from niche`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.niche, 'A4')
|
||||
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.niche, 'A4');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
||||
|
||||
expect(result).toContain('A4');
|
||||
});
|
||||
|
||||
it(`should now check the item summary preview shows fields from botanical`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.botanical, '-')
|
||||
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.botanical, '-');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
||||
|
||||
expect(result).toContain('-');
|
||||
});
|
||||
|
||||
it(`should now check the item summary preview shows fields from barcode`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.barcode, '4')
|
||||
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.barcode, '4');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
||||
|
||||
expect(result).toContain('4');
|
||||
});
|
||||
|
||||
it(`should now close the summary popup`, async() => {
|
||||
const result = await nightmare
|
||||
.mousedown(selectors.itemsIndex.closeItemSummaryPreview)
|
||||
.waitUntilNotPresent(selectors.itemSummary.basicData)
|
||||
.visible(selectors.itemSummary.basicData);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
await page.keyboard.press('Escape');
|
||||
await page.waitForSelector(selectors.itemSummary.basicData, {hidden: true});
|
||||
});
|
||||
|
||||
it(`should navigate to the one of the items detailed section`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.searchResult)
|
||||
.waitForURL('summary')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.itemsIndex.searchResult);
|
||||
await page.waitForURL('summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('summary');
|
||||
});
|
||||
|
||||
it(`should check the descritor edit button is not visible for employee`, async() => {
|
||||
const visibleButton = await nightmare
|
||||
.isVisible(selectors.itemDescriptor.editButton);
|
||||
const visibleButton = await page.isVisible(selectors.itemDescriptor.editButton);
|
||||
|
||||
expect(visibleButton).toBeFalsy();
|
||||
});
|
||||
|
||||
it(`should check the item summary shows fields from basic data section`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm')
|
||||
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
||||
await page.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
||||
|
||||
expect(result).toContain('Melee weapon combat fist 15cm');
|
||||
});
|
||||
|
||||
it(`should check the item summary shows fields from tags section`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
||||
|
||||
expect(result).toContain('Silver');
|
||||
});
|
||||
|
||||
it(`should check the item summary shows fields from niches section`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
||||
|
||||
expect(result).toContain('One A4');
|
||||
});
|
||||
|
||||
it(`should check the item summary shows fields from botanical section`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
||||
|
||||
expect(result).toContain('-');
|
||||
});
|
||||
|
||||
it(`should check the item summary shows fields from barcodes section`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
||||
|
||||
expect(result).toContain('4');
|
||||
});
|
||||
|
|
|
@ -1,102 +1,103 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item Edit basic data path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
await page.accessToSearchResult('Melee weapon combat fist 15cm');
|
||||
await page.accessToSection('item.card.basicData');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item')
|
||||
.accessToSearchResult('Melee weapon combat fist 15cm')
|
||||
.accessToSection('item.card.basicData');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should check the descritor edit button is visible for buyer`, async() => {
|
||||
const visibleButton = await nightmare
|
||||
.isVisible(selectors.itemDescriptor.editButton);
|
||||
|
||||
expect(visibleButton).toBeTruthy();
|
||||
await page.waitForSelector(selectors.itemDescriptor.editButton, {visible: true});
|
||||
});
|
||||
|
||||
it(`should edit the item basic data`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.itemBasicData.nameInput)
|
||||
.write(selectors.itemBasicData.nameInput, 'Rose of Purity')
|
||||
.autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Anthurium')
|
||||
.autocompleteSearch(selectors.itemBasicData.intrastatAutocomplete, 'Coral y materiales similares')
|
||||
.clearInput(selectors.itemBasicData.relevancyInput)
|
||||
.write(selectors.itemBasicData.relevancyInput, '1')
|
||||
.autocompleteSearch(selectors.itemBasicData.originAutocomplete, 'Spain')
|
||||
.autocompleteSearch(selectors.itemBasicData.expenseAutocomplete, 'Alquiler VNH')
|
||||
.clearInput(selectors.itemBasicData.longNameInput)
|
||||
.write(selectors.itemBasicData.longNameInput, 'RS Rose of Purity')
|
||||
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
|
||||
.waitToClick(selectors.itemBasicData.priceInKgCheckbox)
|
||||
.waitToClick(selectors.itemBasicData.submitBasicDataButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.itemBasicData.nameInput);
|
||||
await page.write(selectors.itemBasicData.nameInput, 'Rose of Purity');
|
||||
await page.autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Anthurium');
|
||||
await page.autocompleteSearch(selectors.itemBasicData.intrastatAutocomplete, 'Coral y materiales similares');
|
||||
await page.clearInput(selectors.itemBasicData.relevancyInput);
|
||||
await page.write(selectors.itemBasicData.relevancyInput, '1');
|
||||
await page.autocompleteSearch(selectors.itemBasicData.originAutocomplete, 'Spain');
|
||||
await page.autocompleteSearch(selectors.itemBasicData.expenseAutocomplete, 'Alquiler VNH');
|
||||
await page.clearInput(selectors.itemBasicData.longNameInput);
|
||||
await page.write(selectors.itemBasicData.longNameInput, 'RS Rose of Purity');
|
||||
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
|
||||
await page.waitToClick(selectors.itemBasicData.priceInKgCheckbox);
|
||||
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
}, 15000);
|
||||
}, 20000);
|
||||
|
||||
it(`should confirm the item name was edited`, async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('item.card.basicData')
|
||||
.waitToGetProperty(selectors.itemBasicData.nameInput, 'value');
|
||||
await page.reloadSection('item.card.basicData');
|
||||
await page.waitForContentLoaded();
|
||||
const result = await page.waitToGetProperty(`${selectors.itemBasicData.nameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Rose of Purity');
|
||||
});
|
||||
|
||||
it(`should confirm the item type was edited`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Anthurium');
|
||||
});
|
||||
|
||||
it(`should confirm the item intrastad was edited`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('5080000 Coral y materiales similares');
|
||||
});
|
||||
|
||||
it(`should confirm the item relevancy was edited`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.itemBasicData.relevancyInput, 'value');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.relevancyInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('1');
|
||||
});
|
||||
|
||||
it(`should confirm the item origin was edited`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Spain');
|
||||
});
|
||||
|
||||
it(`should confirm the item expence was edited`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.expenseAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Alquiler VNH');
|
||||
});
|
||||
|
||||
it(`should confirm the item long name was edited`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.itemBasicData.longNameInput, 'value');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.longNameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('RS Rose of Purity');
|
||||
});
|
||||
|
||||
it('should confirm isActive checkbox is unchecked', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.checkboxState(selectors.itemBasicData.isActiveCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm the priceInKg checkbox is checked', async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.checkboxState(selectors.itemBasicData.priceInKgCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
|
|
|
@ -1,61 +1,62 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item edit tax path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
await page.accessToSearchResult('Ranged weapon longbow 2m');
|
||||
await page.accessToSection('item.card.tax');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item')
|
||||
.accessToSearchResult('Ranged weapon longbow 2m')
|
||||
.accessToSection('item.card.tax');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should add the item tax to all countries`, async() => {
|
||||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'General VAT')
|
||||
.autocompleteSearch(selectors.itemTax.secondClassAutocomplete, 'General VAT')
|
||||
.autocompleteSearch(selectors.itemTax.thirdClassAutocomplete, 'General VAT')
|
||||
.waitToClick(selectors.itemTax.submitTaxButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'General VAT');
|
||||
await page.autocompleteSearch(selectors.itemTax.secondClassAutocomplete, 'General VAT');
|
||||
await page.autocompleteSearch(selectors.itemTax.thirdClassAutocomplete, 'General VAT');
|
||||
await page.waitToClick(selectors.itemTax.submitTaxButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the first item tax class was edited`, async() => {
|
||||
const firstVatType = await nightmare
|
||||
.reloadSection('item.card.tax')
|
||||
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
||||
await page.reloadSection('item.card.tax');
|
||||
const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
||||
|
||||
expect(firstVatType).toEqual('General VAT');
|
||||
});
|
||||
|
||||
it(`should confirm the second item tax class was edited`, async() => {
|
||||
const secondVatType = await nightmare
|
||||
const secondVatType = await page
|
||||
.waitToGetProperty(`${selectors.itemTax.secondClassAutocomplete} input`, 'value');
|
||||
|
||||
expect(secondVatType).toEqual('General VAT');
|
||||
});
|
||||
|
||||
it(`should confirm the third item tax class was edited`, async() => {
|
||||
const thirdVatType = await nightmare
|
||||
const thirdVatType = await page
|
||||
.waitToGetProperty(`${selectors.itemTax.thirdClassAutocomplete} input`, 'value');
|
||||
|
||||
expect(thirdVatType).toEqual('General VAT');
|
||||
});
|
||||
|
||||
it(`should edit the first class without saving the form`, async() => {
|
||||
const firstVatType = await nightmare
|
||||
.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT')
|
||||
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
||||
await page.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT');
|
||||
const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
||||
|
||||
expect(firstVatType).toEqual('Reduced VAT');
|
||||
});
|
||||
|
||||
it(`should now click the undo changes button and see the changes works`, async() => {
|
||||
const firstVatType = await nightmare
|
||||
.waitToClick(selectors.itemTax.undoChangesButton)
|
||||
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
||||
await page.waitToClick(selectors.itemTax.undoChangesButton);
|
||||
const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
||||
|
||||
expect(firstVatType).toEqual('General VAT');
|
||||
});
|
||||
|
|
|
@ -1,58 +1,61 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item create tags path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
await page.accessToSearchResult('Ranged weapon longbow 2m');
|
||||
await page.accessToSection('item.card.tags');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item')
|
||||
.accessToSearchResult('Ranged weapon longbow 2m')
|
||||
.accessToSection('item.card.tags');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should create a new tag and delete a former one`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemTags.fourthRemoveTagButton)
|
||||
.waitToClick(selectors.itemTags.addItemTagButton)
|
||||
.autocompleteSearch(selectors.itemTags.seventhTagAutocomplete, 'Ancho de la base')
|
||||
.write(selectors.itemTags.seventhValueInput, '50')
|
||||
.clearInput(selectors.itemTags.seventhRelevancyInput)
|
||||
.write(selectors.itemTags.seventhRelevancyInput, '4')
|
||||
.waitToClick(selectors.itemTags.submitItemTagsButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.itemTags.fourthRemoveTagButton);
|
||||
await page.waitToClick(selectors.itemTags.addItemTagButton);
|
||||
await page.autocompleteSearch(selectors.itemTags.seventhTagAutocomplete, 'Ancho de la base');
|
||||
await page.write(selectors.itemTags.seventhValueInput, '50');
|
||||
await page.clearInput(selectors.itemTags.seventhRelevancyInput);
|
||||
await page.write(selectors.itemTags.seventhRelevancyInput, '4');
|
||||
await page.waitToClick(selectors.itemTags.submitItemTagsButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the fourth row data is the expected one`, async() => {
|
||||
let result = await nightmare
|
||||
.reloadSection('item.card.tags')
|
||||
.wait('vn-item-tags')
|
||||
.waitToGetProperty(`${selectors.itemTags.fourthTagAutocomplete} input`, 'value');
|
||||
await page.reloadSection('item.card.tags');
|
||||
await page.wait('vn-item-tags');
|
||||
let result = await page.waitToGetProperty(`${selectors.itemTags.fourthTagAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Ancho de la base');
|
||||
|
||||
result = await nightmare
|
||||
.waitToGetProperty(selectors.itemTags.fourthValueInput, 'value');
|
||||
result = await page
|
||||
.waitToGetProperty(`${selectors.itemTags.fourthValueInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('50');
|
||||
|
||||
result = await nightmare
|
||||
.waitToGetProperty(selectors.itemTags.fourthRelevancyInput, 'value');
|
||||
result = await page
|
||||
.waitToGetProperty(`${selectors.itemTags.fourthRelevancyInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('4');
|
||||
});
|
||||
|
||||
it(`should confirm the fifth row data is the expected one`, async() => {
|
||||
let tag = await nightmare
|
||||
let tag = await page
|
||||
.waitToGetProperty(`${selectors.itemTags.fifthTagAutocomplete} input`, 'value');
|
||||
|
||||
let value = await nightmare
|
||||
.waitToGetProperty(selectors.itemTags.fifthValueInput, 'value');
|
||||
let value = await page
|
||||
.waitToGetProperty(`${selectors.itemTags.fifthValueInput} input`, 'value');
|
||||
|
||||
let relevancy = await nightmare
|
||||
.waitToGetProperty(selectors.itemTags.fifthRelevancyInput, 'value');
|
||||
let relevancy = await page
|
||||
.waitToGetProperty(`${selectors.itemTags.fifthRelevancyInput} input`, 'value');
|
||||
|
||||
expect(tag).toEqual('Color');
|
||||
expect(value).toEqual('Brown');
|
||||
|
@ -60,14 +63,14 @@ describe('Item create tags path', () => {
|
|||
});
|
||||
|
||||
it(`should confirm the sixth row data is the expected one`, async() => {
|
||||
let tag = await nightmare
|
||||
let tag = await page
|
||||
.waitToGetProperty(`${selectors.itemTags.sixthTagAutocomplete} input`, 'value');
|
||||
|
||||
let value = await nightmare
|
||||
.waitToGetProperty(selectors.itemTags.sixthValueInput, 'value');
|
||||
let value = await page
|
||||
.waitToGetProperty(`${selectors.itemTags.sixthValueInput} input`, 'value');
|
||||
|
||||
let relevancy = await nightmare
|
||||
.waitToGetProperty(selectors.itemTags.sixthRelevancyInput, 'value');
|
||||
let relevancy = await page
|
||||
.waitToGetProperty(`${selectors.itemTags.sixthRelevancyInput} input`, 'value');
|
||||
|
||||
expect(tag).toEqual('Categoria');
|
||||
expect(value).toEqual('+1 precission');
|
||||
|
|
|
@ -1,61 +1,65 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item create niche path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
await page.accessToSearchResult('Ranged weapon longbow 2m');
|
||||
await page.accessToSection('item.card.niche');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item')
|
||||
.accessToSearchResult('Ranged weapon longbow 2m')
|
||||
.accessToSection('item.card.niche');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should click create a new niche and delete a former one`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInInput(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'Warehouse One')
|
||||
.waitToClick(selectors.itemNiches.addNicheButton)
|
||||
.waitToClick(selectors.itemNiches.secondNicheRemoveButton)
|
||||
.autocompleteSearch(selectors.itemNiches.thirdWarehouseAutocomplete, 'Warehouse Two')
|
||||
.write(selectors.itemNiches.thirdCodeInput, 'A4')
|
||||
.waitToClick(selectors.itemNiches.submitNichesButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForTextInInput(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One');
|
||||
await page.waitToClick(selectors.itemNiches.addNicheButton);
|
||||
await page.waitToClick(selectors.itemNiches.secondNicheRemoveButton);
|
||||
await page.autocompleteSearch(selectors.itemNiches.thirdWarehouseAutocomplete, 'Warehouse Two');
|
||||
await page.write(selectors.itemNiches.thirdCodeInput, 'A4');
|
||||
await page.waitToClick(selectors.itemNiches.submitNichesButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the first niche is the expected one`, async() => {
|
||||
let result = await nightmare
|
||||
.reloadSection('item.card.niche')
|
||||
.waitForTextInInput(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'Warehouse One')
|
||||
await page.reloadSection('item.card.niche');
|
||||
await page.waitForTextInInput(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One');
|
||||
let result = await page
|
||||
.waitToGetProperty(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Warehouse One');
|
||||
result = await nightmare
|
||||
.waitToGetProperty(selectors.itemNiches.firstCodeInput, 'value');
|
||||
|
||||
result = await page
|
||||
.waitToGetProperty(`${selectors.itemNiches.firstCodeInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('A1');
|
||||
});
|
||||
|
||||
it(`should confirm the second niche is the expected one`, async() => {
|
||||
let result = await nightmare
|
||||
let result = await page
|
||||
.waitToGetProperty(`${selectors.itemNiches.secondWarehouseAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Warehouse Three');
|
||||
result = await nightmare
|
||||
.waitToGetProperty(selectors.itemNiches.secondCodeInput, 'value');
|
||||
|
||||
result = await page
|
||||
.waitToGetProperty(`${selectors.itemNiches.secondCodeInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('A3');
|
||||
});
|
||||
|
||||
it(`should confirm the third niche is the expected one`, async() => {
|
||||
let result = await nightmare
|
||||
let result = await page
|
||||
.waitToGetProperty(`${selectors.itemNiches.thirdWarehouseAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Warehouse Two');
|
||||
result = await nightmare
|
||||
.waitToGetProperty(selectors.itemNiches.thirdCodeInput, 'value');
|
||||
result = await page
|
||||
.waitToGetProperty(`${selectors.itemNiches.thirdCodeInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('A4');
|
||||
});
|
||||
|
|
|
@ -1,82 +1,85 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item Create botanical path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
await page.accessToSearchResult('Ranged weapon pistol 9mm');
|
||||
await page.accessToSection('item.card.botanical');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item')
|
||||
.accessToSearchResult('Ranged weapon pistol 9mm')
|
||||
.accessToSection('item.card.botanical');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should create a new botanical for the item`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.itemBotanical.botanicalInput, 'Cicuta maculata')
|
||||
.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abelia')
|
||||
.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'dealbata')
|
||||
.waitToClick(selectors.itemBotanical.submitBotanicalButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.itemBotanical.botanicalInput, 'Cicuta maculata');
|
||||
await page.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abelia');
|
||||
await page.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'dealbata');
|
||||
await page.waitToClick(selectors.itemBotanical.submitBotanicalButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the botanical for the item was created`, async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('item.card.botanical')
|
||||
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata')
|
||||
.waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value');
|
||||
await page.reloadSection('item.card.botanical');
|
||||
await page.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBotanical.botanicalInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Cicuta maculata');
|
||||
});
|
||||
|
||||
it(`should confirm the Genus for the item was created`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInInput(`${selectors.itemBotanical.genusAutocomplete} input`, 'Abelia')
|
||||
await page.waitForTextInInput(selectors.itemBotanical.genusAutocomplete, 'Abelia');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBotanical.genusAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Abelia');
|
||||
});
|
||||
|
||||
it(`should confirm the Species for the item was created`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBotanical.speciesAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('dealbata');
|
||||
});
|
||||
|
||||
it(`should edit botanical for the item`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.itemBotanical.botanicalInput)
|
||||
.write(selectors.itemBotanical.botanicalInput, 'Herp Derp')
|
||||
.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abies')
|
||||
.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'decurrens')
|
||||
.waitToClick(selectors.itemBotanical.submitBotanicalButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.itemBotanical.botanicalInput);
|
||||
await page.write(selectors.itemBotanical.botanicalInput, 'Herp Derp');
|
||||
await page.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abies');
|
||||
await page.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'decurrens');
|
||||
await page.waitToClick(selectors.itemBotanical.submitBotanicalButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the botanical for the item was edited`, async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('item.card.botanical')
|
||||
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp')
|
||||
.waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value');
|
||||
await page.reloadSection('item.card.botanical');
|
||||
await page.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBotanical.botanicalInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Herp Derp');
|
||||
});
|
||||
|
||||
it(`should confirm the Genus for the item was edited`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInInput(`${selectors.itemBotanical.genusAutocomplete} input`, 'Abies')
|
||||
await page.waitForTextInInput(selectors.itemBotanical.genusAutocomplete, 'Abies');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBotanical.genusAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Abies');
|
||||
});
|
||||
|
||||
it(`should confirm the Species for the item was edited`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBotanical.speciesAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('decurrens');
|
||||
|
|
|
@ -1,32 +1,36 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item Create barcodes path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
await page.accessToSearchResult('Ranged weapon longbow 2m');
|
||||
await page.accessToSection('item.card.itemBarcode');
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item')
|
||||
.accessToSearchResult('Ranged weapon longbow 2m')
|
||||
.accessToSection('item.card.itemBarcode');
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should click create a new code and delete a former one`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemBarcodes.firstCodeRemoveButton)
|
||||
.waitToClick(selectors.itemBarcodes.addBarcodeButton)
|
||||
.write(selectors.itemBarcodes.thirdCodeInput, '5')
|
||||
.waitToClick(selectors.itemBarcodes.submitBarcodesButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.itemBarcodes.firstCodeRemoveButton);
|
||||
await page.waitToClick(selectors.itemBarcodes.addBarcodeButton);
|
||||
await page.write(selectors.itemBarcodes.thirdCodeInput, '5');
|
||||
await page.waitToClick(selectors.itemBarcodes.submitBarcodesButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('item.card.itemBarcode')
|
||||
.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5')
|
||||
.waitToGetProperty(selectors.itemBarcodes.thirdCodeInput, 'value');
|
||||
await page.reloadSection('item.card.itemBarcode');
|
||||
await page.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemBarcodes.thirdCodeInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('5');
|
||||
});
|
||||
|
|
|
@ -1,82 +1,84 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item Create/Clone path', () => {
|
||||
const nightmare = createNightmare();
|
||||
describe('create', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item');
|
||||
});
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('create', () => {
|
||||
it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||
await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0);
|
||||
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(0);
|
||||
});
|
||||
|
||||
it('should access to the create item view by clicking the create floating button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.createItemButton)
|
||||
.wait(selectors.itemCreateView.createButton)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
||||
await page.wait(selectors.itemCreateView.createButton);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/item/create');
|
||||
});
|
||||
|
||||
it('should return to the item index by clickig the cancel button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.itemCreateView.cancelButton)
|
||||
.wait(selectors.itemsIndex.createItemButton)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.itemCreateView.cancelButton);
|
||||
await page.wait(selectors.itemsIndex.createItemButton);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/item/index');
|
||||
});
|
||||
|
||||
it('should now access to the create item view by clicking the create floating button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.createItemButton)
|
||||
.wait(selectors.itemCreateView.createButton)
|
||||
.parsedUrl();
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
||||
await page.wait(selectors.itemCreateView.createButton);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/item/create');
|
||||
});
|
||||
|
||||
it('should create the Infinity Gauntlet item', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet')
|
||||
.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo')
|
||||
.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares')
|
||||
.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand')
|
||||
.waitToClick(selectors.itemCreateView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand');
|
||||
await page.waitToClick(selectors.itemCreateView.createButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm Infinity Gauntlet item was created', async() => {
|
||||
let result = await nightmare
|
||||
.waitToGetProperty(selectors.itemBasicData.nameInput, 'value');
|
||||
let result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.nameInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Infinity Gauntlet');
|
||||
|
||||
|
||||
result = await nightmare
|
||||
result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Crisantemo');
|
||||
|
||||
result = await nightmare
|
||||
result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('5080000 Coral y materiales similares');
|
||||
|
||||
result = await nightmare
|
||||
result = await page
|
||||
.waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Holand');
|
||||
|
@ -85,45 +87,41 @@ describe('Item Create/Clone path', () => {
|
|||
|
||||
describe('clone', () => {
|
||||
it('should return to the items index by clicking the return to items button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.itemBasicData.goToItemIndexButton)
|
||||
.wait(selectors.itemsIndex.createItemButton)
|
||||
.waitForURL('#!/item/index')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.itemBasicData.goToItemIndexButton);
|
||||
await page.wait(selectors.itemsIndex.createItemButton);
|
||||
await page.waitForURL('#!/item/index');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('#!/item/index');
|
||||
});
|
||||
|
||||
it(`should search for the item Infinity Gauntlet`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||
await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should clone the Infinity Gauntlet`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet')
|
||||
.waitToClick(selectors.itemsIndex.searchResultCloneButton)
|
||||
.waitToClick(selectors.itemsIndex.acceptClonationAlertButton)
|
||||
.waitForURL('tags')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet');
|
||||
await page.waitToClick(selectors.itemsIndex.searchResultCloneButton);
|
||||
await page.waitToClick(selectors.itemsIndex.acceptClonationAlertButton);
|
||||
await page.waitForURL('tags');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('tags');
|
||||
});
|
||||
|
||||
it('should search for the item Infinity Gauntlet and find two', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemTags.goToItemIndexButton)
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
await page.waitToClick(selectors.itemTags.goToItemIndexButton);
|
||||
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||
await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2);
|
||||
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(2);
|
||||
});
|
||||
|
|
|
@ -1,206 +1,203 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item regularize path', () => {
|
||||
const nightmare = createNightmare();
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'item');
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'item');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should edit the user local warehouse', async() => {
|
||||
let result = await nightmare
|
||||
.waitForSpinnerLoad()
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four')
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForSpinnerLoad();
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
await page.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four');
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should open the user config form to check the local settings', async() => {
|
||||
let userLocalWarehouse = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
it('should check the local settings were saved', async() => {
|
||||
const userLocalWarehouse = await page
|
||||
.waitToGetProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
||||
|
||||
await page.keyboard.press('Escape');
|
||||
await page.waitForSelector('.user-popover.vn-popover', {hidden: true});
|
||||
|
||||
expect(userLocalWarehouse).toContain('Warehouse Four');
|
||||
});
|
||||
|
||||
it('should search for an item', async() => {
|
||||
const resultCount = await nightmare
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
it('should search for an specific item', async() => {
|
||||
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||
await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
|
||||
const resultCount = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(resultCount).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the item tax`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm')
|
||||
.waitToClick(selectors.itemsIndex.searchResult)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm');
|
||||
await page.waitToClick(selectors.itemsIndex.searchResult);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it('should open the regularize dialog and check the warehouse matches the local user settings', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemDescriptor.moreMenu)
|
||||
.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton)
|
||||
.waitToGetProperty(`${selectors.itemDescriptor.regularizeWarehouseAutocomplete} input`, 'value');
|
||||
await page.waitToClick(selectors.itemDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton);
|
||||
const result = await page.waitToGetProperty(`${selectors.itemDescriptor.regularizeWarehouseAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Warehouse Four');
|
||||
});
|
||||
|
||||
it('should regularize the item', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.itemDescriptor.regularizeQuantityInput, 100)
|
||||
.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One')
|
||||
.waitToClick(selectors.itemDescriptor.regularizeSaveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.itemDescriptor.regularizeQuantityInput, '100');
|
||||
await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One');
|
||||
await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should click on the Tickets button of the top bar menu', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await Promise.all([
|
||||
page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}),
|
||||
page.waitToClick(selectors.globalItems.ticketsButton)
|
||||
]);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
});
|
||||
|
||||
it('should now clear the user local settings', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
.waitToClick(selectors.globalItems.userConfigFirstAutocompleteClear)
|
||||
.waitForLastSnackbar();
|
||||
it('should clear the user local settings now', async() => {
|
||||
await page.waitForTransitionEnd('vn-searchbar');
|
||||
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||
await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should search for the ticket with alias missing', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 'missing')
|
||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult);
|
||||
await page.keyboard.press('Escape');
|
||||
await page.write(selectors.ticketsIndex.searchTicketInput, 'missing');
|
||||
await page.keyboard.press('Enter');
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the ticket summary`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Missing')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Missing');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchResult);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it(`should check the ticket sale quantity is showing a negative value`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100')
|
||||
await page.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100');
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.ticketSummary.firstSaleQuantity, 'innerText');
|
||||
|
||||
expect(result).toContain('-100');
|
||||
});
|
||||
|
||||
it(`should check the ticket sale discount is 100%`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.ticketSummary.firstSaleDiscount, 'innerText');
|
||||
|
||||
expect(result).toContain('100 %');
|
||||
});
|
||||
|
||||
it('should now click on the Items button of the top bar menu', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.itemsButton)
|
||||
.wait(selectors.itemsIndex.searchItemInput)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await page.waitToClick(selectors.globalItems.itemsButton);
|
||||
await page.wait(selectors.itemsIndex.searchItemInput);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/item/index');
|
||||
});
|
||||
|
||||
it('should search for the item once again', async() => {
|
||||
const resultCount = await nightmare
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||
await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
|
||||
const resultCount = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(resultCount).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the item tax`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm')
|
||||
.waitToClick(selectors.itemsIndex.searchResult)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm');
|
||||
await page.waitToClick(selectors.itemsIndex.searchResult);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it('should regularize the item once more', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemDescriptor.moreMenu)
|
||||
.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton)
|
||||
.write(selectors.itemDescriptor.regularizeQuantityInput, 100)
|
||||
.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One')
|
||||
.waitToClick(selectors.itemDescriptor.regularizeSaveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.itemDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton);
|
||||
await page.write(selectors.itemDescriptor.regularizeQuantityInput, '100');
|
||||
await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One');
|
||||
await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should again click on the Tickets button of the top bar menu', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await Promise.all([
|
||||
page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}),
|
||||
page.waitToClick(selectors.globalItems.ticketsButton)
|
||||
]);
|
||||
await page.waitForTransitionEnd('vn-searchbar');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
});
|
||||
|
||||
it('should search for the ticket with id 25 once again', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 25)
|
||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult);
|
||||
await page.write(selectors.ticketsIndex.searchTicketInput, '25');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should now click on the search result to access to the ticket summary`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, '25')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.ticketsIndex.searchResult, '25');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchResult);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it(`should check the ticket contains now two sales`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100')
|
||||
.countElement(selectors.ticketSummary.sale);
|
||||
await page.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100');
|
||||
const result = await page.countElement(selectors.ticketSummary.sale);
|
||||
|
||||
expect(result).toEqual(2);
|
||||
});
|
||||
|
|
|
@ -1,86 +1,83 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item index path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesPerson', 'item');
|
||||
await page.waitToClick(selectors.itemsIndex.searchIcon);
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'item')
|
||||
.waitToClick(selectors.itemsIndex.searchIcon);
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should click on the fields to show button to open the list of columns to show', async() => {
|
||||
const visible = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.fieldsToShowButton)
|
||||
.isVisible(selectors.itemsIndex.fieldsToShowForm);
|
||||
await page.waitToClick(selectors.itemsIndex.fieldsToShowButton);
|
||||
const visible = await page.isVisible(selectors.itemsIndex.fieldsToShowForm);
|
||||
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should unmark all checkboxes except the first and the last ones', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.idCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.stemsCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.sizeCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.nicheCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.typeCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.categoryCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.intrastadCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.originCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.buyerCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.destinyCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.saveFieldsButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.itemsIndex.idCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.stemsCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.sizeCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.nicheCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.typeCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.categoryCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.originCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.destinyCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should navigate forth and back to see the images column is still visible', async() => {
|
||||
const imageVisible = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.searchResult)
|
||||
.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton)
|
||||
.waitToClick(selectors.itemsIndex.searchIcon)
|
||||
.wait(selectors.itemsIndex.searchResult)
|
||||
.waitImgLoad(selectors.itemsIndex.firstItemImage)
|
||||
.isVisible(selectors.itemsIndex.firstItemImageTd);
|
||||
await page.waitToClick(selectors.itemsIndex.searchResult);
|
||||
await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton);
|
||||
await page.waitToClick(selectors.itemsIndex.searchIcon);
|
||||
await page.wait(selectors.itemsIndex.searchResult);
|
||||
await page.waitImgLoad(selectors.itemsIndex.firstItemImage);
|
||||
const imageVisible = await page.isVisible(selectors.itemsIndex.firstItemImageTd);
|
||||
|
||||
expect(imageVisible).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should check the ids column is not visible', async() => {
|
||||
const idVisible = await nightmare
|
||||
.isVisible(selectors.itemsIndex.firstItemId);
|
||||
|
||||
expect(idVisible).toBeFalsy();
|
||||
await page.waitForSelector(selectors.itemsIndex.firstItemId, {hidden: true});
|
||||
});
|
||||
|
||||
it('should mark all unchecked boxes to leave the index as it was', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.fieldsToShowButton)
|
||||
.waitToClick(selectors.itemsIndex.idCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.stemsCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.sizeCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.nicheCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.typeCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.categoryCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.intrastadCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.originCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.buyerCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.destinyCheckbox)
|
||||
.waitToClick(selectors.itemsIndex.saveFieldsButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.itemsIndex.fieldsToShowButton);
|
||||
await page.waitToClick(selectors.itemsIndex.idCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.stemsCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.sizeCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.nicheCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.typeCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.categoryCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.originCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.destinyCheckbox);
|
||||
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should now navigate forth and back to see the ids column is now visible', async() => {
|
||||
const idVisible = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.searchResult)
|
||||
.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton)
|
||||
.waitToClick(selectors.itemsIndex.searchIcon)
|
||||
.wait(selectors.itemsIndex.searchResult)
|
||||
.isVisible(selectors.itemsIndex.firstItemId);
|
||||
await page.waitToClick(selectors.itemsIndex.searchResult);
|
||||
await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton);
|
||||
await page.waitToClick(selectors.itemsIndex.searchIcon);
|
||||
await page.wait(selectors.itemsIndex.searchResult);
|
||||
const idVisible = await page.isVisible(selectors.itemsIndex.firstItemId);
|
||||
|
||||
expect(idVisible).toBeTruthy();
|
||||
});
|
||||
|
|
|
@ -1,74 +1,74 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item log path', () => {
|
||||
const nightmare = createNightmare();
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('developer', 'item');
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('developer', 'item');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should search for the Knowledge artifact to confirm it isn't created yet`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Knowledge artifact')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
await page.write(selectors.itemsIndex.searchItemInput, 'Knowledge artifact');
|
||||
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0);
|
||||
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(0);
|
||||
});
|
||||
|
||||
it('should access to the create item view by clicking the create floating button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.itemsIndex.createItemButton)
|
||||
.wait(selectors.itemCreateView.createButton)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
||||
await page.wait(selectors.itemCreateView.createButton);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/item/create');
|
||||
});
|
||||
|
||||
it('should create the Knowledge artifact item', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.itemCreateView.temporalName, 'Knowledge artifact')
|
||||
.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo')
|
||||
.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares')
|
||||
.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand')
|
||||
.waitToClick(selectors.itemCreateView.createButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.write(selectors.itemCreateView.temporalName, 'Knowledge artifact');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand');
|
||||
await page.waitToClick(selectors.itemCreateView.createButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should return to the items index by clicking the return to items button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.itemBasicData.goToItemIndexButton)
|
||||
.wait(selectors.itemsIndex.createItemButton)
|
||||
.waitForURL('#!/item/index')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.itemBasicData.goToItemIndexButton);
|
||||
await page.wait(selectors.itemsIndex.createItemButton);
|
||||
await page.waitForURL('#!/item/index');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('#!/item/index');
|
||||
});
|
||||
|
||||
it(`should search for the created item and navigate to it's log section`, async() => {
|
||||
const url = await nightmare
|
||||
.accessToSearchResult('Knowledge artifact')
|
||||
.accessToSection('item.card.log')
|
||||
.waitForURL('/log')
|
||||
.parsedUrl();
|
||||
await page.accessToSearchResult('Knowledge artifact');
|
||||
await page.accessToSection('item.card.log');
|
||||
await page.waitForURL('/log');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/log');
|
||||
});
|
||||
|
||||
it(`should confirm the log is showing 5 entries`, async() => {
|
||||
const anyLineCreatedCount = await nightmare
|
||||
.wait(selectors.itemLog.anyLineCreated)
|
||||
.countElement(selectors.itemLog.anyLineCreated);
|
||||
await page.wait(selectors.itemLog.anyLineCreated);
|
||||
const anyLineCreatedCount = await page.countElement(selectors.itemLog.anyLineCreated);
|
||||
|
||||
expect(anyLineCreatedCount).toEqual(5);
|
||||
});
|
||||
|
||||
it(`should confirm the log is showing the intrastat for the created item`, async() => {
|
||||
const fifthLineCreatedProperty = await nightmare
|
||||
const fifthLineCreatedProperty = await page
|
||||
.waitToGetProperty(selectors.itemLog.fifthLineCreatedProperty, 'innerText');
|
||||
|
||||
expect(fifthLineCreatedProperty).toEqual('Coral y materiales similares');
|
||||
|
|
|
@ -1,47 +1,49 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Item descriptor path', () => {
|
||||
const nightmare = createNightmare();
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item')
|
||||
.accessToSearchResult(1)
|
||||
.accessToSection('item.card.basicData');
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('buyer', 'item');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('item.card.basicData');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should check the descriptor inactive icon is dark as the item is active', async() => {
|
||||
let darkIcon = await nightmare
|
||||
.wait(selectors.itemDescriptor.inactiveIcon)
|
||||
.waitForClassNotPresent(selectors.itemDescriptor.inactiveIcon, 'bright')
|
||||
.isVisible(selectors.itemDescriptor.inactiveIcon);
|
||||
await page.wait(selectors.itemDescriptor.inactiveIcon);
|
||||
await page.waitForClassNotPresent(selectors.itemDescriptor.inactiveIcon, 'bright');
|
||||
let darkIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
|
||||
|
||||
expect(darkIcon).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should set the item to inactive', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
|
||||
.waitToClick(selectors.itemBasicData.submitBasicDataButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
|
||||
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should reload the section and check the inactive icon is bright', async() => {
|
||||
let brightIcon = await nightmare
|
||||
.reloadSection('item.card.basicData')
|
||||
.waitForClassPresent(selectors.itemDescriptor.inactiveIcon, 'bright')
|
||||
.isVisible(selectors.itemDescriptor.inactiveIcon);
|
||||
await page.reloadSection('item.card.basicData');
|
||||
await page.waitForClassPresent(selectors.itemDescriptor.inactiveIcon, 'bright');
|
||||
let brightIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
|
||||
|
||||
expect(brightIcon).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should set the item back to active', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
|
||||
.waitToClick(selectors.itemBasicData.submitBasicDataButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
|
||||
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
|
|
@ -1,94 +1,114 @@
|
|||
import selectors from '../../../helpers/selectors.js';
|
||||
import createNightmare from '../../../helpers/nightmare';
|
||||
import getBrowser from '../../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket List sale path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('employee', 'ticket')
|
||||
.accessToSearchResult(13)
|
||||
.accessToSection('ticket.card.sale');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
await page.accessToSearchResult('13');
|
||||
await page.accessToSection('ticket.card.sale');
|
||||
});
|
||||
|
||||
it('should confirm the first ticket sale contains the colour', async() => {
|
||||
const value = await nightmare
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should confirm the first ticket sale contains the colour tag', async() => {
|
||||
await page.waitForContentLoaded();
|
||||
const value = await page
|
||||
.waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText');
|
||||
|
||||
expect(value).toContain('Black');
|
||||
});
|
||||
|
||||
it('should confirm the first sale contains the price', async() => {
|
||||
const value = await nightmare
|
||||
const value = await page
|
||||
.waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
|
||||
|
||||
expect(value).toContain('1.72');
|
||||
});
|
||||
|
||||
it('should confirm the first sale contains the discount', async() => {
|
||||
const value = await nightmare
|
||||
const value = await page
|
||||
.waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText');
|
||||
|
||||
expect(value).toContain('0 %');
|
||||
expect(value).toContain('0.00%');
|
||||
});
|
||||
|
||||
it('should confirm the first sale contains the total import', async() => {
|
||||
const value = await nightmare
|
||||
const value = await page
|
||||
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
|
||||
|
||||
expect(value).toContain('34.40');
|
||||
});
|
||||
|
||||
it('should add an empty item to the sale list', async() => {
|
||||
const sales = await nightmare
|
||||
.waitToClick(selectors.ticketSales.newItemButton)
|
||||
await page.waitToClick(selectors.ticketSales.newItemButton);
|
||||
const sales = await page
|
||||
.countElement(selectors.ticketSales.saleLine);
|
||||
|
||||
expect(sales).toEqual(2);
|
||||
});
|
||||
|
||||
it('should select a valid item to be added as the second item in the sales list', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketSales.secondSaleIdInput)
|
||||
.write(selectors.ticketSales.secondSaleIdAutocomplete, 'Melee weapon heavy shield 1x0.5m')
|
||||
.waitToClick(selectors.ticketSales.idAutocompleteFirstResult)
|
||||
.write(selectors.ticketSales.secondSaleQuantity, '1\u000d')
|
||||
.waitForLastSnackbar();
|
||||
let searchValue = 'Melee weapon heavy shield 1x0.5m';
|
||||
await page.waitToClick(`${selectors.ticketSales.secondSaleIdAutocomplete} input`);
|
||||
await page.waitForSelector(selector => {
|
||||
document
|
||||
.querySelector(`${selector} vn-drop-down`).$ctrl.content
|
||||
.querySelectorAll('li');
|
||||
}, selectors.ticketSales.secondSaleIdAutocomplete);
|
||||
|
||||
await page.write(`.vn-drop-down.shown`, searchValue);
|
||||
await page.waitForFunction((selector, searchValue) => {
|
||||
let element = document
|
||||
.querySelector(`${selector} vn-drop-down`).$ctrl.content
|
||||
.querySelector('li.active');
|
||||
if (element)
|
||||
return element.innerText.includes(searchValue);
|
||||
}, {}, selectors.ticketSales.secondSaleIdAutocomplete, searchValue);
|
||||
|
||||
await page.keyboard.press('Enter');
|
||||
await page.write(selectors.ticketSales.secondSaleQuantity, '1');
|
||||
await page.keyboard.press('Enter');
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
// #1865
|
||||
xit('should update the description of the new sale', async() => {
|
||||
const result = await nightmare
|
||||
.focusElement(selectors.ticketSales.secondSaleConceptCell)
|
||||
.write(selectors.ticketSales.secondSaleConceptInput, 'Aegis of Valor\u000d')
|
||||
.waitForLastSnackbar();
|
||||
await page.focusElement(selectors.ticketSales.secondSaleConceptCell);
|
||||
await page.write(selectors.ticketSales.secondSaleConceptInput, 'Aegis of Valor');
|
||||
await page.keyboard.press('Enter');
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should add a third empty item to the sale list', async() => {
|
||||
const sales = await nightmare
|
||||
.waitToClick(selectors.ticketSales.newItemButton)
|
||||
.countElement(selectors.ticketSales.saleLine);
|
||||
await page.waitToClick(selectors.ticketSales.newItemButton);
|
||||
const sales = await page.countElement(selectors.ticketSales.saleLine);
|
||||
|
||||
expect(sales).toEqual(3);
|
||||
});
|
||||
|
||||
it('should select the 2nd and 3th item and delete both', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketSales.secondSaleCheckbox)
|
||||
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
|
||||
.waitToClick(selectors.ticketSales.deleteSaleButton)
|
||||
.waitToClick(selectors.ticketSales.acceptDeleteLineButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
|
||||
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
|
||||
await page.waitToClick(selectors.ticketSales.deleteSaleButton);
|
||||
await page.waitToClick(selectors.ticketSales.acceptDeleteLineButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should verify there's only 1 single line remaining`, async() => {
|
||||
const sales = await nightmare
|
||||
.countElement(selectors.ticketSales.saleLine);
|
||||
const sales = await page.countElement(selectors.ticketSales.saleLine);
|
||||
|
||||
expect(sales).toEqual(1);
|
||||
});
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
import selectors from '../../../helpers/selectors.js';
|
||||
import createNightmare from '../../../helpers/nightmare';
|
||||
import getBrowser from '../../../helpers/puppeteer';
|
||||
|
||||
// #1632 [e2e] ticket.sale - Transferir líneas
|
||||
xdescribe('Ticket Edit sale path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'ticket')
|
||||
.accessToSearchResult(16)
|
||||
.accessToSection('ticket.card.sale');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesPerson', 'ticket');
|
||||
await page.accessToSearchResult(16);
|
||||
await page.accessToSection('ticket.card.sale');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should click on the first sale claim icon to navigate over there`, async() => {
|
||||
|
@ -59,7 +65,6 @@ xdescribe('Ticket Edit sale path', () => {
|
|||
|
||||
it(`should click on the zoomed image to close it`, async() => {
|
||||
const result = await nightmare
|
||||
.wait(100)
|
||||
.clickIfVisible(selectors.ticketSales.firstSaleZoomedImage)
|
||||
.countElement(selectors.ticketSales.firstSaleZoomedImage);
|
||||
|
||||
|
@ -149,7 +154,6 @@ xdescribe('Ticket Edit sale path', () => {
|
|||
|
||||
it('should confirm the price have been updated', async() => {
|
||||
const result = await nightmare
|
||||
.wait(1999)
|
||||
.waitToGetProperty(`${selectors.ticketSales.firstSalePrice} span`, 'innerText');
|
||||
|
||||
expect(result).toContain('5.00');
|
||||
|
@ -173,10 +177,10 @@ xdescribe('Ticket Edit sale path', () => {
|
|||
|
||||
it('should confirm the discount have been updated', async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInElement(`${selectors.ticketSales.firstSaleDiscount} > span`, '50 %')
|
||||
.waitForTextInElement(`${selectors.ticketSales.firstSaleDiscount} > span`, '50.00%')
|
||||
.waitToGetProperty(`${selectors.ticketSales.firstSaleDiscount} > span`, 'innerText');
|
||||
|
||||
expect(result).toContain('50 %');
|
||||
expect(result).toContain('50.00%');
|
||||
});
|
||||
|
||||
it('should confirm the total import for that item have been updated', async() => {
|
||||
|
@ -426,7 +430,7 @@ xdescribe('Ticket Edit sale path', () => {
|
|||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketSales.moreMenu)
|
||||
.waitToClick(selectors.ticketSales.moreMenuUpdateDiscount)
|
||||
.write(selectors.ticketSales.moreMenuUpdateDiscountInput, 100)
|
||||
// .write(selectors.ticketSales.moreMenuUpdateDiscountInput, 100) can't find the selector on app (deleted the selector), menu option was removed?
|
||||
.write('body', '\u000d')
|
||||
.waitForTextInElement(selectors.ticketSales.totalImport, '0.00')
|
||||
.waitToGetProperty(selectors.ticketSales.totalImport, 'innerText');
|
||||
|
|
|
@ -1,45 +1,50 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket Create notes path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('employee', 'ticket')
|
||||
.accessToSearchResult(1)
|
||||
.accessToSection('ticket.card.observation');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('ticket.card.observation');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should create a new note', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.ticketNotes.addNoteButton)
|
||||
.autocompleteSearch(selectors.ticketNotes.firstNoteTypeAutocomplete, 'observation one')
|
||||
.write(selectors.ticketNotes.firstDescriptionInput, 'description')
|
||||
.waitToClick(selectors.ticketNotes.submitNotesButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.ticketNotes.addNoteButton);
|
||||
await page.autocompleteSearch(selectors.ticketNotes.firstNoteTypeAutocomplete, 'observation one');
|
||||
await page.write(selectors.ticketNotes.firstDescriptionInput, 'description');
|
||||
await page.waitToClick(selectors.ticketNotes.submitNotesButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
}, 15000);
|
||||
|
||||
it('should confirm the note is the expected one', async() => {
|
||||
let result = await nightmare
|
||||
.reloadSection('ticket.card.observation')
|
||||
await page.reloadSection('ticket.card.observation');
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.ticketNotes.firstNoteTypeAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('observation one');
|
||||
|
||||
let firstDescription = await nightmare
|
||||
.waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value');
|
||||
const firstDescription = await page
|
||||
.waitToGetProperty(`${selectors.ticketNotes.firstDescriptionInput} input`, 'value');
|
||||
|
||||
expect(firstDescription).toEqual('description');
|
||||
});
|
||||
|
||||
it('should delete the note', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.ticketNotes.firstNoteRemoveButton)
|
||||
.waitToClick(selectors.ticketNotes.submitNotesButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketNotes.firstNoteRemoveButton);
|
||||
await page.waitToClick(selectors.ticketNotes.submitNotesButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
|
|
@ -1,36 +1,42 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket expeditions and log path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('production', 'ticket')
|
||||
.accessToSearchResult('1')
|
||||
.accessToSection('ticket.card.expedition');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('production', 'ticket');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('ticket.card.expedition');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton)
|
||||
.waitToClick(selectors.ticketExpedition.acceptDeleteRowButton)
|
||||
.waitToClick(selectors.ticketPackages.packagesButton)
|
||||
.wait(selectors.ticketPackages.firstPackageAutocomplete)
|
||||
.waitToClick(selectors.ticketExpedition.expeditionButton)
|
||||
.wait(selectors.ticketExpedition.expeditionRow)
|
||||
await page.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton);
|
||||
await page.waitToClick(selectors.ticketExpedition.acceptDeleteRowButton),
|
||||
await page.reloadSection('ticket.card.expedition');
|
||||
await page.waitForSelector(selectors.ticketExpedition.expeditionRow, {});
|
||||
const result = await page
|
||||
.countElement(selectors.ticketExpedition.expeditionRow);
|
||||
|
||||
expect(result).toEqual(3);
|
||||
});
|
||||
|
||||
it(`should confirm the expedition deleted is shown now in the ticket log`, async() => {
|
||||
const changedBy = await nightmare
|
||||
.waitToClick(selectors.ticketLog.logButton)
|
||||
await page.waitToClick(selectors.ticketLog.logButton);
|
||||
const changedBy = await page
|
||||
.waitToGetProperty(selectors.ticketLog.changedBy, 'innerText');
|
||||
const actionTaken = await nightmare
|
||||
|
||||
const actionTaken = await page
|
||||
.waitToGetProperty(selectors.ticketLog.actionTaken, 'innerText');
|
||||
const id = await nightmare
|
||||
|
||||
const id = await page
|
||||
.waitToGetProperty(selectors.ticketLog.id, 'innerText');
|
||||
|
||||
expect(changedBy).toEqual('production');
|
||||
|
|
|
@ -1,69 +1,70 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket Create packages path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('employee', 'ticket')
|
||||
.accessToSearchResult('1')
|
||||
.accessToSection('ticket.card.package');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('ticket.card.package');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should attempt create a new package but receive an error if package is blank`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketPackages.firstRemovePackageButton)
|
||||
.waitToClick(selectors.ticketPackages.addPackageButton)
|
||||
.write(selectors.ticketPackages.firstQuantityInput, 99)
|
||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketPackages.firstRemovePackageButton);
|
||||
await page.waitToClick(selectors.ticketPackages.addPackageButton);
|
||||
await page.write(selectors.ticketPackages.firstQuantityInput, '99');
|
||||
await page.waitToClick(selectors.ticketPackages.savePackagesButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Package cannot be blank');
|
||||
});
|
||||
|
||||
it(`should delete the first package and receive and error to save a new one with blank quantity`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
||||
.autocompleteSearch(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m')
|
||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.ticketPackages.firstQuantityInput);
|
||||
await page.autocompleteSearch(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m');
|
||||
await page.waitToClick(selectors.ticketPackages.savePackagesButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Some fields are invalid');
|
||||
});
|
||||
|
||||
it(`should confirm the quantity input isn't invalid yet`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checkValidity();
|
||||
return document.querySelector(`${selector} input`).checkValidity();
|
||||
}, selectors.ticketPackages.firstQuantityInput);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should create a new package with correct data`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
||||
.write(selectors.ticketPackages.firstQuantityInput, -99)
|
||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.clearInput(selectors.ticketPackages.firstQuantityInput);
|
||||
await page.write(selectors.ticketPackages.firstQuantityInput, '-99');
|
||||
await page.waitToClick(selectors.ticketPackages.savePackagesButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the first select is the expected one`, async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('ticket.card.package')
|
||||
.waitForTextInInput(`${selectors.ticketPackages.firstPackageAutocomplete} input`, 'Container medical box 1m')
|
||||
.waitToGetProperty(`${selectors.ticketPackages.firstPackageAutocomplete} input`, 'value');
|
||||
await page.reloadSection('ticket.card.package');
|
||||
await page.waitForTextInInput(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m');
|
||||
const result = await page.waitToGetProperty(`${selectors.ticketPackages.firstPackageAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('7 : Container medical box 1m');
|
||||
});
|
||||
|
||||
it(`should confirm the first quantity is just a number and the string part was ignored by the imput number`, async() => {
|
||||
const result = await nightmare
|
||||
.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '-99')
|
||||
.waitToGetProperty(selectors.ticketPackages.firstQuantityInput, 'value');
|
||||
await page.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '-99');
|
||||
const result = await page.waitToGetProperty(`${selectors.ticketPackages.firstQuantityInput} input`, 'value');
|
||||
|
||||
expect(result).toEqual('-99');
|
||||
});
|
||||
|
|
|
@ -1,83 +1,83 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket Create new tracking state path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
describe('as production', () => {
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('production', 'ticket')
|
||||
.accessToSearchResult('1')
|
||||
.accessToSection('ticket.card.tracking.index');
|
||||
it('should log into the ticket 1 tracking', async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('production', 'ticket');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('ticket.card.tracking.index');
|
||||
});
|
||||
|
||||
it('should access to the create state view by clicking the create floating button', async() => {
|
||||
let url = await nightmare
|
||||
.clickIfVisible(selectors.ticketTracking.createStateButton)
|
||||
.wait(selectors.createStateView.stateAutocomplete)
|
||||
.parsedUrl();
|
||||
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.ticketTracking.createStateButton);
|
||||
await page.waitForSelector(selectors.createStateView.stateAutocomplete, {visible: true});
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('tracking/edit');
|
||||
});
|
||||
|
||||
it(`should attempt create a new state but receive an error if state is empty`, async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.createStateView.saveStateButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('State cannot be blank');
|
||||
});
|
||||
|
||||
it(`should create a new state`, async() => {
|
||||
let result = await nightmare
|
||||
.autocompleteSearch(selectors.createStateView.stateAutocomplete, '¿Fecha?')
|
||||
.waitToClick(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, '¿Fecha?');
|
||||
await page.waitToClick(selectors.createStateView.saveStateButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
});
|
||||
|
||||
describe('as salesPerson', () => {
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('salesPerson', 'ticket')
|
||||
.accessToSearchResult('1')
|
||||
.accessToSection('ticket.card.tracking.index');
|
||||
it('should now log into the ticket 1 tracking', async() => {
|
||||
await page.loginAndModule('salesPerson', 'ticket');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('ticket.card.tracking.index');
|
||||
});
|
||||
|
||||
it('should now access to the create state view by clicking the create floating button', async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.ticketTracking.createStateButton)
|
||||
.wait(selectors.createStateView.stateAutocomplete)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.ticketTracking.createStateButton);
|
||||
await page.waitForURL('tracking/edit');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('tracking/edit');
|
||||
});
|
||||
|
||||
it(`should attemp to create an state for which salesPerson doesn't have permissions`, async() => {
|
||||
let result = await nightmare
|
||||
.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'Encajado')
|
||||
.waitToClick(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitFor(1500);
|
||||
await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'Encajado');
|
||||
await page.waitToClick(selectors.createStateView.saveStateButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(`You don't have enough privileges`);
|
||||
});
|
||||
|
||||
it(`should make sure the worker gets autocomplete uppon selecting the assigned state`, async() => {
|
||||
let result = await nightmare
|
||||
.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'asignado')
|
||||
await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'asignado');
|
||||
let result = await page
|
||||
.waitToGetProperty(`${selectors.createStateView.workerAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual('salesPersonNick');
|
||||
});
|
||||
|
||||
it(`should succesfully create a valid state`, async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.createStateView.saveStateButton);
|
||||
let result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
|
|
@ -1,98 +1,98 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket Edit basic data path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('employee', 'ticket')
|
||||
.accessToSearchResult(11)
|
||||
.accessToSection('ticket.card.basicData.stepOne');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
await page.accessToSearchResult('11');
|
||||
await page.accessToSection('ticket.card.basicData.stepOne');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should confirm the zone autocomplete is disabled unless your role is productionBoss`, async() => {
|
||||
const disabled = await nightmare
|
||||
.wait(selectors.ticketBasicData.zoneAutocomplete)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.ticketBasicData.zoneAutocomplete} input`);
|
||||
await page.waitForSelector(selectors.ticketBasicData.zoneAutocomplete, {});
|
||||
const disabled = await page.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.ticketBasicData.zoneAutocomplete} input`);
|
||||
|
||||
expect(disabled).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should now log as productionBoss to perform the rest of the tests`, async() => {
|
||||
await nightmare
|
||||
.loginAndModule('productionBoss', 'ticket')
|
||||
.accessToSearchResult(11)
|
||||
.accessToSection('ticket.card.basicData.stepOne');
|
||||
await page.loginAndModule('productionBoss', 'ticket');
|
||||
await page.accessToSearchResult('11');
|
||||
await page.accessToSection('ticket.card.basicData.stepOne');
|
||||
});
|
||||
|
||||
it(`should confirm the zone autocomplete is enabled for the role productionBoss`, async() => {
|
||||
const disabled = await nightmare
|
||||
.waitForSpinnerLoad()
|
||||
.wait(selectors.ticketBasicData.zoneAutocomplete)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.ticketBasicData.zoneAutocomplete} input`);
|
||||
await page.waitForSpinnerLoad();
|
||||
await page.wait(selectors.ticketBasicData.zoneAutocomplete);
|
||||
const disabled = await page.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.ticketBasicData.zoneAutocomplete} input`);
|
||||
|
||||
expect(disabled).toBeFalsy();
|
||||
});
|
||||
|
||||
it(`should check the zone is for Silla247`, async() => {
|
||||
let zone = await nightmare
|
||||
let zone = await page
|
||||
.waitToGetProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value');
|
||||
|
||||
expect(zone).toContain('Zone 247 A');
|
||||
});
|
||||
|
||||
it(`should edit the ticket agency then check there are no zones for it`, async() => {
|
||||
let zone = await nightmare
|
||||
.autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Entanglement')
|
||||
await page.autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Entanglement');
|
||||
let zone = await page
|
||||
.getProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value');
|
||||
|
||||
expect(zone.length).toEqual(0);
|
||||
});
|
||||
|
||||
it(`should edit the ticket zone then check the agency is for the new zone`, async() => {
|
||||
let zone = await nightmare
|
||||
.autocompleteSearch(selectors.ticketBasicData.zoneAutocomplete, 'Zone expensive A')
|
||||
await page.autocompleteSearch(selectors.ticketBasicData.zoneAutocomplete, 'Zone expensive A');
|
||||
let zone = await page
|
||||
.waitToGetProperty(`${selectors.ticketBasicData.agencyAutocomplete} input`, 'value');
|
||||
|
||||
expect(zone).toContain('Silla247Expensive');
|
||||
});
|
||||
|
||||
it(`should click next`, async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.ticketBasicData.nextStepButton)
|
||||
.waitForURL('data/step-two')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.ticketBasicData.nextStepButton);
|
||||
await page.waitForURL('data/step-two');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('data/step-two');
|
||||
});
|
||||
|
||||
it(`should have a price diference`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
|
||||
|
||||
expect(result).toContain('-€248.00');
|
||||
});
|
||||
|
||||
it(`should then click next to move on to step three`, async() => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.ticketBasicData.nextStepButton)
|
||||
.waitForURL('data/step-three')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.ticketBasicData.nextStepButton);
|
||||
await page.waitForURL('data/step-three');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('data/step-three');
|
||||
});
|
||||
|
||||
it(`should select a new reason for the changes made then click on finalize`, async() => {
|
||||
let url = await nightmare
|
||||
.autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'Cambiar los precios en el ticket')
|
||||
.waitToClick(selectors.ticketBasicData.finalizeButton)
|
||||
.waitForURL('summary')
|
||||
.parsedUrl();
|
||||
await page.autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'Cambiar los precios en el ticket');
|
||||
await page.waitToClick(selectors.ticketBasicData.finalizeButton);
|
||||
await page.waitForURL('summary');
|
||||
let url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('summary');
|
||||
});
|
||||
|
|
|
@ -1,23 +1,28 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket List components path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('employee', 'ticket')
|
||||
.accessToSearchResult('1')
|
||||
.accessToSection('ticket.card.components');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('ticket.card.components');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should confirm the total base is correct', async() => {
|
||||
const name = 'Base €';
|
||||
const minLength = name.length;
|
||||
|
||||
const base = await nightmare
|
||||
.waitPropertyLength(selectors.ticketComponents.base, 'innerText', minLength)
|
||||
.waitToGetProperty(selectors.ticketComponents.base, 'innerText');
|
||||
await page.waitPropertyLength(selectors.ticketComponents.base, 'innerText', minLength);
|
||||
const base = await page.waitToGetProperty(selectors.ticketComponents.base, 'innerText');
|
||||
|
||||
|
||||
expect(base).toContain('Base');
|
||||
|
|
|
@ -1,166 +1,140 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket descriptor path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'ticket');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
await page.accessToSection('ticket.weekly.index');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should count the amount of tickets in the turns section', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.menuWeeklyTickets)
|
||||
.wait(selectors.ticketsIndex.weeklyTicket)
|
||||
.countElement(selectors.ticketsIndex.weeklyTicket);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.weeklyTicket, 5);
|
||||
const result = await page.countElement(selectors.ticketsIndex.weeklyTicket);
|
||||
|
||||
expect(result).toEqual(5);
|
||||
});
|
||||
|
||||
it('should now click on the Tickets button of the top bar menu', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
});
|
||||
|
||||
it('should search for the ticket 11', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 11)
|
||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the ticket`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
it('should go back to the ticket index then search and access a ticket summary', async() => {
|
||||
await page.accessToSection('ticket.index');
|
||||
await page.accessToSearchResult('11');
|
||||
await page.waitForContentLoaded();
|
||||
});
|
||||
|
||||
it('should add the ticket to thursday turn using the descriptor more menu', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn)
|
||||
.waitToClick(selectors.ticketDescriptor.thursdayButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn);
|
||||
await page.waitToClick(selectors.ticketDescriptor.thursdayButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should again click on the Tickets button of the top bar menu', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await page.waitToClick(selectors.globalItems.ticketsButton);
|
||||
await page.waitForContentLoaded();
|
||||
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
});
|
||||
|
||||
it('should confirm the ticket 11 was added on thursday', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.menuWeeklyTickets)
|
||||
.waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicket, 'value');
|
||||
it('should confirm the ticket 11 was added to thursday', async() => {
|
||||
await page.accessToSection('ticket.weekly.index');
|
||||
const result = await page.waitToGetProperty(`${selectors.ticketsIndex.sixthWeeklyTicket} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Thursday');
|
||||
});
|
||||
|
||||
it('should click on the Tickets button of the top bar menu once more', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await page.waitToClick(selectors.globalItems.ticketsButton);
|
||||
await page.waitForURL('#!/ticket/index');
|
||||
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
});
|
||||
|
||||
it('should now search for the ticket 11', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 11)
|
||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult);
|
||||
await page.waitForContentLoaded();
|
||||
await page.write(selectors.ticketsIndex.searchTicketInput, '11');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the ticket`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.ticketsIndex.searchResult);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it('should add the ticket to saturday turn using the descriptor more menu', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn)
|
||||
.waitToClick(selectors.ticketDescriptor.saturdayButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitForContentLoaded();
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||||
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn);
|
||||
await page.waitToClick(selectors.ticketDescriptor.saturdayButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should click on the Tickets button of the top bar menu once again', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.ticketsButton)
|
||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||
await page.waitToClick(selectors.globalItems.ticketsButton);
|
||||
await page.wait(selectors.ticketsIndex.searchTicketInput);
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/ticket/index');
|
||||
});
|
||||
|
||||
it('should confirm the ticket 11 was added on saturday', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.menuWeeklyTickets)
|
||||
.waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicket, 'value');
|
||||
await page.accessToSection('ticket.weekly.index');
|
||||
const result = await page.waitToGetProperty(`${selectors.ticketsIndex.sixthWeeklyTicket} input`, 'value');
|
||||
|
||||
expect(result).toEqual('Saturday');
|
||||
});
|
||||
|
||||
it('should now search for the weekly ticket 11', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchWeeklyTicketInput, 11)
|
||||
.waitToClick(selectors.ticketsIndex.searchWeeklyButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
||||
await page.write(selectors.ticketsIndex.searchTicketInput, '11');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 1);
|
||||
const result = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it('should delete the weekly ticket 11', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.firstWeeklyTicketDeleteIcon)
|
||||
.waitToClick(selectors.ticketsIndex.acceptDeleteTurn)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketsIndex.firstWeeklyTicketDeleteIcon);
|
||||
await page.waitToClick(selectors.ticketsIndex.acceptDeleteTurn);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the sixth weekly ticket was deleted', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick('vn-searchbar vn-icon[icon=clear]')
|
||||
.waitToClick(selectors.ticketsIndex.searchWeeklyButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 5)
|
||||
.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
||||
await page.waitForContentLoaded();
|
||||
await page.clearInput('vn-searchbar');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchWeeklyButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 5);
|
||||
const result = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
||||
|
||||
expect(result).toEqual(5);
|
||||
});
|
||||
|
|
|
@ -1,59 +1,58 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket purchase request path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'ticket')
|
||||
.accessToSearchResult('16')
|
||||
.accessToSection('ticket.card.request.index');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesPerson', 'ticket');
|
||||
await page.accessToSearchResult('16');
|
||||
await page.accessToSection('ticket.card.request.index');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should add a new request`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketRequests.addRequestButton)
|
||||
.write(selectors.ticketRequests.descriptionInput, 'New stuff')
|
||||
.write(selectors.ticketRequests.quantityInput, 99)
|
||||
.autocompleteSearch(selectors.ticketRequests.atenderAutocomplete, 'buyerNick')
|
||||
.write(selectors.ticketRequests.priceInput, 999)
|
||||
.waitToClick(selectors.ticketRequests.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketRequests.addRequestButton);
|
||||
await page.write(selectors.ticketRequests.descriptionInput, 'New stuff');
|
||||
await page.write(selectors.ticketRequests.quantityInput, '99');
|
||||
await page.autocompleteSearch(selectors.ticketRequests.atenderAutocomplete, 'buyerNick');
|
||||
await page.write(selectors.ticketRequests.priceInput, '999');
|
||||
await page.waitToClick(selectors.ticketRequests.saveButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should have been redirected to the request index`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForURL('/request')
|
||||
.parsedUrl();
|
||||
await page.waitForURL('/request');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/request');
|
||||
});
|
||||
|
||||
it(`should confirm the new request was added`, async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('ticket.card.request.index')
|
||||
.waitToGetProperty(selectors.ticketRequests.firstDescription, 'innerText');
|
||||
await page.reloadSection('ticket.card.request.index');
|
||||
const result = await page.waitToGetProperty(`${selectors.ticketRequests.firstDescription} input`, 'value');
|
||||
|
||||
expect(result).toEqual('New stuff');
|
||||
});
|
||||
|
||||
it(`should delete the added request`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketRequests.firstRemoveRequestButton)
|
||||
.waitForLastSnackbar();
|
||||
await page.waitToClick(selectors.ticketRequests.firstRemoveRequestButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the request was deleted`, async() => {
|
||||
const result = await nightmare
|
||||
.reloadSection('ticket.card.request.index')
|
||||
.wait(selectors.ticketRequests.addRequestButton)
|
||||
.exists(selectors.ticketRequests.request);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
await page.reloadSection('ticket.card.request.index');
|
||||
await page.wait(selectors.ticketRequests.addRequestButton);
|
||||
await page.waitForSelector(selectors.ticketRequests.request, {hidden: true});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,61 +1,66 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Ticket diary path', () => {
|
||||
const nightmare = createNightmare();
|
||||
// #2026 Fallo en relocate de descriptor popover
|
||||
xdescribe('Ticket diary path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('employee', 'ticket');
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should search for a specific ticket', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 1)
|
||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult);
|
||||
await page.write(selectors.ticketsIndex.searchTicketInput, '1');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
||||
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the ticket summary`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave')
|
||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave');
|
||||
await page.waitToClick(selectors.ticketsIndex.searchResult);
|
||||
await page.waitForURL('/summary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it(`should navigate to the item diary from the 1st sale item id descriptor popover`, async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.ticketSummary.firstSaleItemId)
|
||||
.waitToClick(selectors.ticketSummary.popoverDiaryButton)
|
||||
.waitForURL('/diary')
|
||||
.parsedUrl();
|
||||
await page.waitToClick(selectors.ticketSummary.firstSaleItemId);
|
||||
await page.waitForTransitionEnd('.vn-popover');
|
||||
await page.waitToClick(selectors.ticketSummary.popoverDiaryButton);
|
||||
await page.waitForURL('/diary');
|
||||
const url = await page.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/diary');
|
||||
});
|
||||
|
||||
it(`should check the second line id is marked as message`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.itemDiary.secondTicketId, 'className');
|
||||
|
||||
expect(result).toContain('message');
|
||||
});
|
||||
|
||||
it(`should check the third line balance is marked as message`, async() => {
|
||||
const result = await nightmare
|
||||
const result = await page
|
||||
.waitToGetProperty(`${selectors.itemDiary.fourthBalance} > span`, 'className');
|
||||
|
||||
expect(result).toContain('message');
|
||||
});
|
||||
|
||||
it(`should change to the warehouse two and check there are sales marked as negative balance`, async() => {
|
||||
const result = await nightmare
|
||||
.autocompleteSearch(selectors.itemDiary.warehouseAutocomplete, 'Warehouse Two')
|
||||
await page.autocompleteSearch(selectors.itemDiary.warehouseAutocomplete, 'Warehouse Two');
|
||||
const result = await page
|
||||
.waitToGetProperty(selectors.itemDiary.firstBalance, 'className');
|
||||
|
||||
expect(result).toContain('balance');
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue