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.
|
// Carácter predeterminado de final de línea.
|
||||||
"files.eol": "\n",
|
"files.eol": "\n",
|
||||||
"vsicons.presets.angular": false,
|
|
||||||
"eslint.autoFixOnSave": true,
|
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": true
|
"source.fixAll.eslint": true
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,5 +34,5 @@ COPY \
|
||||||
|
|
||||||
CMD ["pm2-runtime", "./back/process.yml"]
|
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
|
CMD curl -f http://localhost:3000/api/Applications/status || exit 1
|
||||||
|
|
|
@ -6,20 +6,13 @@ pipeline {
|
||||||
disableConcurrentBuilds()
|
disableConcurrentBuilds()
|
||||||
}
|
}
|
||||||
environment {
|
environment {
|
||||||
PROJECT_NAME = 'salix'
|
PROJECT_NAME = 'salix'
|
||||||
REGISTRY = 'registry.verdnatura.es'
|
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||||
PORT_MASTER_FRONT = '5002'
|
|
||||||
PORT_MASTER_BACK = '3001'
|
|
||||||
PORT_TEST_FRONT = '5001'
|
|
||||||
PORT_TEST_BACK = '4001'
|
|
||||||
TAG = "${env.BRANCH_NAME}"
|
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Checkout') {
|
stage('Checkout') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
env.STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
|
||||||
|
|
||||||
if (!env.GIT_COMMITTER_EMAIL) {
|
if (!env.GIT_COMMITTER_EMAIL) {
|
||||||
env.COMMITTER_EMAIL = sh(
|
env.COMMITTER_EMAIL = sh(
|
||||||
script: 'git --no-pager show -s --format="%ae"',
|
script: 'git --no-pager show -s --format="%ae"',
|
||||||
|
@ -29,16 +22,6 @@ pipeline {
|
||||||
env.COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL;
|
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) {
|
switch (env.BRANCH_NAME) {
|
||||||
case 'master':
|
case 'master':
|
||||||
env.NODE_ENV = 'production'
|
env.NODE_ENV = 'production'
|
||||||
|
@ -48,6 +31,14 @@ pipeline {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configFileProvider([
|
||||||
|
configFile(fileId: "salix.groovy",
|
||||||
|
variable: 'GROOVY_FILE')
|
||||||
|
]) {
|
||||||
|
load env.GROOVY_FILE
|
||||||
|
}
|
||||||
|
|
||||||
sh 'printenv'
|
sh 'printenv'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,8 +48,8 @@ pipeline {
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
nodejs('node-lts') {
|
nodejs('node-lts') {
|
||||||
sh 'npm install --no-audit'
|
sh 'npm install --no-audit --prefer-offline'
|
||||||
sh 'gulp install'
|
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 => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('sendMessage', {
|
Self.remoteMethodCtx('sendMessage', {
|
||||||
description: 'Send a RocketChat message',
|
description: 'Send a RocketChat message',
|
||||||
|
@ -24,115 +23,8 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// FIXME: Deprecate this method #2019
|
||||||
Self.sendMessage = async(ctx, to, message) => {
|
Self.sendMessage = async(ctx, to, message) => {
|
||||||
const models = Self.app.models;
|
return Self.send(ctx, to, message);
|
||||||
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);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const app = require('vn-loopback/server/server');
|
||||||
|
|
||||||
describe('chat sendMessage()', () => {
|
describe('chat send()', () => {
|
||||||
it('should return a "Fake notification sent" as response', async() => {
|
it('should return a "Fake notification sent" as response', async() => {
|
||||||
let ctx = {req: {accessToken: {userId: 1}}};
|
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.statusCode).toEqual(200);
|
||||||
expect(response.message).toEqual('Fake notification sent');
|
expect(response.message).toEqual('Fake notification sent');
|
||||||
|
@ -11,7 +11,7 @@ describe('chat sendMessage()', () => {
|
||||||
|
|
||||||
it('should not return a response', async() => {
|
it('should not return a response', async() => {
|
||||||
let ctx = {req: {accessToken: {userId: 18}}};
|
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();
|
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) => {
|
Self.removeFile = async(ctx, id) => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const trashDmsType = await models.DmsType.findOne({where: {code: 'trash'}});
|
|
||||||
const dms = await models.Dms.findById(id);
|
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);
|
const hasWriteRole = await models.DmsType.hasWriteRole(ctx, dms.dmsTypeFk);
|
||||||
if (!hasWriteRole)
|
if (!hasWriteRole)
|
||||||
|
|
|
@ -2,6 +2,7 @@ const app = require('vn-loopback/server/server');
|
||||||
|
|
||||||
describe('dms downloadFile()', () => {
|
describe('dms downloadFile()', () => {
|
||||||
let dmsId = 1;
|
let dmsId = 1;
|
||||||
|
|
||||||
it('should return a response for an employee with text content-type', async() => {
|
it('should return a response for an employee with text content-type', async() => {
|
||||||
let workerId = 107;
|
let workerId = 107;
|
||||||
let ctx = {req: {accessToken: {userId: workerId}}};
|
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": {
|
"Delivery": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"Message": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"MessageInbox": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"Province": {
|
"Province": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -59,12 +53,6 @@
|
||||||
"Postcode": {
|
"Postcode": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"UserPhoneType": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"UserPhone": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"UserLog": {
|
"UserLog": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
|
require('../methods/chat/send')(Self);
|
||||||
require('../methods/chat/sendMessage')(Self);
|
require('../methods/chat/sendMessage')(Self);
|
||||||
|
require('../methods/chat/sendCheckingPresence')(Self);
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,36 +4,39 @@
|
||||||
"base": "VnModel",
|
"base": "VnModel",
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "country"
|
"table": "country"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"id": true,
|
"id": true,
|
||||||
"description": "Identifier"
|
"description": "Identifier"
|
||||||
},
|
},
|
||||||
"country": {
|
"country": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"code": {
|
"code": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"isUeeMember": {
|
||||||
|
"type": "Boolean"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
"currency": {
|
"currency": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Currency",
|
"model": "Currency",
|
||||||
"foreignKey": "currencyFk"
|
"foreignKey": "currencyFk"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"acls": [
|
"acls": [
|
||||||
{
|
{
|
||||||
"accessType": "READ",
|
"accessType": "READ",
|
||||||
"principalType": "ROLE",
|
"principalType": "ROLE",
|
||||||
"principalId": "$everyone",
|
"principalId": "$everyone",
|
||||||
"permission": "ALLOW"
|
"permission": "ALLOW"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -3,6 +3,9 @@
|
||||||
"name": "Dms",
|
"name": "Dms",
|
||||||
"description": "Documental Managment system",
|
"description": "Documental Managment system",
|
||||||
"base": "VnModel",
|
"base": "VnModel",
|
||||||
|
"log": {
|
||||||
|
"showField": "reference"
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "dms"
|
"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
|
- script: ./loopback/server/server.js
|
||||||
name: salix-back
|
name: salix-back
|
||||||
instances: 1
|
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;
|
GROUP BY tc.itemFk, warehouseFk;
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponent
|
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
|
FROM tmp.ticketComponentBase tcb
|
||||||
JOIN bi.claims_ratio cr ON cr.Id_Cliente = vClientFk
|
JOIN claimRatio cr ON cr.clientFk = vClientFk
|
||||||
WHERE cr.recobro > 0.009;
|
WHERE cr.priceIncreasing > 0.009;
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponent
|
INSERT INTO tmp.ticketComponent
|
||||||
SELECT tcb.warehouseFk, tcb.itemFk, vManaAutoComponent, ROUND(base * (0.01 + wm.pricesModifierRate), 3) as manaAuto
|
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
|
INSERT INTO tmp.ticketComponent
|
||||||
SELECT tcb.warehouseFk,
|
SELECT tcb.warehouseFk,
|
||||||
tcb.itemFk,
|
tcb.itemFk,
|
||||||
cr.id,
|
c.id,
|
||||||
GREATEST(IFNULL(ROUND(tcb.base * cr.tax, 4), 0), tcc.minPrice - tcc.rate3)
|
GREATEST(IFNULL(ROUND(tcb.base * c.tax, 4), 0), tcc.minPrice - tcc.rate3)
|
||||||
FROM tmp.ticketComponentBase tcb
|
FROM tmp.ticketComponentBase tcb
|
||||||
JOIN componentRate cr
|
JOIN component c
|
||||||
JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk
|
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
|
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
|
INSERT INTO tmp.ticketComponent
|
||||||
SELECT tcc.warehouseFk, tcc.itemFk, vSellByPacketComponent, tcc.rate2 - tcc.rate3
|
SELECT tcc.warehouseFk, tcc.itemFk, vSellByPacketComponent, tcc.rate2 - tcc.rate3
|
||||||
|
@ -147,7 +147,7 @@ proc: BEGIN
|
||||||
vGeneralInflationCoefficient
|
vGeneralInflationCoefficient
|
||||||
* ROUND((
|
* ROUND((
|
||||||
i.compression
|
i.compression
|
||||||
* r.cm3
|
* ic.cm3
|
||||||
* IF(am.deliveryMethodFk = 1, (GREATEST(i.density, vMinimumDensityWeight) / vMinimumDensityWeight), 1)
|
* IF(am.deliveryMethodFk = 1, (GREATEST(i.density, vMinimumDensityWeight) / vMinimumDensityWeight), 1)
|
||||||
* IFNULL((z.price - z.bonus)
|
* IFNULL((z.price - z.bonus)
|
||||||
* 1/*amz.inflation*/ , 50)) / vBoxVolume, 4
|
* 1/*amz.inflation*/ , 50)) / vBoxVolume, 4
|
||||||
|
@ -156,8 +156,8 @@ proc: BEGIN
|
||||||
JOIN item i ON i.id = tcc.itemFk
|
JOIN item i ON i.id = tcc.itemFk
|
||||||
JOIN zone z ON z.id = vZoneFk
|
JOIN zone z ON z.id = vZoneFk
|
||||||
JOIN agencyMode am ON am.id = z.agencyModeFk
|
JOIN agencyMode am ON am.id = z.agencyModeFk
|
||||||
LEFT JOIN bi.rotacion r ON r.warehouse_id = tcc.warehouseFk
|
LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk
|
||||||
AND r.Id_Article = tcc.itemFk
|
AND ic.itemFk = tcc.itemFk
|
||||||
HAVING cost <> 0;
|
HAVING cost <> 0;
|
||||||
|
|
||||||
IF (SELECT COUNT(*) FROM vn.addressForPackaging WHERE addressFk = vAddressFk) THEN
|
IF (SELECT COUNT(*) FROM vn.addressForPackaging WHERE addressFk = vAddressFk) THEN
|
||||||
|
@ -178,9 +178,9 @@ proc: BEGIN
|
||||||
vSpecialPriceComponent,
|
vSpecialPriceComponent,
|
||||||
sp.value - SUM(tcc.cost) sumCost
|
sp.value - SUM(tcc.cost) sumCost
|
||||||
FROM tmp.ticketComponentCopy tcc
|
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
|
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
|
GROUP BY tcc.itemFk, tcc.warehouseFk
|
||||||
HAVING ABS(sumCost) > 0.001;
|
HAVING ABS(sumCost) > 0.001;
|
||||||
|
|
||||||
|
@ -188,10 +188,10 @@ proc: BEGIN
|
||||||
CREATE TEMPORARY TABLE tmp.ticketComponentSum
|
CREATE TEMPORARY TABLE tmp.ticketComponentSum
|
||||||
(INDEX (itemFk, warehouseFk))
|
(INDEX (itemFk, warehouseFk))
|
||||||
ENGINE = MEMORY
|
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
|
FROM tmp.ticketComponent tc
|
||||||
JOIN componentRate cr ON cr.id = tc.componentFk
|
JOIN component c ON c.id = tc.componentFk
|
||||||
GROUP BY tc.itemFk, tc.warehouseFk, cr.classRate;
|
GROUP BY tc.itemFk, tc.warehouseFk, c.classRate;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate;
|
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate;
|
||||||
CREATE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY
|
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
|
VALUES
|
||||||
(1, 978, 1, 0, 2000, 9, 0);
|
(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
|
VALUES
|
||||||
(101, 'BruceWayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es'),
|
(101, 'BruceWayne', 'Bruce Wayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es'),
|
||||||
(102, 'PetterParker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en'),
|
(102, 'PetterParker', 'Petter Parker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en'),
|
||||||
(103, 'ClarkKent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr'),
|
(103, 'ClarkKent', 'Clark Kent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr'),
|
||||||
(104, 'TonyStark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'es'),
|
(104, 'TonyStark', 'Tony Stark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'es'),
|
||||||
(105, 'MaxEisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt'),
|
(105, 'MaxEisenhardt', 'Max Eisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt'),
|
||||||
(106, 'DavidCharlesHaller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'es'),
|
(106, 'DavidCharlesHaller', 'David Charles Haller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'es'),
|
||||||
(107, 'HankPym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'es'),
|
(107, 'HankPym', 'Hank Pym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'es'),
|
||||||
(108, 'CharlesXavier', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'es'),
|
(108, 'CharlesXavier', 'Charles Xavier', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'es'),
|
||||||
(109, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'es'),
|
(109, 'BruceBanner', 'Bruce Banner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'es'),
|
||||||
(110, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'es'),
|
(110, 'JessicaJones', 'Jessica Jones', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'es'),
|
||||||
(111, 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'),
|
(111, 'Missing', 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'),
|
||||||
(112, 'Trash', '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
|
VALUES
|
||||||
(106, 'LGN', 'David Charles', 'Haller', 106, 19),
|
(106, 'LGN', 'David Charles', 'Haller', 106, 19, 432978106),
|
||||||
(107, 'ANT', 'Hank' , 'Pym' , 107, 19),
|
(107, 'ANT', 'Hank' , 'Pym' , 107, 19, 432978107),
|
||||||
(108, 'DCX', 'Charles' , 'Xavier', 108, 19),
|
(108, 'DCX', 'Charles' , 'Xavier', 108, 19, 432978108),
|
||||||
(109, 'HLK', 'Bruce' , 'Banner', 109, 19),
|
(109, 'HLK', 'Bruce' , 'Banner', 109, 19, 432978109),
|
||||||
(110, 'JJJ', 'Jessica' , 'Jones' , 110, 19);
|
(110, 'JJJ', 'Jessica' , 'Jones' , 110, 19, 432978110);
|
||||||
|
|
||||||
INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`)
|
INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'España', 0, 'ES', 1, 24),
|
(1, 'España', 1, 'ES', 1, 24),
|
||||||
(2, 'Italia', 1, 'IT', 1, 27),
|
(2, 'Italia', 1, 'IT', 1, 27),
|
||||||
(3, 'Alemania', 1, 'DE', 1, 22),
|
(3, 'Alemania', 1, 'DE', 1, 22),
|
||||||
(4, 'Rumania', 1, 'RO', 1, 24),
|
(4, 'Rumania', 1, 'RO', 1, 24),
|
||||||
(5, 'Holanda', 1, 'NL', 1, 18),
|
(5, 'Holanda', 1, 'NL', 1, 18),
|
||||||
(8, 'Portugal', 1, 'PT', 1, 27),
|
(8, 'Portugal', 1, 'PT', 1, 27),
|
||||||
|
(13,'Ecuador', 0, 'EC', 1, 24),
|
||||||
(19,'Francia', 1, 'FR', 1, 27),
|
(19,'Francia', 1, 'FR', 1, 27),
|
||||||
(30,'Canarias', 1, 'IC', 1, 24);
|
(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),
|
(1, 'Pay on receipt', '0000000000', 4, 0, 1, 1),
|
||||||
(2, 'Cash', '1111111111', 1, 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`)
|
INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `isVolumetric`, `bankFk`, `warehouseAliasFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'inhouse pickup' , 1, 0, 1, 1),
|
(1, 'inhouse pickup' , 1, 0, 1, 1),
|
||||||
|
@ -181,8 +189,8 @@ INSERT INTO `vn`.`province`(`id`, `name`, `countryFk`, `warehouseFk`)
|
||||||
(1, 'Province one', 1, NULL),
|
(1, 'Province one', 1, NULL),
|
||||||
(2, 'Province two', 1, NULL),
|
(2, 'Province two', 1, NULL),
|
||||||
(3, 'Province three', 1, NULL),
|
(3, 'Province three', 1, NULL),
|
||||||
(4, 'Province four', 1, NULL),
|
(4, 'Province four', 2, NULL),
|
||||||
(5, 'Province five', 1, NULL);
|
(5, 'Province five', 13, NULL);
|
||||||
|
|
||||||
INSERT INTO `vn`.`town`(`id`, `name`, `provinceFk`)
|
INSERT INTO `vn`.`town`(`id`, `name`, `provinceFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -216,21 +224,20 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
|
||||||
(3, 'Daily Bugle'),
|
(3, 'Daily Bugle'),
|
||||||
(4, 'GCN Channel'),
|
(4, 'GCN Channel'),
|
||||||
(5, 'The Newspaper');
|
(5, 'The Newspaper');
|
||||||
|
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`)
|
||||||
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`)
|
|
||||||
VALUES
|
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),
|
(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, 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),
|
(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, 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),
|
(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, 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),
|
(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, 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),
|
(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, 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),
|
(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, 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),
|
(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, 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),
|
(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, 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),
|
(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, 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),
|
(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, 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),
|
(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, 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`)
|
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
|
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`)
|
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`)
|
||||||
VALUES
|
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),
|
(2, 'T', 121.36, CURDATE(), 102, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
|
||||||
(3, 'T', 8.88, CURDATE(), 103, 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),
|
(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 = 'T1111111' WHERE id = 1;
|
||||||
UPDATE `vn`.`invoiceOut` SET ref = 'T2222222' WHERE id = 2;
|
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),
|
('T', 'Española rapida', 1, 'NATIONAL', 0),
|
||||||
('V', 'Intracomunitaria global', 0, 'CEE', 1);
|
('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
|
VALUES
|
||||||
(1, 'Zone pickup A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 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),
|
(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),
|
(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),
|
(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),
|
(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),
|
(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),
|
(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),
|
(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),
|
(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),
|
(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),
|
(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),
|
(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);
|
(13, 'Zone quantum break', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 5, 0, 0, 0, NULL);
|
||||||
|
|
||||||
INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`)
|
INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -643,7 +650,8 @@ INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk
|
||||||
(2, 'ITG', 'Anthurium', 1, 31, 5, 0),
|
(2, 'ITG', 'Anthurium', 1, 31, 5, 0),
|
||||||
(3, 'WPN', 'Paniculata', 2, 31, 5, 0),
|
(3, 'WPN', 'Paniculata', 2, 31, 5, 0),
|
||||||
(4, 'PRT', 'Delivery ports', 3, NULL, 5, 1),
|
(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`)
|
INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`)
|
||||||
VALUES
|
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'),
|
(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');
|
(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
|
VALUES
|
||||||
(101, 500, NULL, 0.00, 0.00, 1.00),
|
(101, 500, NULL, 0.00, 0.00, 1.00),
|
||||||
(102, 1000, 2.00, 0.01, 0.05, 1.00),
|
(102, 1000, 2.00, 0.01, 0.05, 1.00),
|
||||||
(103, 2000, 0.00, 0.00, 0.02, 1.00),
|
(103, 2000, 0.00, 0.00, 0.02, 1.00),
|
||||||
(104, 2500, 150.00, 0.02, 0.10, 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`)
|
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
|
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)),
|
(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()),
|
(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());
|
(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`)
|
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
|
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)),
|
(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`;
|
FROM `postgresql`.`person` `p`;
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`business`(`business_id`, `client_id`, `provider_id`, `date_start`, `date_end`, `workerBusiness`, `reasonEndFk`)
|
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`;
|
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`)
|
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`)
|
INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`)
|
||||||
VALUES
|
VALUES
|
||||||
(106, 1, DATE_ADD(CURDATE(), INTERVAL 10 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, DATE_ADD(CURDATE(), INTERVAL 11 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, DATE_ADD(CURDATE(), INTERVAL 12 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, DATE_ADD(CURDATE(), INTERVAL 20 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, DATE_ADD(CURDATE(), INTERVAL -10 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, DATE_ADD(CURDATE(), INTERVAL -12 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, DATE_ADD(CURDATE(), INTERVAL -20 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, 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, DATE_ADD(CURDATE(), INTERVAL 16 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, DATE_ADD(CURDATE(), INTERVAL 20 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, DATE_ADD(CURDATE(), INTERVAL 30 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, DATE_ADD(CURDATE(), INTERVAL -10 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, DATE_ADD(CURDATE(), INTERVAL -12 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, DATE_ADD(CURDATE(), INTERVAL -20 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`)
|
INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`)
|
||||||
VALUES
|
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 +5 DAY)),
|
||||||
(8, 'day', DATE_ADD(CURDATE(), INTERVAL +6 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
|
VALUES
|
||||||
(106, CONCAT(CURDATE(), ' 07:00'), 1, TRUE, 'in'),
|
(106, CONCAT(CURDATE(), ' 07:00'), TRUE, 'in'),
|
||||||
(106, CONCAT(CURDATE(), ' 10:00'), 2, TRUE, 'middle'),
|
(106, CONCAT(CURDATE(), ' 10:00'), TRUE, 'middle'),
|
||||||
(106, CONCAT(CURDATE(), ' 10:10'), 3, TRUE, 'middle'),
|
(106, CONCAT(CURDATE(), ' 10:10'), TRUE, 'middle'),
|
||||||
(106, CONCAT(CURDATE(), ' 15:00'), 4, TRUE, 'out');
|
(106, CONCAT(CURDATE(), ' 15:00'), TRUE, 'out');
|
||||||
|
|
||||||
INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`, `code`)
|
INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`, `code`)
|
||||||
VALUES
|
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()),
|
(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()),
|
(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()),
|
(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`)
|
INSERT INTO `vn`.`ticketDms`(`ticketFk`, `dmsFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1926,75 +1941,33 @@ INSERT INTO `vn`.`queuePriority`(`id`, `priority`)
|
||||||
(2, 'Normal'),
|
(2, 'Normal'),
|
||||||
(3, 'Baja');
|
(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`)
|
INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `weekScope`, `dayWorkMax`, `dayStayMax`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 43200, 129600, 734400, 43200, 50400);
|
(1, 43200, 129600, 734400, 43200, 50400);
|
||||||
|
|
||||||
INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11');
|
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
|
state
|
||||||
sample
|
sample
|
||||||
department
|
department
|
||||||
)
|
component
|
||||||
dump_tables ${TABLES[@]}
|
componentType
|
||||||
|
|
||||||
TABLES=(
|
|
||||||
bi
|
|
||||||
tarifa_componentes
|
|
||||||
tarifa_componentes_series
|
|
||||||
)
|
)
|
||||||
dump_tables ${TABLES[@]}
|
dump_tables ${TABLES[@]}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
SCHEMAS=(
|
SCHEMAS=(
|
||||||
account
|
account
|
||||||
bi
|
bs
|
||||||
cache
|
cache
|
||||||
edi
|
edi
|
||||||
hedera
|
hedera
|
||||||
|
|
|
@ -48,7 +48,7 @@ describe('buyUltimate()', () => {
|
||||||
expect(buyUltimateTable[1].buyFk).toEqual(4);
|
expect(buyUltimateTable[1].buyFk).toEqual(4);
|
||||||
expect(buyUltimateTable[0].buyFk).toEqual(3);
|
expect(buyUltimateTable[0].buyFk).toEqual(3);
|
||||||
expect(buyUltimateTable[2].buyFk).toEqual(5);
|
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[4].buyFk).toEqual(6);
|
||||||
expect(buyUltimateTable[5].buyFk).toEqual(7);
|
expect(buyUltimateTable[5].buyFk).toEqual(7);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,28 +1,45 @@
|
||||||
version: '3.5'
|
version: '3.7'
|
||||||
services:
|
services:
|
||||||
front:
|
front:
|
||||||
image: registry.verdnatura.es/salix-front:${TAG}
|
image: registry.verdnatura.es/salix-front:${BRANCH_NAME:?}
|
||||||
restart: unless-stopped
|
build:
|
||||||
build:
|
context: .
|
||||||
context: .
|
dockerfile: front/Dockerfile
|
||||||
dockerfile: front/Dockerfile
|
ports:
|
||||||
ports:
|
- 80
|
||||||
- ${PORT_FRONT}:80
|
deploy:
|
||||||
links:
|
replicas: 3
|
||||||
- back
|
back:
|
||||||
deploy:
|
image: registry.verdnatura.es/salix-back:${BRANCH_NAME:?}
|
||||||
replicas: 3
|
build: .
|
||||||
back:
|
ports:
|
||||||
image: registry.verdnatura.es/salix-back:${TAG}
|
- 3000
|
||||||
restart: unless-stopped
|
environment:
|
||||||
build: .
|
- NODE_ENV
|
||||||
ports:
|
configs:
|
||||||
- ${PORT_BACK}:3000
|
- source: datasources
|
||||||
environment:
|
target: /etc/salix/datasources.json
|
||||||
- NODE_ENV
|
- source: datasources_local
|
||||||
volumes:
|
target: /etc/salix/datasources.local.json
|
||||||
- /mnt/storage/containers/salix:/etc/salix
|
- source: print
|
||||||
- /mnt/storage/pdfs:/var/lib/salix/pdfs
|
target: /etc/salix/print.json
|
||||||
- /mnt/storage/dms:/var/lib/salix/dms
|
- source: print_local
|
||||||
deploy:
|
target: /etc/salix/print.local.json
|
||||||
replicas: 6
|
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" */
|
/* eslint no-invalid-this: "off" */
|
||||||
|
import {url as defaultURL} from './config';
|
||||||
import Nightmare from 'nightmare';
|
|
||||||
import {URL} from 'url';
|
|
||||||
import config from './config.js';
|
|
||||||
|
|
||||||
let currentUser;
|
|
||||||
|
|
||||||
let actions = {
|
let actions = {
|
||||||
clickIfExists: async function(selector) {
|
clickIfExists: async function(selector) {
|
||||||
let exists = await this.exists(selector);
|
let exists;
|
||||||
if (exists) await this.click(selector);
|
try {
|
||||||
|
exists = await this.waitForSelector(selector, {timeout: 500});
|
||||||
|
} catch (error) {
|
||||||
|
exists = false;
|
||||||
|
}
|
||||||
|
if (exists) await this.waitToClick(selector);
|
||||||
return exists;
|
return exists;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -26,54 +26,43 @@ let actions = {
|
||||||
changeLanguageToEnglish: async function() {
|
changeLanguageToEnglish: async function() {
|
||||||
let langSelector = '.user-popover vn-autocomplete[ng-model="$ctrl.lang"]';
|
let langSelector = '.user-popover vn-autocomplete[ng-model="$ctrl.lang"]';
|
||||||
|
|
||||||
let lang = await this.waitToClick('#user')
|
await this.waitToClick('#user');
|
||||||
.wait(langSelector)
|
await this.wait(langSelector);
|
||||||
.waitToGetProperty(`${langSelector} input`, 'value');
|
let lang = await this.waitToGetProperty(`${langSelector} input`, 'value');
|
||||||
|
|
||||||
if (lang !== 'English')
|
if (lang !== 'English')
|
||||||
await this.autocompleteSearch(langSelector, 'English');
|
await this.autocompleteSearch(langSelector, 'English');
|
||||||
|
|
||||||
|
await this.keyboard.press('Escape');
|
||||||
|
await this.waitForSelector(langSelector, {hidden: true});
|
||||||
},
|
},
|
||||||
|
|
||||||
doLogin: async function(userName, password) {
|
doLogin: async function(userName, password = 'nightmare') {
|
||||||
if (password == null) password = 'nightmare';
|
await this.wait(`vn-login [ng-model="$ctrl.user"]`);
|
||||||
await this.wait(`vn-login [name=user]`)
|
await this.clearInput(`vn-login [ng-model="$ctrl.user"]`);
|
||||||
.clearInput(`vn-login [name=user]`)
|
await this.write(`vn-login [ng-model="$ctrl.user"]`, userName);
|
||||||
.write(`vn-login [name=user]`, userName)
|
await this.clearInput(`vn-login [ng-model="$ctrl.password"]`);
|
||||||
.write(`vn-login [name=password]`, password)
|
await this.write(`vn-login [ng-model="$ctrl.password"]`, password);
|
||||||
.click(`vn-login button[type=submit]`);
|
await this.click('vn-login button[type=submit]');
|
||||||
},
|
},
|
||||||
|
|
||||||
login: async function(userName) {
|
login: async function(userName) {
|
||||||
if (currentUser !== userName) {
|
try {
|
||||||
let accountClicked = await this.clickIfExists('#user');
|
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) {
|
await this.doLogin(userName);
|
||||||
let buttonSelector = '.vn-dialog.shown button[response=accept]';
|
await this.wait(() => {
|
||||||
await this.waitToClick('#logout')
|
return document.location.hash === '#!/';
|
||||||
.wait(buttonSelector => {
|
}, {});
|
||||||
return document.querySelector(buttonSelector) != null
|
await this.changeLanguageToEnglish();
|
||||||
|| 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);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
selectModule: async function(moduleName) {
|
selectModule: async function(moduleName) {
|
||||||
|
@ -81,13 +70,14 @@ let actions = {
|
||||||
return m[0] + '-' + m[1];
|
return m[0] + '-' + m[1];
|
||||||
}).toLowerCase();
|
}).toLowerCase();
|
||||||
|
|
||||||
await this.waitToClick(`vn-home a[ui-sref="${moduleName}.index"]`)
|
let selector = `vn-home a[ui-sref="${moduleName}.index"]`;
|
||||||
.waitForURL(snakeName);
|
await this.waitToClick(selector);
|
||||||
|
await this.waitForURL(snakeName);
|
||||||
},
|
},
|
||||||
|
|
||||||
loginAndModule: async function(userName, moduleName) {
|
loginAndModule: async function(userName, moduleName) {
|
||||||
await this.login(userName)
|
await this.login(userName);
|
||||||
.selectModule(moduleName);
|
await this.selectModule(moduleName);
|
||||||
},
|
},
|
||||||
|
|
||||||
datePicker: async function(selector, changeMonth, day) {
|
datePicker: async function(selector, changeMonth, day) {
|
||||||
|
@ -96,369 +86,434 @@ let actions = {
|
||||||
date.setDate(day ? day : 16);
|
date.setDate(day ? day : 16);
|
||||||
date = date.toISOString().substr(0, 10);
|
date = date.toISOString().substr(0, 10);
|
||||||
|
|
||||||
await this.wait(selector)
|
await this.wait(selector);
|
||||||
.evaluate((selector, date) => {
|
await this.evaluate((selector, date) => {
|
||||||
let input = document.querySelector(selector).$ctrl.input;
|
let input = document.querySelector(selector).$ctrl.input;
|
||||||
input.value = date;
|
input.value = date;
|
||||||
input.dispatchEvent(new Event('change'));
|
input.dispatchEvent(new Event('change'));
|
||||||
}, selector, date);
|
}, selector, date);
|
||||||
},
|
},
|
||||||
|
|
||||||
pickTime: async function(selector, time) {
|
pickTime: async function(selector, time) {
|
||||||
await this.wait(selector)
|
await this.wait(selector);
|
||||||
.evaluate((selector, time) => {
|
await this.evaluate((selector, time) => {
|
||||||
let input = document.querySelector(selector).$ctrl.input;
|
let input = document.querySelector(selector).$ctrl.input;
|
||||||
input.value = time;
|
input.value = time;
|
||||||
input.dispatchEvent(new Event('change'));
|
input.dispatchEvent(new Event('change'));
|
||||||
}, selector, time);
|
}, selector, time);
|
||||||
},
|
},
|
||||||
|
|
||||||
clearTextarea: function(selector) {
|
clearTextarea: async function(selector) {
|
||||||
return this.wait(selector)
|
await this.wait(selector);
|
||||||
.evaluate(inputSelector => {
|
await this.evaluate(inputSelector => {
|
||||||
return document.querySelector(inputSelector).value = '';
|
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);
|
}, 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) {
|
getProperty: async function(selector, property) {
|
||||||
return this.wait(selector)
|
return await this.evaluate((selector, property) => {
|
||||||
.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) => {
|
|
||||||
return document.querySelector(selector)[property].replace(/\s+/g, ' ').trim();
|
return document.querySelector(selector)[property].replace(/\s+/g, ' ').trim();
|
||||||
}, selector, property);
|
}, selector, property);
|
||||||
},
|
},
|
||||||
|
|
||||||
waitPropertyLength: function(selector, property, minLength) {
|
waitPropertyLength: async function(selector, property, minLength) {
|
||||||
return this.wait((selector, property, minLength) => {
|
await this.wait((selector, property, minLength) => {
|
||||||
const element = document.querySelector(selector);
|
const element = document.querySelector(selector);
|
||||||
return element && element[property] != null && element[property] !== '' && element[property].length >= minLength;
|
return element && element[property] != null && element[property] !== '' && element[property].length >= minLength;
|
||||||
}, selector, property, minLength)
|
}, {}, selector, property, minLength);
|
||||||
.getProperty(selector, property);
|
return await this.getProperty(selector, property);
|
||||||
},
|
},
|
||||||
|
|
||||||
waitPropertyValue: function(selector, property, status) {
|
waitPropertyValue: async function(selector, property, status) {
|
||||||
return this.wait(selector)
|
await this.waitForSelector(selector);
|
||||||
.wait((selector, property, status) => {
|
return await this.waitForFunction((selector, property, status) => {
|
||||||
const element = document.querySelector(selector);
|
|
||||||
return element[property] === status;
|
|
||||||
}, selector, property, status);
|
|
||||||
},
|
|
||||||
|
|
||||||
waitToGetProperty: function(selector, property) {
|
|
||||||
return this.wait((selector, property) => {
|
|
||||||
const element = document.querySelector(selector);
|
const element = document.querySelector(selector);
|
||||||
|
return element[property] === status;
|
||||||
return element && element[property] != null && element[property] !== '';
|
}, {}, selector, property, status);
|
||||||
}, selector, property)
|
|
||||||
.getProperty(selector, property);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
write: function(selector, text) {
|
waitToGetProperty: async function(selector, property) {
|
||||||
return this.wait(selector)
|
try {
|
||||||
.type(selector, text);
|
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) {
|
write: async function(selector, text) {
|
||||||
return this.wait(selector)
|
await this.waitForSelector(selector, {});
|
||||||
.click(selector);
|
await this.type(`${selector} input`, text);
|
||||||
|
await this.waitForTextInInput(selector, text);
|
||||||
},
|
},
|
||||||
|
|
||||||
focusElement: function(selector) {
|
waitToClick: async function(selector) {
|
||||||
return this.wait(selector)
|
await this.waitForSelector(selector, {});
|
||||||
.evaluate(selector => {
|
await this.click(selector, {waitUntil: 'domcontentloaded'});
|
||||||
let element = document.querySelector(selector);
|
|
||||||
element.focus();
|
|
||||||
}, selector);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isVisible: function(selector) {
|
focusElement: async function(selector) {
|
||||||
return this.wait(selector)
|
await this.wait(selector);
|
||||||
.evaluate(elementSelector => {
|
return await this.evaluate(selector => {
|
||||||
let selectorMatches = document.querySelectorAll(elementSelector);
|
let element = document.querySelector(selector);
|
||||||
let element = selectorMatches[0];
|
element.focus();
|
||||||
|
}, selector);
|
||||||
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);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
waitImgLoad: function(selector) {
|
isVisible: async function(selector) {
|
||||||
return this.wait(selector)
|
await this.wait(selector);
|
||||||
.wait(selector => {
|
return await this.evaluate(elementSelector => {
|
||||||
const imageReady = document.querySelector(selector).complete;
|
let selectorMatches = document.querySelectorAll(elementSelector);
|
||||||
return imageReady;
|
let element = selectorMatches[0];
|
||||||
}, selector);
|
|
||||||
|
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) {
|
waitImgLoad: async function(selector) {
|
||||||
return this.wait(selector)
|
await this.wait(selector);
|
||||||
.isVisible(selector)
|
return await this.wait(selector => {
|
||||||
.then(visible => {
|
const imageReady = document.querySelector(selector).complete;
|
||||||
if (visible)
|
return imageReady;
|
||||||
return this.click(selector);
|
}, {}, selector);
|
||||||
|
|
||||||
throw new Error(`invisible selector: ${selector}`);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
countElement: function(selector) {
|
clickIfVisible: async function(selector) {
|
||||||
return this.evaluate(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;
|
return document.querySelectorAll(selector).length;
|
||||||
}, selector);
|
}, selector);
|
||||||
},
|
},
|
||||||
|
|
||||||
waitForNumberOfElements: function(selector, count) {
|
waitForNumberOfElements: async function(selector, count) {
|
||||||
return this.wait((selector, count) => {
|
return await this.waitForFunction((selector, count) => {
|
||||||
return document.querySelectorAll(selector).length === count;
|
return document.querySelectorAll(selector).length === count;
|
||||||
}, selector, count);
|
}, {}, selector, count);
|
||||||
},
|
},
|
||||||
|
|
||||||
waitForClassNotPresent: function(selector, className) {
|
waitForClassNotPresent: async function(selector, className) {
|
||||||
return this.wait(selector)
|
await this.wait(selector);
|
||||||
.wait((selector, className) => {
|
return await this.wait((selector, className) => {
|
||||||
if (!document.querySelector(selector).classList.contains(className))
|
if (!document.querySelector(selector).classList.contains(className))
|
||||||
return true;
|
return true;
|
||||||
}, selector, className);
|
}, {}, selector, className);
|
||||||
},
|
},
|
||||||
|
|
||||||
waitForClassPresent: function(selector, className) {
|
waitForClassPresent: async function(selector, className) {
|
||||||
return this.wait(selector)
|
await this.wait(selector);
|
||||||
.wait((elementSelector, targetClass) => {
|
return await this.wait((elementSelector, targetClass) => {
|
||||||
if (document.querySelector(elementSelector).classList.contains(targetClass))
|
if (document.querySelector(elementSelector).classList.contains(targetClass))
|
||||||
return true;
|
return true;
|
||||||
}, selector, className);
|
}, {}, selector, className);
|
||||||
},
|
},
|
||||||
|
|
||||||
waitForTextInElement: function(selector, text) {
|
waitForTextInElement: async function(selector, text) {
|
||||||
return this.wait(selector)
|
await this.wait(selector);
|
||||||
.wait((selector, text) => {
|
return await this.wait((selector, text) => {
|
||||||
return document.querySelector(selector).innerText.toLowerCase().includes(text.toLowerCase());
|
return document.querySelector(selector).innerText.toLowerCase().includes(text.toLowerCase());
|
||||||
}, selector, text);
|
}, {}, selector, text);
|
||||||
},
|
},
|
||||||
|
|
||||||
waitForTextInInput: function(selector, text) {
|
waitForTextInInput: async function(selector, text) {
|
||||||
return this.wait(selector)
|
await this.wait(selector);
|
||||||
.wait((selector, text) => {
|
return await this.wait((selector, text) => {
|
||||||
return document.querySelector(selector).value.toLowerCase().includes(text.toLowerCase());
|
return document.querySelector(`${selector} input`).value.toLowerCase().includes(text.toLowerCase());
|
||||||
}, selector, text);
|
}, {}, selector, text);
|
||||||
},
|
},
|
||||||
|
|
||||||
waitForInnerText: function(selector) {
|
waitForInnerText: async function(selector) {
|
||||||
return this.wait(selector)
|
await this.waitForSelector(selector, {});
|
||||||
.wait(selector => {
|
await this.waitForFunction(selector => {
|
||||||
const innerText = document.querySelector(selector).innerText;
|
const innerText = document.querySelector(selector).innerText;
|
||||||
return innerText != null && innerText != '';
|
return innerText != null && innerText != '';
|
||||||
}, selector)
|
}, {}, selector);
|
||||||
.evaluate(selector => {
|
return await this.evaluate(selector => {
|
||||||
return document.querySelector(selector).innerText;
|
return document.querySelector(selector).innerText;
|
||||||
}, selector);
|
}, selector);
|
||||||
},
|
},
|
||||||
|
|
||||||
waitForEmptyInnerText: function(selector) {
|
waitForEmptyInnerText: async function(selector) {
|
||||||
return this.wait(selector => {
|
return await this.wait(selector => {
|
||||||
return document.querySelector(selector).innerText == '';
|
return document.querySelector(selector).innerText == '';
|
||||||
}, selector);
|
}, selector);
|
||||||
},
|
},
|
||||||
|
|
||||||
waitForURL: function(hashURL) {
|
waitForURL: async function(hashURL) {
|
||||||
return this.wait(hash => {
|
await this.waitForFunction(expectedHash => {
|
||||||
return document.location.hash.includes(hash);
|
return document.location.hash.includes(expectedHash);
|
||||||
}, hashURL);
|
}, {}, hashURL);
|
||||||
},
|
},
|
||||||
|
|
||||||
waitForShapes: function(selector) {
|
hideSnackbar: async function() {
|
||||||
return this.wait(selector)
|
await this.waitToClick('#shapes .shown button');
|
||||||
.evaluate(selector => {
|
},
|
||||||
const shapes = document.querySelectorAll(selector);
|
|
||||||
const shapesList = [];
|
|
||||||
|
|
||||||
for (const shape of shapes)
|
waitForLastShape: async function(selector) {
|
||||||
shapesList.push(shape.innerText);
|
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);
|
}, selector);
|
||||||
},
|
|
||||||
waitForSnackbar: function() {
|
|
||||||
return this.wait(500)
|
|
||||||
.waitForShapes('vn-snackbar .shape .text');
|
|
||||||
},
|
|
||||||
|
|
||||||
waitForLastShape: function(selector) {
|
await this.write(`.vn-drop-down.shown`, searchValue);
|
||||||
return this.wait(selector)
|
await this.waitForFunction((selector, searchValue) => {
|
||||||
.evaluate(selector => {
|
let element = document
|
||||||
const shape = document.querySelector(selector);
|
.querySelector(`${selector} vn-drop-down`).$ctrl.content
|
||||||
|
.querySelector('li.active');
|
||||||
|
if (element)
|
||||||
|
return element.innerText.toLowerCase().includes(searchValue.toLowerCase());
|
||||||
|
}, {}, selector, searchValue);
|
||||||
|
|
||||||
return shape.innerText;
|
await this.keyboard.press('Enter');
|
||||||
}, selector);
|
await this.waitForFunction((selector, searchValue) => {
|
||||||
},
|
return document.querySelector(`${selector} input`).value.toLowerCase()
|
||||||
|
|
||||||
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()
|
|
||||||
.includes(searchValue.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) {
|
reloadSection: async function(sectionRoute) {
|
||||||
return this.waitToClick('vn-icon[icon="desktop_windows"]')
|
await this.waitFor(1000);
|
||||||
.wait('vn-card.summary')
|
await Promise.all([
|
||||||
.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
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) {
|
forceReloadSection: async function(sectionRoute) {
|
||||||
return this.waitToClick('vn-icon[icon="desktop_windows"]')
|
await this.waitToClick('vn-icon[icon="desktop_windows"]');
|
||||||
.waitToClick('button[response="accept"]')
|
await this.waitToClick('button[response="accept"]');
|
||||||
.wait('vn-card.summary')
|
await this.wait('vn-card.summary');
|
||||||
.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
await this.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
|
||||||
},
|
},
|
||||||
|
|
||||||
checkboxState: function(selector) {
|
checkboxState: async function(selector) {
|
||||||
return this.wait(selector)
|
await this.wait(selector);
|
||||||
.evaluate(selector => {
|
return await this.evaluate(selector => {
|
||||||
let checkbox = document.querySelector(selector);
|
let checkbox = document.querySelector(selector);
|
||||||
switch (checkbox.$ctrl.field) {
|
switch (checkbox.$ctrl.field) {
|
||||||
case null:
|
case null:
|
||||||
return 'intermediate';
|
return 'intermediate';
|
||||||
case true:
|
case true:
|
||||||
return 'checked';
|
return 'checked';
|
||||||
default:
|
default:
|
||||||
return 'unchecked';
|
return 'unchecked';
|
||||||
}
|
}
|
||||||
}, selector);
|
}, selector);
|
||||||
},
|
},
|
||||||
|
|
||||||
isDisabled: function(selector) {
|
isDisabled: async function(selector) {
|
||||||
return this.wait(selector)
|
await this.wait(selector);
|
||||||
.evaluate(selector => {
|
return await this.evaluate(selector => {
|
||||||
let element = document.querySelector(selector);
|
let element = document.querySelector(selector);
|
||||||
return element.$ctrl.disabled;
|
return element.$ctrl.disabled;
|
||||||
}, selector);
|
}, selector);
|
||||||
},
|
},
|
||||||
|
|
||||||
waitForStylePresent: function(selector, property, value) {
|
waitForStylePresent: async function(selector, property, value) {
|
||||||
return this.wait((selector, property, value) => {
|
return await this.wait((selector, property, value) => {
|
||||||
const element = document.querySelector(selector);
|
const element = document.querySelector(selector);
|
||||||
return element.style[property] == value;
|
return element.style[property] == value;
|
||||||
}, selector, property, value);
|
}, {}, selector, property, value);
|
||||||
},
|
},
|
||||||
|
|
||||||
waitForSpinnerLoad: function() {
|
waitForSpinnerLoad: async function() {
|
||||||
return this.waitUntilNotPresent('vn-topbar vn-spinner');
|
await this.waitUntilNotPresent('vn-topbar vn-spinner');
|
||||||
},
|
},
|
||||||
|
|
||||||
waitForWatcherData: function(selector) {
|
waitForWatcherData: async function(selector) {
|
||||||
return this.wait(selector)
|
await this.wait(selector);
|
||||||
.wait(selector => {
|
await this.wait(selector => {
|
||||||
const watcher = document.querySelector(selector);
|
let watcher = document.querySelector(selector);
|
||||||
let orgData = watcher.$ctrl.orgData;
|
let orgData = watcher.$ctrl.orgData;
|
||||||
return !angular.equals({}, orgData) && orgData != null;
|
return !angular.equals({}, orgData) && orgData != null;
|
||||||
}, selector)
|
}, {}, selector);
|
||||||
.waitForSpinnerLoad();
|
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) {
|
export function extendPage(page) {
|
||||||
Nightmare.action(name, function(...args) {
|
for (let name in actions) {
|
||||||
let fnArgs = args.slice(0, args.length - 1);
|
page[name] = async(...args) => {
|
||||||
let done = args[args.length - 1];
|
return await actions[name].call(page, ...args);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
actions[name].apply(this, fnArgs)
|
page.wait = page.waitFor;
|
||||||
.then(res => done(null, res))
|
|
||||||
.catch(err => {
|
|
||||||
let stringArgs = fnArgs
|
|
||||||
.map(i => typeof i == 'function' ? 'Function' : i)
|
|
||||||
.join(', ');
|
|
||||||
|
|
||||||
let orgMessage = err.message.startsWith('.wait()')
|
return page;
|
||||||
? '.wait() timed out'
|
|
||||||
: err.message;
|
|
||||||
|
|
||||||
done(new Error(`.${name}(${stringArgs}) failed: ${orgMessage}`));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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"]',
|
userLocalCompany: '.user-popover vn-autocomplete[ng-model="$ctrl.localCompanyFk"]',
|
||||||
userWarehouse: '.user-popover vn-autocomplete[ng-model="$ctrl.warehouseFk"]',
|
userWarehouse: '.user-popover vn-autocomplete[ng-model="$ctrl.warehouseFk"]',
|
||||||
userCompany: '.user-popover vn-autocomplete[ng-model="$ctrl.companyFk"]',
|
userCompany: '.user-popover vn-autocomplete[ng-model="$ctrl.companyFk"]',
|
||||||
userConfigFirstAutocompleteClear: '#localWarehouse .icons > vn-icon[icon=clear]',
|
userConfigFirstAutocomplete: '#localWarehouse',
|
||||||
userConfigSecondAutocompleteClear: '#localBank .icons > vn-icon[icon=clear]',
|
userConfigSecondAutocomplete: '#localBank',
|
||||||
userConfigThirdAutocompleteClear: '#localCompany .icons > vn-icon[icon=clear]',
|
userConfigThirdAutocomplete: '#localCompany',
|
||||||
acceptButton: '.vn-confirm.shown button[response=accept]'
|
acceptButton: '.vn-confirm.shown button[response=accept]'
|
||||||
},
|
},
|
||||||
clientsIndex: {
|
clientsIndex: {
|
||||||
searchClientInput: `vn-textfield input`,
|
searchClientInput: 'vn-topbar',
|
||||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||||
searchResult: 'vn-client-index .vn-item',
|
searchResult: 'vn-client-index .vn-item',
|
||||||
createClientButton: `vn-float-button`,
|
createClientButton: `vn-float-button`,
|
||||||
othersButton: 'vn-left-menu li[name="Others"] > a'
|
othersButton: 'vn-left-menu li[name="Others"] > a'
|
||||||
},
|
},
|
||||||
createClientView: {
|
createClientView: {
|
||||||
name: `vn-textfield input[name="name"]`,
|
name: `vn-client-create [ng-model="$ctrl.client.name"]`,
|
||||||
taxNumber: `vn-textfield input[name="fi"]`,
|
taxNumber: 'vn-client-create [ng-model="$ctrl.client.fi"]',
|
||||||
socialName: `vn-textfield input[name="socialName"]`,
|
socialName: 'vn-client-create [ng-model="$ctrl.client.socialName"]',
|
||||||
street: `vn-textfield input[name="street"]`,
|
street: 'vn-client-create [ng-model="$ctrl.client.street"]',
|
||||||
postcode: `vn-textfield input[name="postcode"]`,
|
postcode: 'vn-client-create [ng-model="$ctrl.client.postcode"]',
|
||||||
city: `vn-textfield input[name="city"]`,
|
city: 'vn-client-create [ng-model="$ctrl.client.city"]',
|
||||||
province: `vn-autocomplete[ng-model="$ctrl.client.provinceFk"]`,
|
province: `vn-autocomplete[ng-model="$ctrl.client.provinceFk"]`,
|
||||||
country: `vn-autocomplete[ng-model="$ctrl.client.countryFk"]`,
|
country: `vn-autocomplete[ng-model="$ctrl.client.countryFk"]`,
|
||||||
userName: `vn-textfield input[name="userName"]`,
|
userName: 'vn-client-create [ng-model="$ctrl.client.userName"]',
|
||||||
email: `vn-textfield input[name="email"]`,
|
email: 'vn-client-create [ng-model="$ctrl.client.email"]',
|
||||||
salesPersonAutocomplete: `vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]`,
|
salesPersonAutocomplete: `vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]`,
|
||||||
createButton: `button[type=submit]`,
|
createButton: `button[type=submit]`,
|
||||||
cancelButton: 'vn-button[href="#!/client/index"]'
|
cancelButton: 'vn-button[href="#!/client/index"]'
|
||||||
|
@ -48,22 +48,24 @@ export default {
|
||||||
},
|
},
|
||||||
clientBasicData: {
|
clientBasicData: {
|
||||||
basicDataButton: 'vn-left-menu a[ui-sref="client.card.basicData"]',
|
basicDataButton: 'vn-left-menu a[ui-sref="client.card.basicData"]',
|
||||||
nameInput: 'vn-textfield[ng-model="$ctrl.client.name"] input',
|
nameInput: 'vn-client-basic-data [ng-model="$ctrl.client.name"]',
|
||||||
contactInput: 'vn-textfield[ng-model="$ctrl.client.contact"] input',
|
contactInput: 'vn-client-basic-data [ng-model="$ctrl.client.contact"]',
|
||||||
emailInput: 'vn-textfield[ng-model="$ctrl.client.email"] input',
|
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"]',
|
salesPersonAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]',
|
||||||
channelAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.contactChannelFk"]',
|
channelAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.contactChannelFk"]',
|
||||||
saveButton: `button[type=submit]`
|
saveButton: `button[type=submit]`
|
||||||
},
|
},
|
||||||
clientFiscalData: {
|
clientFiscalData: {
|
||||||
fiscalDataButton: 'vn-left-menu a[ui-sref="client.card.fiscalData"]',
|
fiscalDataButton: 'vn-left-menu a[ui-sref="client.card.fiscalData"]',
|
||||||
socialNameInput: `vn-textfield input[name="socialName"]`,
|
socialNameInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.socialName"]',
|
||||||
fiscalIdInput: `vn-textfield input[name="fi"]`,
|
fiscalIdInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.fi"]',
|
||||||
equalizationTaxCheckbox: 'vn-check[ng-model="$ctrl.client.isEqualizated"]',
|
equalizationTaxCheckbox: 'vn-check[ng-model="$ctrl.client.isEqualizated"]',
|
||||||
acceptPropagationButton: '.vn-confirm.shown button[response=accept]',
|
acceptPropagationButton: '.vn-confirm.shown button[response=accept]',
|
||||||
addressInput: `vn-textfield input[name="street"]`,
|
addressInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.street"]',
|
||||||
postcodeInput: `vn-textfield input[name="postcode"]`,
|
postcodeInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.postcode"]',
|
||||||
cityInput: `vn-textfield input[name="city"]`,
|
cityInput: 'vn-client-fiscal-data [ng-model="$ctrl.client.city"]',
|
||||||
provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.provinceFk"]',
|
provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.provinceFk"]',
|
||||||
countryAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.countryFk"]',
|
countryAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.countryFk"]',
|
||||||
activeCheckbox: 'vn-check[label="Active"]',
|
activeCheckbox: 'vn-check[label="Active"]',
|
||||||
|
@ -78,17 +80,17 @@ export default {
|
||||||
},
|
},
|
||||||
clientBillingData: {
|
clientBillingData: {
|
||||||
payMethodAutocomplete: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.payMethodFk"]',
|
payMethodAutocomplete: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.payMethodFk"]',
|
||||||
IBANInput: `vn-client-billing-data vn-textfield input[name="iban"]`,
|
IBANInput: 'vn-client-billing-data [ng-model="$ctrl.client.iban"]',
|
||||||
dueDayInput: `vn-client-billing-data vn-input-number input[name="dueDay"]`,
|
dueDayInput: 'vn-client-billing-data [ng-model="$ctrl.client.dueDay"]',
|
||||||
receivedCoreLCRCheckbox: 'vn-client-billing-data vn-check[label="Received LCR"]',
|
receivedCoreLCRCheckbox: 'vn-client-billing-data vn-check[label="Received LCR"]',
|
||||||
receivedCoreVNLCheckbox: 'vn-client-billing-data vn-check[label="Received core VNL"]',
|
receivedCoreVNLCheckbox: 'vn-client-billing-data vn-check[label="Received core VNL"]',
|
||||||
receivedB2BVNLCheckbox: 'vn-client-billing-data vn-check[label="Received B2B VNL"]',
|
receivedB2BVNLCheckbox: 'vn-client-billing-data vn-check[label="Received B2B VNL"]',
|
||||||
swiftBicAutocomplete: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.bankEntityFk"]',
|
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]',
|
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',
|
newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button',
|
||||||
newBankEntityName: '.vn-dialog.shown vn-textfield[label="Name"] input',
|
newBankEntityName: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.name"]',
|
||||||
newBankEntityBIC: '.vn-dialog.shown vn-textfield[label="Swift / BIC"] input',
|
newBankEntityBIC: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.bic"]',
|
||||||
newBankEntityCode: '.vn-dialog.shown vn-textfield[label="Entity Code"] input',
|
newBankEntityCode: '.vn-dialog.shown [ng-model="$ctrl.newBankEntity.id"]',
|
||||||
acceptBankEntityButton: '.vn-dialog.shown button[response="accept"]',
|
acceptBankEntityButton: '.vn-dialog.shown button[response="accept"]',
|
||||||
saveButton: `button[type=submit]`,
|
saveButton: `button[type=submit]`,
|
||||||
watcher: 'vn-client-billing-data vn-watcher'
|
watcher: 'vn-client-billing-data vn-watcher'
|
||||||
|
@ -97,26 +99,28 @@ export default {
|
||||||
addressesButton: 'vn-left-menu a[ui-sref="client.card.address.index"]',
|
addressesButton: 'vn-left-menu a[ui-sref="client.card.address.index"]',
|
||||||
createAddress: `vn-client-address-index vn-float-button`,
|
createAddress: `vn-client-address-index vn-float-button`,
|
||||||
defaultCheckboxInput: 'vn-check[label="Default"]',
|
defaultCheckboxInput: 'vn-check[label="Default"]',
|
||||||
consigneeInput: `vn-textfield input[name="nickname"]`,
|
consigneeInput: '[ng-model="$ctrl.address.nickname"]',
|
||||||
streetAddressInput: `vn-textfield input[name="street"]`,
|
streetAddressInput: '[ng-model="$ctrl.address.street"]',
|
||||||
postcodeInput: `vn-textfield input[name="postalCode"]`,
|
postcodeInput: '[ng-model="$ctrl.address.postalCode"]',
|
||||||
cityInput: `vn-textfield input[name="city"]`,
|
cityInput: '[ng-model="$ctrl.address.city"]',
|
||||||
provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.provinceFk"]',
|
provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.provinceId"]',
|
||||||
agencyAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.agencyModeFk"]',
|
agencyAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.agencyModeId"]',
|
||||||
phoneInput: `vn-textfield input[name="phone"]`,
|
phoneInput: '[ng-model="$ctrl.address.phone"]',
|
||||||
mobileInput: `vn-textfield input[name="mobile"]`,
|
mobileInput: '[ng-model="$ctrl.address.mobile"]',
|
||||||
defaultAddress: 'vn-client-address-index div:nth-child(1) div[name="street"]',
|
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"]',
|
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',
|
firstEditAddress: 'vn-client-address-index div:nth-child(1) > a',
|
||||||
secondEditAddress: 'vn-client-address-index div:nth-child(2) > a',
|
secondEditAddress: 'vn-client-address-index div:nth-child(2) > a',
|
||||||
activeCheckbox: 'vn-check[label="Enabled"]',
|
activeCheckbox: 'vn-check[label="Enabled"]',
|
||||||
equalizationTaxCheckbox: 'vn-client-address-edit vn-check[label="Is equalizated"]',
|
equalizationTaxCheckbox: 'vn-client-address-edit vn-check[label="Is equalizated"]',
|
||||||
firstObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] :nth-child(1) [ng-model="observation.observationTypeFk"]',
|
firstObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(1) [ng-model="observation.observationTypeFk"]',
|
||||||
firstObservationDescriptionInput: 'vn-client-address-edit [name=observations] :nth-child(1) [ng-model="observation.description"] input',
|
firstObservationDescriptionInput: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(1) [ng-model="observation.description"]',
|
||||||
secondObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] :nth-child(2) [ng-model="observation.observationTypeFk"]',
|
secondObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] vn-horizontal:nth-child(2) [ng-model="observation.observationTypeFk"]',
|
||||||
secondObservationDescriptionInput: 'vn-client-address-edit [name=observations] :nth-child(2) [ng-model="observation.description"] input',
|
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"]',
|
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"]',
|
cancelCreateAddressButton: 'button[ui-sref="client.card.address.index"]',
|
||||||
cancelEditAddressButton: 'vn-client-address-edit > form > vn-button-bar > vn-button > button',
|
cancelEditAddressButton: 'vn-client-address-edit > form > vn-button-bar > vn-button > button',
|
||||||
watcher: 'vn-client-address-edit vn-watcher'
|
watcher: 'vn-client-address-edit vn-watcher'
|
||||||
|
@ -124,27 +128,27 @@ export default {
|
||||||
clientWebAccess: {
|
clientWebAccess: {
|
||||||
webAccessButton: 'vn-left-menu a[ui-sref="client.card.webAccess"]',
|
webAccessButton: 'vn-left-menu a[ui-sref="client.card.webAccess"]',
|
||||||
enableWebAccessCheckbox: 'vn-check[label="Enable web access"]',
|
enableWebAccessCheckbox: 'vn-check[label="Enable web access"]',
|
||||||
userNameInput: `vn-textfield input[name="name"]`,
|
userNameInput: 'vn-client-web-access [ng-model="$ctrl.account.name"]',
|
||||||
saveButton: `button[type=submit]`
|
saveButton: 'button[type=submit]'
|
||||||
},
|
},
|
||||||
clientNotes: {
|
clientNotes: {
|
||||||
addNoteFloatButton: `vn-float-button`,
|
addNoteFloatButton: 'vn-float-button',
|
||||||
noteInput: 'vn-textarea[label="Note"]',
|
noteInput: '[ng-model="$ctrl.note.text"]',
|
||||||
saveButton: `button[type=submit]`,
|
saveButton: 'button[type=submit]',
|
||||||
firstNoteText: 'vn-client-note .text'
|
firstNoteText: 'vn-client-note .text'
|
||||||
},
|
},
|
||||||
clientCredit: {
|
clientCredit: {
|
||||||
addCreditFloatButton: `vn-float-button`,
|
addCreditFloatButton: 'vn-float-button',
|
||||||
creditInput: `vn-input-number input[name="credit"]`,
|
creditInput: 'vn-client-credit-create [ng-model="$ctrl.client.credit"]',
|
||||||
saveButton: `button[type=submit]`,
|
saveButton: 'button[type=submit]',
|
||||||
firstCreditText: 'vn-client-credit-index vn-card vn-table vn-tbody > vn-tr'
|
firstCreditText: 'vn-client-credit-index vn-card vn-table vn-tbody > vn-tr'
|
||||||
},
|
},
|
||||||
clientGreuge: {
|
clientGreuge: {
|
||||||
addGreugeFloatButton: `vn-float-button`,
|
addGreugeFloatButton: 'vn-float-button',
|
||||||
amountInput: `vn-input-number input[name="amount"]`,
|
amountInput: 'vn-client-greuge-create [ng-model="$ctrl.greuge.amount"]',
|
||||||
descriptionInput: `vn-textfield input[name="description"]`,
|
descriptionInput: 'vn-client-greuge-create [ng-model="$ctrl.greuge.description"]',
|
||||||
typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.greuge.greugeTypeFk"]',
|
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'
|
firstGreugeText: 'vn-client-greuge-index vn-card vn-table vn-tbody > vn-tr'
|
||||||
},
|
},
|
||||||
clientMandate: {
|
clientMandate: {
|
||||||
|
@ -162,10 +166,10 @@ export default {
|
||||||
},
|
},
|
||||||
clientBalance: {
|
clientBalance: {
|
||||||
balanceButton: 'vn-left-menu a[ui-sref="client.card.balance.index"]',
|
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`,
|
newPaymentButton: `vn-float-button`,
|
||||||
newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]',
|
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"]',
|
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)'
|
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"]',
|
searchResultPreviewButton: 'vn-item-index .buttons > [icon="desktop_windows"]',
|
||||||
searchResultCloneButton: 'vn-item-index .buttons > [icon="icon-clone"]',
|
searchResultCloneButton: 'vn-item-index .buttons > [icon="icon-clone"]',
|
||||||
acceptClonationAlertButton: '.vn-confirm.shown [response="accept"]',
|
acceptClonationAlertButton: '.vn-confirm.shown [response="accept"]',
|
||||||
searchItemInput: 'vn-searchbar vn-textfield input',
|
searchItemInput: 'vn-searchbar',
|
||||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||||
closeItemSummaryPreview: '.vn-popup.shown',
|
closeItemSummaryPreview: '.vn-popup.shown',
|
||||||
fieldsToShowButton: 'vn-item-index vn-table > div > div > vn-icon-button[icon="menu"]',
|
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'
|
saveFieldsButton: '.vn-dialog.shown vn-horizontal:nth-child(16) > vn-button > button'
|
||||||
},
|
},
|
||||||
itemCreateView: {
|
itemCreateView: {
|
||||||
temporalName: `vn-textfield input[name="provisionalName"]`,
|
temporalName: 'vn-item-create [ng-model="$ctrl.item.provisionalName"]',
|
||||||
typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]',
|
typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]',
|
||||||
intrastatAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]',
|
intrastatAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]',
|
||||||
originAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]',
|
originAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]',
|
||||||
createButton: `button[type=submit]`,
|
createButton: 'button[type=submit]',
|
||||||
cancelButton: 'vn-button[ui-sref="item.index"]'
|
cancelButton: 'vn-button[ui-sref="item.index"]'
|
||||||
},
|
},
|
||||||
itemDescriptor: {
|
itemDescriptor: {
|
||||||
goBackToModuleIndexButton: 'vn-item-descriptor a[href="#!/item/index"]',
|
goBackToModuleIndexButton: 'vn-item-descriptor a[href="#!/item/index"]',
|
||||||
moreMenu: 'vn-item-descriptor vn-icon-menu[icon=more_vert]',
|
moreMenu: 'vn-item-descriptor vn-icon-menu[icon=more_vert]',
|
||||||
moreMenuRegularizeButton: '.vn-drop-down.shown li[name="Regularize stock"]',
|
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"]',
|
regularizeWarehouseAutocomplete: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.warehouseFk"]',
|
||||||
editButton: 'vn-item-descriptor vn-float-button[icon="edit"]',
|
editButton: 'vn-item-descriptor vn-float-button[icon="edit"]',
|
||||||
regularizeSaveButton: '.vn-dialog.shown tpl-buttons > button',
|
regularizeSaveButton: '.vn-dialog.shown tpl-buttons > button',
|
||||||
|
@ -232,11 +236,11 @@ export default {
|
||||||
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',
|
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',
|
||||||
typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]',
|
typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]',
|
||||||
intrastatAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]',
|
intrastatAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]',
|
||||||
nameInput: 'vn-textfield[label="Name"] input',
|
nameInput: 'vn-item-basic-data [ng-model="$ctrl.item.name"]',
|
||||||
relevancyInput: 'vn-input-number[ng-model="$ctrl.item.relevancy"] input',
|
relevancyInput: 'vn-item-basic-data [ng-model="$ctrl.item.relevancy"]',
|
||||||
originAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]',
|
originAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]',
|
||||||
expenseAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.expenseFk"]',
|
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"]',
|
isActiveCheckbox: 'vn-check[label="Active"]',
|
||||||
priceInKgCheckbox: 'vn-check[label="Price in kg"]',
|
priceInKgCheckbox: 'vn-check[label="Price in kg"]',
|
||||||
submitBasicDataButton: `button[type=submit]`
|
submitBasicDataButton: `button[type=submit]`
|
||||||
|
@ -245,47 +249,47 @@ export default {
|
||||||
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',
|
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',
|
||||||
tagsButton: 'vn-left-menu a[ui-sref="item.card.tags"]',
|
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"]',
|
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',
|
fourthValueInput: 'vn-item-tags vn-horizontal:nth-child(4) [ng-model="itemTag.value"]',
|
||||||
fourthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(4) > vn-textfield[label="Relevancy"] input',
|
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"]',
|
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"]',
|
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',
|
fifthValueInput: 'vn-item-tags vn-horizontal:nth-child(5) [ng-model="itemTag.value"]',
|
||||||
fifthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(5) > vn-textfield[label="Relevancy"] input',
|
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"]',
|
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',
|
sixthValueInput: 'vn-item-tags vn-horizontal:nth-child(6) [ng-model="itemTag.value"]',
|
||||||
sixthRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(6) > vn-textfield[label="Relevancy"] input',
|
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"]',
|
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',
|
seventhValueInput: 'vn-item-tags vn-horizontal:nth-child(7) [ng-model="itemTag.value"]',
|
||||||
seventhRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(7) > vn-textfield[label="Relevancy"] input',
|
seventhRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(7) [ng-model="itemTag.priority"]',
|
||||||
addItemTagButton: 'vn-item-tags vn-icon-button[icon="add_circle"]',
|
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: {
|
itemTax: {
|
||||||
undoChangesButton: 'vn-item-tax vn-button-bar > vn-button[label="Undo changes"]',
|
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"]',
|
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"]',
|
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"]',
|
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: {
|
itemBarcodes: {
|
||||||
addBarcodeButton: 'vn-item-barcode vn-icon[icon="add_circle"]',
|
addBarcodeButton: 'vn-item-barcode vn-icon[icon="add_circle"]',
|
||||||
thirdCodeInput: `vn-item-barcode vn-horizontal:nth-child(3) > vn-textfield input`,
|
thirdCodeInput: 'vn-item-barcode vn-horizontal:nth-child(3) [ng-model="barcode.code"]',
|
||||||
submitBarcodesButton: `vn-item-barcode button[type=submit]`,
|
submitBarcodesButton: 'vn-item-barcode button[type=submit]',
|
||||||
firstCodeRemoveButton: 'vn-item-barcode vn-horizontal vn-none vn-icon[icon="delete"]'
|
firstCodeRemoveButton: 'vn-item-barcode vn-horizontal vn-none vn-icon[icon="delete"]'
|
||||||
},
|
},
|
||||||
itemNiches: {
|
itemNiches: {
|
||||||
addNicheButton: 'vn-item-niche vn-icon[icon="add_circle"]',
|
addNicheButton: 'vn-item-niche vn-icon[icon="add_circle"]',
|
||||||
firstWarehouseAutocomplete: 'vn-item-niche vn-autocomplete[ng-model="niche.warehouseFk"]',
|
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"]',
|
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"]',
|
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"]',
|
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',
|
thirdCodeInput: 'vn-item-niche vn-horizontal:nth-child(3) [ng-model="niche.code"]',
|
||||||
submitNichesButton: `vn-item-niche button[type=submit]`
|
submitNichesButton: 'vn-item-niche button[type=submit]'
|
||||||
},
|
},
|
||||||
itemBotanical: {
|
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"]',
|
genusAutocomplete: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.genusFk"]',
|
||||||
speciesAutocomplete: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.specieFk"]',
|
speciesAutocomplete: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.specieFk"]',
|
||||||
submitBotanicalButton: `vn-item-botanical button[type=submit]`
|
submitBotanicalButton: `vn-item-botanical button[type=submit]`
|
||||||
|
@ -326,20 +330,19 @@ export default {
|
||||||
},
|
},
|
||||||
ticketsIndex: {
|
ticketsIndex: {
|
||||||
openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]',
|
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',
|
newTicketButton: 'vn-ticket-index > a',
|
||||||
searchResult: 'vn-ticket-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
|
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',
|
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)',
|
searchResultDate: 'vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(5)',
|
||||||
searchTicketInput: `vn-searchbar input`,
|
searchTicketInput: 'vn-searchbar',
|
||||||
searchWeeklyTicketInput: `vn-searchbar input`,
|
|
||||||
searchWeeklyClearInput: 'vn-searchbar vn-icon[icon=clear]',
|
searchWeeklyClearInput: 'vn-searchbar vn-icon[icon=clear]',
|
||||||
advancedSearchButton: 'vn-ticket-search-panel button[type=submit]',
|
advancedSearchButton: 'vn-ticket-search-panel button[type=submit]',
|
||||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||||
searchWeeklyButton: 'vn-searchbar vn-icon[icon="search"]',
|
searchWeeklyButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||||
moreMenu: 'vn-ticket-index vn-icon-menu[icon=more_vert]',
|
moreMenu: 'vn-ticket-index vn-icon-menu[icon=more_vert]',
|
||||||
menuWeeklyTickets: 'vn-left-menu [ui-sref="ticket.weekly.index"]',
|
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',
|
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"]',
|
firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
|
||||||
acceptDeleteTurn: '.vn-confirm.shown button[response="accept"]'
|
acceptDeleteTurn: '.vn-confirm.shown button[response="accept"]'
|
||||||
|
@ -379,8 +382,8 @@ export default {
|
||||||
firstNoteRemoveButton: 'vn-icon[icon="delete"]',
|
firstNoteRemoveButton: 'vn-icon[icon="delete"]',
|
||||||
addNoteButton: 'vn-icon[icon="add_circle"]',
|
addNoteButton: 'vn-icon[icon="add_circle"]',
|
||||||
firstNoteTypeAutocomplete: 'vn-autocomplete[ng-model="observation.observationTypeFk"]',
|
firstNoteTypeAutocomplete: 'vn-autocomplete[ng-model="observation.observationTypeFk"]',
|
||||||
firstDescriptionInput: 'vn-textfield[label="Description"] input',
|
firstDescriptionInput: 'vn-ticket-observation [ng-model="observation.description"]',
|
||||||
submitNotesButton: `button[type=submit]`
|
submitNotesButton: 'button[type=submit]'
|
||||||
},
|
},
|
||||||
ticketExpedition: {
|
ticketExpedition: {
|
||||||
expeditionButton: 'vn-left-menu a[ui-sref="ticket.card.expedition"]',
|
expeditionButton: 'vn-left-menu a[ui-sref="ticket.card.expedition"]',
|
||||||
|
@ -391,7 +394,7 @@ export default {
|
||||||
ticketPackages: {
|
ticketPackages: {
|
||||||
packagesButton: 'vn-left-menu a[ui-sref="ticket.card.package"]',
|
packagesButton: 'vn-left-menu a[ui-sref="ticket.card.package"]',
|
||||||
firstPackageAutocomplete: 'vn-autocomplete[label="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"]',
|
firstRemovePackageButton: 'vn-icon-button[vn-tooltip="Remove package"]',
|
||||||
addPackageButton: 'vn-icon-button[vn-tooltip="Add package"]',
|
addPackageButton: 'vn-icon-button[vn-tooltip="Add package"]',
|
||||||
clearPackageAutocompleteButton: 'vn-autocomplete[label="Package"] .icons > vn-icon[icon=clear]',
|
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"]',
|
moreMenuReserve: '.vn-drop-down.shown li[name="Mark as reserved"]',
|
||||||
moreMenuUnmarkReseved: '.vn-drop-down.shown li[name="Unmark as reserved"]',
|
moreMenuUnmarkReseved: '.vn-drop-down.shown li[name="Unmark as reserved"]',
|
||||||
moreMenuUpdateDiscount: '.vn-drop-down.shown li[name="Update discount"]',
|
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',
|
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',
|
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"]',
|
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)',
|
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',
|
firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) vn-td:nth-child(3) > img',
|
||||||
firstSaleZoomedImage: 'body > div > div > 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)',
|
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',
|
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',
|
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',
|
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',
|
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)',
|
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)',
|
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',
|
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)',
|
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',
|
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)',
|
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',
|
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',
|
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',
|
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',
|
selectAllSalesCheckbox: 'vn-ticket-sale vn-thead vn-check',
|
||||||
secondSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(2) vn-check[ng-model="sale.checked"]',
|
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"]',
|
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"]',
|
deleteSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="delete"]',
|
||||||
transferSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="call_split"]',
|
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"]',
|
moveToTicketInputClearButton: '.vn-popover.shown i[title="Clear"]',
|
||||||
moveToTicketButton: '.vn-popover.shown vn-icon[icon="arrow_forward_ios"]',
|
moveToTicketButton: '.vn-popover.shown vn-icon[icon="arrow_forward_ios"]',
|
||||||
moveToNewTicketButton: '.vn-popover.shown vn-button[label="New ticket"]',
|
moveToNewTicketButton: '.vn-popover.shown vn-button[label="New ticket"]',
|
||||||
|
@ -482,13 +483,13 @@ export default {
|
||||||
ticketRequests: {
|
ticketRequests: {
|
||||||
addRequestButton: 'vn-ticket-request-index > a > vn-float-button > button',
|
addRequestButton: 'vn-ticket-request-index > a > vn-float-button > button',
|
||||||
request: 'vn-ticket-request-index vn-table vn-tr',
|
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"]',
|
atenderAutocomplete: 'vn-ticket-request-create vn-autocomplete[ng-model="$ctrl.ticketRequest.attenderFk"]',
|
||||||
quantityInput: 'vn-ticket-request-create vn-input-number input[name=quantity]',
|
quantityInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.quantity"]',
|
||||||
priceInput: 'vn-ticket-request-create vn-input-number input[name=price]',
|
priceInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.price"]',
|
||||||
firstRemoveRequestButton: 'vn-ticket-request-index vn-icon[icon="delete"]:nth-child(1)',
|
firstRemoveRequestButton: 'vn-ticket-request-index vn-icon[icon="delete"]:nth-child(1)',
|
||||||
saveButton: 'vn-ticket-request-create button[type=submit]',
|
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: {
|
ticketLog: {
|
||||||
|
@ -501,11 +502,11 @@ export default {
|
||||||
addServiceButton: 'vn-ticket-service vn-icon-button[vn-tooltip="Add service"] > button',
|
addServiceButton: 'vn-ticket-service vn-icon-button[vn-tooltip="Add service"] > button',
|
||||||
firstAddServiceTypeButton: 'vn-ticket-service vn-icon-button[vn-tooltip="New service type"]',
|
firstAddServiceTypeButton: 'vn-ticket-service vn-icon-button[vn-tooltip="New service type"]',
|
||||||
firstServiceTypeAutocomplete: 'vn-ticket-service vn-autocomplete[ng-model="service.ticketServiceTypeFk"]',
|
firstServiceTypeAutocomplete: 'vn-ticket-service vn-autocomplete[ng-model="service.ticketServiceTypeFk"]',
|
||||||
firstQuantityInput: 'vn-ticket-service vn-input-number[label="Quantity"] input',
|
firstQuantityInput: 'vn-ticket-service [ng-model="service.quantity"]',
|
||||||
firstPriceInput: 'vn-ticket-service vn-input-number[label="Price"] input',
|
firstPriceInput: 'vn-ticket-service [ng-model="service.price"]',
|
||||||
firstVatTypeAutocomplete: 'vn-ticket-service vn-autocomplete[label="Tax class"]',
|
firstVatTypeAutocomplete: 'vn-ticket-service vn-autocomplete[label="Tax class"]',
|
||||||
fistDeleteServiceButton: 'vn-ticket-service form vn-horizontal:nth-child(1) vn-icon-button[icon="delete"]',
|
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"]',
|
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',
|
serviceLine: 'vn-ticket-service > form > vn-card > vn-one:nth-child(2) > vn-horizontal',
|
||||||
saveServiceButton: `button[type=submit]`,
|
saveServiceButton: `button[type=submit]`,
|
||||||
|
@ -518,7 +519,7 @@ export default {
|
||||||
saveStateButton: `button[type=submit]`
|
saveStateButton: `button[type=submit]`
|
||||||
},
|
},
|
||||||
claimsIndex: {
|
claimsIndex: {
|
||||||
searchClaimInput: `vn-searchbar input`,
|
searchClaimInput: 'vn-searchbar',
|
||||||
searchResult: 'vn-claim-index vn-card > vn-table > div > vn-tbody > a',
|
searchResult: 'vn-claim-index vn-card > vn-table > div > vn-tbody > a',
|
||||||
searchButton: 'vn-searchbar vn-icon[icon="search"]'
|
searchButton: 'vn-searchbar vn-icon[icon="search"]'
|
||||||
},
|
},
|
||||||
|
@ -548,12 +549,11 @@ export default {
|
||||||
},
|
},
|
||||||
claimDetail: {
|
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',
|
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',
|
discoutPopoverMana: '.vn-popover.shown .content > div > vn-horizontal > h5',
|
||||||
addItemButton: 'vn-claim-detail a vn-float-button',
|
addItemButton: 'vn-claim-detail a vn-float-button',
|
||||||
firstClaimableSaleFromTicket: '.vn-dialog.shown vn-tbody > vn-tr',
|
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',
|
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',
|
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'
|
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"]',
|
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"]',
|
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"]',
|
secondClaimRedeliveryAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimRedeliveryFk"]',
|
||||||
saveDevelopmentButton: `button[type=submit]`
|
saveDevelopmentButton: 'button[type=submit]'
|
||||||
},
|
},
|
||||||
claimAction: {
|
claimAction: {
|
||||||
importClaimButton: 'vn-claim-action vn-button[label="Import claim"]',
|
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',
|
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)',
|
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)',
|
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"]',
|
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||||
createOrderButton: `vn-float-button`,
|
createOrderButton: 'vn-float-button',
|
||||||
},
|
},
|
||||||
orderDescriptor: {
|
orderDescriptor: {
|
||||||
returnToModuleIndexButton: 'vn-order-descriptor a[ui-sref="order.index"]',
|
returnToModuleIndexButton: 'vn-order-descriptor a[ui-sref="order.index"]',
|
||||||
|
@ -598,21 +597,21 @@ export default {
|
||||||
addressAutocomplete: 'vn-autocomplete[label="Address"]',
|
addressAutocomplete: 'vn-autocomplete[label="Address"]',
|
||||||
agencyAutocomplete: 'vn-autocomplete[label="Agency"]',
|
agencyAutocomplete: 'vn-autocomplete[label="Agency"]',
|
||||||
landedDatePicker: 'vn-date-picker[label="Landed"]',
|
landedDatePicker: 'vn-date-picker[label="Landed"]',
|
||||||
createButton: `button[type=submit]`,
|
createButton: 'button[type=submit]',
|
||||||
cancelButton: 'vn-button[href="#!/client/index"]'
|
cancelButton: 'vn-button[href="#!/client/index"]'
|
||||||
},
|
},
|
||||||
orderCatalog: {
|
orderCatalog: {
|
||||||
orderByAutocomplete: 'vn-autocomplete[label="Order by"]',
|
orderByAutocomplete: 'vn-autocomplete[label="Order by"]',
|
||||||
plantRealmButton: 'vn-order-catalog > vn-side-menu vn-icon[icon="icon-plant"]',
|
plantRealmButton: 'vn-order-catalog > vn-side-menu vn-icon[icon="icon-plant"]',
|
||||||
typeAutocomplete: 'vn-autocomplete[data="$ctrl.itemTypes"]',
|
typeAutocomplete: 'vn-autocomplete[data="$ctrl.itemTypes"]',
|
||||||
itemIdInput: 'vn-catalog-filter vn-textfield[ng-model="$ctrl.itemFk"] input',
|
itemIdInput: 'vn-order-catalog > vn-side-menu vn-textfield[ng-model="$ctrl.itemId"]',
|
||||||
itemTagValueInput: 'vn-catalog-filter vn-textfield[ng-model="$ctrl.value"] input',
|
itemTagValueInput: 'vn-order-catalog > vn-side-menu vn-textfield[ng-model="$ctrl.value"]',
|
||||||
openTagSearch: 'vn-catalog-filter > div > vn-vertical > vn-textfield[ng-model="$ctrl.value"] .append i',
|
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"]',
|
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]',
|
searchTagButton: 'vn-order-catalog-search-panel button[type=submit]',
|
||||||
thirdFilterRemoveButton: 'vn-catalog-filter .chips > vn-chip:nth-child(3) vn-icon[icon=cancel]',
|
thirdFilterRemoveButton: 'vn-order-catalog > vn-side-menu .chips > vn-chip:nth-child(3) vn-icon[icon=cancel]',
|
||||||
fourthFilterRemoveButton: 'vn-catalog-filter .chips > vn-chip:nth-child(4) vn-icon[icon=cancel]',
|
fourthFilterRemoveButton: 'vn-order-catalog > vn-side-menu .chips > vn-chip:nth-child(4) vn-icon[icon=cancel]',
|
||||||
},
|
},
|
||||||
orderBasicData: {
|
orderBasicData: {
|
||||||
clientAutocomplete: 'vn-autocomplete[label="Client"]',
|
clientAutocomplete: 'vn-autocomplete[label="Client"]',
|
||||||
|
@ -636,7 +635,7 @@ export default {
|
||||||
createdDatePicker: 'vn-route-create vn-date-picker[ng-model="$ctrl.route.created"]',
|
createdDatePicker: 'vn-route-create vn-date-picker[ng-model="$ctrl.route.created"]',
|
||||||
vehicleAutoComplete: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]',
|
vehicleAutoComplete: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]',
|
||||||
agencyAutoComplete: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]',
|
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]'
|
submitButton: 'vn-route-create button[type=submit]'
|
||||||
},
|
},
|
||||||
routeDescriptor: {
|
routeDescriptor: {
|
||||||
|
@ -649,26 +648,26 @@ export default {
|
||||||
workerAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.workerFk"]',
|
workerAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.workerFk"]',
|
||||||
vehicleAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]',
|
vehicleAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]',
|
||||||
agencyAutoComplete: 'vn-route-basic-data vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]',
|
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',
|
kmStartInput: 'vn-route-basic-data [ng-model="$ctrl.route.kmStart"]',
|
||||||
kmEndInput: 'vn-route-basic-data vn-input-number[ng-model="$ctrl.route.kmEnd"] input',
|
kmEndInput: 'vn-route-basic-data [ng-model="$ctrl.route.kmEnd"]',
|
||||||
createdDateInput: 'vn-route-basic-data vn-date-picker[ng-model="$ctrl.route.created"]',
|
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',
|
startedHourInput: 'vn-route-basic-data [ng-model="$ctrl.route.started"]',
|
||||||
finishedHourInput: 'vn-route-basic-data vn-input-time[ng-model="$ctrl.route.finished"] input',
|
finishedHourInput: 'vn-route-basic-data [ng-model="$ctrl.route.finished"]',
|
||||||
saveButton: 'vn-route-basic-data button[type=submit]'
|
saveButton: 'vn-route-basic-data button[type=submit]'
|
||||||
},
|
},
|
||||||
routeTickets: {
|
routeTickets: {
|
||||||
firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) 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"] input',
|
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"] input',
|
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"] input',
|
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"] input',
|
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',
|
firstTicketCheckbox: 'vn-route-tickets vn-tr:nth-child(1) vn-check',
|
||||||
buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]',
|
buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]',
|
||||||
firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]',
|
firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]',
|
||||||
confirmButton: '.vn-confirm.shown button[response="accept"]'
|
confirmButton: '.vn-confirm.shown button[response="accept"]'
|
||||||
},
|
},
|
||||||
workerPbx: {
|
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]'
|
saveButton: 'vn-worker-pbx button[type=submit]'
|
||||||
},
|
},
|
||||||
workerTimeControl: {
|
workerTimeControl: {
|
||||||
|
@ -724,7 +723,7 @@ export default {
|
||||||
acceptDeleteDialog: '.vn-confirm.shown button[response="accept"]'
|
acceptDeleteDialog: '.vn-confirm.shown button[response="accept"]'
|
||||||
},
|
},
|
||||||
invoiceOutIndex: {
|
invoiceOutIndex: {
|
||||||
searchInvoiceOutInput: `vn-searchbar input`,
|
searchInvoiceOutInput: 'vn-searchbar',
|
||||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||||
searchResult: 'vn-invoice-out-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
|
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', () => {
|
describe('Login path', async() => {
|
||||||
const nightmare = createNightmare();
|
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() => {
|
it('should receive an error when the username is incorrect', async() => {
|
||||||
const result = await nightmare
|
await page.doLogin('badUser', '');
|
||||||
.doLogin('badUser', null)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result.length).toBeGreaterThan(0);
|
expect(result.length).toBeGreaterThan(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should receive an error when the username is blank', async() => {
|
it('should receive an error when the username is blank', async() => {
|
||||||
const result = await nightmare
|
await page.doLogin('', '');
|
||||||
.doLogin('', null)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result.length).toBeGreaterThan(0);
|
expect(result.length).toBeGreaterThan(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should receive an error when the password is incorrect', async() => {
|
it('should receive an error when the password is incorrect', async() => {
|
||||||
const result = await nightmare
|
await page.doLogin('employee', 'badPassword');
|
||||||
.doLogin('employee', 'badPassword')
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result.length).toBeGreaterThan(0);
|
expect(result.length).toBeGreaterThan(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should log in', async() => {
|
it('should log in', async() => {
|
||||||
const url = await nightmare
|
await page.doLogin('employee', 'nightmare');
|
||||||
.doLogin('employee', null)
|
await page.waitForNavigation();
|
||||||
.wait('#user')
|
let url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/');
|
expect(url.hash).toEqual('#!/');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,90 +1,90 @@
|
||||||
import selectors from '../../helpers/selectors';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client create path', () => {
|
describe('Client create path', async() => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
|
let page;
|
||||||
|
beforeAll(async() => {
|
||||||
|
browser = await getBrowser();
|
||||||
|
page = browser.page;
|
||||||
|
await page.loginAndModule('employee', 'client');
|
||||||
|
});
|
||||||
|
|
||||||
beforeAll(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('employee', 'client');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should search for the user Carol Danvers to confirm it isn't created yet`, async() => {
|
it(`should search for the user Carol Danvers to confirm it isn't created yet`, async() => {
|
||||||
const result = await nightmare
|
await page.write(selectors.clientsIndex.searchClientInput, 'Carol Danvers');
|
||||||
.write(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
|
await page.waitToClick(selectors.clientsIndex.searchButton);
|
||||||
.waitToClick(selectors.clientsIndex.searchButton)
|
await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0);
|
||||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0)
|
const result = await page.countElement(selectors.clientsIndex.searchResult);
|
||||||
.countElement(selectors.clientsIndex.searchResult);
|
|
||||||
|
|
||||||
expect(result).toEqual(0);
|
expect(result).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now access to the create client view by clicking the create-client floating button', async() => {
|
it('should now access to the create client view by clicking the create-client floating button', async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.clientsIndex.createClientButton);
|
||||||
.waitToClick(selectors.clientsIndex.createClientButton)
|
await page.wait(selectors.createClientView.createButton);
|
||||||
.wait(selectors.createClientView.createButton)
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/client/create');
|
expect(url.hash).toEqual('#!/client/create');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should receive an error when clicking the create button having all the form fields empty', async() => {
|
it('should receive an error when clicking the create button having all the form fields empty', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.createClientView.createButton);
|
||||||
.waitToClick(selectors.createClientView.createButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Some fields are invalid');
|
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() => {
|
it('should receive an error when clicking the create button having name and Business name fields empty', async() => {
|
||||||
const result = await nightmare
|
await page.write(selectors.createClientView.taxNumber, '74451390E');
|
||||||
.write(selectors.createClientView.taxNumber, '74451390E')
|
await page.write(selectors.createClientView.userName, 'CaptainMarvel');
|
||||||
.write(selectors.createClientView.userName, 'CaptainMarvel')
|
await page.write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es');
|
||||||
.write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es')
|
await page.autocompleteSearch(selectors.createClientView.salesPersonAutocomplete, 'replenisher');
|
||||||
.autocompleteSearch(selectors.createClientView.salesPersonAutocomplete, 'replenisher')
|
await page.waitToClick(selectors.createClientView.createButton);
|
||||||
.waitToClick(selectors.createClientView.createButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Some fields are invalid');
|
expect(result).toEqual('Some fields are invalid');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should attempt to create a new user with all it's data but wrong email`, async() => {
|
it(`should attempt to create a new user with all it's data but wrong email`, async() => {
|
||||||
const result = await nightmare
|
await page.write(selectors.createClientView.name, 'Carol Danvers');
|
||||||
.write(selectors.createClientView.name, 'Carol Danvers')
|
await page.write(selectors.createClientView.socialName, 'AVG tax');
|
||||||
.write(selectors.createClientView.socialName, 'AVG tax')
|
await page.write(selectors.createClientView.street, 'Many places');
|
||||||
.write(selectors.createClientView.street, 'Many places')
|
await page.waitForContentLoaded();
|
||||||
.autocompleteSearch(selectors.createClientView.country, 'España')
|
await page.autocompleteSearch(selectors.createClientView.country, 'España');
|
||||||
.autocompleteSearch(selectors.createClientView.province, 'Province one')
|
await page.autocompleteSearch(selectors.createClientView.province, 'Province one');
|
||||||
.write(selectors.createClientView.city, 'Valencia')
|
await page.write(selectors.createClientView.city, 'Valencia');
|
||||||
.write(selectors.createClientView.postcode, '46000')
|
await page.write(selectors.createClientView.postcode, '46000');
|
||||||
.clearInput(selectors.createClientView.email)
|
await page.clearInput(selectors.createClientView.email);
|
||||||
.write(selectors.createClientView.email, 'incorrect email format')
|
await page.write(selectors.createClientView.email, 'incorrect email format');
|
||||||
.waitToClick(selectors.createClientView.createButton)
|
await page.waitToClick(selectors.createClientView.createButton);
|
||||||
.waitForLastSnackbar();
|
const result = await page.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toEqual('Some fields are invalid');
|
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() => {
|
it(`should attempt to create a new user with all it's data but wrong postal code`, async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.createClientView.email);
|
||||||
.clearInput(selectors.createClientView.email)
|
await page.write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es');
|
||||||
.write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es')
|
await page.clearInput(selectors.createClientView.postcode);
|
||||||
.clearInput(selectors.createClientView.postcode)
|
await page.write(selectors.createClientView.postcode, '479999');
|
||||||
.write(selectors.createClientView.postcode, '479999')
|
await page.waitToClick(selectors.createClientView.createButton);
|
||||||
.waitToClick(selectors.createClientView.createButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.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() => {
|
it(`should check for autocompleted city, province and country`, async() => {
|
||||||
const clientCity = await nightmare
|
const clientCity = await page
|
||||||
.waitToGetProperty(`${selectors.createClientView.city}`, 'value');
|
.waitToGetProperty(`${selectors.createClientView.city} input`, 'value');
|
||||||
|
|
||||||
const clientProvince = await nightmare
|
const clientProvince = await page
|
||||||
.waitToGetProperty(`${selectors.createClientView.province} input`, 'value');
|
.waitToGetProperty(`${selectors.createClientView.province} input`, 'value');
|
||||||
|
|
||||||
const clientCountry = await nightmare
|
const clientCountry = await page
|
||||||
.waitToGetProperty(`${selectors.createClientView.country} input`, 'value');
|
.waitToGetProperty(`${selectors.createClientView.country} input`, 'value');
|
||||||
|
|
||||||
expect(clientCity).toEqual('Valencia');
|
expect(clientCity).toEqual('Valencia');
|
||||||
|
@ -93,33 +93,31 @@ describe('Client create path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should create a new user with all correct data`, async() => {
|
it(`should create a new user with all correct data`, async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.createClientView.postcode);
|
||||||
.clearInput(selectors.createClientView.postcode)
|
await page.write(selectors.createClientView.postcode, '46000');
|
||||||
.write(selectors.createClientView.postcode, '46000')
|
await page.waitToClick(selectors.createClientView.createButton);
|
||||||
.waitToClick(selectors.createClientView.createButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should click on the Clients button of the top bar menu', async() => {
|
it('should click on the Clients button of the top bar menu', async() => {
|
||||||
const url = await nightmare
|
await page.waitFor(500);
|
||||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||||
.waitToClick(selectors.globalItems.clientsButton)
|
await page.waitToClick(selectors.globalItems.clientsButton);
|
||||||
.wait(selectors.clientsIndex.createClientButton)
|
await page.wait(selectors.clientsIndex.createClientButton);
|
||||||
.parsedUrl();
|
const url = await page.parsedUrl();
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/client/index');
|
expect(url.hash).toEqual('#!/client/index');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should search for the user Carol Danvers to confirm it exists`, async() => {
|
it(`should search for the user Carol Danvers to confirm it exists`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForContentLoaded();
|
||||||
.write(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
|
await page.accessToSearchResult('Carol Danvers');
|
||||||
.waitToClick(selectors.clientsIndex.searchButton)
|
await page.waitForURL('#!/client/114/summary');
|
||||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
const url = await page.parsedUrl();
|
||||||
.countElement(selectors.clientsIndex.searchResult);
|
|
||||||
|
|
||||||
expect(result).toEqual(1);
|
expect(url.hash).toEqual('#!/client/114/summary');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,65 +1,68 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client Edit basicData path', () => {
|
describe('Client Edit basicData path', () => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
describe('as employee', () => {
|
let page;
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
nightmare
|
browser = await getBrowser();
|
||||||
.loginAndModule('employee', 'client')
|
page = browser.page;
|
||||||
.accessToSearchResult('Bruce Wayne')
|
await page.loginAndModule('employee', 'client');
|
||||||
.accessToSection('client.card.basicData');
|
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() => {
|
it('should not be able to change the salesPerson', async() => {
|
||||||
const result = await nightmare
|
await page.wait(selectors.clientBasicData.nameInput);
|
||||||
.wait(selectors.clientBasicData.nameInput)
|
const result = await page.evaluate(selector => {
|
||||||
.evaluate(selector => {
|
return document.querySelector(selector).disabled;
|
||||||
return document.querySelector(selector).disabled;
|
}, `${selectors.clientBasicData.salesPersonAutocomplete} input`);
|
||||||
}, `${selectors.clientBasicData.salesPersonAutocomplete} input`);
|
|
||||||
|
|
||||||
expect(result).toBeTruthy();
|
expect(result).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should edit the client basic data but leave salesPerson untainted', async() => {
|
it('should edit the client basic data but leave salesPerson untainted', async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.clientBasicData.nameInput);
|
||||||
.clearInput(selectors.clientBasicData.nameInput)
|
await page.write(selectors.clientBasicData.nameInput, 'Ptonomy Wallace');
|
||||||
.write(selectors.clientBasicData.nameInput, 'Ptonomy Wallace')
|
await page.clearInput(selectors.clientBasicData.contactInput);
|
||||||
.clearInput(selectors.clientBasicData.contactInput)
|
await page.write(selectors.clientBasicData.contactInput, 'David Haller');
|
||||||
.write(selectors.clientBasicData.contactInput, 'David Haller')
|
await page.clearInput(selectors.clientBasicData.emailInput);
|
||||||
.clearInput(selectors.clientBasicData.emailInput)
|
await page.write(selectors.clientBasicData.emailInput, 'PWallace@verdnatura.es');
|
||||||
.write(selectors.clientBasicData.emailInput, 'PWallace@verdnatura.es')
|
await page.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Rumors on the streets');
|
||||||
.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Rumors on the streets')
|
await page.waitToClick(selectors.clientBasicData.saveButton);
|
||||||
.waitToClick(selectors.clientBasicData.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the name have been edited', async() => {
|
it('should confirm the name have been edited', async() => {
|
||||||
const result = await nightmare
|
await page.reloadSection('client.card.basicData');
|
||||||
.reloadSection('client.card.basicData')
|
const result = await page.waitToGetProperty(`${selectors.clientBasicData.nameInput} input`, 'value');
|
||||||
.waitToGetProperty(selectors.clientBasicData.nameInput, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('Ptonomy Wallace');
|
expect(result).toEqual('Ptonomy Wallace');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the contact name have been edited', async() => {
|
it('should confirm the contact name have been edited', async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.waitToGetProperty(selectors.clientBasicData.contactInput, 'value');
|
.waitToGetProperty(`${selectors.clientBasicData.contactInput} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('David Haller');
|
expect(result).toEqual('David Haller');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the email have been edited', async() => {
|
it('should confirm the email have been edited', async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.waitToGetProperty(selectors.clientBasicData.emailInput, 'value');
|
.waitToGetProperty(`${selectors.clientBasicData.emailInput} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('PWallace@verdnatura.es');
|
expect(result).toEqual('PWallace@verdnatura.es');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the channel have been selected', async() => {
|
it('should confirm the channel have been selected', async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.waitToGetProperty(`${selectors.clientBasicData.channelAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.clientBasicData.channelAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Rumors on the streets');
|
expect(result).toEqual('Rumors on the streets');
|
||||||
|
@ -67,70 +70,66 @@ describe('Client Edit basicData path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('as salesAssistant', () => {
|
describe('as salesAssistant', () => {
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
nightmare
|
await page.loginAndModule('salesASsistant', 'client');
|
||||||
.loginAndModule('salesASsistant', 'client')
|
await page.accessToSearchResult('Ptonomy Wallace');
|
||||||
.accessToSearchResult('Ptonomy Wallace')
|
await page.accessToSection('client.card.basicData');
|
||||||
.accessToSection('client.card.basicData');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to change the salesPerson', async() => {
|
it('should be able to change the salesPerson', async() => {
|
||||||
const result = await nightmare
|
await page.wait(selectors.clientBasicData.nameInput);
|
||||||
.wait(selectors.clientBasicData.nameInput)
|
const result = await page.evaluate(selector => {
|
||||||
.evaluate(selector => {
|
return document.querySelector(selector).disabled;
|
||||||
return document.querySelector(selector).disabled;
|
}, `${selectors.clientBasicData.salesPersonAutocomplete} input`);
|
||||||
}, `${selectors.clientBasicData.salesPersonAutocomplete} input`);
|
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should edit the client basic data including salesPerson', async() => {
|
it('should edit the client basic data including salesPerson', async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.clientBasicData.nameInput);
|
||||||
.clearInput(selectors.clientBasicData.nameInput)
|
await page.write(selectors.clientBasicData.nameInput, 'Ororo Munroe');
|
||||||
.write(selectors.clientBasicData.nameInput, 'Ororo Munroe')
|
await page.clearInput(selectors.clientBasicData.contactInput);
|
||||||
.clearInput(selectors.clientBasicData.contactInput)
|
await page.write(selectors.clientBasicData.contactInput, 'Black Panther');
|
||||||
.write(selectors.clientBasicData.contactInput, 'Black Panther')
|
await page.clearInput(selectors.clientBasicData.emailInput);
|
||||||
.clearInput(selectors.clientBasicData.emailInput)
|
await page.write(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es');
|
||||||
.write(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es')
|
await page.autocompleteSearch(selectors.clientBasicData.salesPersonAutocomplete, 'replenisherNick');
|
||||||
.autocompleteSearch(selectors.clientBasicData.salesPersonAutocomplete, 'replenisherNick')
|
await page.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Metropolis newspaper');
|
||||||
.autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Metropolis newspaper')
|
await page.waitToClick(selectors.clientBasicData.saveButton);
|
||||||
.waitToClick(selectors.clientBasicData.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now confirm the name have been edited', async() => {
|
it('should now confirm the name have been edited', async() => {
|
||||||
const result = await nightmare
|
await page.reloadSection('client.card.basicData');
|
||||||
.reloadSection('client.card.basicData')
|
const result = await page.waitToGetProperty(`${selectors.clientBasicData.nameInput} input`, 'value');
|
||||||
.waitToGetProperty(selectors.clientBasicData.nameInput, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('Ororo Munroe');
|
expect(result).toEqual('Ororo Munroe');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now confirm the contact name have been edited', async() => {
|
it('should now confirm the contact name have been edited', async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.waitToGetProperty(selectors.clientBasicData.contactInput, 'value');
|
.waitToGetProperty(`${selectors.clientBasicData.contactInput} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Black Panther');
|
expect(result).toEqual('Black Panther');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now confirm the email have been edited', async() => {
|
it('should now confirm the email have been edited', async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.waitToGetProperty(selectors.clientBasicData.emailInput, 'value');
|
.waitToGetProperty(`${selectors.clientBasicData.emailInput} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Storm@verdnatura.es');
|
expect(result).toEqual('Storm@verdnatura.es');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the sales person have been selected', async() => {
|
it('should confirm the sales person have been selected', async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.waitToGetProperty(`${selectors.clientBasicData.salesPersonAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.clientBasicData.salesPersonAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('replenisherNick');
|
expect(result).toEqual('replenisherNick');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now confirm the channel have been selected', async() => {
|
it('should now confirm the channel have been selected', async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.waitToGetProperty(`${selectors.clientBasicData.channelAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.clientBasicData.channelAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Metropolis newspaper');
|
expect(result).toEqual('Metropolis newspaper');
|
||||||
|
|
|
@ -1,314 +1,287 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client Edit fiscalData path', () => {
|
describe('Client Edit fiscalData path', () => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
describe('as employee', () => {
|
let page;
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
nightmare
|
browser = await getBrowser();
|
||||||
.loginAndModule('employee', 'client')
|
page = browser.page;
|
||||||
.accessToSearchResult('Bruce Banner')
|
await page.loginAndModule('employee', 'client');
|
||||||
.accessToSection('client.card.address.index');
|
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
|
// 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() => {
|
it(`should click on the 1st edit icon to check EQtax isnt checked`, async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('unchecked');
|
expect(result).toBe('unchecked');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Confirms all addresses have EQtax false for future propagation test step 2
|
// 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() => {
|
it(`should go back to addresses then select the second one and confirm the EQtax isnt checked`, async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientAddresses.addressesButton);
|
||||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
await page.waitToClick(selectors.clientAddresses.secondEditAddress);
|
||||||
.waitToClick(selectors.clientAddresses.secondEditAddress)
|
const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('unchecked');
|
expect(result).toBe('unchecked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the fiscal data button`, async() => {
|
it(`should click on the fiscal data button`, async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.clientFiscalData.fiscalDataButton);
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
await page.waitForURL('fiscal-data');
|
||||||
.waitForURL('fiscal-data')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('fiscal-data');
|
expect(url.hash).toContain('fiscal-data');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not be able to edit the verified data checkbox', async() => {
|
it('should not be able to edit the verified data checkbox', async() => {
|
||||||
const result = await nightmare
|
await page.wait(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
.wait(selectors.clientFiscalData.verifiedDataCheckbox)
|
const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBeTruthy();
|
expect(result).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('as administrative', () => {
|
describe('as administrative', () => {
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
nightmare
|
await page.loginAndModule('administrative', 'client');
|
||||||
.loginAndModule('administrative', 'client')
|
await page.accessToSearchResult('Bruce Banner');
|
||||||
.accessToSearchResult('Bruce Banner')
|
await page.accessToSection('client.card.fiscalData');
|
||||||
.accessToSection('client.card.fiscalData');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should edit the fiscal data but fail as the fiscal id ain't valid`, async() => {
|
it(`should edit the fiscal data but fail as the fiscal id ain't valid`, async() => {
|
||||||
const result = await nightmare
|
await page.wait(selectors.clientFiscalData.socialNameInput);
|
||||||
.wait(selectors.clientFiscalData.socialNameInput)
|
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
await page.write(selectors.clientFiscalData.socialNameInput, 'SMASH');
|
||||||
.write(selectors.clientFiscalData.socialNameInput, 'SMASH')
|
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);
|
||||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
await page.write(selectors.clientFiscalData.fiscalIdInput, 'INVALID!');
|
||||||
.write(selectors.clientFiscalData.fiscalIdInput, 'INVALID!')
|
await page.clearInput(selectors.clientFiscalData.addressInput);
|
||||||
.clearInput(selectors.clientFiscalData.addressInput)
|
await page.write(selectors.clientFiscalData.addressInput, 'Somewhere edited');
|
||||||
.write(selectors.clientFiscalData.addressInput, 'Somewhere edited')
|
await page.autocompleteSearch(selectors.clientFiscalData.countryAutocomplete, 'España');
|
||||||
.autocompleteSearch(selectors.clientFiscalData.countryAutocomplete, 'España')
|
await page.autocompleteSearch(selectors.clientFiscalData.provinceAutocomplete, 'Province one');
|
||||||
.autocompleteSearch(selectors.clientFiscalData.provinceAutocomplete, 'Province one')
|
await page.clearInput(selectors.clientFiscalData.cityInput);
|
||||||
.clearInput(selectors.clientFiscalData.cityInput)
|
await page.write(selectors.clientFiscalData.cityInput, 'Valencia');
|
||||||
.write(selectors.clientFiscalData.cityInput, 'Valencia')
|
await page.clearInput(selectors.clientFiscalData.postcodeInput);
|
||||||
.clearInput(selectors.clientFiscalData.postcodeInput)
|
await page.write(selectors.clientFiscalData.postcodeInput, '46000');
|
||||||
.write(selectors.clientFiscalData.postcodeInput, '46000')
|
await page.waitToClick(selectors.clientFiscalData.activeCheckbox);
|
||||||
.waitToClick(selectors.clientFiscalData.activeCheckbox)
|
await page.waitToClick(selectors.clientFiscalData.frozenCheckbox);
|
||||||
.waitToClick(selectors.clientFiscalData.frozenCheckbox)
|
await page.waitToClick(selectors.clientFiscalData.hasToInvoiceCheckbox);
|
||||||
.waitToClick(selectors.clientFiscalData.hasToInvoiceCheckbox)
|
await page.waitToClick(selectors.clientFiscalData.viesCheckbox);
|
||||||
.waitToClick(selectors.clientFiscalData.viesCheckbox)
|
await page.waitToClick(selectors.clientFiscalData.invoiceByMailCheckbox);
|
||||||
.waitToClick(selectors.clientFiscalData.invoiceByMailCheckbox)
|
await page.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||||
.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox)
|
await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox);
|
||||||
.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox)
|
await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox)
|
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Invalid Tax number');
|
expect(result).toEqual('Invalid Tax number');
|
||||||
});
|
}, 15000);
|
||||||
|
|
||||||
it(`should edit the fiscal this time with a valid fiscal id`, async() => {
|
it(`should edit the fiscal this time with a valid fiscal id`, async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);
|
||||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
await page.write(selectors.clientFiscalData.fiscalIdInput, '94980061C');
|
||||||
.write(selectors.clientFiscalData.fiscalIdInput, '94980061C')
|
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should propagate the Equalization tax', async() => {
|
it('should propagate the Equalization tax', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientFiscalData.acceptPropagationButton);
|
||||||
.waitToClick(selectors.clientFiscalData.acceptPropagationButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Equivalent tax spreaded');
|
expect(result).toEqual('Equivalent tax spreaded');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should receive an error if the fiscal id contains A or B at the beginning', async() => {
|
it('should receive an error if the fiscal id contains A or B at the beginning', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientFiscalData.viesCheckbox);
|
||||||
.waitToClick(selectors.clientFiscalData.viesCheckbox)
|
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);
|
||||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
await page.write(selectors.clientFiscalData.fiscalIdInput, 'A94980061C');
|
||||||
.write(selectors.clientFiscalData.fiscalIdInput, 'A94980061C')
|
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Cannot check Equalization Tax in this NIF/CIF');
|
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() => {
|
it('should finally edit the fixcal data correctly as VIES isnt checked and fiscal id is valid for EQtax', async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.clientFiscalData.fiscalIdInput);
|
||||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
await page.write(selectors.clientFiscalData.fiscalIdInput, '94980061C');
|
||||||
.write(selectors.clientFiscalData.fiscalIdInput, '94980061C')
|
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
// confirm all addresses have now EQtax checked step 1
|
// confirm all addresses have now EQtax checked step 1
|
||||||
it(`should click on the addresses button to access to the client's addresses`, async() => {
|
it(`should click on the addresses button to access to the client's addresses`, async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.clientAddresses.addressesButton);
|
||||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
await page.waitForURL('/address/index');
|
||||||
.waitForURL('/address/index')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/address/index');
|
expect(url.hash).toContain('/address/index');
|
||||||
});
|
});
|
||||||
|
|
||||||
// confirm all addresses have now EQtax checked step 2
|
// confirm all addresses have now EQtax checked step 2
|
||||||
it(`should click on the 1st edit icon to confirm EQtax is checked`, async() => {
|
it(`should click on the 1st edit icon to confirm EQtax is checked`, async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
await page.waitForWatcherData(selectors.clientAddresses.watcher);
|
||||||
.waitForWatcherData(selectors.clientAddresses.watcher)
|
const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('checked');
|
expect(result).toBe('checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
// confirm all addresses have now EQtax checked step 3
|
// 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() => {
|
it(`should go back to addresses then select the second one and confirm the EQtax is checked`, async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientAddresses.addressesButton);
|
||||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
await page.waitToClick(selectors.clientAddresses.secondEditAddress);
|
||||||
.waitToClick(selectors.clientAddresses.secondEditAddress)
|
await page.waitForWatcherData(selectors.clientAddresses.watcher);
|
||||||
.waitForWatcherData(selectors.clientAddresses.watcher)
|
const result = await page.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('checked');
|
expect(result).toBe('checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should navigate back to fiscal data and uncheck EQtax then check VIES', async() => {
|
it('should navigate back to fiscal data and uncheck EQtax then check VIES', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientFiscalData.fiscalDataButton);
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
await page.waitToClick(selectors.clientFiscalData.viesCheckbox);
|
||||||
.waitToClick(selectors.clientFiscalData.viesCheckbox)
|
await page.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox);
|
||||||
.waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox)
|
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should propagate the Equalization tax changes', async() => {
|
it('should propagate the Equalization tax changes', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientFiscalData.acceptPropagationButton);
|
||||||
.waitToClick(selectors.clientFiscalData.acceptPropagationButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Equivalent tax spreaded');
|
expect(result).toEqual('Equivalent tax spreaded');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm its name have been edited', async() => {
|
it('should confirm its name have been edited', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientFiscalData.fiscalDataButton);
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value');
|
||||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('SMASH');
|
expect(result).toEqual('SMASH');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the fiscal id have been edited', async() => {
|
it('should confirm the fiscal id have been edited', async() => {
|
||||||
const result = await nightmare
|
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.fiscalIdInput} input`, 'value');
|
||||||
.waitToGetProperty(selectors.clientFiscalData.fiscalIdInput, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('94980061C');
|
expect(result).toEqual('94980061C');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the address have been edited', async() => {
|
it('should confirm the address have been edited', async() => {
|
||||||
const result = await nightmare
|
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.addressInput} input`, 'value');
|
||||||
.waitToGetProperty(selectors.clientFiscalData.addressInput, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('Somewhere edited');
|
expect(result).toEqual('Somewhere edited');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the postcode have been edited', async() => {
|
it('should confirm the postcode have been edited', async() => {
|
||||||
const result = await nightmare
|
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.postcodeInput} input`, 'value');
|
||||||
.waitToGetProperty(`${selectors.clientFiscalData.postcodeInput}`, 'value');
|
|
||||||
|
|
||||||
expect(result).toContain('46000');
|
expect(result).toContain('46000');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the city have been autocompleted', async() => {
|
it('should confirm the city have been autocompleted', async() => {
|
||||||
const result = await nightmare
|
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.cityInput} input`, 'value');
|
||||||
.waitToGetProperty(`${selectors.clientFiscalData.cityInput}`, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('Valencia');
|
expect(result).toEqual('Valencia');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it(`should confirm the province have been autocompleted`, async() => {
|
it(`should confirm the province have been autocompleted`, async() => {
|
||||||
const result = await nightmare
|
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.provinceAutocomplete} input`, 'value');
|
||||||
.waitToGetProperty(`${selectors.clientFiscalData.provinceAutocomplete} input`, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('Province one');
|
expect(result).toEqual('Province one');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the country have been autocompleted', async() => {
|
it('should confirm the country have been autocompleted', async() => {
|
||||||
const result = await nightmare
|
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.countryAutocomplete} input`, 'value');
|
||||||
.waitToGetProperty(`${selectors.clientFiscalData.countryAutocomplete} input`, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('España');
|
expect(result).toEqual('España');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm active checkbox is unchecked', async() => {
|
it('should confirm active checkbox is unchecked', async() => {
|
||||||
const result = await nightmare
|
const result = await page.checkboxState(selectors.clientFiscalData.activeCheckbox);
|
||||||
.checkboxState(selectors.clientFiscalData.activeCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('unchecked');
|
expect(result).toBe('unchecked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm frozen checkbox is checked', async() => {
|
it('should confirm frozen checkbox is checked', async() => {
|
||||||
const result = await nightmare
|
const result = await page.checkboxState(selectors.clientFiscalData.frozenCheckbox);
|
||||||
.checkboxState(selectors.clientFiscalData.frozenCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('checked');
|
expect(result).toBe('checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm Has to invoice checkbox is unchecked', async() => {
|
it('should confirm Has to invoice checkbox is unchecked', async() => {
|
||||||
const result = await nightmare
|
const result = await page.checkboxState(selectors.clientFiscalData.hasToInvoiceCheckbox);
|
||||||
.checkboxState(selectors.clientFiscalData.hasToInvoiceCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('unchecked');
|
expect(result).toBe('unchecked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm Vies checkbox is checked', async() => {
|
it('should confirm Vies checkbox is checked', async() => {
|
||||||
const result = await nightmare
|
const result = await page.checkboxState(selectors.clientFiscalData.viesCheckbox);
|
||||||
.checkboxState(selectors.clientFiscalData.viesCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('checked');
|
expect(result).toBe('checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm Invoice by mail checkbox is unchecked', async() => {
|
it('should confirm Invoice by mail checkbox is unchecked', async() => {
|
||||||
const result = await nightmare
|
const result = await page.checkboxState(selectors.clientFiscalData.invoiceByMailCheckbox);
|
||||||
.checkboxState(selectors.clientFiscalData.invoiceByMailCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('unchecked');
|
expect(result).toBe('unchecked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm invoice by address checkbox is unchecked', async() => {
|
it('should confirm invoice by address checkbox is unchecked', async() => {
|
||||||
const result = await nightmare
|
const result = await page.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||||
.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('unchecked');
|
expect(result).toBe('unchecked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm Equalization tax checkbox is unchecked', async() => {
|
it('should confirm Equalization tax checkbox is unchecked', async() => {
|
||||||
const result = await nightmare
|
const result = await page.checkboxState(selectors.clientFiscalData.equalizationTaxCheckbox);
|
||||||
.checkboxState(selectors.clientFiscalData.equalizationTaxCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('unchecked');
|
expect(result).toBe('unchecked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm Verified data checkbox is checked', async() => {
|
it('should confirm Verified data checkbox is checked', async() => {
|
||||||
const result = await nightmare
|
const result = await page.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('checked');
|
expect(result).toBe('checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 1
|
// 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() => {
|
it(`should click on the addresses button to access to the client's addresses`, async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.clientAddresses.addressesButton);
|
||||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
await page.waitForURL('/address/index');
|
||||||
.waitForURL('/address/index')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/address/index');
|
expect(url.hash).toContain('/address/index');
|
||||||
});
|
});
|
||||||
|
|
||||||
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 2
|
// 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() => {
|
it(`should click on the 1st edit icon to access the address details and uncheck EQtax checkbox`, async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
await page.waitForTextInInput(selectors.clientAddresses.cityInput, 'Silla');
|
||||||
.waitForTextInInput(selectors.clientAddresses.cityInput, 'Silla')
|
await page.waitToClick(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||||
.waitToClick(selectors.clientAddresses.equalizationTaxCheckbox)
|
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||||
.waitToClick(selectors.clientAddresses.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 3
|
// 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() => {
|
it('should navigate back to fiscal data to confirm invoice by address is now checked', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientFiscalData.fiscalDataButton);
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
await page.waitForWatcherData(selectors.clientFiscalData.watcher);
|
||||||
.waitForWatcherData(selectors.clientFiscalData.watcher)
|
const result = await page.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
||||||
.checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('checked');
|
expect(result).toBe('checked');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,121 +1,105 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client Edit billing data path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('administrative', 'client')
|
|
||||||
.accessToSearchResult('Bruce Banner')
|
|
||||||
.accessToSection('client.card.billingData');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should attempt to edit the billing data without an IBAN but fail`, async() => {
|
it(`should attempt to edit the billing data without an IBAN but fail`, async() => {
|
||||||
const snackbarMessage = await nightmare
|
await page.autocompleteSearch(selectors.clientBillingData.payMethodAutocomplete, 'PayMethod with IBAN');
|
||||||
.autocompleteSearch(selectors.clientBillingData.payMethodAutocomplete, 'PayMethod with IBAN')
|
await page.autocompleteSearch(selectors.clientBillingData.swiftBicAutocomplete, 'BBKKESMMMMM');
|
||||||
.autocompleteSearch(selectors.clientBillingData.swiftBicAutocomplete, 'BBKKESMMMMM')
|
await page.clearInput(selectors.clientBillingData.dueDayInput);
|
||||||
.clearInput(selectors.clientBillingData.dueDayInput)
|
await page.write(selectors.clientBillingData.dueDayInput, '60');
|
||||||
.write(selectors.clientBillingData.dueDayInput, '60')
|
await page.waitForTextInInput(selectors.clientBillingData.dueDayInput, '60');
|
||||||
.waitForTextInInput(selectors.clientBillingData.dueDayInput, '60')
|
await page.waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox);
|
||||||
.waitToClick(selectors.clientBillingData.receivedCoreLCRCheckbox)
|
await page.waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox);
|
||||||
.waitToClick(selectors.clientBillingData.receivedCoreVNLCheckbox)
|
await page.waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox);
|
||||||
.waitToClick(selectors.clientBillingData.receivedB2BVNLCheckbox)
|
await page.waitToClick(selectors.clientBillingData.saveButton);
|
||||||
.waitToClick(selectors.clientBillingData.saveButton)
|
let snackbarMessage = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(snackbarMessage).toEqual('That payment method requires an IBAN');
|
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() => {
|
it(`should create a new BIC code`, async() => {
|
||||||
const newcode = await nightmare
|
await page.waitToClick(selectors.clientBillingData.newBankEntityButton);
|
||||||
.waitToClick(selectors.clientBillingData.newBankEntityButton)
|
await page.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank');
|
||||||
.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank')
|
await page.write(selectors.clientBillingData.newBankEntityCode, '9999');
|
||||||
.write(selectors.clientBillingData.newBankEntityCode, 9999)
|
await page.write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT');
|
||||||
.write(selectors.clientBillingData.newBankEntityBIC, 'GTHMCT')
|
await page.waitToClick(selectors.clientBillingData.acceptBankEntityButton);
|
||||||
.waitToClick(selectors.clientBillingData.acceptBankEntityButton)
|
await page.waitForTextInInput(selectors.clientBillingData.swiftBicAutocomplete, 'Gotham City Bank');
|
||||||
.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
let newcode = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(newcode).toEqual('GTHMCT Gotham City Bank');
|
expect(newcode).toEqual('GTHMCT Gotham City Bank');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the IBAN pay method is sucessfully saved`, async() => {
|
it(`should confirm the IBAN pay method was sucessfully saved`, async() => {
|
||||||
const payMethod = await nightmare
|
let payMethod = await page.waitToGetProperty(`${selectors.clientBillingData.payMethodAutocomplete} input`, 'value');
|
||||||
.waitToGetProperty(`${selectors.clientBillingData.payMethodAutocomplete} input`, 'value');
|
|
||||||
|
|
||||||
expect(payMethod).toEqual('PayMethod with IBAN');
|
expect(payMethod).toEqual('PayMethod with IBAN');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should clear the BIC code field, update the IBAN to see how he BIC code autocompletes`, async() => {
|
it(`should clear the BIC code field, update the IBAN to see how he BIC code autocompletes`, async() => {
|
||||||
const AutomaticCode = await nightmare
|
await page.write(selectors.clientBillingData.IBANInput, 'ES9121000418450200051332');
|
||||||
.clearInput(selectors.clientBillingData.IBANInput)
|
await page.keyboard.press('Tab');
|
||||||
.write(selectors.clientBillingData.IBANInput, 'ES9121000418450200051332')
|
await page.keyboard.press('Tab');
|
||||||
.waitForTextInInput(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'caixesbb')
|
await page.waitForTextInInput(selectors.clientBillingData.swiftBicAutocomplete, 'caixesbb');
|
||||||
.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
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() => {
|
it(`should save the form with all its new data`, async() => {
|
||||||
const snackbarMessages = await nightmare
|
await page.waitForContentLoaded();
|
||||||
.waitForWatcherData(selectors.clientBillingData.watcher)
|
await page.waitForWatcherData(selectors.clientBillingData.watcher);
|
||||||
.waitToClick(selectors.clientBillingData.saveButton)
|
await page.waitToClick(selectors.clientBillingData.saveButton);
|
||||||
.waitForSnackbar();
|
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() => {
|
it('should confirm the due day have been edited', async() => {
|
||||||
const dueDate = await nightmare
|
let dueDate = await page.waitToGetProperty(`${selectors.clientBillingData.dueDayInput} input`, 'value');
|
||||||
.waitToGetProperty(selectors.clientBillingData.dueDayInput, 'value');
|
|
||||||
|
|
||||||
expect(dueDate).toEqual('60');
|
expect(dueDate).toEqual('60');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the IBAN was saved', async() => {
|
it('should confirm the IBAN was saved', async() => {
|
||||||
const IBAN = await nightmare
|
let IBAN = await page.waitToGetProperty(`${selectors.clientBillingData.IBANInput} input`, 'value');
|
||||||
.waitToGetProperty(selectors.clientBillingData.IBANInput, 'value');
|
|
||||||
|
|
||||||
expect(IBAN).toEqual('ES9121000418450200051332');
|
expect(IBAN).toEqual('ES9121000418450200051332');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the swift / BIC code was saved', async() => {
|
it('should confirm the swift / BIC code was saved', async() => {
|
||||||
const code = await nightmare
|
let code = await page.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
||||||
.waitToGetProperty(`${selectors.clientBillingData.swiftBicAutocomplete} input`, 'value');
|
|
||||||
|
|
||||||
expect(code).toEqual('CAIXESBB Caixa Bank');
|
expect(code).toEqual('CAIXESBB Caixa Bank');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm Received LCR checkbox is checked', async() => {
|
it('should confirm Received LCR checkbox is checked', async() => {
|
||||||
const result = await nightmare
|
let result = await page.checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox);
|
||||||
.checkboxState(selectors.clientBillingData.receivedCoreLCRCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('checked');
|
expect(result).toBe('checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm Received core VNL checkbox is unchecked', async() => {
|
it('should confirm Received core VNL checkbox is unchecked', async() => {
|
||||||
const result = await nightmare
|
let result = await page.checkboxState(selectors.clientBillingData.receivedCoreVNLCheckbox);
|
||||||
.checkboxState(selectors.clientBillingData.receivedCoreVNLCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('unchecked');
|
expect(result).toBe('unchecked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm Received B2B VNL checkbox is unchecked', async() => {
|
it('should confirm Received B2B VNL checkbox is unchecked', async() => {
|
||||||
const result = await nightmare
|
let result = await page.checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox);
|
||||||
.checkboxState(selectors.clientBillingData.receivedB2BVNLCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('unchecked');
|
expect(result).toBe('unchecked');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,119 +1,112 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client Add address path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('employee', 'client')
|
|
||||||
.accessToSearchResult('Bruce Banner')
|
|
||||||
.accessToSection('client.card.address.index');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the add new address button to access to the new address form`, async() => {
|
it(`should click on the add new address button to access to the new address form`, async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.clientAddresses.createAddress);
|
||||||
.waitToClick(selectors.clientAddresses.createAddress)
|
await page.waitForURL('address/create');
|
||||||
.waitForURL('address/create')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('address/create');
|
expect(url.hash).toContain('address/create');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should receive an error after clicking save button as consignee, street and town fields are empty', async() => {
|
it('should receive an error after clicking save button as consignee, street and town fields are empty', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientAddresses.defaultCheckboxInput);
|
||||||
.waitToClick(selectors.clientAddresses.defaultCheckboxInput)
|
await page.autocompleteSearch(selectors.clientAddresses.provinceAutocomplete, 'Province five');
|
||||||
.clearInput(selectors.clientAddresses.streetAddressInput)
|
await page.write(selectors.clientAddresses.cityInput, 'Valencia');
|
||||||
.autocompleteSearch(selectors.clientAddresses.provinceAutocomplete, 'Province one')
|
await page.write(selectors.clientAddresses.postcodeInput, '46000');
|
||||||
.clearInput(selectors.clientAddresses.cityInput)
|
await page.autocompleteSearch(selectors.clientAddresses.agencyAutocomplete, 'Entanglement');
|
||||||
.write(selectors.clientAddresses.cityInput, 'Valencia')
|
await page.write(selectors.clientAddresses.phoneInput, '999887744');
|
||||||
.clearInput(selectors.clientAddresses.postcodeInput)
|
await page.write(selectors.clientAddresses.mobileInput, '999887744');
|
||||||
.write(selectors.clientAddresses.postcodeInput, '46000')
|
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||||
.autocompleteSearch(selectors.clientAddresses.agencyAutocomplete, 'Entanglement')
|
const result = await page.waitForLastSnackbar();
|
||||||
.write(selectors.clientAddresses.phoneInput, '999887744')
|
|
||||||
.write(selectors.clientAddresses.mobileInput, '999887744')
|
|
||||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Some fields are invalid');
|
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() => {
|
it(`should receive an error after clicking save button as consignee, incoterms and customsAgent are empty`, async() => {
|
||||||
const result = await nightmare
|
await page.autocompleteSearch(selectors.clientAddresses.incotermsAutocomplete, 'Free Alongside Ship');
|
||||||
.waitToGetProperty(`${selectors.clientAddresses.cityInput}`, 'value');
|
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||||
|
const result = await page.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toEqual('Valencia');
|
expect(result).toEqual('Customs agent is required for a non UEE member');
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
it(`should confirm the province have been autocompleted`, async() => {
|
|
||||||
const result = await nightmare
|
|
||||||
.waitToGetProperty(`${selectors.clientAddresses.provinceAutocomplete} input`, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('Province one');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should create a new address with all it's data`, async() => {
|
it(`should create a new address with all it's data`, async() => {
|
||||||
const result = await nightmare
|
await page.autocompleteSearch(selectors.clientAddresses.customsAgentAutocomplete, 'Agent one');
|
||||||
.write(selectors.clientAddresses.consigneeInput, 'Bruce Bunner')
|
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||||
.write(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York')
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitToClick(selectors.clientAddresses.saveButton)
|
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the addresses button confirm the new address exists and it's the default one`, async() => {
|
it(`should click on the first address button to confirm the new address exists and it's the default one`, async() => {
|
||||||
const result = await nightmare
|
const result = await page.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
||||||
// .waitToClick(selectors.clientAddresses.addressesButton)
|
|
||||||
.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('320 Park Avenue New York');
|
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() => {
|
it(`should click on the make default icon of the second address`, async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientAddresses.secondMakeDefaultStar);
|
||||||
.waitToClick(selectors.clientAddresses.secondMakeDefaultStar)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
|
|
||||||
.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
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');
|
expect(result).toContain('Somewhere in Thailand');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the edit icon of the default address`, async() => {
|
it(`should click on the edit icon of the default address`, async() => {
|
||||||
const url = await nightmare
|
await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand');
|
||||||
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
|
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
await page.waitForURL('/edit');
|
||||||
.waitForURL('/edit')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/edit');
|
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() => {
|
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
|
await page.waitForWatcherData(selectors.clientAddresses.watcher);
|
||||||
.waitForWatcherData(selectors.clientAddresses.watcher)
|
await page.waitToClick(selectors.clientAddresses.activeCheckbox);
|
||||||
.waitToClick(selectors.clientAddresses.activeCheckbox)
|
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||||
.waitToClick(selectors.clientAddresses.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('The default consignee can not be unchecked');
|
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() => {
|
it(`should go back to the addreses section by clicking the cancel button`, async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.clientAddresses.cancelEditAddressButton);
|
||||||
.waitToClick(selectors.clientAddresses.cancelEditAddressButton)
|
await page.waitToClick('.vn-confirm.shown button[response="accept"]');
|
||||||
.waitToClick('.vn-confirm.shown button[response="accept"]')
|
await page.waitForURL('address/index');
|
||||||
.waitForURL('address/index')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('address/index');
|
expect(url.hash).toContain('address/index');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,54 +1,55 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client add address notes path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('employee', 'client')
|
|
||||||
.accessToSearchResult('Petter Parker')
|
|
||||||
.accessToSection('client.card.address.index');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the edit icon of the default address`, async() => {
|
it(`should click on the edit icon of the default address`, async() => {
|
||||||
const url = await nightmare
|
await page.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street');
|
||||||
.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street')
|
await page.waitToClick(selectors.clientAddresses.firstEditAddress);
|
||||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
await page.waitForURL('/edit');
|
||||||
.waitForURL('/edit')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/edit');
|
expect(url.hash).toContain('/edit');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not save a description without observation type', async() => {
|
it('should not save a description without observation type', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientAddresses.addObservationButton);
|
||||||
.waitToClick(selectors.clientAddresses.addObservationButton)
|
await page.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description');
|
||||||
.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
|
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||||
.waitToClick(selectors.clientAddresses.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Some fields are invalid');
|
expect(result).toEqual('Some fields are invalid');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not save an observation type without description', async() => {
|
it('should not save an observation type without description', async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.clientAddresses.firstObservationDescriptionInput);
|
||||||
.clearInput(selectors.clientAddresses.firstObservationDescriptionInput)
|
await page.autocompleteSearch(selectors.clientAddresses.firstObservationTypeAutocomplete, 'comercial');
|
||||||
.autocompleteSearch(selectors.clientAddresses.firstObservationTypeAutocomplete, 'comercial')
|
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||||
.waitToClick(selectors.clientAddresses.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Some fields are invalid');
|
expect(result).toEqual('Some fields are invalid');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create two new observations', async() => {
|
it('should create two new observations', async() => {
|
||||||
const result = await nightmare
|
await page.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description');
|
||||||
.write(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
|
await page.waitToClick(selectors.clientAddresses.addObservationButton);
|
||||||
.waitToClick(selectors.clientAddresses.addObservationButton)
|
await page.autocompleteSearch(selectors.clientAddresses.secondObservationTypeAutocomplete, 'observation one');
|
||||||
.autocompleteSearch(selectors.clientAddresses.secondObservationTypeAutocomplete, 'observation one')
|
await page.write(selectors.clientAddresses.secondObservationDescriptionInput, 'second description');
|
||||||
.write(selectors.clientAddresses.secondObservationDescriptionInput, 'second description')
|
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||||
.waitToClick(selectors.clientAddresses.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,41 +1,43 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client Edit web access path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('employee', 'client')
|
|
||||||
.accessToSearchResult('Bruce Banner')
|
|
||||||
.accessToSection('client.card.webAccess');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should uncheck the Enable web access checkbox and update the name`, async() => {
|
it(`should uncheck the Enable web access checkbox and update the name`, async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox);
|
||||||
.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox)
|
await page.clearInput(selectors.clientWebAccess.userNameInput);
|
||||||
.clearInput(selectors.clientWebAccess.userNameInput)
|
await page.write(selectors.clientWebAccess.userNameInput, 'Hulk');
|
||||||
.write(selectors.clientWebAccess.userNameInput, 'Hulk')
|
await page.waitToClick(selectors.clientWebAccess.saveButton);
|
||||||
.waitToClick(selectors.clientWebAccess.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm web access is now unchecked', async() => {
|
it('should confirm web access is now unchecked', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientBasicData.basicDataButton);
|
||||||
.waitToClick(selectors.clientBasicData.basicDataButton)
|
await page.wait(selectors.clientBasicData.nameInput);
|
||||||
.wait(selectors.clientBasicData.nameInput)
|
await page.waitToClick(selectors.clientsIndex.othersButton);
|
||||||
.waitToClick(selectors.clientsIndex.othersButton)
|
await page.waitToClick(selectors.clientWebAccess.webAccessButton);
|
||||||
.waitToClick(selectors.clientWebAccess.webAccessButton)
|
const result = await page.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox);
|
||||||
.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBe('unchecked');
|
expect(result).toBe('unchecked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm web access name have been updated', async() => {
|
it('should confirm web access name have been updated', async() => {
|
||||||
const result = await nightmare
|
const result = await page.waitToGetProperty(`${selectors.clientWebAccess.userNameInput} input`, 'value');
|
||||||
.waitToGetProperty(selectors.clientWebAccess.userNameInput, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('Hulk');
|
expect(result).toEqual('Hulk');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,37 +1,40 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client Add notes path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('employee', 'client')
|
|
||||||
.accessToSearchResult('Bruce Banner')
|
|
||||||
.accessToSection('client.card.note.index');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the add note button`, async() => {
|
it(`should click on the add note button`, async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.clientNotes.addNoteFloatButton);
|
||||||
.waitToClick(selectors.clientNotes.addNoteFloatButton)
|
await page.waitForURL('/note/create');
|
||||||
.waitForURL('/note/create')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/note/create');
|
expect(url.hash).toContain('/note/create');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should create a note`, async() => {
|
it(`should create a note`, async() => {
|
||||||
const result = await nightmare
|
await page.waitFor(selectors.clientNotes.noteInput);
|
||||||
.write(selectors.clientNotes.noteInput, 'Meeting with Black Widow 21st 9am')
|
await page.type(`${selectors.clientNotes.noteInput} textarea`, 'Meeting with Black Widow 21st 9am');
|
||||||
.waitToClick(selectors.clientNotes.saveButton)
|
await page.waitToClick(selectors.clientNotes.saveButton);
|
||||||
.waitForLastSnackbar();
|
const result = await page.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the note was created', async() => {
|
it('should confirm the note was created', async() => {
|
||||||
const result = await nightmare
|
const result = await page.waitToGetProperty(selectors.clientNotes.firstNoteText, 'innerText');
|
||||||
.waitToGetProperty(selectors.clientNotes.firstNoteText, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual('Meeting with Black Widow 21st 9am');
|
expect(result).toEqual('Meeting with Black Widow 21st 9am');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,38 +1,42 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client Add credit path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('salesAssistant', 'client')
|
|
||||||
.accessToSearchResult('Hank Pym')
|
|
||||||
.accessToSection('client.card.credit.index');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the add credit button`, async() => {
|
it(`should click on the add credit button`, async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.clientCredit.addCreditFloatButton);
|
||||||
.waitToClick(selectors.clientCredit.addCreditFloatButton)
|
await page.waitForURL('/credit/create');
|
||||||
.waitForURL('/credit/create')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/credit/create');
|
expect(url.hash).toContain('/credit/create');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should edit the credit`, async() => {
|
it(`should edit the credit`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForContentLoaded();
|
||||||
.clearInput(selectors.clientCredit.creditInput)
|
await page.clearInput(selectors.clientCredit.creditInput);
|
||||||
.write(selectors.clientCredit.creditInput, 999)
|
await page.write(selectors.clientCredit.creditInput, '999');
|
||||||
.waitToClick(selectors.clientCredit.saveButton)
|
await page.waitToClick(selectors.clientCredit.saveButton);
|
||||||
.waitForLastSnackbar();
|
const result = await page.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the credit was updated', async() => {
|
it('should confirm the credit was updated', async() => {
|
||||||
const result = await nightmare
|
await page.waitForContentLoaded();
|
||||||
.waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText');
|
const result = await page.waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain(999);
|
expect(result).toContain(999);
|
||||||
expect(result).toContain('salesAssistant');
|
expect(result).toContain('salesAssistant');
|
||||||
|
|
|
@ -1,48 +1,49 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client Add greuge path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('salesAssistant', 'client')
|
|
||||||
.accessToSearchResult('Petter Parker')
|
|
||||||
.accessToSection('client.card.greuge.index');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the add greuge button`, async() => {
|
it(`should click on the add greuge button`, async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.clientGreuge.addGreugeFloatButton);
|
||||||
.waitToClick(selectors.clientGreuge.addGreugeFloatButton)
|
await page.waitForURL('greuge/create');
|
||||||
.waitForURL('greuge/create')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('greuge/create');
|
expect(url.hash).toContain('greuge/create');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should receive an error if all fields are empty but date and type on submit`, async() => {
|
it(`should receive an error if all fields are empty but date and type on submit`, async() => {
|
||||||
const result = await nightmare
|
await page.autocompleteSearch(selectors.clientGreuge.typeAutocomplete, 'Diff');
|
||||||
.autocompleteSearch(selectors.clientGreuge.typeAutocomplete, 'Diff')
|
await page.waitToClick(selectors.clientGreuge.saveButton);
|
||||||
.waitToClick(selectors.clientGreuge.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Some fields are invalid');
|
expect(result).toEqual('Some fields are invalid');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should create a new greuge with all its data`, async() => {
|
it(`should create a new greuge with all its data`, async() => {
|
||||||
const result = await nightmare
|
await page.write(selectors.clientGreuge.amountInput, '999');
|
||||||
.write(selectors.clientGreuge.amountInput, 999)
|
await page.waitForTextInInput(selectors.clientGreuge.amountInput, '999');
|
||||||
.waitForTextInInput(selectors.clientGreuge.amountInput, '999')
|
await page.write(selectors.clientGreuge.descriptionInput, 'new armor for Batman!');
|
||||||
.write(selectors.clientGreuge.descriptionInput, 'new armor for Batman!')
|
await page.waitToClick(selectors.clientGreuge.saveButton);
|
||||||
.waitToClick(selectors.clientGreuge.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the greuge was added to the list', async() => {
|
it('should confirm the greuge was added to the list', async() => {
|
||||||
const result = await nightmare
|
const result = await page.waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText');
|
||||||
.waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain(999);
|
expect(result).toContain(999);
|
||||||
expect(result).toContain('new armor for Batman!');
|
expect(result).toContain('new armor for Batman!');
|
||||||
|
|
|
@ -1,18 +1,23 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client mandate path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('salesPerson', 'client')
|
|
||||||
.accessToSearchResult('Petter Parker')
|
|
||||||
.accessToSection('client.card.mandate');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the client has a mandate of the CORE type', async() => {
|
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');
|
.waitToGetProperty(selectors.clientMandate.firstMandateText, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain('1');
|
expect(result).toContain('1');
|
||||||
|
|
|
@ -1,180 +1,167 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client lock verified data path', () => {
|
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', () => {
|
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() => {
|
it('should confirm verified data button is disabled for salesPerson', async() => {
|
||||||
const result = await nightmare
|
await page.wait(200);
|
||||||
.wait(200)
|
await page.wait(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
.wait(selectors.clientFiscalData.verifiedDataCheckbox)
|
const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBeTruthy();
|
expect(result).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should edit the social name', async() => {
|
it('should edit the social name', async() => {
|
||||||
const result = await nightmare
|
await page.wait(selectors.clientFiscalData.socialNameInput);
|
||||||
.wait(selectors.clientFiscalData.socialNameInput)
|
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
await page.write(selectors.clientFiscalData.socialNameInput, 'Captain America Civil War');
|
||||||
.write(selectors.clientFiscalData.socialNameInput, 'Captain America Civil War')
|
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the social name have been edited', async() => {
|
it('should confirm the social name have been edited', async() => {
|
||||||
const result = await nightmare
|
await page.reloadSection('client.card.fiscalData');
|
||||||
.reloadSection('client.card.fiscalData')
|
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value');
|
||||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('Captain America Civil War');
|
expect(result).toEqual('Captain America Civil War');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('as administrative', () => {
|
describe('as administrative', () => {
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
nightmare
|
await page.loginAndModule('administrative', 'client');
|
||||||
.loginAndModule('administrative', 'client')
|
await page.accessToSearchResult('Hank Pym');
|
||||||
.accessToSearchResult('Hank Pym')
|
await page.accessToSection('client.card.fiscalData');
|
||||||
.accessToSection('client.card.fiscalData');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm verified data button is enabled for administrative', async() => {
|
it('should confirm verified data button is enabled for administrative', async() => {
|
||||||
const result = await nightmare
|
const result = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check the Verified data checkbox', async() => {
|
it('should check the Verified data checkbox', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
.waitToClick(selectors.clientFiscalData.verifiedDataCheckbox)
|
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm Verified data checkbox is checked', async() => {
|
it('should confirm Verified data checkbox is checked', async() => {
|
||||||
const isChecked = await nightmare
|
await page.reloadSection('client.card.fiscalData');
|
||||||
.reloadSection('client.card.fiscalData')
|
const isChecked = await page.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
|
|
||||||
|
|
||||||
expect(isChecked).toEqual('checked');
|
expect(isChecked).toEqual('checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should again edit the social name', async() => {
|
it('should again edit the social name', async() => {
|
||||||
const result = await nightmare
|
await page.wait(selectors.clientFiscalData.socialNameInput);
|
||||||
.wait(selectors.clientFiscalData.socialNameInput)
|
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
await page.write(selectors.clientFiscalData.socialNameInput, 'Ant man and the Wasp');
|
||||||
.write(selectors.clientFiscalData.socialNameInput, 'Ant man and the Wasp')
|
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should again confirm the social name have been edited', async() => {
|
it('should again confirm the social name have been edited', async() => {
|
||||||
const result = await nightmare
|
await page.reloadSection('client.card.fiscalData');
|
||||||
.reloadSection('client.card.fiscalData')
|
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value');
|
||||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('Ant man and the Wasp');
|
expect(result).toEqual('Ant man and the Wasp');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('as salesPerson second run', () => {
|
describe('as salesPerson second run', () => {
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
nightmare
|
await page.loginAndModule('salesPerson', 'client');
|
||||||
.loginAndModule('salesPerson', 'client')
|
await page.accessToSearchResult('Hank Pym');
|
||||||
.accessToSearchResult('Hank Pym')
|
await page.accessToSection('client.card.fiscalData');
|
||||||
.accessToSection('client.card.fiscalData');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm verified data button is disabled once again for salesPerson', async() => {
|
it('should confirm verified data button is disabled once again for salesPerson', async() => {
|
||||||
const isDisabled = await nightmare
|
const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
|
||||||
|
|
||||||
expect(isDisabled).toBeTruthy();
|
expect(isDisabled).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not be able to save change throwing a verified data error', async() => {
|
it('should not be able to save change throwing a verified data error', async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
await page.write(selectors.clientFiscalData.socialNameInput, 'This wont happen');
|
||||||
.write(selectors.clientFiscalData.socialNameInput, 'This wont happen')
|
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual(jasmine.arrayContaining([`You can't make changes on a client with verified data`]));
|
expect(result).toEqual(jasmine.arrayContaining([`You can't make changes on a client with verified data`]));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('as salesAssistant', () => {
|
describe('as salesAssistant', () => {
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
nightmare
|
await page.forceReloadSection('client.card.fiscalData');
|
||||||
.forceReloadSection('client.card.fiscalData')
|
await page.loginAndModule('salesAssistant', 'client');
|
||||||
.loginAndModule('salesAssistant', 'client')
|
await page.accessToSearchResult('Hank Pym');
|
||||||
.accessToSearchResult('Hank Pym')
|
await page.accessToSection('client.card.fiscalData');
|
||||||
.accessToSection('client.card.fiscalData');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm verified data button is enabled for salesAssistant', async() => {
|
it('should confirm verified data button is enabled for salesAssistant', async() => {
|
||||||
const isDisabled = await nightmare
|
const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
|
||||||
|
|
||||||
expect(isDisabled).toBeFalsy();
|
expect(isDisabled).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now edit the social name', async() => {
|
it('should now edit the social name', async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.clientFiscalData.socialNameInput);
|
||||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
await page.write(selectors.clientFiscalData.socialNameInput, 'new social name edition');
|
||||||
.write(selectors.clientFiscalData.socialNameInput, 'new social name edition')
|
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now confirm the social name have been edited once and for all', async() => {
|
it('should now confirm the social name have been edited once and for all', async() => {
|
||||||
const result = await nightmare
|
await page.reloadSection('client.card.fiscalData');
|
||||||
.reloadSection('client.card.fiscalData')
|
const result = await page.waitToGetProperty(`${selectors.clientFiscalData.socialNameInput} input`, 'value');
|
||||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('new social name edition');
|
expect(result).toEqual('new social name edition');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('as salesPerson third run', () => {
|
describe('as salesPerson third run', () => {
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
nightmare
|
await page.loginAndModule('salesPerson', 'client');
|
||||||
.loginAndModule('salesPerson', 'client')
|
await page.accessToSearchResult('Hank Pym');
|
||||||
.accessToSearchResult('Hank Pym')
|
await page.accessToSection('client.card.fiscalData');
|
||||||
.accessToSection('client.card.fiscalData');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm verified data button is enabled once again', async() => {
|
it('should confirm verified data button is enabled once again', async() => {
|
||||||
const isDisabled = await nightmare
|
const isDisabled = await page;
|
||||||
.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
|
|
||||||
expect(isDisabled).toBeTruthy();
|
expect(isDisabled).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the form is enabled for salesPerson', async() => {
|
it('should confirm the form is enabled for salesPerson', async() => {
|
||||||
const result = await nightmare
|
await page.wait(selectors.clientFiscalData.socialNameInput);
|
||||||
.wait(selectors.clientFiscalData.socialNameInput)
|
const result = await page.evaluate(selector => {
|
||||||
.evaluate(selector => {
|
return document.querySelector(selector).disabled;
|
||||||
return document.querySelector(selector).disabled;
|
}, 'vn-textfield[ng-model="$ctrl.client.socialName"] > div');
|
||||||
}, 'vn-textfield[ng-model="$ctrl.client.socialName"] > div');
|
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,48 +1,51 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client log path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('employee', 'client')
|
|
||||||
.accessToSearchResult('DavidCharlesHaller')
|
|
||||||
.accessToSection('client.card.basicData');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update the clients name', async() => {
|
it('should update the clients name', async() => {
|
||||||
let result = await nightmare
|
await page.clearInput(selectors.clientBasicData.nameInput);
|
||||||
.clearInput(selectors.clientBasicData.nameInput)
|
await page.write(selectors.clientBasicData.nameInput, 'this is a test');
|
||||||
.write(selectors.clientBasicData.nameInput, 'this is a test')
|
await page.waitToClick(selectors.clientBasicData.saveButton);
|
||||||
.waitToClick(selectors.clientBasicData.saveButton)
|
let result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should navigate to the log section', async() => {
|
it('should navigate to the log section', async() => {
|
||||||
let url = await nightmare
|
await page.waitToClick(selectors.clientLog.logButton);
|
||||||
.waitToClick(selectors.clientLog.logButton)
|
await page.waitForURL('log');
|
||||||
.waitForURL('log')
|
let url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('log');
|
expect(url.hash).toContain('log');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check the previous value of the last logged change', async() => {
|
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');
|
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
|
||||||
|
|
||||||
expect(lastModificationPreviousValue).toContain('DavidCharlesHaller');
|
expect(lastModificationPreviousValue).toContain('DavidCharlesHaller');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check the current value of the last logged change', async() => {
|
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');
|
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
|
||||||
|
|
||||||
let lastModificationCurrentValue = await nightmare
|
let lastModificationCurrentValue = await page.
|
||||||
.waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
|
waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
|
||||||
|
|
||||||
|
|
||||||
expect(lastModificationPreviousValue).toEqual('name: DavidCharlesHaller');
|
expect(lastModificationPreviousValue).toEqual('name: DavidCharlesHaller');
|
||||||
|
|
|
@ -1,66 +1,71 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client balance path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('administrative', 'client')
|
|
||||||
.accessToSearchResult('Petter Parker');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now edit the local user config data', async() => {
|
it('should now edit the local user config data', async() => {
|
||||||
let result = await nightmare
|
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||||
.waitToClick(selectors.globalItems.userMenuButton)
|
await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs');
|
||||||
.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs')
|
let result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should access to the balance section to check the data shown matches the local settings', async() => {
|
it('should access to the balance section to check the data shown matches the local settings', async() => {
|
||||||
let result = await nightmare
|
await page.accessToSection('client.card.balance.index');
|
||||||
.accessToSection('client.card.balance.index')
|
let result = await page.waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value');
|
||||||
.waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('CCs');
|
expect(result).toEqual('CCs');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now clear the user local settings', async() => {
|
it('should now clear the user local settings', async() => {
|
||||||
let result = await nightmare
|
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||||
.waitToClick(selectors.globalItems.userMenuButton)
|
await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete);
|
||||||
.waitToClick(selectors.globalItems.userConfigThirdAutocompleteClear)
|
let result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should click the new payment button', async() => {
|
it('should click the new payment button', async() => {
|
||||||
let url = await nightmare
|
await page.keyboard.press('Escape');
|
||||||
.reloadSection('client.card.balance.index')
|
await page.reloadSection('client.card.balance.index');
|
||||||
.waitToClick(selectors.clientBalance.newPaymentButton)
|
await page.waitForURL('/balance');
|
||||||
.waitForURL('/balance')
|
|
||||||
.parsedUrl();
|
let url = await page.parsedUrl();
|
||||||
|
|
||||||
expect(url.hash).toContain('/balance');
|
expect(url.hash).toContain('/balance');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create a new payment that clears the debt', async() => {
|
it('should create a new payment that clears the debt', async() => {
|
||||||
let result = await nightmare
|
await Promise.all([
|
||||||
.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt')
|
page.waitToClick(selectors.clientBalance.newPaymentButton),
|
||||||
.waitToClick(selectors.clientBalance.saveButton)
|
page.waitForSelector('.vn-dialog.vn-popup.shown', {visible: true})
|
||||||
.waitForLastSnackbar();
|
]);
|
||||||
|
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!');
|
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() => {
|
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
|
await page.waitForSpinnerLoad();
|
||||||
.waitForSpinnerLoad()
|
let company = await page
|
||||||
.waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.clientBalance.companyAutocomplete} input`, 'value');
|
||||||
|
|
||||||
let firstBalanceLine = await nightmare
|
let firstBalanceLine = await page
|
||||||
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,95 +73,75 @@ describe('Client balance path', () => {
|
||||||
expect(firstBalanceLine).toContain('0.00');
|
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() => {
|
it('should create a new payment that sets the balance to positive value', async() => {
|
||||||
let result = await nightmare
|
await page.waitToClick(selectors.clientBalance.newPaymentButton);
|
||||||
.clearInput(selectors.clientBalance.newPaymentAmountInput)
|
await page.waitFor(3000); // didn't manage to make this dynamic to allow clearInput to find the icon clear... :(
|
||||||
.write(selectors.clientBalance.newPaymentAmountInput, '100')
|
await page.clearInput(selectors.clientBalance.newPaymentAmountInput);
|
||||||
.waitToClick(selectors.clientBalance.saveButton)
|
await page.write(selectors.clientBalance.newPaymentAmountInput, '100');
|
||||||
.waitForLastSnackbar();
|
await page.waitToClick(selectors.clientBalance.saveButton);
|
||||||
|
let result = await page.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toContain('Data saved!');
|
expect(result).toContain('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check balance is now -100', async() => {
|
it('should check balance is now -100', async() => {
|
||||||
let result = await nightmare
|
let result = await page
|
||||||
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain('-€100.00');
|
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() => {
|
it('should create a new payment that sets the balance back to the original negative value', async() => {
|
||||||
let result = await nightmare
|
await page.waitToClick(selectors.clientBalance.newPaymentButton);
|
||||||
.clearInput(selectors.clientBalance.newPaymentAmountInput)
|
await page.waitFor(3000); // didn't manage to make this dynamic to allow clearInput to find the icon clear... :(
|
||||||
.write(selectors.clientBalance.newPaymentAmountInput, '-150')
|
await page.waitForSelector('.vn-dialog.vn-popup.shown', {visible: true});
|
||||||
.waitToClick(selectors.clientBalance.saveButton)
|
await page.clearInput(selectors.clientBalance.newPaymentAmountInput);
|
||||||
.waitForLastSnackbar();
|
await page.write(selectors.clientBalance.newPaymentAmountInput, '-150');
|
||||||
|
await page.waitToClick(selectors.clientBalance.saveButton);
|
||||||
|
let result = await page.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toContain('Data saved!');
|
expect(result).toContain('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check balance is now 50', async() => {
|
it('should check balance is now 50', async() => {
|
||||||
let result = await nightmare
|
let result = await page
|
||||||
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual('€50.00');
|
expect(result).toEqual('€50.00');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now click on the Clients button of the top bar menu', async() => {
|
it('should now click on the Clients button of the top bar menu', async() => {
|
||||||
let url = await nightmare
|
await page.login('employee');
|
||||||
.waitForLogin('employee')
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
await page.waitToClick(selectors.globalItems.clientsButton);
|
||||||
.waitToClick(selectors.globalItems.clientsButton)
|
await page.wait(selectors.clientsIndex.createClientButton);
|
||||||
.wait(selectors.clientsIndex.createClientButton)
|
let url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/client/index');
|
expect(url.hash).toEqual('#!/client/index');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now search for the user Petter Parker', async() => {
|
it('should now search for the user Petter Parker', async() => {
|
||||||
let resultCount = await nightmare
|
await page.write(selectors.clientsIndex.searchClientInput, 'Petter Parker');
|
||||||
.write(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
await page.waitToClick(selectors.clientsIndex.searchButton);
|
||||||
.waitToClick(selectors.clientsIndex.searchButton)
|
await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1);
|
||||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
let resultCount = await page.countElement(selectors.clientsIndex.searchResult);
|
||||||
.countElement(selectors.clientsIndex.searchResult);
|
|
||||||
|
|
||||||
expect(resultCount).toEqual(1);
|
expect(resultCount).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the search result to access to the client's balance`, async() => {
|
it(`should click on the search result to access to the client's balance`, async() => {
|
||||||
let url = await nightmare
|
await page.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker');
|
||||||
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
await page.waitToClick(selectors.clientsIndex.searchResult);
|
||||||
.waitToClick(selectors.clientsIndex.searchResult)
|
await page.waitForContentLoaded();
|
||||||
.waitToClick(selectors.clientBalance.balanceButton)
|
await page.waitToClick(selectors.clientBalance.balanceButton);
|
||||||
.waitForURL('/balance')
|
await page.waitForURL('/balance');
|
||||||
.parsedUrl();
|
let url = await page.parsedUrl();
|
||||||
|
|
||||||
expect(url.hash).toContain('/balance');
|
expect(url.hash).toContain('/balance');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not be able to click the new payment button as it isnt present', async() => {
|
it('should not be able to click the new payment button as it isnt present', async() => {
|
||||||
let result = await nightmare
|
await page.waitFor(selectors.clientBalance.newPaymentButton, {hidden: true});
|
||||||
.exists(selectors.clientBalance.newPaymentButton);
|
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,30 +1,40 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('User config', () => {
|
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', () => {
|
describe('as salesPerson', () => {
|
||||||
beforeAll(() => {
|
it('should login', async() => {
|
||||||
nightmare
|
await page.login('salesPerson');
|
||||||
.waitForLogin('salesPerson');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now open the user config form to check the settings', async() => {
|
it('should now open the user config form to check the settings', async() => {
|
||||||
let userLocalWarehouse = await nightmare
|
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||||
.waitToClick(selectors.globalItems.userMenuButton)
|
|
||||||
|
let userLocalWarehouse = await page
|
||||||
.getProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
.getProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
||||||
|
|
||||||
let userLocalBank = await nightmare
|
|
||||||
|
let userLocalBank = await page
|
||||||
.getProperty(`${selectors.globalItems.userLocalBank} input`, 'value');
|
.getProperty(`${selectors.globalItems.userLocalBank} input`, 'value');
|
||||||
|
|
||||||
let userLocalCompany = await nightmare
|
let userLocalCompany = await page
|
||||||
.getProperty(`${selectors.globalItems.userLocalCompany} input`, 'value');
|
.getProperty(`${selectors.globalItems.userLocalCompany} input`, 'value');
|
||||||
|
|
||||||
let userWarehouse = await nightmare
|
let userWarehouse = await page
|
||||||
.waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value');
|
.waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value');
|
||||||
|
|
||||||
let userCompany = await nightmare
|
let userCompany = await page
|
||||||
.waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value');
|
.waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value');
|
||||||
|
|
||||||
expect(userLocalWarehouse).toEqual('');
|
expect(userLocalWarehouse).toEqual('');
|
||||||
|
@ -36,26 +46,25 @@ describe('User config', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('as employee', () => {
|
describe('as employee', () => {
|
||||||
beforeAll(() => {
|
it('should log in', async() => {
|
||||||
nightmare
|
await page.login('employee');
|
||||||
.waitForLogin('employee');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open the user config form to check the settings', async() => {
|
it('should open the user config form to check the settings', async() => {
|
||||||
let userLocalWarehouse = await nightmare
|
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||||
.waitToClick(selectors.globalItems.userMenuButton)
|
let userLocalWarehouse = await page
|
||||||
.getProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
.getProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
||||||
|
|
||||||
let userLocalBank = await nightmare
|
let userLocalBank = await page
|
||||||
.getProperty(`${selectors.globalItems.userLocalBank} input`, 'value');
|
.getProperty(`${selectors.globalItems.userLocalBank} input`, 'value');
|
||||||
|
|
||||||
let userLocalCompany = await nightmare
|
let userLocalCompany = await page
|
||||||
.getProperty(`${selectors.globalItems.userLocalCompany} input`, 'value');
|
.getProperty(`${selectors.globalItems.userLocalCompany} input`, 'value');
|
||||||
|
|
||||||
let userWarehouse = await nightmare
|
let userWarehouse = await page
|
||||||
.waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value');
|
.waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value');
|
||||||
|
|
||||||
let userCompany = await nightmare
|
let userCompany = await page
|
||||||
.waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value');
|
.waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value');
|
||||||
|
|
||||||
expect(userLocalWarehouse).toEqual('');
|
expect(userLocalWarehouse).toEqual('');
|
||||||
|
@ -66,37 +75,35 @@ describe('User config', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now edit the user config data', async() => {
|
it('should now edit the user config data', async() => {
|
||||||
let result = await nightmare
|
await page.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four');
|
||||||
.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four')
|
await page.autocompleteSearch(selectors.globalItems.userLocalBank, 'Pay on receipt');
|
||||||
.autocompleteSearch(selectors.globalItems.userLocalBank, 'Pay on receipt')
|
await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'VNL');
|
||||||
.autocompleteSearch(selectors.globalItems.userLocalCompany, 'VNL')
|
let result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('as salesPerson 2nd run', () => {
|
describe('as salesPerson 2nd run', () => {
|
||||||
beforeAll(() => {
|
it('should log in once more', async() => {
|
||||||
nightmare
|
await page.login('salesPerson');
|
||||||
.waitForLogin('salesPerson');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should again open the user config form to check the local settings', async() => {
|
it('should again open the user config form to check the local settings', async() => {
|
||||||
let userLocalWarehouse = await nightmare
|
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||||
.waitToClick(selectors.globalItems.userMenuButton)
|
let userLocalWarehouse = await page
|
||||||
.waitToGetProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
.waitToGetProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
||||||
|
|
||||||
let userLocalBank = await nightmare
|
let userLocalBank = await page
|
||||||
.waitToGetProperty(`${selectors.globalItems.userLocalBank} input`, 'value');
|
.waitToGetProperty(`${selectors.globalItems.userLocalBank} input`, 'value');
|
||||||
|
|
||||||
let userLocalCompany = await nightmare
|
let userLocalCompany = await page
|
||||||
.waitToGetProperty(`${selectors.globalItems.userLocalCompany} input`, 'value');
|
.waitToGetProperty(`${selectors.globalItems.userLocalCompany} input`, 'value');
|
||||||
|
|
||||||
let userWarehouse = await nightmare
|
let userWarehouse = await page
|
||||||
.waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value');
|
.waitToGetProperty(`${selectors.globalItems.userWarehouse} input`, 'value');
|
||||||
|
|
||||||
let userCompany = await nightmare
|
let userCompany = await page
|
||||||
.waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value');
|
.waitToGetProperty(`${selectors.globalItems.userCompany} input`, 'value');
|
||||||
|
|
||||||
expect(userLocalWarehouse).toContain('Warehouse Four');
|
expect(userLocalWarehouse).toContain('Warehouse Four');
|
||||||
|
@ -107,12 +114,10 @@ describe('User config', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now clear the local settings', async() => {
|
it('should now clear the local settings', async() => {
|
||||||
let result = await nightmare
|
await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete);
|
||||||
.waitToClick(selectors.globalItems.userMenuButton)
|
await page.clearInput(selectors.globalItems.userConfigSecondAutocomplete);
|
||||||
.waitToClick(selectors.globalItems.userConfigFirstAutocompleteClear)
|
await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete);
|
||||||
.waitToClick(selectors.globalItems.userConfigSecondAutocompleteClear)
|
let result = await page.waitForLastSnackbar();
|
||||||
.waitToClick(selectors.globalItems.userConfigThirdAutocompleteClear)
|
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,40 +1,37 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client web Payment', () => {
|
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', () => {
|
describe('as employee', () => {
|
||||||
beforeAll(() => {
|
|
||||||
nightmare
|
|
||||||
.loginAndModule('employee', 'client')
|
|
||||||
.accessToSearchResult('Tony Stark')
|
|
||||||
.accessToSection('client.card.webPayment');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not be able to confirm payments', async() => {
|
it('should not be able to confirm payments', async() => {
|
||||||
let exists = await nightmare
|
await page.waitFor(selectors.webPayment.confirmFirstPaymentButton, {hidden: true});
|
||||||
.exists(selectors.webPayment.confirmFirstPaymentButton);
|
|
||||||
|
|
||||||
expect(exists).toBeFalsy();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('as administrative', () => {
|
describe('as administrative', () => {
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
nightmare
|
await page.loginAndModule('administrative', 'client');
|
||||||
.loginAndModule('administrative', 'client')
|
await page.accessToSearchResult('Tony Stark');
|
||||||
.accessToSearchResult('Tony Stark')
|
await page.accessToSection('client.card.webPayment');
|
||||||
.accessToSection('client.card.webPayment');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to confirm payments', async() => {
|
it('should be able to confirm payments', async() => {
|
||||||
let exists = await nightmare
|
await page.waitToClick(selectors.webPayment.confirmFirstPaymentButton);
|
||||||
.waitToClick(selectors.webPayment.confirmFirstPaymentButton)
|
await page.waitFor(selectors.webPayment.firstPaymentConfirmed, {hidden: true});
|
||||||
.wait(selectors.webPayment.firstPaymentConfirmed)
|
|
||||||
.exists(selectors.webPayment.firstPaymentConfirmed);
|
|
||||||
|
|
||||||
expect(exists).toBeTruthy();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,31 +1,34 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Client DMS', () => {
|
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', () => {
|
describe('as salesPerson', () => {
|
||||||
beforeAll(() => {
|
|
||||||
nightmare
|
|
||||||
.loginAndModule('salesPerson', 'client')
|
|
||||||
.accessToSearchResult('Tony Stark')
|
|
||||||
.accessToSection('client.card.dms.index');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should delete de first file', async() => {
|
it('should delete de first file', async() => {
|
||||||
let result = await nightmare
|
await page.waitToClick(selectors.dms.deleteFileButton);
|
||||||
.waitToClick(selectors.dms.deleteFileButton)
|
await page.waitToClick(selectors.dms.acceptDeleteButton);
|
||||||
.waitToClick(selectors.dms.acceptDeleteButton)
|
let result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the first document line worker name making the descriptor visible`, async() => {
|
it(`should click on the first document line worker name making the descriptor visible`, async() => {
|
||||||
const visible = await nightmare
|
await page.waitToClick(selectors.dms.firstDocWorker);
|
||||||
.waitToClick(selectors.dms.firstDocWorker)
|
await page.wait(selectors.dms.firstDocWorkerDescriptor);
|
||||||
.wait(selectors.dms.firstDocWorkerDescriptor)
|
const visible = await page.isVisible(selectors.dms.firstDocWorkerDescriptor);
|
||||||
.isVisible(selectors.dms.firstDocWorkerDescriptor);
|
|
||||||
|
|
||||||
expect(visible).toBeTruthy();
|
expect(visible).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,32 +1,35 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Worker pbx path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('hr', 'worker')
|
|
||||||
.accessToSearchResult('employee')
|
|
||||||
.accessToSection('worker.card.pbx');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should receive an error when the extension exceeds 4 characters', async() => {
|
it('should receive an error when the extension exceeds 4 characters', async() => {
|
||||||
const result = await nightmare
|
await page.waitForContentLoaded();
|
||||||
.write(selectors.workerPbx.extensionInput, 55555)
|
await page.write(selectors.workerPbx.extensionInput, '55555');
|
||||||
|
await page.waitToClick(selectors.workerPbx.saveButton);
|
||||||
.waitToClick(selectors.workerPbx.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Extension format is invalid');
|
expect(result).toEqual('Extension format is invalid');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should sucessfully save the changes', async() => {
|
it('should sucessfully save the changes', async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.workerPbx.extensionInput);
|
||||||
.clearInput(selectors.workerPbx.extensionInput)
|
await page.write(selectors.workerPbx.extensionInput, '4444');
|
||||||
.write(selectors.workerPbx.extensionInput, 4444)
|
await page.waitToClick(selectors.workerPbx.saveButton);
|
||||||
.waitToClick(selectors.workerPbx.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved! User must access web');
|
expect(result).toEqual('Data saved! User must access web');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,95 +1,102 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Worker time control path', () => {
|
// #2047 WorkerTimeControl no suma horas
|
||||||
const nightmare = createNightmare();
|
xdescribe('Worker time control path', () => {
|
||||||
|
let browser;
|
||||||
beforeAll(() => {
|
let page;
|
||||||
nightmare
|
beforeAll(async() => {
|
||||||
.loginAndModule('hr', 'worker')
|
browser = await getBrowser();
|
||||||
.accessToSearchResult('HankPym')
|
page = browser.page;
|
||||||
.accessToSection('worker.card.timeControl');
|
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', () => {
|
describe('on Monday', () => {
|
||||||
it('should scan in Hank Pym', async() => {
|
it('should scan in Hank Pym', async() => {
|
||||||
const scanTime = '07:00';
|
const scanTime = '07:00';
|
||||||
const result = await nightmare
|
|
||||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should scan out Hank Pym for break`, async() => {
|
it(`should scan out Hank Pym for break`, async() => {
|
||||||
const scanTime = '10:00';
|
const scanTime = '10:00';
|
||||||
const result = await nightmare
|
|
||||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should scan in Hank Pym for a wrong hour and forget to scan in from the break`, async() => {
|
it(`should scan in Hank Pym for a wrong hour and forget to scan in from the break`, async() => {
|
||||||
const scanTime = '18:00';
|
const scanTime = '18:00';
|
||||||
const result = await nightmare
|
|
||||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should delete the wrong entry for Hank Pym`, async() => {
|
it(`should delete the wrong entry for Hank Pym`, async() => {
|
||||||
const wrongScanTime = '18:00';
|
const wrongScanTime = '18:00';
|
||||||
const result = await nightmare
|
|
||||||
.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime)
|
await page.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime);
|
||||||
.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete)
|
await page.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete);
|
||||||
.waitToClick(selectors.workerTimeControl.acceptDeleteDialog)
|
await page.waitToClick(selectors.workerTimeControl.acceptDeleteDialog);
|
||||||
.waitForLastSnackbar();
|
let result = await page.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toEqual('Entry removed');
|
expect(result).toEqual('Entry removed');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should scan out Hank Pym to leave early`, async() => {
|
it(`should scan out Hank Pym to leave early`, async() => {
|
||||||
const scanTime = '14:00';
|
const scanTime = '14:00';
|
||||||
const result = await nightmare
|
|
||||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should add the break's scan in for Hank Pym and be in the right order`, async() => {
|
it(`should add the break's scan in for Hank Pym and be in the right order`, async() => {
|
||||||
const scanTime = '10:20';
|
const scanTime = '10:20';
|
||||||
const result = await nightmare
|
|
||||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText');
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual('14:00');
|
expect(result).toEqual('14:00');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should the third entry be the scan in from break`, async() => {
|
it(`should the third entry be the scan in from break`, async() => {
|
||||||
const scanTime = '10:20';
|
const scanTime = '10:20';
|
||||||
const result = await nightmare
|
|
||||||
|
const result = await page
|
||||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check Hank Pym worked 8 hours`, async() => {
|
it(`should check Hank Pym worked 8 hours`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '07:00 h.');
|
||||||
.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '07:00 h.')
|
const result = await page
|
||||||
.waitToGetProperty(selectors.workerTimeControl.mondayWorkedHours, 'innerText');
|
.waitToGetProperty(selectors.workerTimeControl.mondayWorkedHours, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual('07:00 h.');
|
expect(result).toEqual('07:00 h.');
|
||||||
|
@ -99,52 +106,51 @@ describe('Worker time control path', () => {
|
||||||
describe('on Tuesday', () => {
|
describe('on Tuesday', () => {
|
||||||
it('should happily scan in Hank Pym', async() => {
|
it('should happily scan in Hank Pym', async() => {
|
||||||
const scanTime = '08:00';
|
const scanTime = '08:00';
|
||||||
const result = await nightmare
|
|
||||||
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText');
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should happily scan out Hank Pym for break`, async() => {
|
it(`should happily scan out Hank Pym for break`, async() => {
|
||||||
const scanTime = '10:00';
|
const scanTime = '10:00';
|
||||||
const result = await nightmare
|
|
||||||
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText');
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should happily scan in Hank Pym from the break`, async() => {
|
it(`should happily scan in Hank Pym from the break`, async() => {
|
||||||
const scanTime = '10:20';
|
const scanTime = '10:20';
|
||||||
const result = await nightmare
|
|
||||||
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText');
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should happily scan out Hank Pym for the day`, async() => {
|
it(`should happily scan out Hank Pym for the day`, async() => {
|
||||||
const scanTime = '16:00';
|
const scanTime = '16:00';
|
||||||
const result = await nightmare
|
|
||||||
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText');
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check Hank Pym worked 8 happy hours`, async() => {
|
it(`should check Hank Pym worked 8 happy hours`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '08:00 h.');
|
||||||
.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '08:00 h.')
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.tuesdayWorkedHours, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.tuesdayWorkedHours, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual('08:00 h.');
|
expect(result).toEqual('08:00 h.');
|
||||||
});
|
});
|
||||||
|
@ -153,52 +159,51 @@ describe('Worker time control path', () => {
|
||||||
describe('on Wednesday', () => {
|
describe('on Wednesday', () => {
|
||||||
it('should cheerfully scan in Hank Pym', async() => {
|
it('should cheerfully scan in Hank Pym', async() => {
|
||||||
const scanTime = '09:00';
|
const scanTime = '09:00';
|
||||||
const result = await nightmare
|
|
||||||
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText');
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should cheerfully scan out Hank Pym for break`, async() => {
|
it(`should cheerfully scan out Hank Pym for break`, async() => {
|
||||||
const scanTime = '10:00';
|
const scanTime = '10:00';
|
||||||
const result = await nightmare
|
|
||||||
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText');
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should cheerfully scan in Hank Pym from the break`, async() => {
|
it(`should cheerfully scan in Hank Pym from the break`, async() => {
|
||||||
const scanTime = '10:20';
|
const scanTime = '10:20';
|
||||||
const result = await nightmare
|
|
||||||
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText');
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should cheerfully scan out Hank Pym for the day`, async() => {
|
it(`should cheerfully scan out Hank Pym for the day`, async() => {
|
||||||
const scanTime = '17:00';
|
const scanTime = '17:00';
|
||||||
const result = await nightmare
|
|
||||||
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText');
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check Hank Pym worked 8 cheerfull hours`, async() => {
|
it(`should check Hank Pym worked 8 cheerfull hours`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '08:00 h.');
|
||||||
.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '08:00 h.')
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.wednesdayWorkedHours, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.wednesdayWorkedHours, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual('08:00 h.');
|
expect(result).toEqual('08:00 h.');
|
||||||
});
|
});
|
||||||
|
@ -207,52 +212,48 @@ describe('Worker time control path', () => {
|
||||||
describe('on Thursday', () => {
|
describe('on Thursday', () => {
|
||||||
it('should joyfully scan in Hank Pym', async() => {
|
it('should joyfully scan in Hank Pym', async() => {
|
||||||
const scanTime = '09:59';
|
const scanTime = '09:59';
|
||||||
const result = await nightmare
|
|
||||||
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText');
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should joyfully scan out Hank Pym for break`, async() => {
|
it(`should joyfully scan out Hank Pym for break`, async() => {
|
||||||
const scanTime = '10:00';
|
const scanTime = '10:00';
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
||||||
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should joyfully scan in Hank Pym from the break`, async() => {
|
it(`should joyfully scan in Hank Pym from the break`, async() => {
|
||||||
const scanTime = '10:20';
|
const scanTime = '10:20';
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
||||||
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should joyfully scan out Hank Pym for the day`, async() => {
|
it(`should joyfully scan out Hank Pym for the day`, async() => {
|
||||||
const scanTime = '17:59';
|
const scanTime = '17:59';
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
||||||
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check Hank Pym worked 8 joyfull hours`, async() => {
|
it(`should check Hank Pym worked 8 joyfull hours`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '08:00 h.');
|
||||||
.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '08:00 h.')
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.thursdayWorkedHours, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.thursdayWorkedHours, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual('08:00 h.');
|
expect(result).toEqual('08:00 h.');
|
||||||
});
|
});
|
||||||
|
@ -261,93 +262,88 @@ describe('Worker time control path', () => {
|
||||||
describe('on Friday', () => {
|
describe('on Friday', () => {
|
||||||
it('should smilingly scan in Hank Pym', async() => {
|
it('should smilingly scan in Hank Pym', async() => {
|
||||||
const scanTime = '07:30';
|
const scanTime = '07:30';
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
||||||
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should smilingly scan out Hank Pym for break`, async() => {
|
it(`should smilingly scan out Hank Pym for break`, async() => {
|
||||||
const scanTime = '10:00';
|
const scanTime = '10:00';
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
||||||
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should smilingly scan in Hank Pym from the break`, async() => {
|
it(`should smilingly scan in Hank Pym from the break`, async() => {
|
||||||
const scanTime = '10:20';
|
const scanTime = '10:20';
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
||||||
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should smilingly scan out Hank Pym for the day`, async() => {
|
it(`should smilingly scan out Hank Pym for the day`, async() => {
|
||||||
const scanTime = '15:30';
|
const scanTime = '15:30';
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
||||||
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check Hank Pym worked 8 hours with a smile on his face`, async() => {
|
it(`should check Hank Pym worked 8 hours with a smile on his face`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '08:00 h.');
|
||||||
.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '08:00 h.')
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.fridayWorkedHours, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.fridayWorkedHours, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual('08:00 h.');
|
expect(result).toEqual('08:00 h.');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('as hr', () => {
|
describe('as HHRR', () => {
|
||||||
describe('on Saturday', () => {
|
describe('on Saturday', () => {
|
||||||
beforeAll(() => {
|
it('should log in and navigate to timeControl', async() => {
|
||||||
nightmare
|
await page.loginAndModule('hr', 'worker');
|
||||||
.loginAndModule('hr', 'worker')
|
await page.accessToSearchResult('HankPym');
|
||||||
.accessToSearchResult('HankPym')
|
await Promise.all([
|
||||||
.accessToSection('worker.card.timeControl');
|
page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}),
|
||||||
|
page.waitForContentLoaded(),
|
||||||
|
page.accessToSection('worker.card.timeControl')
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should lovingly scan in Hank Pym', async() => {
|
it('should lovingly scan in Hank Pym', async() => {
|
||||||
const scanTime = '06:00';
|
const scanTime = '06:00';
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
|
||||||
.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should lovingly scan out Hank Pym for the day with no break to leave a bit early`, async() => {
|
it(`should lovingly scan out Hank Pym for the day with no break to leave a bit early`, async() => {
|
||||||
const scanTime = '13:40';
|
const scanTime = '13:40';
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
|
||||||
.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check Hank Pym worked 8 hours with all his will`, async() => {
|
it(`should check Hank Pym worked 8 hours with all his will`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '08:00 h.');
|
||||||
.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '08:00 h.')
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.saturdayWorkedHours, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.saturdayWorkedHours, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual('08:00 h.');
|
expect(result).toEqual('08:00 h.');
|
||||||
});
|
});
|
||||||
|
@ -356,49 +352,48 @@ describe('Worker time control path', () => {
|
||||||
describe('on Sunday', () => {
|
describe('on Sunday', () => {
|
||||||
it('should gladly scan in Hank Pym', async() => {
|
it('should gladly scan in Hank Pym', async() => {
|
||||||
const scanTime = '05:00';
|
const scanTime = '05:00';
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
|
||||||
.waitToClick(selectors.workerTimeControl.sundayAddTimeButton)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should gladly scan out Hank Pym for the day with no break to leave a bit early`, async() => {
|
it(`should gladly scan out Hank Pym for the day with no break to leave a bit early`, async() => {
|
||||||
const scanTime = '12:40';
|
const scanTime = '12:40';
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
|
||||||
.waitToClick(selectors.workerTimeControl.sundayAddTimeButton)
|
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
|
||||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
await page.waitToClick(selectors.workerTimeControl.confirmButton);
|
||||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(scanTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check Hank Pym worked 8 glad hours`, async() => {
|
it(`should check Hank Pym worked 8 glad hours`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '08:00 h.');
|
||||||
.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '08:00 h.')
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.sundayWorkedHours, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.sundayWorkedHours, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual('08:00 h.');
|
expect(result).toEqual('08:00 h.');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check Hank Pym doesn't have hours set on the next months first week`, async() => {
|
it(`should check Hank Pym doesn't have hours set on the next months first week`, async() => {
|
||||||
const wholeWeekHours = await nightmare
|
await page.waitToClick(selectors.workerTimeControl.nextMonthButton);
|
||||||
.waitToClick(selectors.workerTimeControl.nextMonthButton)
|
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
|
||||||
.waitToClick(selectors.workerTimeControl.secondWeekDay)
|
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.');
|
||||||
.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.')
|
const wholeWeekHours = await page
|
||||||
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
||||||
|
|
||||||
expect(wholeWeekHours).toEqual('00:00 h.');
|
expect(wholeWeekHours).toEqual('00:00 h.');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check he didn't scan in this week yet`, async() => {
|
it(`should check he didn't scan in this week yet`, async() => {
|
||||||
const wholeWeekHours = await nightmare
|
await page.waitToClick(selectors.workerTimeControl.navigateBackToIndex);
|
||||||
.waitToClick(selectors.workerTimeControl.navigateBackToIndex)
|
await page.accessToSearchResult('salesBoss');
|
||||||
.accessToSearchResult('salesBoss')
|
await page.accessToSection('worker.card.timeControl');
|
||||||
.accessToSection('worker.card.timeControl')
|
await page.waitFor(1000);
|
||||||
|
|
||||||
|
const wholeWeekHours = await page
|
||||||
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
||||||
|
|
||||||
expect(wholeWeekHours).toEqual('00:00 h.');
|
expect(wholeWeekHours).toEqual('00:00 h.');
|
||||||
|
@ -407,17 +402,15 @@ describe('Worker time control path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('after all this amazing week', () => {
|
describe('after all this amazing week', () => {
|
||||||
beforeAll(() => {
|
it('should log in Hank', async() => {
|
||||||
nightmare
|
await page.loginAndModule('HankPym', 'worker');
|
||||||
.loginAndModule('HankPym', 'worker')
|
await page.accessToSearchResult('HankPym');
|
||||||
.accessToSearchResult('HankPym')
|
await page.accessToSection('worker.card.timeControl');
|
||||||
.accessToSection('worker.card.timeControl');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should Hank Pym check his hours are alright', async() => {
|
it('should check his hours are alright', async() => {
|
||||||
const wholeWeekHours = await nightmare
|
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '55:00 h.');
|
||||||
.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '55:00 h.')
|
const wholeWeekHours = await page.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
||||||
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
|
||||||
|
|
||||||
expect(wholeWeekHours).toEqual('55:00 h.');
|
expect(wholeWeekHours).toEqual('55:00 h.');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,202 +1,175 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Item summary path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('employee', 'item');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search for an item', async() => {
|
it('should search for an item', async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon longbow 2m');
|
||||||
.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon longbow 2m')
|
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||||
.waitToClick(selectors.itemsIndex.searchButton)
|
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
|
||||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||||
.countElement(selectors.itemsIndex.searchResult);
|
|
||||||
|
|
||||||
expect(result).toEqual(1);
|
expect(result).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the search result summary button to open the item summary popup`, async() => {
|
it(`should click on the search result summary button to open the item summary popup`, async() => {
|
||||||
const isVisible = await nightmare
|
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon longbow 2m');
|
||||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon longbow 2m')
|
await page.waitToClick(selectors.itemsIndex.searchResultPreviewButton);
|
||||||
.waitToClick(selectors.itemsIndex.searchResultPreviewButton)
|
const isVisible = await page.isVisible(selectors.itemSummary.basicData);
|
||||||
.isVisible(selectors.itemSummary.basicData);
|
|
||||||
|
|
||||||
expect(isVisible).toBeTruthy();
|
expect(isVisible).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the item summary preview shows fields from basic data`, async() => {
|
it(`should check the item summary preview shows fields from basic data`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.itemSummary.basicData, 'Ranged weapon longbow 2m');
|
||||||
.waitForTextInElement(selectors.itemSummary.basicData, 'Ranged weapon longbow 2m')
|
const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
||||||
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('Ranged weapon longbow 2m');
|
expect(result).toContain('Ranged weapon longbow 2m');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the item summary preview shows fields from tags`, async() => {
|
it(`should check the item summary preview shows fields from tags`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.itemSummary.tags, 'Brown');
|
||||||
.waitForTextInElement(selectors.itemSummary.tags, 'Brown')
|
const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
||||||
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('Brown');
|
expect(result).toContain('Brown');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the item summary preview shows fields from niche`, async() => {
|
it(`should check the item summary preview shows fields from niche`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.itemSummary.niche, 'A1');
|
||||||
.waitForTextInElement(selectors.itemSummary.niche, 'A1')
|
const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
||||||
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('A1');
|
expect(result).toContain('A1');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the item summary preview shows fields from botanical`, async() => {
|
it(`should check the item summary preview shows fields from botanical`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.itemSummary.botanical, 'Hedera helix');
|
||||||
.waitForTextInElement(selectors.itemSummary.botanical, 'Hedera helix')
|
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
||||||
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('Hedera helix');
|
expect(result).toContain('Hedera helix');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the item summary preview shows fields from barcode`, async() => {
|
it(`should check the item summary preview shows fields from barcode`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.itemSummary.barcode, '1');
|
||||||
.waitForTextInElement(selectors.itemSummary.barcode, '1')
|
const result = await page.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
||||||
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('1');
|
expect(result).toContain('1');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should close the summary popup`, async() => {
|
it(`should close the summary popup`, async() => {
|
||||||
const result = await nightmare
|
await page.keyboard.press('Escape');
|
||||||
.mousedown(selectors.itemsIndex.closeItemSummaryPreview)
|
await page.waitUntilNotPresent(selectors.itemSummary.basicData);
|
||||||
.waitUntilNotPresent(selectors.itemSummary.basicData)
|
await page.waitFor(selectors.itemSummary.basicData, {hidden: true});
|
||||||
.visible(selectors.itemSummary.basicData);
|
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search for other item', async() => {
|
it('should search for other item', async() => {
|
||||||
const result = await nightmare
|
await page.clearInput('vn-searchbar');
|
||||||
.clearInput('vn-searchbar input')
|
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||||
.waitToClick(selectors.itemsIndex.searchButton)
|
await page.write(selectors.itemsIndex.searchItemInput, 'Melee weapon combat fist 15cm');
|
||||||
.write(selectors.itemsIndex.searchItemInput, 'Melee weapon combat fist 15cm')
|
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||||
.waitToClick(selectors.itemsIndex.searchButton)
|
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
|
||||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||||
.countElement(selectors.itemsIndex.searchResult);
|
|
||||||
|
|
||||||
expect(result).toEqual(1);
|
expect(result).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should now click on the search result summary button to open the item summary popup`, async() => {
|
it(`should now click on the search result summary button to open the item summary popup`, async() => {
|
||||||
const isVisible = await nightmare
|
await page.waitToClick(selectors.itemsIndex.searchResultPreviewButton);
|
||||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Melee weapon combat fist 15cm')
|
await page.waitForSelector(selectors.itemSummary.basicData, {visible: true});
|
||||||
.waitToClick(selectors.itemsIndex.searchResultPreviewButton)
|
|
||||||
.isVisible(selectors.itemSummary.basicData);
|
|
||||||
|
|
||||||
|
|
||||||
expect(isVisible).toBeTruthy();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should now check the item summary preview shows fields from basic data`, async() => {
|
it(`should now check the item summary preview shows fields from basic data`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm');
|
||||||
.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm')
|
const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
||||||
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('Melee weapon combat fist 15cm');
|
expect(result).toContain('Melee weapon combat fist 15cm');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should now check the item summary preview shows fields from tags`, async() => {
|
it(`should now check the item summary preview shows fields from tags`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.itemSummary.tags, 'Silver');
|
||||||
.waitForTextInElement(selectors.itemSummary.tags, 'Silver')
|
const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
||||||
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('Silver');
|
expect(result).toContain('Silver');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should now check the item summary preview shows fields from niche`, async() => {
|
it(`should now check the item summary preview shows fields from niche`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.itemSummary.niche, 'A4');
|
||||||
.waitForTextInElement(selectors.itemSummary.niche, 'A4')
|
const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
||||||
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('A4');
|
expect(result).toContain('A4');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should now check the item summary preview shows fields from botanical`, async() => {
|
it(`should now check the item summary preview shows fields from botanical`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.itemSummary.botanical, '-');
|
||||||
.waitForTextInElement(selectors.itemSummary.botanical, '-')
|
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
||||||
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('-');
|
expect(result).toContain('-');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should now check the item summary preview shows fields from barcode`, async() => {
|
it(`should now check the item summary preview shows fields from barcode`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.itemSummary.barcode, '4');
|
||||||
.waitForTextInElement(selectors.itemSummary.barcode, '4')
|
const result = await page.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
||||||
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('4');
|
expect(result).toContain('4');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should now close the summary popup`, async() => {
|
it(`should now close the summary popup`, async() => {
|
||||||
const result = await nightmare
|
await page.keyboard.press('Escape');
|
||||||
.mousedown(selectors.itemsIndex.closeItemSummaryPreview)
|
await page.waitForSelector(selectors.itemSummary.basicData, {hidden: true});
|
||||||
.waitUntilNotPresent(selectors.itemSummary.basicData)
|
|
||||||
.visible(selectors.itemSummary.basicData);
|
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should navigate to the one of the items detailed section`, async() => {
|
it(`should navigate to the one of the items detailed section`, async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.itemsIndex.searchResult);
|
||||||
.waitToClick(selectors.itemsIndex.searchResult)
|
await page.waitForURL('summary');
|
||||||
.waitForURL('summary')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('summary');
|
expect(url.hash).toContain('summary');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the descritor edit button is not visible for employee`, async() => {
|
it(`should check the descritor edit button is not visible for employee`, async() => {
|
||||||
const visibleButton = await nightmare
|
const visibleButton = await page.isVisible(selectors.itemDescriptor.editButton);
|
||||||
.isVisible(selectors.itemDescriptor.editButton);
|
|
||||||
|
|
||||||
expect(visibleButton).toBeFalsy();
|
expect(visibleButton).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the item summary shows fields from basic data section`, async() => {
|
it(`should check the item summary shows fields from basic data section`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm');
|
||||||
.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm')
|
const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
||||||
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('Melee weapon combat fist 15cm');
|
expect(result).toContain('Melee weapon combat fist 15cm');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the item summary shows fields from tags section`, async() => {
|
it(`should check the item summary shows fields from tags section`, async() => {
|
||||||
const result = await nightmare
|
const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
||||||
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('Silver');
|
expect(result).toContain('Silver');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the item summary shows fields from niches section`, async() => {
|
it(`should check the item summary shows fields from niches section`, async() => {
|
||||||
const result = await nightmare
|
const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
||||||
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('One A4');
|
expect(result).toContain('One A4');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the item summary shows fields from botanical section`, async() => {
|
it(`should check the item summary shows fields from botanical section`, async() => {
|
||||||
const result = await nightmare
|
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
||||||
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('-');
|
expect(result).toContain('-');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the item summary shows fields from barcodes section`, async() => {
|
it(`should check the item summary shows fields from barcodes section`, async() => {
|
||||||
const result = await nightmare
|
const result = await page.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
||||||
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('4');
|
expect(result).toContain('4');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,102 +1,103 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Item Edit basic data path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('buyer', 'item')
|
|
||||||
.accessToSearchResult('Melee weapon combat fist 15cm')
|
|
||||||
.accessToSection('item.card.basicData');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the descritor edit button is visible for buyer`, async() => {
|
it(`should check the descritor edit button is visible for buyer`, async() => {
|
||||||
const visibleButton = await nightmare
|
await page.waitForSelector(selectors.itemDescriptor.editButton, {visible: true});
|
||||||
.isVisible(selectors.itemDescriptor.editButton);
|
|
||||||
|
|
||||||
expect(visibleButton).toBeTruthy();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should edit the item basic data`, async() => {
|
it(`should edit the item basic data`, async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.itemBasicData.nameInput);
|
||||||
.clearInput(selectors.itemBasicData.nameInput)
|
await page.write(selectors.itemBasicData.nameInput, 'Rose of Purity');
|
||||||
.write(selectors.itemBasicData.nameInput, 'Rose of Purity')
|
await page.autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Anthurium');
|
||||||
.autocompleteSearch(selectors.itemBasicData.typeAutocomplete, 'Anthurium')
|
await page.autocompleteSearch(selectors.itemBasicData.intrastatAutocomplete, 'Coral y materiales similares');
|
||||||
.autocompleteSearch(selectors.itemBasicData.intrastatAutocomplete, 'Coral y materiales similares')
|
await page.clearInput(selectors.itemBasicData.relevancyInput);
|
||||||
.clearInput(selectors.itemBasicData.relevancyInput)
|
await page.write(selectors.itemBasicData.relevancyInput, '1');
|
||||||
.write(selectors.itemBasicData.relevancyInput, '1')
|
await page.autocompleteSearch(selectors.itemBasicData.originAutocomplete, 'Spain');
|
||||||
.autocompleteSearch(selectors.itemBasicData.originAutocomplete, 'Spain')
|
await page.autocompleteSearch(selectors.itemBasicData.expenseAutocomplete, 'Alquiler VNH');
|
||||||
.autocompleteSearch(selectors.itemBasicData.expenseAutocomplete, 'Alquiler VNH')
|
await page.clearInput(selectors.itemBasicData.longNameInput);
|
||||||
.clearInput(selectors.itemBasicData.longNameInput)
|
await page.write(selectors.itemBasicData.longNameInput, 'RS Rose of Purity');
|
||||||
.write(selectors.itemBasicData.longNameInput, 'RS Rose of Purity')
|
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
|
||||||
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
|
await page.waitToClick(selectors.itemBasicData.priceInKgCheckbox);
|
||||||
.waitToClick(selectors.itemBasicData.priceInKgCheckbox)
|
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
||||||
.waitToClick(selectors.itemBasicData.submitBasicDataButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
}, 15000);
|
}, 20000);
|
||||||
|
|
||||||
it(`should confirm the item name was edited`, async() => {
|
it(`should confirm the item name was edited`, async() => {
|
||||||
const result = await nightmare
|
await page.reloadSection('item.card.basicData');
|
||||||
.reloadSection('item.card.basicData')
|
await page.waitForContentLoaded();
|
||||||
.waitToGetProperty(selectors.itemBasicData.nameInput, 'value');
|
const result = await page.waitToGetProperty(`${selectors.itemBasicData.nameInput} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Rose of Purity');
|
expect(result).toEqual('Rose of Purity');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the item type was edited`, async() => {
|
it(`should confirm the item type was edited`, async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Anthurium');
|
expect(result).toEqual('Anthurium');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the item intrastad was edited`, async() => {
|
it(`should confirm the item intrastad was edited`, async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('5080000 Coral y materiales similares');
|
expect(result).toEqual('5080000 Coral y materiales similares');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the item relevancy was edited`, async() => {
|
it(`should confirm the item relevancy was edited`, async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.waitToGetProperty(selectors.itemBasicData.relevancyInput, 'value');
|
.waitToGetProperty(`${selectors.itemBasicData.relevancyInput} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('1');
|
expect(result).toEqual('1');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the item origin was edited`, async() => {
|
it(`should confirm the item origin was edited`, async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Spain');
|
expect(result).toEqual('Spain');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the item expence was edited`, async() => {
|
it(`should confirm the item expence was edited`, async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.waitToGetProperty(`${selectors.itemBasicData.expenseAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.itemBasicData.expenseAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Alquiler VNH');
|
expect(result).toEqual('Alquiler VNH');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the item long name was edited`, async() => {
|
it(`should confirm the item long name was edited`, async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.waitToGetProperty(selectors.itemBasicData.longNameInput, 'value');
|
.waitToGetProperty(`${selectors.itemBasicData.longNameInput} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('RS Rose of Purity');
|
expect(result).toEqual('RS Rose of Purity');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm isActive checkbox is unchecked', async() => {
|
it('should confirm isActive checkbox is unchecked', async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.checkboxState(selectors.itemBasicData.isActiveCheckbox);
|
.checkboxState(selectors.itemBasicData.isActiveCheckbox);
|
||||||
|
|
||||||
expect(result).toBe('unchecked');
|
expect(result).toBe('unchecked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the priceInKg checkbox is checked', async() => {
|
it('should confirm the priceInKg checkbox is checked', async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.checkboxState(selectors.itemBasicData.priceInKgCheckbox);
|
.checkboxState(selectors.itemBasicData.priceInKgCheckbox);
|
||||||
|
|
||||||
expect(result).toBe('checked');
|
expect(result).toBe('checked');
|
||||||
|
|
|
@ -1,61 +1,62 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Item edit tax path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('buyer', 'item')
|
|
||||||
.accessToSearchResult('Ranged weapon longbow 2m')
|
|
||||||
.accessToSection('item.card.tax');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should add the item tax to all countries`, async() => {
|
it(`should add the item tax to all countries`, async() => {
|
||||||
const result = await nightmare
|
await page.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'General VAT');
|
||||||
.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'General VAT')
|
await page.autocompleteSearch(selectors.itemTax.secondClassAutocomplete, 'General VAT');
|
||||||
.autocompleteSearch(selectors.itemTax.secondClassAutocomplete, 'General VAT')
|
await page.autocompleteSearch(selectors.itemTax.thirdClassAutocomplete, 'General VAT');
|
||||||
.autocompleteSearch(selectors.itemTax.thirdClassAutocomplete, 'General VAT')
|
await page.waitToClick(selectors.itemTax.submitTaxButton);
|
||||||
.waitToClick(selectors.itemTax.submitTaxButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the first item tax class was edited`, async() => {
|
it(`should confirm the first item tax class was edited`, async() => {
|
||||||
const firstVatType = await nightmare
|
await page.reloadSection('item.card.tax');
|
||||||
.reloadSection('item.card.tax')
|
const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
||||||
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
|
||||||
|
|
||||||
expect(firstVatType).toEqual('General VAT');
|
expect(firstVatType).toEqual('General VAT');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the second item tax class was edited`, async() => {
|
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');
|
.waitToGetProperty(`${selectors.itemTax.secondClassAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(secondVatType).toEqual('General VAT');
|
expect(secondVatType).toEqual('General VAT');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the third item tax class was edited`, async() => {
|
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');
|
.waitToGetProperty(`${selectors.itemTax.thirdClassAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(thirdVatType).toEqual('General VAT');
|
expect(thirdVatType).toEqual('General VAT');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should edit the first class without saving the form`, async() => {
|
it(`should edit the first class without saving the form`, async() => {
|
||||||
const firstVatType = await nightmare
|
await page.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT');
|
||||||
.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT')
|
const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
||||||
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
|
||||||
|
|
||||||
expect(firstVatType).toEqual('Reduced VAT');
|
expect(firstVatType).toEqual('Reduced VAT');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should now click the undo changes button and see the changes works`, async() => {
|
it(`should now click the undo changes button and see the changes works`, async() => {
|
||||||
const firstVatType = await nightmare
|
await page.waitToClick(selectors.itemTax.undoChangesButton);
|
||||||
.waitToClick(selectors.itemTax.undoChangesButton)
|
const firstVatType = await page.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
||||||
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
|
||||||
|
|
||||||
expect(firstVatType).toEqual('General VAT');
|
expect(firstVatType).toEqual('General VAT');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,58 +1,61 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Item create tags path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('buyer', 'item')
|
|
||||||
.accessToSearchResult('Ranged weapon longbow 2m')
|
|
||||||
.accessToSection('item.card.tags');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should create a new tag and delete a former one`, async() => {
|
it(`should create a new tag and delete a former one`, async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.itemTags.fourthRemoveTagButton);
|
||||||
.waitToClick(selectors.itemTags.fourthRemoveTagButton)
|
await page.waitToClick(selectors.itemTags.addItemTagButton);
|
||||||
.waitToClick(selectors.itemTags.addItemTagButton)
|
await page.autocompleteSearch(selectors.itemTags.seventhTagAutocomplete, 'Ancho de la base');
|
||||||
.autocompleteSearch(selectors.itemTags.seventhTagAutocomplete, 'Ancho de la base')
|
await page.write(selectors.itemTags.seventhValueInput, '50');
|
||||||
.write(selectors.itemTags.seventhValueInput, '50')
|
await page.clearInput(selectors.itemTags.seventhRelevancyInput);
|
||||||
.clearInput(selectors.itemTags.seventhRelevancyInput)
|
await page.write(selectors.itemTags.seventhRelevancyInput, '4');
|
||||||
.write(selectors.itemTags.seventhRelevancyInput, '4')
|
await page.waitToClick(selectors.itemTags.submitItemTagsButton);
|
||||||
.waitToClick(selectors.itemTags.submitItemTagsButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the fourth row data is the expected one`, async() => {
|
it(`should confirm the fourth row data is the expected one`, async() => {
|
||||||
let result = await nightmare
|
await page.reloadSection('item.card.tags');
|
||||||
.reloadSection('item.card.tags')
|
await page.wait('vn-item-tags');
|
||||||
.wait('vn-item-tags')
|
let result = await page.waitToGetProperty(`${selectors.itemTags.fourthTagAutocomplete} input`, 'value');
|
||||||
.waitToGetProperty(`${selectors.itemTags.fourthTagAutocomplete} input`, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('Ancho de la base');
|
expect(result).toEqual('Ancho de la base');
|
||||||
|
|
||||||
result = await nightmare
|
result = await page
|
||||||
.waitToGetProperty(selectors.itemTags.fourthValueInput, 'value');
|
.waitToGetProperty(`${selectors.itemTags.fourthValueInput} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('50');
|
expect(result).toEqual('50');
|
||||||
|
|
||||||
result = await nightmare
|
result = await page
|
||||||
.waitToGetProperty(selectors.itemTags.fourthRelevancyInput, 'value');
|
.waitToGetProperty(`${selectors.itemTags.fourthRelevancyInput} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('4');
|
expect(result).toEqual('4');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the fifth row data is the expected one`, async() => {
|
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');
|
.waitToGetProperty(`${selectors.itemTags.fifthTagAutocomplete} input`, 'value');
|
||||||
|
|
||||||
let value = await nightmare
|
let value = await page
|
||||||
.waitToGetProperty(selectors.itemTags.fifthValueInput, 'value');
|
.waitToGetProperty(`${selectors.itemTags.fifthValueInput} input`, 'value');
|
||||||
|
|
||||||
let relevancy = await nightmare
|
let relevancy = await page
|
||||||
.waitToGetProperty(selectors.itemTags.fifthRelevancyInput, 'value');
|
.waitToGetProperty(`${selectors.itemTags.fifthRelevancyInput} input`, 'value');
|
||||||
|
|
||||||
expect(tag).toEqual('Color');
|
expect(tag).toEqual('Color');
|
||||||
expect(value).toEqual('Brown');
|
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() => {
|
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');
|
.waitToGetProperty(`${selectors.itemTags.sixthTagAutocomplete} input`, 'value');
|
||||||
|
|
||||||
let value = await nightmare
|
let value = await page
|
||||||
.waitToGetProperty(selectors.itemTags.sixthValueInput, 'value');
|
.waitToGetProperty(`${selectors.itemTags.sixthValueInput} input`, 'value');
|
||||||
|
|
||||||
let relevancy = await nightmare
|
let relevancy = await page
|
||||||
.waitToGetProperty(selectors.itemTags.sixthRelevancyInput, 'value');
|
.waitToGetProperty(`${selectors.itemTags.sixthRelevancyInput} input`, 'value');
|
||||||
|
|
||||||
expect(tag).toEqual('Categoria');
|
expect(tag).toEqual('Categoria');
|
||||||
expect(value).toEqual('+1 precission');
|
expect(value).toEqual('+1 precission');
|
||||||
|
|
|
@ -1,61 +1,65 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Item create niche path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('buyer', 'item')
|
|
||||||
.accessToSearchResult('Ranged weapon longbow 2m')
|
|
||||||
.accessToSection('item.card.niche');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click create a new niche and delete a former one`, async() => {
|
it(`should click create a new niche and delete a former one`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInInput(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One');
|
||||||
.waitForTextInInput(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'Warehouse One')
|
await page.waitToClick(selectors.itemNiches.addNicheButton);
|
||||||
.waitToClick(selectors.itemNiches.addNicheButton)
|
await page.waitToClick(selectors.itemNiches.secondNicheRemoveButton);
|
||||||
.waitToClick(selectors.itemNiches.secondNicheRemoveButton)
|
await page.autocompleteSearch(selectors.itemNiches.thirdWarehouseAutocomplete, 'Warehouse Two');
|
||||||
.autocompleteSearch(selectors.itemNiches.thirdWarehouseAutocomplete, 'Warehouse Two')
|
await page.write(selectors.itemNiches.thirdCodeInput, 'A4');
|
||||||
.write(selectors.itemNiches.thirdCodeInput, 'A4')
|
await page.waitToClick(selectors.itemNiches.submitNichesButton);
|
||||||
.waitToClick(selectors.itemNiches.submitNichesButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the first niche is the expected one`, async() => {
|
it(`should confirm the first niche is the expected one`, async() => {
|
||||||
let result = await nightmare
|
await page.reloadSection('item.card.niche');
|
||||||
.reloadSection('item.card.niche')
|
await page.waitForTextInInput(selectors.itemNiches.firstWarehouseAutocomplete, 'Warehouse One');
|
||||||
.waitForTextInInput(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'Warehouse One')
|
let result = await page
|
||||||
.waitToGetProperty(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Warehouse One');
|
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');
|
expect(result).toEqual('A1');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the second niche is the expected one`, async() => {
|
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');
|
.waitToGetProperty(`${selectors.itemNiches.secondWarehouseAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Warehouse Three');
|
expect(result).toEqual('Warehouse Three');
|
||||||
result = await nightmare
|
result = await page
|
||||||
.waitToGetProperty(selectors.itemNiches.secondCodeInput, 'value');
|
.waitToGetProperty(`${selectors.itemNiches.secondCodeInput} input`, 'value');
|
||||||
|
|
||||||
|
|
||||||
expect(result).toEqual('A3');
|
expect(result).toEqual('A3');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the third niche is the expected one`, async() => {
|
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');
|
.waitToGetProperty(`${selectors.itemNiches.thirdWarehouseAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Warehouse Two');
|
expect(result).toEqual('Warehouse Two');
|
||||||
result = await nightmare
|
result = await page
|
||||||
.waitToGetProperty(selectors.itemNiches.thirdCodeInput, 'value');
|
.waitToGetProperty(`${selectors.itemNiches.thirdCodeInput} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('A4');
|
expect(result).toEqual('A4');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,82 +1,85 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Item Create botanical path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('buyer', 'item')
|
|
||||||
.accessToSearchResult('Ranged weapon pistol 9mm')
|
|
||||||
.accessToSection('item.card.botanical');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should create a new botanical for the item`, async() => {
|
it(`should create a new botanical for the item`, async() => {
|
||||||
const result = await nightmare
|
await page.write(selectors.itemBotanical.botanicalInput, 'Cicuta maculata');
|
||||||
.write(selectors.itemBotanical.botanicalInput, 'Cicuta maculata')
|
await page.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abelia');
|
||||||
.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abelia')
|
await page.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'dealbata');
|
||||||
.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'dealbata')
|
await page.waitToClick(selectors.itemBotanical.submitBotanicalButton);
|
||||||
.waitToClick(selectors.itemBotanical.submitBotanicalButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the botanical for the item was created`, async() => {
|
it(`should confirm the botanical for the item was created`, async() => {
|
||||||
const result = await nightmare
|
await page.reloadSection('item.card.botanical');
|
||||||
.reloadSection('item.card.botanical')
|
await page.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata');
|
||||||
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata')
|
const result = await page
|
||||||
.waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value');
|
.waitToGetProperty(`${selectors.itemBotanical.botanicalInput} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Cicuta maculata');
|
expect(result).toEqual('Cicuta maculata');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the Genus for the item was created`, async() => {
|
it(`should confirm the Genus for the item was created`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInInput(selectors.itemBotanical.genusAutocomplete, 'Abelia');
|
||||||
.waitForTextInInput(`${selectors.itemBotanical.genusAutocomplete} input`, 'Abelia')
|
const result = await page
|
||||||
.waitToGetProperty(`${selectors.itemBotanical.genusAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.itemBotanical.genusAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Abelia');
|
expect(result).toEqual('Abelia');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the Species for the item was created`, async() => {
|
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');
|
.waitToGetProperty(`${selectors.itemBotanical.speciesAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('dealbata');
|
expect(result).toEqual('dealbata');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should edit botanical for the item`, async() => {
|
it(`should edit botanical for the item`, async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.itemBotanical.botanicalInput);
|
||||||
.clearInput(selectors.itemBotanical.botanicalInput)
|
await page.write(selectors.itemBotanical.botanicalInput, 'Herp Derp');
|
||||||
.write(selectors.itemBotanical.botanicalInput, 'Herp Derp')
|
await page.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abies');
|
||||||
.autocompleteSearch(selectors.itemBotanical.genusAutocomplete, 'Abies')
|
await page.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'decurrens');
|
||||||
.autocompleteSearch(selectors.itemBotanical.speciesAutocomplete, 'decurrens')
|
await page.waitToClick(selectors.itemBotanical.submitBotanicalButton);
|
||||||
.waitToClick(selectors.itemBotanical.submitBotanicalButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the botanical for the item was edited`, async() => {
|
it(`should confirm the botanical for the item was edited`, async() => {
|
||||||
const result = await nightmare
|
await page.reloadSection('item.card.botanical');
|
||||||
.reloadSection('item.card.botanical')
|
await page.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp');
|
||||||
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp')
|
const result = await page
|
||||||
.waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value');
|
.waitToGetProperty(`${selectors.itemBotanical.botanicalInput} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Herp Derp');
|
expect(result).toEqual('Herp Derp');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the Genus for the item was edited`, async() => {
|
it(`should confirm the Genus for the item was edited`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInInput(selectors.itemBotanical.genusAutocomplete, 'Abies');
|
||||||
.waitForTextInInput(`${selectors.itemBotanical.genusAutocomplete} input`, 'Abies')
|
const result = await page
|
||||||
.waitToGetProperty(`${selectors.itemBotanical.genusAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.itemBotanical.genusAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Abies');
|
expect(result).toEqual('Abies');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the Species for the item was edited`, async() => {
|
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');
|
.waitToGetProperty(`${selectors.itemBotanical.speciesAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('decurrens');
|
expect(result).toEqual('decurrens');
|
||||||
|
|
|
@ -1,32 +1,36 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Item Create barcodes path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('buyer', 'item')
|
|
||||||
.accessToSearchResult('Ranged weapon longbow 2m')
|
|
||||||
.accessToSection('item.card.itemBarcode');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click create a new code and delete a former one`, async() => {
|
it(`should click create a new code and delete a former one`, async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.itemBarcodes.firstCodeRemoveButton);
|
||||||
.waitToClick(selectors.itemBarcodes.firstCodeRemoveButton)
|
await page.waitToClick(selectors.itemBarcodes.addBarcodeButton);
|
||||||
.waitToClick(selectors.itemBarcodes.addBarcodeButton)
|
await page.write(selectors.itemBarcodes.thirdCodeInput, '5');
|
||||||
.write(selectors.itemBarcodes.thirdCodeInput, '5')
|
await page.waitToClick(selectors.itemBarcodes.submitBarcodesButton);
|
||||||
.waitToClick(selectors.itemBarcodes.submitBarcodesButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
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() => {
|
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
|
await page.reloadSection('item.card.itemBarcode');
|
||||||
.reloadSection('item.card.itemBarcode')
|
await page.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5');
|
||||||
.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5')
|
const result = await page
|
||||||
.waitToGetProperty(selectors.itemBarcodes.thirdCodeInput, 'value');
|
.waitToGetProperty(`${selectors.itemBarcodes.thirdCodeInput} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('5');
|
expect(result).toEqual('5');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,82 +1,84 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Item Create/Clone path', () => {
|
describe('Item Create/Clone path', () => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
describe('create', () => {
|
let page;
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
nightmare
|
browser = await getBrowser();
|
||||||
.loginAndModule('buyer', 'item');
|
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() => {
|
it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet');
|
||||||
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||||
.waitToClick(selectors.itemsIndex.searchButton)
|
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0);
|
||||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0)
|
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||||
.countElement(selectors.itemsIndex.searchResult);
|
|
||||||
|
|
||||||
expect(result).toEqual(0);
|
expect(result).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should access to the create item view by clicking the create floating button', async() => {
|
it('should access to the create item view by clicking the create floating button', async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
||||||
.waitToClick(selectors.itemsIndex.createItemButton)
|
await page.wait(selectors.itemCreateView.createButton);
|
||||||
.wait(selectors.itemCreateView.createButton)
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/item/create');
|
expect(url.hash).toEqual('#!/item/create');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return to the item index by clickig the cancel button', async() => {
|
it('should return to the item index by clickig the cancel button', async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.itemCreateView.cancelButton);
|
||||||
.waitToClick(selectors.itemCreateView.cancelButton)
|
await page.wait(selectors.itemsIndex.createItemButton);
|
||||||
.wait(selectors.itemsIndex.createItemButton)
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/item/index');
|
expect(url.hash).toEqual('#!/item/index');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now access to the create item view by clicking the create floating button', async() => {
|
it('should now access to the create item view by clicking the create floating button', async() => {
|
||||||
const url = await nightmare
|
await page.waitForContentLoaded();
|
||||||
.waitToClick(selectors.itemsIndex.createItemButton)
|
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
||||||
.wait(selectors.itemCreateView.createButton)
|
await page.wait(selectors.itemCreateView.createButton);
|
||||||
.parsedUrl();
|
const url = await page.parsedUrl();
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/item/create');
|
expect(url.hash).toEqual('#!/item/create');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create the Infinity Gauntlet item', async() => {
|
it('should create the Infinity Gauntlet item', async() => {
|
||||||
const result = await nightmare
|
await page.write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet');
|
||||||
.write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet')
|
await page.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo');
|
||||||
.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo')
|
await page.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares');
|
||||||
.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares')
|
await page.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand');
|
||||||
.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand')
|
await page.waitToClick(selectors.itemCreateView.createButton);
|
||||||
.waitToClick(selectors.itemCreateView.createButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm Infinity Gauntlet item was created', async() => {
|
it('should confirm Infinity Gauntlet item was created', async() => {
|
||||||
let result = await nightmare
|
let result = await page
|
||||||
.waitToGetProperty(selectors.itemBasicData.nameInput, 'value');
|
.waitToGetProperty(`${selectors.itemBasicData.nameInput} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Infinity Gauntlet');
|
expect(result).toEqual('Infinity Gauntlet');
|
||||||
|
|
||||||
|
|
||||||
result = await nightmare
|
result = await page
|
||||||
.waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.itemBasicData.typeAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Crisantemo');
|
expect(result).toEqual('Crisantemo');
|
||||||
|
|
||||||
result = await nightmare
|
result = await page
|
||||||
.waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.itemBasicData.intrastatAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('5080000 Coral y materiales similares');
|
expect(result).toEqual('5080000 Coral y materiales similares');
|
||||||
|
|
||||||
result = await nightmare
|
result = await page
|
||||||
.waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.itemBasicData.originAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Holand');
|
expect(result).toEqual('Holand');
|
||||||
|
@ -85,45 +87,41 @@ describe('Item Create/Clone path', () => {
|
||||||
|
|
||||||
describe('clone', () => {
|
describe('clone', () => {
|
||||||
it('should return to the items index by clicking the return to items button', async() => {
|
it('should return to the items index by clicking the return to items button', async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.itemBasicData.goToItemIndexButton);
|
||||||
.waitToClick(selectors.itemBasicData.goToItemIndexButton)
|
await page.wait(selectors.itemsIndex.createItemButton);
|
||||||
.wait(selectors.itemsIndex.createItemButton)
|
await page.waitForURL('#!/item/index');
|
||||||
.waitForURL('#!/item/index')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('#!/item/index');
|
expect(url.hash).toContain('#!/item/index');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should search for the item Infinity Gauntlet`, async() => {
|
it(`should search for the item Infinity Gauntlet`, async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet');
|
||||||
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||||
.waitToClick(selectors.itemsIndex.searchButton)
|
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
|
||||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||||
.countElement(selectors.itemsIndex.searchResult);
|
|
||||||
|
|
||||||
expect(result).toEqual(1);
|
expect(result).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should clone the Infinity Gauntlet`, async() => {
|
it(`should clone the Infinity Gauntlet`, async() => {
|
||||||
const url = await nightmare
|
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet');
|
||||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Infinity Gauntlet')
|
await page.waitToClick(selectors.itemsIndex.searchResultCloneButton);
|
||||||
.waitToClick(selectors.itemsIndex.searchResultCloneButton)
|
await page.waitToClick(selectors.itemsIndex.acceptClonationAlertButton);
|
||||||
.waitToClick(selectors.itemsIndex.acceptClonationAlertButton)
|
await page.waitForURL('tags');
|
||||||
.waitForURL('tags')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('tags');
|
expect(url.hash).toContain('tags');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search for the item Infinity Gauntlet and find two', async() => {
|
it('should search for the item Infinity Gauntlet and find two', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.itemTags.goToItemIndexButton);
|
||||||
.waitToClick(selectors.itemTags.goToItemIndexButton)
|
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
await page.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet');
|
||||||
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||||
.waitToClick(selectors.itemsIndex.searchButton)
|
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2);
|
||||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2)
|
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||||
.countElement(selectors.itemsIndex.searchResult);
|
|
||||||
|
|
||||||
expect(result).toEqual(2);
|
expect(result).toEqual(2);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,206 +1,203 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Item regularize path', () => {
|
describe('Item regularize path', () => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
beforeAll(() => {
|
let page;
|
||||||
nightmare
|
beforeAll(async() => {
|
||||||
.loginAndModule('employee', 'item');
|
browser = await getBrowser();
|
||||||
|
page = browser.page;
|
||||||
|
await page.loginAndModule('employee', 'item');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterAll(async() => {
|
||||||
|
await browser.close();
|
||||||
|
});
|
||||||
|
|
||||||
it('should edit the user local warehouse', async() => {
|
it('should edit the user local warehouse', async() => {
|
||||||
let result = await nightmare
|
await page.waitForSpinnerLoad();
|
||||||
.waitForSpinnerLoad()
|
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||||
.waitToClick(selectors.globalItems.userMenuButton)
|
await page.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four');
|
||||||
.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four')
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open the user config form to check the local settings', async() => {
|
it('should check the local settings were saved', async() => {
|
||||||
let userLocalWarehouse = await nightmare
|
const userLocalWarehouse = await page
|
||||||
.waitToClick(selectors.globalItems.userMenuButton)
|
|
||||||
.waitToGetProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value');
|
.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');
|
expect(userLocalWarehouse).toContain('Warehouse Four');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search for an item', async() => {
|
it('should search for an specific item', async() => {
|
||||||
const resultCount = await nightmare
|
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm');
|
||||||
.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm')
|
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||||
.waitToClick(selectors.itemsIndex.searchButton)
|
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
|
||||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
const resultCount = await page.countElement(selectors.itemsIndex.searchResult);
|
||||||
.countElement(selectors.itemsIndex.searchResult);
|
|
||||||
|
|
||||||
expect(resultCount).toEqual(1);
|
expect(resultCount).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the search result to access to the item tax`, async() => {
|
it(`should click on the search result to access to the item tax`, async() => {
|
||||||
const url = await nightmare
|
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm');
|
||||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm')
|
await page.waitToClick(selectors.itemsIndex.searchResult);
|
||||||
.waitToClick(selectors.itemsIndex.searchResult)
|
await page.waitForURL('/summary');
|
||||||
.waitForURL('/summary')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/summary');
|
expect(url.hash).toContain('/summary');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open the regularize dialog and check the warehouse matches the local user settings', async() => {
|
it('should open the regularize dialog and check the warehouse matches the local user settings', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.itemDescriptor.moreMenu);
|
||||||
.waitToClick(selectors.itemDescriptor.moreMenu)
|
await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton);
|
||||||
.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton)
|
const result = await page.waitToGetProperty(`${selectors.itemDescriptor.regularizeWarehouseAutocomplete} input`, 'value');
|
||||||
.waitToGetProperty(`${selectors.itemDescriptor.regularizeWarehouseAutocomplete} input`, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('Warehouse Four');
|
expect(result).toEqual('Warehouse Four');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should regularize the item', async() => {
|
it('should regularize the item', async() => {
|
||||||
const result = await nightmare
|
await page.write(selectors.itemDescriptor.regularizeQuantityInput, '100');
|
||||||
.write(selectors.itemDescriptor.regularizeQuantityInput, 100)
|
await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One');
|
||||||
.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One')
|
await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton);
|
||||||
.waitToClick(selectors.itemDescriptor.regularizeSaveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should click on the Tickets button of the top bar menu', async() => {
|
it('should click on the Tickets button of the top bar menu', async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
await Promise.all([
|
||||||
.waitToClick(selectors.globalItems.ticketsButton)
|
page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}),
|
||||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
page.waitToClick(selectors.globalItems.ticketsButton)
|
||||||
.parsedUrl();
|
]);
|
||||||
|
const url = await page.parsedUrl();
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/ticket/index');
|
expect(url.hash).toEqual('#!/ticket/index');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now clear the user local settings', async() => {
|
it('should clear the user local settings now', async() => {
|
||||||
let result = await nightmare
|
await page.waitForTransitionEnd('vn-searchbar');
|
||||||
.waitToClick(selectors.globalItems.userMenuButton)
|
await page.waitToClick(selectors.globalItems.userMenuButton);
|
||||||
.waitToClick(selectors.globalItems.userConfigFirstAutocompleteClear)
|
await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete);
|
||||||
.waitForLastSnackbar();
|
const result = await page.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search for the ticket with alias missing', async() => {
|
it('should search for the ticket with alias missing', async() => {
|
||||||
const result = await nightmare
|
await page.keyboard.press('Escape');
|
||||||
.write(selectors.ticketsIndex.searchTicketInput, 'missing')
|
await page.write(selectors.ticketsIndex.searchTicketInput, 'missing');
|
||||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
await page.keyboard.press('Enter');
|
||||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||||
.countElement(selectors.ticketsIndex.searchResult);
|
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||||
|
|
||||||
expect(result).toEqual(1);
|
expect(result).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the search result to access to the ticket summary`, async() => {
|
it(`should click on the search result to access to the ticket summary`, async() => {
|
||||||
const url = await nightmare
|
await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Missing');
|
||||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Missing')
|
await page.waitToClick(selectors.ticketsIndex.searchResult);
|
||||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
await page.waitForURL('/summary');
|
||||||
.waitForURL('/summary')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/summary');
|
expect(url.hash).toContain('/summary');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the ticket sale quantity is showing a negative value`, async() => {
|
it(`should check the ticket sale quantity is showing a negative value`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100');
|
||||||
.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100')
|
const result = await page
|
||||||
.waitToGetProperty(selectors.ticketSummary.firstSaleQuantity, 'innerText');
|
.waitToGetProperty(selectors.ticketSummary.firstSaleQuantity, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain('-100');
|
expect(result).toContain('-100');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the ticket sale discount is 100%`, async() => {
|
it(`should check the ticket sale discount is 100%`, async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.waitToGetProperty(selectors.ticketSummary.firstSaleDiscount, 'innerText');
|
.waitToGetProperty(selectors.ticketSummary.firstSaleDiscount, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain('100 %');
|
expect(result).toContain('100 %');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now click on the Items button of the top bar menu', async() => {
|
it('should now click on the Items button of the top bar menu', async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
await page.waitToClick(selectors.globalItems.itemsButton);
|
||||||
.waitToClick(selectors.globalItems.itemsButton)
|
await page.wait(selectors.itemsIndex.searchItemInput);
|
||||||
.wait(selectors.itemsIndex.searchItemInput)
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/item/index');
|
expect(url.hash).toEqual('#!/item/index');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search for the item once again', async() => {
|
it('should search for the item once again', async() => {
|
||||||
const resultCount = await nightmare
|
await page.clearInput(selectors.itemsIndex.searchItemInput);
|
||||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
await page.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm');
|
||||||
.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm')
|
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||||
.waitToClick(selectors.itemsIndex.searchButton)
|
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
|
||||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
const resultCount = await page.countElement(selectors.itemsIndex.searchResult);
|
||||||
.countElement(selectors.itemsIndex.searchResult);
|
|
||||||
|
|
||||||
expect(resultCount).toEqual(1);
|
expect(resultCount).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the search result to access to the item tax`, async() => {
|
it(`should click on the search result to access to the item tax`, async() => {
|
||||||
const url = await nightmare
|
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm');
|
||||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon pistol 9mm')
|
await page.waitToClick(selectors.itemsIndex.searchResult);
|
||||||
.waitToClick(selectors.itemsIndex.searchResult)
|
await page.waitForURL('/summary');
|
||||||
.waitForURL('/summary')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/summary');
|
expect(url.hash).toContain('/summary');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should regularize the item once more', async() => {
|
it('should regularize the item once more', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.itemDescriptor.moreMenu);
|
||||||
.waitToClick(selectors.itemDescriptor.moreMenu)
|
await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton);
|
||||||
.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton)
|
await page.write(selectors.itemDescriptor.regularizeQuantityInput, '100');
|
||||||
.write(selectors.itemDescriptor.regularizeQuantityInput, 100)
|
await page.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One');
|
||||||
.autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One')
|
await page.waitToClick(selectors.itemDescriptor.regularizeSaveButton);
|
||||||
.waitToClick(selectors.itemDescriptor.regularizeSaveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should again click on the Tickets button of the top bar menu', async() => {
|
it('should again click on the Tickets button of the top bar menu', async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
await Promise.all([
|
||||||
.waitToClick(selectors.globalItems.ticketsButton)
|
page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}),
|
||||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
page.waitToClick(selectors.globalItems.ticketsButton)
|
||||||
.parsedUrl();
|
]);
|
||||||
|
await page.waitForTransitionEnd('vn-searchbar');
|
||||||
|
const url = await page.parsedUrl();
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/ticket/index');
|
expect(url.hash).toEqual('#!/ticket/index');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search for the ticket with id 25 once again', async() => {
|
it('should search for the ticket with id 25 once again', async() => {
|
||||||
const result = await nightmare
|
await page.write(selectors.ticketsIndex.searchTicketInput, '25');
|
||||||
.write(selectors.ticketsIndex.searchTicketInput, 25)
|
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
||||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||||
.countElement(selectors.ticketsIndex.searchResult);
|
|
||||||
|
|
||||||
expect(result).toEqual(1);
|
expect(result).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should now click on the search result to access to the ticket summary`, async() => {
|
it(`should now click on the search result to access to the ticket summary`, async() => {
|
||||||
const url = await nightmare
|
await page.waitForTextInElement(selectors.ticketsIndex.searchResult, '25');
|
||||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, '25')
|
await page.waitToClick(selectors.ticketsIndex.searchResult);
|
||||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
await page.waitForURL('/summary');
|
||||||
.waitForURL('/summary')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/summary');
|
expect(url.hash).toContain('/summary');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the ticket contains now two sales`, async() => {
|
it(`should check the ticket contains now two sales`, async() => {
|
||||||
const result = await nightmare
|
await page.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100');
|
||||||
.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100')
|
const result = await page.countElement(selectors.ticketSummary.sale);
|
||||||
.countElement(selectors.ticketSummary.sale);
|
|
||||||
|
|
||||||
expect(result).toEqual(2);
|
expect(result).toEqual(2);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,86 +1,83 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Item index path', () => {
|
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(() => {
|
afterAll(async() => {
|
||||||
nightmare
|
await browser.close();
|
||||||
.loginAndModule('salesPerson', 'item')
|
|
||||||
.waitToClick(selectors.itemsIndex.searchIcon);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should click on the fields to show button to open the list of columns to show', async() => {
|
it('should click on the fields to show button to open the list of columns to show', async() => {
|
||||||
const visible = await nightmare
|
await page.waitToClick(selectors.itemsIndex.fieldsToShowButton);
|
||||||
.waitToClick(selectors.itemsIndex.fieldsToShowButton)
|
const visible = await page.isVisible(selectors.itemsIndex.fieldsToShowForm);
|
||||||
.isVisible(selectors.itemsIndex.fieldsToShowForm);
|
|
||||||
|
|
||||||
expect(visible).toBeTruthy();
|
expect(visible).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should unmark all checkboxes except the first and the last ones', async() => {
|
it('should unmark all checkboxes except the first and the last ones', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.itemsIndex.idCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.idCheckbox)
|
await page.waitToClick(selectors.itemsIndex.stemsCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.stemsCheckbox)
|
await page.waitToClick(selectors.itemsIndex.sizeCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.sizeCheckbox)
|
await page.waitToClick(selectors.itemsIndex.nicheCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.nicheCheckbox)
|
await page.waitToClick(selectors.itemsIndex.typeCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.typeCheckbox)
|
await page.waitToClick(selectors.itemsIndex.categoryCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.categoryCheckbox)
|
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.intrastadCheckbox)
|
await page.waitToClick(selectors.itemsIndex.originCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.originCheckbox)
|
await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.buyerCheckbox)
|
await page.waitToClick(selectors.itemsIndex.destinyCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.destinyCheckbox)
|
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
|
||||||
.waitToClick(selectors.itemsIndex.saveFieldsButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should navigate forth and back to see the images column is still visible', async() => {
|
it('should navigate forth and back to see the images column is still visible', async() => {
|
||||||
const imageVisible = await nightmare
|
await page.waitToClick(selectors.itemsIndex.searchResult);
|
||||||
.waitToClick(selectors.itemsIndex.searchResult)
|
await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton);
|
||||||
.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton)
|
await page.waitToClick(selectors.itemsIndex.searchIcon);
|
||||||
.waitToClick(selectors.itemsIndex.searchIcon)
|
await page.wait(selectors.itemsIndex.searchResult);
|
||||||
.wait(selectors.itemsIndex.searchResult)
|
await page.waitImgLoad(selectors.itemsIndex.firstItemImage);
|
||||||
.waitImgLoad(selectors.itemsIndex.firstItemImage)
|
const imageVisible = await page.isVisible(selectors.itemsIndex.firstItemImageTd);
|
||||||
.isVisible(selectors.itemsIndex.firstItemImageTd);
|
|
||||||
|
|
||||||
expect(imageVisible).toBeTruthy();
|
expect(imageVisible).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check the ids column is not visible', async() => {
|
it('should check the ids column is not visible', async() => {
|
||||||
const idVisible = await nightmare
|
await page.waitForSelector(selectors.itemsIndex.firstItemId, {hidden: true});
|
||||||
.isVisible(selectors.itemsIndex.firstItemId);
|
|
||||||
|
|
||||||
expect(idVisible).toBeFalsy();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should mark all unchecked boxes to leave the index as it was', async() => {
|
it('should mark all unchecked boxes to leave the index as it was', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.itemsIndex.fieldsToShowButton);
|
||||||
.waitToClick(selectors.itemsIndex.fieldsToShowButton)
|
await page.waitToClick(selectors.itemsIndex.idCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.idCheckbox)
|
await page.waitToClick(selectors.itemsIndex.stemsCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.stemsCheckbox)
|
await page.waitToClick(selectors.itemsIndex.sizeCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.sizeCheckbox)
|
await page.waitToClick(selectors.itemsIndex.nicheCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.nicheCheckbox)
|
await page.waitToClick(selectors.itemsIndex.typeCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.typeCheckbox)
|
await page.waitToClick(selectors.itemsIndex.categoryCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.categoryCheckbox)
|
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.intrastadCheckbox)
|
await page.waitToClick(selectors.itemsIndex.originCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.originCheckbox)
|
await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.buyerCheckbox)
|
await page.waitToClick(selectors.itemsIndex.destinyCheckbox);
|
||||||
.waitToClick(selectors.itemsIndex.destinyCheckbox)
|
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
|
||||||
.waitToClick(selectors.itemsIndex.saveFieldsButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now navigate forth and back to see the ids column is now visible', async() => {
|
it('should now navigate forth and back to see the ids column is now visible', async() => {
|
||||||
const idVisible = await nightmare
|
await page.waitToClick(selectors.itemsIndex.searchResult);
|
||||||
.waitToClick(selectors.itemsIndex.searchResult)
|
await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton);
|
||||||
.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton)
|
await page.waitToClick(selectors.itemsIndex.searchIcon);
|
||||||
.waitToClick(selectors.itemsIndex.searchIcon)
|
await page.wait(selectors.itemsIndex.searchResult);
|
||||||
.wait(selectors.itemsIndex.searchResult)
|
const idVisible = await page.isVisible(selectors.itemsIndex.firstItemId);
|
||||||
.isVisible(selectors.itemsIndex.firstItemId);
|
|
||||||
|
|
||||||
expect(idVisible).toBeTruthy();
|
expect(idVisible).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,74 +1,74 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Item log path', () => {
|
describe('Item log path', () => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
beforeAll(() => {
|
let page;
|
||||||
nightmare
|
beforeAll(async() => {
|
||||||
.loginAndModule('developer', 'item');
|
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() => {
|
it(`should search for the Knowledge artifact to confirm it isn't created yet`, async() => {
|
||||||
const result = await nightmare
|
await page.write(selectors.itemsIndex.searchItemInput, 'Knowledge artifact');
|
||||||
.write(selectors.itemsIndex.searchItemInput, 'Knowledge artifact')
|
await page.waitToClick(selectors.itemsIndex.searchButton);
|
||||||
.waitToClick(selectors.itemsIndex.searchButton)
|
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0);
|
||||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0)
|
const result = await page.countElement(selectors.itemsIndex.searchResult);
|
||||||
.countElement(selectors.itemsIndex.searchResult);
|
|
||||||
|
|
||||||
expect(result).toEqual(0);
|
expect(result).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should access to the create item view by clicking the create floating button', async() => {
|
it('should access to the create item view by clicking the create floating button', async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.itemsIndex.createItemButton);
|
||||||
.waitToClick(selectors.itemsIndex.createItemButton)
|
await page.wait(selectors.itemCreateView.createButton);
|
||||||
.wait(selectors.itemCreateView.createButton)
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/item/create');
|
expect(url.hash).toEqual('#!/item/create');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create the Knowledge artifact item', async() => {
|
it('should create the Knowledge artifact item', async() => {
|
||||||
const result = await nightmare
|
await page.write(selectors.itemCreateView.temporalName, 'Knowledge artifact');
|
||||||
.write(selectors.itemCreateView.temporalName, 'Knowledge artifact')
|
await page.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo');
|
||||||
.autocompleteSearch(selectors.itemCreateView.typeAutocomplete, 'Crisantemo')
|
await page.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares');
|
||||||
.autocompleteSearch(selectors.itemCreateView.intrastatAutocomplete, 'Coral y materiales similares')
|
await page.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand');
|
||||||
.autocompleteSearch(selectors.itemCreateView.originAutocomplete, 'Holand')
|
await page.waitToClick(selectors.itemCreateView.createButton);
|
||||||
.waitToClick(selectors.itemCreateView.createButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return to the items index by clicking the return to items button', async() => {
|
it('should return to the items index by clicking the return to items button', async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.itemBasicData.goToItemIndexButton);
|
||||||
.waitToClick(selectors.itemBasicData.goToItemIndexButton)
|
await page.wait(selectors.itemsIndex.createItemButton);
|
||||||
.wait(selectors.itemsIndex.createItemButton)
|
await page.waitForURL('#!/item/index');
|
||||||
.waitForURL('#!/item/index')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('#!/item/index');
|
expect(url.hash).toContain('#!/item/index');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should search for the created item and navigate to it's log section`, async() => {
|
it(`should search for the created item and navigate to it's log section`, async() => {
|
||||||
const url = await nightmare
|
await page.accessToSearchResult('Knowledge artifact');
|
||||||
.accessToSearchResult('Knowledge artifact')
|
await page.accessToSection('item.card.log');
|
||||||
.accessToSection('item.card.log')
|
await page.waitForURL('/log');
|
||||||
.waitForURL('/log')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/log');
|
expect(url.hash).toContain('/log');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the log is showing 5 entries`, async() => {
|
it(`should confirm the log is showing 5 entries`, async() => {
|
||||||
const anyLineCreatedCount = await nightmare
|
await page.wait(selectors.itemLog.anyLineCreated);
|
||||||
.wait(selectors.itemLog.anyLineCreated)
|
const anyLineCreatedCount = await page.countElement(selectors.itemLog.anyLineCreated);
|
||||||
.countElement(selectors.itemLog.anyLineCreated);
|
|
||||||
|
|
||||||
expect(anyLineCreatedCount).toEqual(5);
|
expect(anyLineCreatedCount).toEqual(5);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the log is showing the intrastat for the created item`, async() => {
|
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');
|
.waitToGetProperty(selectors.itemLog.fifthLineCreatedProperty, 'innerText');
|
||||||
|
|
||||||
expect(fifthLineCreatedProperty).toEqual('Coral y materiales similares');
|
expect(fifthLineCreatedProperty).toEqual('Coral y materiales similares');
|
||||||
|
|
|
@ -1,47 +1,49 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Item descriptor path', () => {
|
describe('Item descriptor path', () => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
beforeAll(() => {
|
let page;
|
||||||
nightmare
|
beforeAll(async() => {
|
||||||
.loginAndModule('buyer', 'item')
|
browser = await getBrowser();
|
||||||
.accessToSearchResult(1)
|
page = browser.page;
|
||||||
.accessToSection('item.card.basicData');
|
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() => {
|
it('should check the descriptor inactive icon is dark as the item is active', async() => {
|
||||||
let darkIcon = await nightmare
|
await page.wait(selectors.itemDescriptor.inactiveIcon);
|
||||||
.wait(selectors.itemDescriptor.inactiveIcon)
|
await page.waitForClassNotPresent(selectors.itemDescriptor.inactiveIcon, 'bright');
|
||||||
.waitForClassNotPresent(selectors.itemDescriptor.inactiveIcon, 'bright')
|
let darkIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
|
||||||
.isVisible(selectors.itemDescriptor.inactiveIcon);
|
|
||||||
|
|
||||||
expect(darkIcon).toBeTruthy();
|
expect(darkIcon).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set the item to inactive', async() => {
|
it('should set the item to inactive', async() => {
|
||||||
let result = await nightmare
|
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
|
||||||
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
|
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
||||||
.waitToClick(selectors.itemBasicData.submitBasicDataButton)
|
let result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should reload the section and check the inactive icon is bright', async() => {
|
it('should reload the section and check the inactive icon is bright', async() => {
|
||||||
let brightIcon = await nightmare
|
await page.reloadSection('item.card.basicData');
|
||||||
.reloadSection('item.card.basicData')
|
await page.waitForClassPresent(selectors.itemDescriptor.inactiveIcon, 'bright');
|
||||||
.waitForClassPresent(selectors.itemDescriptor.inactiveIcon, 'bright')
|
let brightIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
|
||||||
.isVisible(selectors.itemDescriptor.inactiveIcon);
|
|
||||||
|
|
||||||
expect(brightIcon).toBeTruthy();
|
expect(brightIcon).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set the item back to active', async() => {
|
it('should set the item back to active', async() => {
|
||||||
let result = await nightmare
|
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
|
||||||
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
|
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
||||||
.waitToClick(selectors.itemBasicData.submitBasicDataButton)
|
let result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,94 +1,114 @@
|
||||||
import selectors from '../../../helpers/selectors.js';
|
import selectors from '../../../helpers/selectors.js';
|
||||||
import createNightmare from '../../../helpers/nightmare';
|
import getBrowser from '../../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Ticket List sale path', () => {
|
describe('Ticket List sale path', () => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
|
let page;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
return nightmare
|
browser = await getBrowser();
|
||||||
.loginAndModule('employee', 'ticket')
|
page = browser.page;
|
||||||
.accessToSearchResult(13)
|
await page.loginAndModule('employee', 'ticket');
|
||||||
.accessToSection('ticket.card.sale');
|
await page.accessToSearchResult('13');
|
||||||
|
await page.accessToSection('ticket.card.sale');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the first ticket sale contains the colour', async() => {
|
afterAll(async() => {
|
||||||
const value = await nightmare
|
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');
|
.waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText');
|
||||||
|
|
||||||
expect(value).toContain('Black');
|
expect(value).toContain('Black');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the first sale contains the price', async() => {
|
it('should confirm the first sale contains the price', async() => {
|
||||||
const value = await nightmare
|
const value = await page
|
||||||
.waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
|
.waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
|
||||||
|
|
||||||
expect(value).toContain('1.72');
|
expect(value).toContain('1.72');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the first sale contains the discount', async() => {
|
it('should confirm the first sale contains the discount', async() => {
|
||||||
const value = await nightmare
|
const value = await page
|
||||||
.waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText');
|
.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() => {
|
it('should confirm the first sale contains the total import', async() => {
|
||||||
const value = await nightmare
|
const value = await page
|
||||||
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
|
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
|
||||||
|
|
||||||
expect(value).toContain('34.40');
|
expect(value).toContain('34.40');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add an empty item to the sale list', async() => {
|
it('should add an empty item to the sale list', async() => {
|
||||||
const sales = await nightmare
|
await page.waitToClick(selectors.ticketSales.newItemButton);
|
||||||
.waitToClick(selectors.ticketSales.newItemButton)
|
const sales = await page
|
||||||
.countElement(selectors.ticketSales.saleLine);
|
.countElement(selectors.ticketSales.saleLine);
|
||||||
|
|
||||||
expect(sales).toEqual(2);
|
expect(sales).toEqual(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should select a valid item to be added as the second item in the sales list', async() => {
|
it('should select a valid item to be added as the second item in the sales list', async() => {
|
||||||
const result = await nightmare
|
let searchValue = 'Melee weapon heavy shield 1x0.5m';
|
||||||
.waitToClick(selectors.ticketSales.secondSaleIdInput)
|
await page.waitToClick(`${selectors.ticketSales.secondSaleIdAutocomplete} input`);
|
||||||
.write(selectors.ticketSales.secondSaleIdAutocomplete, 'Melee weapon heavy shield 1x0.5m')
|
await page.waitForSelector(selector => {
|
||||||
.waitToClick(selectors.ticketSales.idAutocompleteFirstResult)
|
document
|
||||||
.write(selectors.ticketSales.secondSaleQuantity, '1\u000d')
|
.querySelector(`${selector} vn-drop-down`).$ctrl.content
|
||||||
.waitForLastSnackbar();
|
.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!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
// #1865
|
// #1865
|
||||||
xit('should update the description of the new sale', async() => {
|
xit('should update the description of the new sale', async() => {
|
||||||
const result = await nightmare
|
await page.focusElement(selectors.ticketSales.secondSaleConceptCell);
|
||||||
.focusElement(selectors.ticketSales.secondSaleConceptCell)
|
await page.write(selectors.ticketSales.secondSaleConceptInput, 'Aegis of Valor');
|
||||||
.write(selectors.ticketSales.secondSaleConceptInput, 'Aegis of Valor\u000d')
|
await page.keyboard.press('Enter');
|
||||||
.waitForLastSnackbar();
|
const result = await page.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add a third empty item to the sale list', async() => {
|
it('should add a third empty item to the sale list', async() => {
|
||||||
const sales = await nightmare
|
await page.waitToClick(selectors.ticketSales.newItemButton);
|
||||||
.waitToClick(selectors.ticketSales.newItemButton)
|
const sales = await page.countElement(selectors.ticketSales.saleLine);
|
||||||
.countElement(selectors.ticketSales.saleLine);
|
|
||||||
|
|
||||||
expect(sales).toEqual(3);
|
expect(sales).toEqual(3);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should select the 2nd and 3th item and delete both', async() => {
|
it('should select the 2nd and 3th item and delete both', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
|
||||||
.waitToClick(selectors.ticketSales.secondSaleCheckbox)
|
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
|
||||||
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
|
await page.waitToClick(selectors.ticketSales.deleteSaleButton);
|
||||||
.waitToClick(selectors.ticketSales.deleteSaleButton)
|
await page.waitToClick(selectors.ticketSales.acceptDeleteLineButton);
|
||||||
.waitToClick(selectors.ticketSales.acceptDeleteLineButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should verify there's only 1 single line remaining`, async() => {
|
it(`should verify there's only 1 single line remaining`, async() => {
|
||||||
const sales = await nightmare
|
const sales = await page.countElement(selectors.ticketSales.saleLine);
|
||||||
.countElement(selectors.ticketSales.saleLine);
|
|
||||||
|
|
||||||
expect(sales).toEqual(1);
|
expect(sales).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,15 +1,21 @@
|
||||||
import selectors from '../../../helpers/selectors.js';
|
import selectors from '../../../helpers/selectors.js';
|
||||||
import createNightmare from '../../../helpers/nightmare';
|
import getBrowser from '../../../helpers/puppeteer';
|
||||||
|
|
||||||
// #1632 [e2e] ticket.sale - Transferir líneas
|
// #1632 [e2e] ticket.sale - Transferir líneas
|
||||||
xdescribe('Ticket Edit sale path', () => {
|
xdescribe('Ticket Edit sale path', () => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
|
let page;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
nightmare
|
browser = await getBrowser();
|
||||||
.loginAndModule('salesPerson', 'ticket')
|
page = browser.page;
|
||||||
.accessToSearchResult(16)
|
await page.loginAndModule('salesPerson', 'ticket');
|
||||||
.accessToSection('ticket.card.sale');
|
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() => {
|
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() => {
|
it(`should click on the zoomed image to close it`, async() => {
|
||||||
const result = await nightmare
|
const result = await nightmare
|
||||||
.wait(100)
|
|
||||||
.clickIfVisible(selectors.ticketSales.firstSaleZoomedImage)
|
.clickIfVisible(selectors.ticketSales.firstSaleZoomedImage)
|
||||||
.countElement(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() => {
|
it('should confirm the price have been updated', async() => {
|
||||||
const result = await nightmare
|
const result = await nightmare
|
||||||
.wait(1999)
|
|
||||||
.waitToGetProperty(`${selectors.ticketSales.firstSalePrice} span`, 'innerText');
|
.waitToGetProperty(`${selectors.ticketSales.firstSalePrice} span`, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain('5.00');
|
expect(result).toContain('5.00');
|
||||||
|
@ -173,10 +177,10 @@ xdescribe('Ticket Edit sale path', () => {
|
||||||
|
|
||||||
it('should confirm the discount have been updated', async() => {
|
it('should confirm the discount have been updated', async() => {
|
||||||
const result = await nightmare
|
const result = await nightmare
|
||||||
.waitForTextInElement(`${selectors.ticketSales.firstSaleDiscount} > span`, '50 %')
|
.waitForTextInElement(`${selectors.ticketSales.firstSaleDiscount} > span`, '50.00%')
|
||||||
.waitToGetProperty(`${selectors.ticketSales.firstSaleDiscount} > span`, 'innerText');
|
.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() => {
|
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
|
const result = await nightmare
|
||||||
.waitToClick(selectors.ticketSales.moreMenu)
|
.waitToClick(selectors.ticketSales.moreMenu)
|
||||||
.waitToClick(selectors.ticketSales.moreMenuUpdateDiscount)
|
.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')
|
.write('body', '\u000d')
|
||||||
.waitForTextInElement(selectors.ticketSales.totalImport, '0.00')
|
.waitForTextInElement(selectors.ticketSales.totalImport, '0.00')
|
||||||
.waitToGetProperty(selectors.ticketSales.totalImport, 'innerText');
|
.waitToGetProperty(selectors.ticketSales.totalImport, 'innerText');
|
||||||
|
|
|
@ -1,45 +1,50 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Ticket Create notes path', () => {
|
describe('Ticket Create notes path', () => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
|
let page;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
return nightmare
|
browser = await getBrowser();
|
||||||
.loginAndModule('employee', 'ticket')
|
page = browser.page;
|
||||||
.accessToSearchResult(1)
|
await page.loginAndModule('employee', 'ticket');
|
||||||
.accessToSection('ticket.card.observation');
|
await page.accessToSearchResult('1');
|
||||||
|
await page.accessToSection('ticket.card.observation');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async() => {
|
||||||
|
await browser.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create a new note', async() => {
|
it('should create a new note', async() => {
|
||||||
let result = await nightmare
|
await page.waitForContentLoaded();
|
||||||
.waitToClick(selectors.ticketNotes.addNoteButton)
|
await page.waitToClick(selectors.ticketNotes.addNoteButton);
|
||||||
.autocompleteSearch(selectors.ticketNotes.firstNoteTypeAutocomplete, 'observation one')
|
await page.autocompleteSearch(selectors.ticketNotes.firstNoteTypeAutocomplete, 'observation one');
|
||||||
.write(selectors.ticketNotes.firstDescriptionInput, 'description')
|
await page.write(selectors.ticketNotes.firstDescriptionInput, 'description');
|
||||||
.waitToClick(selectors.ticketNotes.submitNotesButton)
|
await page.waitToClick(selectors.ticketNotes.submitNotesButton);
|
||||||
.waitForLastSnackbar();
|
const result = await page.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
}, 15000);
|
||||||
|
|
||||||
it('should confirm the note is the expected one', async() => {
|
it('should confirm the note is the expected one', async() => {
|
||||||
let result = await nightmare
|
await page.reloadSection('ticket.card.observation');
|
||||||
.reloadSection('ticket.card.observation')
|
const result = await page
|
||||||
.waitToGetProperty(`${selectors.ticketNotes.firstNoteTypeAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.ticketNotes.firstNoteTypeAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('observation one');
|
expect(result).toEqual('observation one');
|
||||||
|
|
||||||
let firstDescription = await nightmare
|
const firstDescription = await page
|
||||||
.waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value');
|
.waitToGetProperty(`${selectors.ticketNotes.firstDescriptionInput} input`, 'value');
|
||||||
|
|
||||||
expect(firstDescription).toEqual('description');
|
expect(firstDescription).toEqual('description');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should delete the note', async() => {
|
it('should delete the note', async() => {
|
||||||
let result = await nightmare
|
await page.waitToClick(selectors.ticketNotes.firstNoteRemoveButton);
|
||||||
.waitToClick(selectors.ticketNotes.firstNoteRemoveButton)
|
await page.waitToClick(selectors.ticketNotes.submitNotesButton);
|
||||||
.waitToClick(selectors.ticketNotes.submitNotesButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,36 +1,42 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Ticket expeditions and log path', () => {
|
describe('Ticket expeditions and log path', () => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
|
let page;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
return nightmare
|
browser = await getBrowser();
|
||||||
.loginAndModule('production', 'ticket')
|
page = browser.page;
|
||||||
.accessToSearchResult('1')
|
await page.loginAndModule('production', 'ticket');
|
||||||
.accessToSection('ticket.card.expedition');
|
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() => {
|
it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton);
|
||||||
.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton)
|
await page.waitToClick(selectors.ticketExpedition.acceptDeleteRowButton),
|
||||||
.waitToClick(selectors.ticketExpedition.acceptDeleteRowButton)
|
await page.reloadSection('ticket.card.expedition');
|
||||||
.waitToClick(selectors.ticketPackages.packagesButton)
|
await page.waitForSelector(selectors.ticketExpedition.expeditionRow, {});
|
||||||
.wait(selectors.ticketPackages.firstPackageAutocomplete)
|
const result = await page
|
||||||
.waitToClick(selectors.ticketExpedition.expeditionButton)
|
|
||||||
.wait(selectors.ticketExpedition.expeditionRow)
|
|
||||||
.countElement(selectors.ticketExpedition.expeditionRow);
|
.countElement(selectors.ticketExpedition.expeditionRow);
|
||||||
|
|
||||||
expect(result).toEqual(3);
|
expect(result).toEqual(3);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the expedition deleted is shown now in the ticket log`, async() => {
|
it(`should confirm the expedition deleted is shown now in the ticket log`, async() => {
|
||||||
const changedBy = await nightmare
|
await page.waitToClick(selectors.ticketLog.logButton);
|
||||||
.waitToClick(selectors.ticketLog.logButton)
|
const changedBy = await page
|
||||||
.waitToGetProperty(selectors.ticketLog.changedBy, 'innerText');
|
.waitToGetProperty(selectors.ticketLog.changedBy, 'innerText');
|
||||||
const actionTaken = await nightmare
|
|
||||||
|
const actionTaken = await page
|
||||||
.waitToGetProperty(selectors.ticketLog.actionTaken, 'innerText');
|
.waitToGetProperty(selectors.ticketLog.actionTaken, 'innerText');
|
||||||
const id = await nightmare
|
|
||||||
|
const id = await page
|
||||||
.waitToGetProperty(selectors.ticketLog.id, 'innerText');
|
.waitToGetProperty(selectors.ticketLog.id, 'innerText');
|
||||||
|
|
||||||
expect(changedBy).toEqual('production');
|
expect(changedBy).toEqual('production');
|
||||||
|
|
|
@ -1,69 +1,70 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Ticket Create packages path', () => {
|
describe('Ticket Create packages path', () => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
|
let page;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
return nightmare
|
browser = await getBrowser();
|
||||||
.loginAndModule('employee', 'ticket')
|
page = browser.page;
|
||||||
.accessToSearchResult('1')
|
await page.loginAndModule('employee', 'ticket');
|
||||||
.accessToSection('ticket.card.package');
|
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() => {
|
it(`should attempt create a new package but receive an error if package is blank`, async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.ticketPackages.firstRemovePackageButton);
|
||||||
.waitToClick(selectors.ticketPackages.firstRemovePackageButton)
|
await page.waitToClick(selectors.ticketPackages.addPackageButton);
|
||||||
.waitToClick(selectors.ticketPackages.addPackageButton)
|
await page.write(selectors.ticketPackages.firstQuantityInput, '99');
|
||||||
.write(selectors.ticketPackages.firstQuantityInput, 99)
|
await page.waitToClick(selectors.ticketPackages.savePackagesButton);
|
||||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Package cannot be blank');
|
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() => {
|
it(`should delete the first package and receive and error to save a new one with blank quantity`, async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.ticketPackages.firstQuantityInput);
|
||||||
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
await page.autocompleteSearch(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m');
|
||||||
.autocompleteSearch(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m')
|
await page.waitToClick(selectors.ticketPackages.savePackagesButton);
|
||||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Some fields are invalid');
|
expect(result).toEqual('Some fields are invalid');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the quantity input isn't invalid yet`, async() => {
|
it(`should confirm the quantity input isn't invalid yet`, async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.evaluate(selector => {
|
.evaluate(selector => {
|
||||||
return document.querySelector(selector).checkValidity();
|
return document.querySelector(`${selector} input`).checkValidity();
|
||||||
}, selectors.ticketPackages.firstQuantityInput);
|
}, selectors.ticketPackages.firstQuantityInput);
|
||||||
|
|
||||||
expect(result).toBeTruthy();
|
expect(result).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should create a new package with correct data`, async() => {
|
it(`should create a new package with correct data`, async() => {
|
||||||
const result = await nightmare
|
await page.clearInput(selectors.ticketPackages.firstQuantityInput);
|
||||||
.clearInput(selectors.ticketPackages.firstQuantityInput)
|
await page.write(selectors.ticketPackages.firstQuantityInput, '-99');
|
||||||
.write(selectors.ticketPackages.firstQuantityInput, -99)
|
await page.waitToClick(selectors.ticketPackages.savePackagesButton);
|
||||||
.waitToClick(selectors.ticketPackages.savePackagesButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the first select is the expected one`, async() => {
|
it(`should confirm the first select is the expected one`, async() => {
|
||||||
const result = await nightmare
|
await page.reloadSection('ticket.card.package');
|
||||||
.reloadSection('ticket.card.package')
|
await page.waitForTextInInput(selectors.ticketPackages.firstPackageAutocomplete, 'Container medical box 1m');
|
||||||
.waitForTextInInput(`${selectors.ticketPackages.firstPackageAutocomplete} input`, 'Container medical box 1m')
|
const result = await page.waitToGetProperty(`${selectors.ticketPackages.firstPackageAutocomplete} input`, 'value');
|
||||||
.waitToGetProperty(`${selectors.ticketPackages.firstPackageAutocomplete} input`, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('7 : Container medical box 1m');
|
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() => {
|
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
|
await page.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '-99');
|
||||||
.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '-99')
|
const result = await page.waitToGetProperty(`${selectors.ticketPackages.firstQuantityInput} input`, 'value');
|
||||||
.waitToGetProperty(selectors.ticketPackages.firstQuantityInput, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('-99');
|
expect(result).toEqual('-99');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,83 +1,83 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Ticket Create new tracking state path', () => {
|
describe('Ticket Create new tracking state path', () => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
|
let page;
|
||||||
|
|
||||||
|
afterAll(async() => {
|
||||||
|
await browser.close();
|
||||||
|
});
|
||||||
|
|
||||||
describe('as production', () => {
|
describe('as production', () => {
|
||||||
beforeAll(() => {
|
it('should log into the ticket 1 tracking', async() => {
|
||||||
return nightmare
|
browser = await getBrowser();
|
||||||
.loginAndModule('production', 'ticket')
|
page = browser.page;
|
||||||
.accessToSearchResult('1')
|
await page.loginAndModule('production', 'ticket');
|
||||||
.accessToSection('ticket.card.tracking.index');
|
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() => {
|
it('should access to the create state view by clicking the create floating button', async() => {
|
||||||
let url = await nightmare
|
await page.waitForContentLoaded();
|
||||||
.clickIfVisible(selectors.ticketTracking.createStateButton)
|
await page.waitToClick(selectors.ticketTracking.createStateButton);
|
||||||
.wait(selectors.createStateView.stateAutocomplete)
|
await page.waitForSelector(selectors.createStateView.stateAutocomplete, {visible: true});
|
||||||
.parsedUrl();
|
let url = await page.parsedUrl();
|
||||||
|
|
||||||
|
|
||||||
expect(url.hash).toContain('tracking/edit');
|
expect(url.hash).toContain('tracking/edit');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should attempt create a new state but receive an error if state is empty`, async() => {
|
it(`should attempt create a new state but receive an error if state is empty`, async() => {
|
||||||
let result = await nightmare
|
await page.waitToClick(selectors.createStateView.saveStateButton);
|
||||||
.waitToClick(selectors.createStateView.saveStateButton)
|
let result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('State cannot be blank');
|
expect(result).toEqual('State cannot be blank');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should create a new state`, async() => {
|
it(`should create a new state`, async() => {
|
||||||
let result = await nightmare
|
await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, '¿Fecha?');
|
||||||
.autocompleteSearch(selectors.createStateView.stateAutocomplete, '¿Fecha?')
|
await page.waitToClick(selectors.createStateView.saveStateButton);
|
||||||
.waitToClick(selectors.createStateView.saveStateButton)
|
let result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('as salesPerson', () => {
|
describe('as salesPerson', () => {
|
||||||
beforeAll(() => {
|
it('should now log into the ticket 1 tracking', async() => {
|
||||||
return nightmare
|
await page.loginAndModule('salesPerson', 'ticket');
|
||||||
.loginAndModule('salesPerson', 'ticket')
|
await page.accessToSearchResult('1');
|
||||||
.accessToSearchResult('1')
|
await page.accessToSection('ticket.card.tracking.index');
|
||||||
.accessToSection('ticket.card.tracking.index');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now access to the create state view by clicking the create floating button', async() => {
|
it('should now access to the create state view by clicking the create floating button', async() => {
|
||||||
let url = await nightmare
|
await page.waitToClick(selectors.ticketTracking.createStateButton);
|
||||||
.waitToClick(selectors.ticketTracking.createStateButton)
|
await page.waitForURL('tracking/edit');
|
||||||
.wait(selectors.createStateView.stateAutocomplete)
|
let url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('tracking/edit');
|
expect(url.hash).toContain('tracking/edit');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should attemp to create an state for which salesPerson doesn't have permissions`, async() => {
|
it(`should attemp to create an state for which salesPerson doesn't have permissions`, async() => {
|
||||||
let result = await nightmare
|
await page.waitFor(1500);
|
||||||
.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'Encajado')
|
await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'Encajado');
|
||||||
.waitToClick(selectors.createStateView.saveStateButton)
|
await page.waitToClick(selectors.createStateView.saveStateButton);
|
||||||
.waitForLastSnackbar();
|
let result = await page.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toEqual(`You don't have enough privileges`);
|
expect(result).toEqual(`You don't have enough privileges`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should make sure the worker gets autocomplete uppon selecting the assigned state`, async() => {
|
it(`should make sure the worker gets autocomplete uppon selecting the assigned state`, async() => {
|
||||||
let result = await nightmare
|
await page.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'asignado');
|
||||||
.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'asignado')
|
let result = await page
|
||||||
.waitToGetProperty(`${selectors.createStateView.workerAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.createStateView.workerAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('salesPersonNick');
|
expect(result).toEqual('salesPersonNick');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should succesfully create a valid state`, async() => {
|
it(`should succesfully create a valid state`, async() => {
|
||||||
let result = await nightmare
|
await page.waitToClick(selectors.createStateView.saveStateButton);
|
||||||
.waitToClick(selectors.createStateView.saveStateButton)
|
let result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,98 +1,98 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Ticket Edit basic data path', () => {
|
describe('Ticket Edit basic data path', () => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
|
let page;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
return nightmare
|
browser = await getBrowser();
|
||||||
.loginAndModule('employee', 'ticket')
|
page = browser.page;
|
||||||
.accessToSearchResult(11)
|
await page.loginAndModule('employee', 'ticket');
|
||||||
.accessToSection('ticket.card.basicData.stepOne');
|
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() => {
|
it(`should confirm the zone autocomplete is disabled unless your role is productionBoss`, async() => {
|
||||||
const disabled = await nightmare
|
await page.waitForSelector(selectors.ticketBasicData.zoneAutocomplete, {});
|
||||||
.wait(selectors.ticketBasicData.zoneAutocomplete)
|
const disabled = await page.evaluate(selector => {
|
||||||
.evaluate(selector => {
|
return document.querySelector(selector).disabled;
|
||||||
return document.querySelector(selector).disabled;
|
}, `${selectors.ticketBasicData.zoneAutocomplete} input`);
|
||||||
}, `${selectors.ticketBasicData.zoneAutocomplete} input`);
|
|
||||||
|
|
||||||
expect(disabled).toBeTruthy();
|
expect(disabled).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should now log as productionBoss to perform the rest of the tests`, async() => {
|
it(`should now log as productionBoss to perform the rest of the tests`, async() => {
|
||||||
await nightmare
|
await page.loginAndModule('productionBoss', 'ticket');
|
||||||
.loginAndModule('productionBoss', 'ticket')
|
await page.accessToSearchResult('11');
|
||||||
.accessToSearchResult(11)
|
await page.accessToSection('ticket.card.basicData.stepOne');
|
||||||
.accessToSection('ticket.card.basicData.stepOne');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the zone autocomplete is enabled for the role productionBoss`, async() => {
|
it(`should confirm the zone autocomplete is enabled for the role productionBoss`, async() => {
|
||||||
const disabled = await nightmare
|
await page.waitForSpinnerLoad();
|
||||||
.waitForSpinnerLoad()
|
await page.wait(selectors.ticketBasicData.zoneAutocomplete);
|
||||||
.wait(selectors.ticketBasicData.zoneAutocomplete)
|
const disabled = await page.evaluate(selector => {
|
||||||
.evaluate(selector => {
|
return document.querySelector(selector).disabled;
|
||||||
return document.querySelector(selector).disabled;
|
}, `${selectors.ticketBasicData.zoneAutocomplete} input`);
|
||||||
}, `${selectors.ticketBasicData.zoneAutocomplete} input`);
|
|
||||||
|
|
||||||
expect(disabled).toBeFalsy();
|
expect(disabled).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the zone is for Silla247`, async() => {
|
it(`should check the zone is for Silla247`, async() => {
|
||||||
let zone = await nightmare
|
let zone = await page
|
||||||
.waitToGetProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(zone).toContain('Zone 247 A');
|
expect(zone).toContain('Zone 247 A');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should edit the ticket agency then check there are no zones for it`, async() => {
|
it(`should edit the ticket agency then check there are no zones for it`, async() => {
|
||||||
let zone = await nightmare
|
await page.autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Entanglement');
|
||||||
.autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Entanglement')
|
let zone = await page
|
||||||
.getProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value');
|
.getProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(zone.length).toEqual(0);
|
expect(zone.length).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should edit the ticket zone then check the agency is for the new zone`, async() => {
|
it(`should edit the ticket zone then check the agency is for the new zone`, async() => {
|
||||||
let zone = await nightmare
|
await page.autocompleteSearch(selectors.ticketBasicData.zoneAutocomplete, 'Zone expensive A');
|
||||||
.autocompleteSearch(selectors.ticketBasicData.zoneAutocomplete, 'Zone expensive A')
|
let zone = await page
|
||||||
.waitToGetProperty(`${selectors.ticketBasicData.agencyAutocomplete} input`, 'value');
|
.waitToGetProperty(`${selectors.ticketBasicData.agencyAutocomplete} input`, 'value');
|
||||||
|
|
||||||
expect(zone).toContain('Silla247Expensive');
|
expect(zone).toContain('Silla247Expensive');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click next`, async() => {
|
it(`should click next`, async() => {
|
||||||
let url = await nightmare
|
await page.waitToClick(selectors.ticketBasicData.nextStepButton);
|
||||||
.waitToClick(selectors.ticketBasicData.nextStepButton)
|
await page.waitForURL('data/step-two');
|
||||||
.waitForURL('data/step-two')
|
let url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('data/step-two');
|
expect(url.hash).toContain('data/step-two');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should have a price diference`, async() => {
|
it(`should have a price diference`, async() => {
|
||||||
const result = await nightmare
|
const result = await page
|
||||||
.waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
|
.waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain('-€248.00');
|
expect(result).toContain('-€248.00');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should then click next to move on to step three`, async() => {
|
it(`should then click next to move on to step three`, async() => {
|
||||||
let url = await nightmare
|
await page.waitToClick(selectors.ticketBasicData.nextStepButton);
|
||||||
.waitToClick(selectors.ticketBasicData.nextStepButton)
|
await page.waitForURL('data/step-three');
|
||||||
.waitForURL('data/step-three')
|
let url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('data/step-three');
|
expect(url.hash).toContain('data/step-three');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should select a new reason for the changes made then click on finalize`, async() => {
|
it(`should select a new reason for the changes made then click on finalize`, async() => {
|
||||||
let url = await nightmare
|
await page.autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'Cambiar los precios en el ticket');
|
||||||
.autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'Cambiar los precios en el ticket')
|
await page.waitToClick(selectors.ticketBasicData.finalizeButton);
|
||||||
.waitToClick(selectors.ticketBasicData.finalizeButton)
|
await page.waitForURL('summary');
|
||||||
.waitForURL('summary')
|
let url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('summary');
|
expect(url.hash).toContain('summary');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,23 +1,28 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Ticket List components path', () => {
|
describe('Ticket List components path', () => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
|
let page;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
return nightmare
|
browser = await getBrowser();
|
||||||
.loginAndModule('employee', 'ticket')
|
page = browser.page;
|
||||||
.accessToSearchResult('1')
|
await page.loginAndModule('employee', 'ticket');
|
||||||
.accessToSection('ticket.card.components');
|
await page.accessToSearchResult('1');
|
||||||
|
await page.accessToSection('ticket.card.components');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async() => {
|
||||||
|
await browser.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the total base is correct', async() => {
|
it('should confirm the total base is correct', async() => {
|
||||||
const name = 'Base €';
|
const name = 'Base €';
|
||||||
const minLength = name.length;
|
const minLength = name.length;
|
||||||
|
|
||||||
const base = await nightmare
|
await page.waitPropertyLength(selectors.ticketComponents.base, 'innerText', minLength);
|
||||||
.waitPropertyLength(selectors.ticketComponents.base, 'innerText', minLength)
|
const base = await page.waitToGetProperty(selectors.ticketComponents.base, 'innerText');
|
||||||
.waitToGetProperty(selectors.ticketComponents.base, 'innerText');
|
|
||||||
|
|
||||||
|
|
||||||
expect(base).toContain('Base');
|
expect(base).toContain('Base');
|
||||||
|
|
|
@ -1,166 +1,140 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Ticket descriptor path', () => {
|
describe('Ticket descriptor path', () => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
|
let page;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
nightmare
|
browser = await getBrowser();
|
||||||
.loginAndModule('employee', 'ticket');
|
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() => {
|
it('should count the amount of tickets in the turns section', async() => {
|
||||||
const result = await nightmare
|
await page.waitForNumberOfElements(selectors.ticketsIndex.weeklyTicket, 5);
|
||||||
.waitToClick(selectors.ticketsIndex.menuWeeklyTickets)
|
const result = await page.countElement(selectors.ticketsIndex.weeklyTicket);
|
||||||
.wait(selectors.ticketsIndex.weeklyTicket)
|
|
||||||
.countElement(selectors.ticketsIndex.weeklyTicket);
|
|
||||||
|
|
||||||
expect(result).toEqual(5);
|
expect(result).toEqual(5);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now click on the Tickets button of the top bar menu', async() => {
|
it('should go back to the ticket index then search and access a ticket summary', async() => {
|
||||||
const url = await nightmare
|
await page.accessToSection('ticket.index');
|
||||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
await page.accessToSearchResult('11');
|
||||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
await page.waitForContentLoaded();
|
||||||
.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 add the ticket to thursday turn using the descriptor more menu', async() => {
|
it('should add the ticket to thursday turn using the descriptor more menu', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||||||
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn);
|
||||||
.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn)
|
await page.waitToClick(selectors.ticketDescriptor.thursdayButton);
|
||||||
.waitToClick(selectors.ticketDescriptor.thursdayButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should again click on the Tickets button of the top bar menu', async() => {
|
it('should again click on the Tickets button of the top bar menu', async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
await page.waitToClick(selectors.globalItems.ticketsButton);
|
||||||
.waitToClick(selectors.globalItems.ticketsButton)
|
await page.waitForContentLoaded();
|
||||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
|
||||||
.parsedUrl();
|
const url = await page.parsedUrl();
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/ticket/index');
|
expect(url.hash).toEqual('#!/ticket/index');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the ticket 11 was added on thursday', async() => {
|
it('should confirm the ticket 11 was added to thursday', async() => {
|
||||||
const result = await nightmare
|
await page.accessToSection('ticket.weekly.index');
|
||||||
.waitToClick(selectors.ticketsIndex.menuWeeklyTickets)
|
const result = await page.waitToGetProperty(`${selectors.ticketsIndex.sixthWeeklyTicket} input`, 'value');
|
||||||
.waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicket, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('Thursday');
|
expect(result).toEqual('Thursday');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should click on the Tickets button of the top bar menu once more', async() => {
|
it('should click on the Tickets button of the top bar menu once more', async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
await page.waitToClick(selectors.globalItems.ticketsButton);
|
||||||
.waitToClick(selectors.globalItems.ticketsButton)
|
await page.waitForURL('#!/ticket/index');
|
||||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
|
||||||
.parsedUrl();
|
const url = await page.parsedUrl();
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/ticket/index');
|
expect(url.hash).toEqual('#!/ticket/index');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now search for the ticket 11', async() => {
|
it('should now search for the ticket 11', async() => {
|
||||||
const result = await nightmare
|
await page.waitForContentLoaded();
|
||||||
.write(selectors.ticketsIndex.searchTicketInput, 11)
|
await page.write(selectors.ticketsIndex.searchTicketInput, '11');
|
||||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
||||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||||
.countElement(selectors.ticketsIndex.searchResult);
|
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||||
|
|
||||||
expect(result).toEqual(1);
|
expect(result).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the search result to access to the ticket`, async() => {
|
it(`should click on the search result to access to the ticket`, async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.ticketsIndex.searchResult);
|
||||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
await page.waitForURL('/summary');
|
||||||
.waitForURL('/summary')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/summary');
|
expect(url.hash).toContain('/summary');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add the ticket to saturday turn using the descriptor more menu', async() => {
|
it('should add the ticket to saturday turn using the descriptor more menu', async() => {
|
||||||
const result = await nightmare
|
await page.waitForContentLoaded();
|
||||||
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||||||
.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn)
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn);
|
||||||
.waitToClick(selectors.ticketDescriptor.saturdayButton)
|
await page.waitToClick(selectors.ticketDescriptor.saturdayButton);
|
||||||
.waitForLastSnackbar();
|
const result = await page.waitForLastSnackbar();
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should click on the Tickets button of the top bar menu once again', async() => {
|
it('should click on the Tickets button of the top bar menu once again', async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
await page.waitToClick(selectors.globalItems.ticketsButton);
|
||||||
.waitToClick(selectors.globalItems.ticketsButton)
|
await page.wait(selectors.ticketsIndex.searchTicketInput);
|
||||||
.wait(selectors.ticketsIndex.searchTicketInput)
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/ticket/index');
|
expect(url.hash).toEqual('#!/ticket/index');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the ticket 11 was added on saturday', async() => {
|
it('should confirm the ticket 11 was added on saturday', async() => {
|
||||||
const result = await nightmare
|
await page.accessToSection('ticket.weekly.index');
|
||||||
.waitToClick(selectors.ticketsIndex.menuWeeklyTickets)
|
const result = await page.waitToGetProperty(`${selectors.ticketsIndex.sixthWeeklyTicket} input`, 'value');
|
||||||
.waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicket, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('Saturday');
|
expect(result).toEqual('Saturday');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now search for the weekly ticket 11', async() => {
|
it('should now search for the weekly ticket 11', async() => {
|
||||||
const result = await nightmare
|
await page.write(selectors.ticketsIndex.searchTicketInput, '11');
|
||||||
.write(selectors.ticketsIndex.searchWeeklyTicketInput, 11)
|
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
||||||
.waitToClick(selectors.ticketsIndex.searchWeeklyButton)
|
await page.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 1);
|
||||||
.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 1)
|
const result = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
||||||
.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
|
||||||
|
|
||||||
expect(result).toEqual(1);
|
expect(result).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should delete the weekly ticket 11', async() => {
|
it('should delete the weekly ticket 11', async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.ticketsIndex.firstWeeklyTicketDeleteIcon);
|
||||||
.waitToClick(selectors.ticketsIndex.firstWeeklyTicketDeleteIcon)
|
await page.waitToClick(selectors.ticketsIndex.acceptDeleteTurn);
|
||||||
.waitToClick(selectors.ticketsIndex.acceptDeleteTurn)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the sixth weekly ticket was deleted', async() => {
|
it('should confirm the sixth weekly ticket was deleted', async() => {
|
||||||
const result = await nightmare
|
await page.waitForContentLoaded();
|
||||||
.waitToClick('vn-searchbar vn-icon[icon=clear]')
|
await page.clearInput('vn-searchbar');
|
||||||
.waitToClick(selectors.ticketsIndex.searchWeeklyButton)
|
await page.waitToClick(selectors.ticketsIndex.searchWeeklyButton);
|
||||||
.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 5)
|
await page.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 5);
|
||||||
.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
const result = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
||||||
|
|
||||||
expect(result).toEqual(5);
|
expect(result).toEqual(5);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,59 +1,58 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Ticket purchase request path', () => {
|
describe('Ticket purchase request path', () => {
|
||||||
const nightmare = createNightmare();
|
let browser;
|
||||||
|
let page;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
nightmare
|
browser = await getBrowser();
|
||||||
.loginAndModule('salesPerson', 'ticket')
|
page = browser.page;
|
||||||
.accessToSearchResult('16')
|
await page.loginAndModule('salesPerson', 'ticket');
|
||||||
.accessToSection('ticket.card.request.index');
|
await page.accessToSearchResult('16');
|
||||||
|
await page.accessToSection('ticket.card.request.index');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async() => {
|
||||||
|
await browser.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should add a new request`, async() => {
|
it(`should add a new request`, async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.ticketRequests.addRequestButton);
|
||||||
.waitToClick(selectors.ticketRequests.addRequestButton)
|
await page.write(selectors.ticketRequests.descriptionInput, 'New stuff');
|
||||||
.write(selectors.ticketRequests.descriptionInput, 'New stuff')
|
await page.write(selectors.ticketRequests.quantityInput, '99');
|
||||||
.write(selectors.ticketRequests.quantityInput, 99)
|
await page.autocompleteSearch(selectors.ticketRequests.atenderAutocomplete, 'buyerNick');
|
||||||
.autocompleteSearch(selectors.ticketRequests.atenderAutocomplete, 'buyerNick')
|
await page.write(selectors.ticketRequests.priceInput, '999');
|
||||||
.write(selectors.ticketRequests.priceInput, 999)
|
await page.waitToClick(selectors.ticketRequests.saveButton);
|
||||||
.waitToClick(selectors.ticketRequests.saveButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should have been redirected to the request index`, async() => {
|
it(`should have been redirected to the request index`, async() => {
|
||||||
const url = await nightmare
|
await page.waitForURL('/request');
|
||||||
.waitForURL('/request')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/request');
|
expect(url.hash).toContain('/request');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the new request was added`, async() => {
|
it(`should confirm the new request was added`, async() => {
|
||||||
const result = await nightmare
|
await page.reloadSection('ticket.card.request.index');
|
||||||
.reloadSection('ticket.card.request.index')
|
const result = await page.waitToGetProperty(`${selectors.ticketRequests.firstDescription} input`, 'value');
|
||||||
.waitToGetProperty(selectors.ticketRequests.firstDescription, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual('New stuff');
|
expect(result).toEqual('New stuff');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should delete the added request`, async() => {
|
it(`should delete the added request`, async() => {
|
||||||
const result = await nightmare
|
await page.waitToClick(selectors.ticketRequests.firstRemoveRequestButton);
|
||||||
.waitToClick(selectors.ticketRequests.firstRemoveRequestButton)
|
const result = await page.waitForLastSnackbar();
|
||||||
.waitForLastSnackbar();
|
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the request was deleted`, async() => {
|
it(`should confirm the request was deleted`, async() => {
|
||||||
const result = await nightmare
|
await page.reloadSection('ticket.card.request.index');
|
||||||
.reloadSection('ticket.card.request.index')
|
await page.wait(selectors.ticketRequests.addRequestButton);
|
||||||
.wait(selectors.ticketRequests.addRequestButton)
|
await page.waitForSelector(selectors.ticketRequests.request, {hidden: true});
|
||||||
.exists(selectors.ticketRequests.request);
|
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,61 +1,66 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import createNightmare from '../../helpers/nightmare';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Ticket diary path', () => {
|
// #2026 Fallo en relocate de descriptor popover
|
||||||
const nightmare = createNightmare();
|
xdescribe('Ticket diary path', () => {
|
||||||
|
let browser;
|
||||||
|
let page;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(async() => {
|
||||||
nightmare
|
browser = await getBrowser();
|
||||||
.loginAndModule('employee', 'ticket');
|
page = browser.page;
|
||||||
|
await page.loginAndModule('employee', 'ticket');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async() => {
|
||||||
|
await browser.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search for a specific ticket', async() => {
|
it('should search for a specific ticket', async() => {
|
||||||
const result = await nightmare
|
await page.write(selectors.ticketsIndex.searchTicketInput, '1');
|
||||||
.write(selectors.ticketsIndex.searchTicketInput, 1)
|
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
||||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
||||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||||
.countElement(selectors.ticketsIndex.searchResult);
|
|
||||||
|
|
||||||
expect(result).toEqual(1);
|
expect(result).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the search result to access to the ticket summary`, async() => {
|
it(`should click on the search result to access to the ticket summary`, async() => {
|
||||||
const url = await nightmare
|
await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave');
|
||||||
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave')
|
await page.waitToClick(selectors.ticketsIndex.searchResult);
|
||||||
.waitToClick(selectors.ticketsIndex.searchResult)
|
await page.waitForURL('/summary');
|
||||||
.waitForURL('/summary')
|
const url = await page.parsedUrl();
|
||||||
.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/summary');
|
expect(url.hash).toContain('/summary');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should navigate to the item diary from the 1st sale item id descriptor popover`, async() => {
|
it(`should navigate to the item diary from the 1st sale item id descriptor popover`, async() => {
|
||||||
const url = await nightmare
|
await page.waitToClick(selectors.ticketSummary.firstSaleItemId);
|
||||||
.waitToClick(selectors.ticketSummary.firstSaleItemId)
|
await page.waitForTransitionEnd('.vn-popover');
|
||||||
.waitToClick(selectors.ticketSummary.popoverDiaryButton)
|
await page.waitToClick(selectors.ticketSummary.popoverDiaryButton);
|
||||||
.waitForURL('/diary')
|
await page.waitForURL('/diary');
|
||||||
.parsedUrl();
|
const url = await page.parsedUrl();
|
||||||
|
|
||||||
expect(url.hash).toContain('/diary');
|
expect(url.hash).toContain('/diary');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the second line id is marked as message`, async() => {
|
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');
|
.waitToGetProperty(selectors.itemDiary.secondTicketId, 'className');
|
||||||
|
|
||||||
expect(result).toContain('message');
|
expect(result).toContain('message');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the third line balance is marked as message`, async() => {
|
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');
|
.waitToGetProperty(`${selectors.itemDiary.fourthBalance} > span`, 'className');
|
||||||
|
|
||||||
expect(result).toContain('message');
|
expect(result).toContain('message');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should change to the warehouse two and check there are sales marked as negative balance`, async() => {
|
it(`should change to the warehouse two and check there are sales marked as negative balance`, async() => {
|
||||||
const result = await nightmare
|
await page.autocompleteSearch(selectors.itemDiary.warehouseAutocomplete, 'Warehouse Two');
|
||||||
.autocompleteSearch(selectors.itemDiary.warehouseAutocomplete, 'Warehouse Two')
|
const result = await page
|
||||||
.waitToGetProperty(selectors.itemDiary.firstBalance, 'className');
|
.waitToGetProperty(selectors.itemDiary.firstBalance, 'className');
|
||||||
|
|
||||||
expect(result).toContain('balance');
|
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