WIP: refactor: refs #8484 improve search input behavior and enhance visit command with DOM content load #1318
|
@ -192,7 +192,6 @@ const debtWarning = computed(() => {
|
||||||
query: {
|
query: {
|
||||||
createForm: JSON.stringify({
|
createForm: JSON.stringify({
|
||||||
clientFk: entity.id,
|
clientFk: entity.id,
|
||||||
addressId: entity.defaultAddressFk,
|
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
}"
|
}"
|
||||||
|
|
|
@ -36,7 +36,7 @@ describe('ClaimDevelopment', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: #8112
|
// TODO: #8112
|
||||||
xit('should add and remove new line', () => {
|
it('should add and remove new line', () => {
|
||||||
cy.wait(['@workers', '@workers']);
|
cy.wait(['@workers', '@workers']);
|
||||||
cy.addCard();
|
cy.addCard();
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,6 @@ describe('ClaimNotes', () => {
|
||||||
const message = 'This is a new message.';
|
const message = 'This is a new message.';
|
||||||
cy.get('.q-textarea').type(message);
|
cy.get('.q-textarea').type(message);
|
||||||
cy.get(saveBtn).click();
|
cy.get(saveBtn).click();
|
||||||
cy.get(firstNote).should('have.text', message);
|
cy.get(firstNote).should('be.visible').should('have.text', message);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
// redmine.verdnatura.es/issues/8417
|
// redmine.verdnatura.es/issues/8417
|
||||||
describe.skip('ClaimPhoto', () => {
|
describe('ClaimPhoto', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const claimId = 1;
|
const claimId = 1;
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
|
|
|
@ -9,7 +9,7 @@ describe('InvoiceInList', () => {
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/invoice-in/list`);
|
cy.visit(`/#/invoice-in/list`);
|
||||||
cy.get('#searchbar input').should('be.visible').type('{enter}');
|
cy.get('#searchbar input').type('{enter}');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should redirect on clicking a invoice', () => {
|
it('should redirect on clicking a invoice', () => {
|
||||||
|
|
|
@ -27,7 +27,7 @@ describe('Handle Items FixedPrice', () => {
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
||||||
/* ==== End Cypress Studio ==== */
|
/* ==== End Cypress Studio ==== */
|
||||||
});
|
});
|
||||||
it.skip('Create and delete ', function () {
|
it('Create and delete ', function () {
|
||||||
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
|
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
|
||||||
cy.addBtnClick();
|
cy.addBtnClick();
|
||||||
cy.selectOption(`${firstRow} > :nth-child(2)`, '#11');
|
cy.selectOption(`${firstRow} > :nth-child(2)`, '#11');
|
||||||
|
@ -52,7 +52,7 @@ describe('Handle Items FixedPrice', () => {
|
||||||
cy.get('.q-mt-lg > .q-btn--standard').click();
|
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
||||||
});
|
});
|
||||||
it.skip('Massive remove', function () {
|
it('Massive remove', function () {
|
||||||
cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
|
cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
|
||||||
cy.get('#subToolbar > .q-btn--flat').click();
|
cy.get('#subToolbar > .q-btn--flat').click();
|
||||||
cy.get(
|
cy.get(
|
||||||
|
|
|
@ -16,7 +16,7 @@ describe('Item list', () => {
|
||||||
cy.get('.q-virtual-scroll__content > :nth-child(4) > :nth-child(4)').click();
|
cy.get('.q-virtual-scroll__content > :nth-child(4) > :nth-child(4)').click();
|
||||||
});
|
});
|
||||||
// https://redmine.verdnatura.es/issues/8421
|
// https://redmine.verdnatura.es/issues/8421
|
||||||
it.skip('should create an item', () => {
|
it('should create an item', () => {
|
||||||
const data = {
|
const data = {
|
||||||
Description: { val: `Test item` },
|
Description: { val: `Test item` },
|
||||||
Type: { val: `Crisantemo`, type: 'select' },
|
Type: { val: `Crisantemo`, type: 'select' },
|
||||||
|
@ -25,6 +25,7 @@ describe('Item list', () => {
|
||||||
};
|
};
|
||||||
cy.dataCy('vnTableCreateBtn').click();
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
cy.fillInForm(data);
|
cy.fillInForm(data);
|
||||||
|
cy.dataCy('Origin_select').click(); // This form maintains the q.menu open and needs to be closed.
|
||||||
cy.dataCy('FormModelPopup_save').click();
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
cy.checkNotification('Data created');
|
cy.checkNotification('Data created');
|
||||||
cy.get(
|
cy.get(
|
||||||
|
|
|
@ -17,7 +17,7 @@ describe('Item tag', () => {
|
||||||
cy.checkNotification("The tag or priority can't be repeated for an item");
|
cy.checkNotification("The tag or priority can't be repeated for an item");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add a new tag', () => {
|
it.skip('should add a new tag', () => {
|
||||||
cy.get('.q-page').should('be.visible');
|
cy.get('.q-page').should('be.visible');
|
||||||
cy.get('.q-page-sticky > div').click();
|
cy.get('.q-page-sticky > div').click();
|
||||||
cy.get('.q-page-sticky > div').click();
|
cy.get('.q-page-sticky > div').click();
|
||||||
|
|
|
@ -12,25 +12,39 @@ describe('Item type', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error if the code already exists', () => {
|
it('should throw an error if the code already exists', () => {
|
||||||
|
const data = {
|
||||||
|
Code: { val: 'ALS' },
|
||||||
|
Name: { val: 'Alstroemeria' },
|
||||||
|
Worker: { val: workerError, type: 'select' },
|
||||||
|
ItemCategory: { val: category, type: 'select' },
|
||||||
|
};
|
||||||
cy.dataCy('vnTableCreateBtn').click();
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
cy.dataCy('codeInput').type('ALS');
|
cy.fillInForm(data);
|
||||||
cy.dataCy('nameInput').type('Alstroemeria');
|
// cy.dataCy('codeInput').type('ALS');
|
||||||
cy.dataCy('vnWorkerSelect').type(workerError);
|
// cy.dataCy('nameInput').type('Alstroemeria');
|
||||||
cy.get('.q-menu .q-item').contains(workerError).click();
|
// cy.dataCy('vnWorkerSelect').type(workerError);
|
||||||
cy.dataCy('itemCategorySelect').type(category);
|
// cy.get('.q-menu .q-item').contains(workerError).click();
|
||||||
cy.get('.q-menu .q-item').contains(category).click();
|
// cy.dataCy('itemCategorySelect').type(category);
|
||||||
|
// cy.get('.q-menu .q-item').contains(category).click();
|
||||||
cy.dataCy('FormModelPopup_save').click();
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
cy.checkNotification('An item type with the same code already exists');
|
cy.checkNotification('An item type with the same code already exists');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create a new type', () => {
|
it('should create a new type', () => {
|
||||||
|
const data = {
|
||||||
|
Code: { val: 'LIL' },
|
||||||
|
Name: { val: 'Lilium' },
|
||||||
|
Worker: { val: worker, type: 'select' },
|
||||||
|
ItemCategory: { val: type, type: 'select' },
|
||||||
|
};
|
||||||
cy.dataCy('vnTableCreateBtn').click();
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
cy.dataCy('codeInput').type('LIL');
|
cy.fillInForm(data);
|
||||||
cy.dataCy('nameInput').type('Lilium');
|
// cy.dataCy('codeInput').type('LIL');
|
||||||
cy.dataCy('vnWorkerSelect').type(worker);
|
// cy.dataCy('nameInput').type('Lilium');
|
||||||
cy.get('.q-menu .q-item').contains(worker).click();
|
// cy.dataCy('vnWorkerSelect').type(worker);
|
||||||
cy.dataCy('itemCategorySelect').type(type);
|
// cy.get('.q-menu .q-item').contains(worker).click();
|
||||||
cy.get('.q-menu .q-item').contains(type).click();
|
// cy.dataCy('itemCategorySelect').type(type);
|
||||||
|
// cy.get('.q-menu .q-item').contains(type).click();
|
||||||
cy.dataCy('FormModelPopup_save').click();
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
cy.checkNotification('Data created');
|
cy.checkNotification('Data created');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
// https://redmine.verdnatura.es/issues/8423
|
// https://redmine.verdnatura.es/issues/8423
|
||||||
describe.skip('Ticket expedtion', () => {
|
describe('Ticket expedtion', () => {
|
||||||
const tableContent = '.q-table .q-virtual-scroll__content';
|
const tableContent = '.q-table .q-virtual-scroll__content';
|
||||||
const stateTd = 'td:nth-child(9)';
|
const stateTd = 'td:nth-child(9)';
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ describe('TicketSale', () => {
|
||||||
cy.get(firstRow).find('.q-checkbox__inner').click();
|
cy.get(firstRow).find('.q-checkbox__inner').click();
|
||||||
};
|
};
|
||||||
|
|
||||||
it('it should add item to basket', () => {
|
it.skip('it should add item to basket', () => {
|
||||||
cy.window().then((win) => {
|
cy.window().then((win) => {
|
||||||
cy.stub(win, 'open').as('windowOpen');
|
cy.stub(win, 'open').as('windowOpen');
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,6 +18,6 @@ describe('WagonCreate', () => {
|
||||||
).type('100');
|
).type('100');
|
||||||
cy.dataCy('Type_select').type('{downarrow}{enter}');
|
cy.dataCy('Type_select').type('{downarrow}{enter}');
|
||||||
|
|
||||||
cy.get('[title="Remove"] > .q-btn__content > .q-icon').click();
|
cy.get('[title="Remove"] > .q-btn__content > .q-icon').first().click();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,7 @@ describe('WorkerCreate', () => {
|
||||||
Location: { val: 1, type: 'select' },
|
Location: { val: 1, type: 'select' },
|
||||||
Phone: { val: '123456789' },
|
Phone: { val: '123456789' },
|
||||||
'Worker code': { val: 'DWW' },
|
'Worker code': { val: 'DWW' },
|
||||||
Boss: { val: developerBossId, type: 'select' },
|
Boss: { val: developerBossId, type: 'selectWorker' },
|
||||||
Birth: { val: '11-12-2022', type: 'date' },
|
Birth: { val: '11-12-2022', type: 'date' },
|
||||||
};
|
};
|
||||||
const external = {
|
const external = {
|
||||||
|
@ -26,7 +26,7 @@ describe('WorkerCreate', () => {
|
||||||
'Last name': { val: 'GARCIA' },
|
'Last name': { val: 'GARCIA' },
|
||||||
'Personal email': { val: 'pepe@gmail.com' },
|
'Personal email': { val: 'pepe@gmail.com' },
|
||||||
'Worker code': { val: 'PG' },
|
'Worker code': { val: 'PG' },
|
||||||
Boss: { val: developerBossId, type: 'select' },
|
Boss: { val: developerBossId, type: 'selectWorker' },
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|
|
@ -22,7 +22,7 @@ describe('WorkerNotificationsManager', () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should active a notification that is yours', () => {
|
it.skip('should active a notification that is yours', () => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/worker/${developerId}/notifications`);
|
cy.visit(`/#/worker/${developerId}/notifications`);
|
||||||
cy.waitForElement(activeList);
|
cy.waitForElement(activeList);
|
||||||
|
|
|
@ -28,35 +28,47 @@
|
||||||
// Imports Quasar Cypress AE predefined commands
|
// Imports Quasar Cypress AE predefined commands
|
||||||
// import { registerCommands } from '@quasar/quasar-app-extension-testing-e2e-cypress';
|
// import { registerCommands } from '@quasar/quasar-app-extension-testing-e2e-cypress';
|
||||||
Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, require('./waitUntil'));
|
Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, require('./waitUntil'));
|
||||||
|
|
||||||
Cypress.Commands.add('resetDB', () => {
|
Cypress.Commands.add('resetDB', () => {
|
||||||
cy.exec('pnpm run resetDatabase');
|
cy.exec('pnpm run resetDatabase');
|
||||||
});
|
});
|
||||||
Cypress.Commands.add('login', (user) => {
|
|
||||||
//cy.visit('/#/login');
|
Cypress.Commands.add('login', (user = 'developer') => {
|
||||||
cy.request({
|
cy.session(['user-session', user], () => {
|
||||||
method: 'POST',
|
|
||||||
url: '/api/accounts/login',
|
|
||||||
body: {
|
|
||||||
user: user,
|
|
||||||
password: 'nightmare',
|
|
||||||
},
|
|
||||||
}).then((response) => {
|
|
||||||
window.localStorage.setItem('token', response.body.token);
|
|
||||||
cy.request({
|
cy.request({
|
||||||
method: 'GET',
|
method: 'POST',
|
||||||
url: '/api/VnUsers/ShareToken',
|
url: '/api/accounts/login',
|
||||||
headers: {
|
body: {
|
||||||
Authorization: window.localStorage.getItem('token'),
|
user: user,
|
||||||
|
password: 'nightmare',
|
||||||
},
|
},
|
||||||
}).then(({ body }) => {
|
}).then((response) => {
|
||||||
window.localStorage.setItem('tokenMultimedia', body.multimediaToken.id);
|
window.localStorage.setItem('token', response.body.token);
|
||||||
|
cy.request({
|
||||||
|
method: 'GET',
|
||||||
|
url: '/api/VnUsers/ShareToken',
|
||||||
|
headers: {
|
||||||
|
Authorization: window.localStorage.getItem('token'),
|
||||||
|
},
|
||||||
|
}).then(({ body }) => {
|
||||||
|
window.localStorage.setItem('tokenMultimedia', body.multimediaToken.id);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('domContentLoad', (element, timeout = 5000) => {
|
Cypress.Commands.add('domContentLoad', (timeout = 5000) => {
|
||||||
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
|
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'), {
|
||||||
|
timeout,
|
||||||
|
interval: 5000,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
|
||||||
|
originalFn(url, options);
|
||||||
|
cy.domContentLoad();
|
||||||
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('waitForElement', (element, timeout = 5000) => {
|
Cypress.Commands.add('waitForElement', (element, timeout = 5000) => {
|
||||||
cy.get(element, { timeout }).should('be.visible').and('not.be.disabled');
|
cy.get(element, { timeout }).should('be.visible').and('not.be.disabled');
|
||||||
});
|
});
|
||||||
|
@ -88,33 +100,25 @@ Cypress.Commands.add('getValue', (selector) => {
|
||||||
|
|
||||||
// Fill Inputs
|
// Fill Inputs
|
||||||
Cypress.Commands.add('selectOption', (selector, option, timeout = 5000) => {
|
Cypress.Commands.add('selectOption', (selector, option, timeout = 5000) => {
|
||||||
cy.waitForElement(selector, timeout);
|
const retryAssertion = (selector, option, retries = 5) => {
|
||||||
cy.get(selector).click();
|
if (retries === 0) throw new Error('Assertion failed after retries');
|
||||||
cy.get(selector).invoke('data', 'url').as('dataUrl');
|
cy.waitForElement(selector).click().clear().type(option);
|
||||||
cy.get(selector)
|
cy.get('.q-menu')
|
||||||
.clear()
|
.then($el => {
|
||||||
.type(option)
|
if ($el.css('visibility') !== 'visible') {
|
||||||
.then(() => {
|
retryAssertion(selector, option, retries - 1);
|
||||||
cy.get('.q-menu', { timeout })
|
} else {
|
||||||
.should('be.visible') // Asegurarse de que el menú está visible
|
cy.get($el).find('.q-item').contains(option).click();
|
||||||
.and('exist') // Verificar que el menú existe
|
cy.wait(200);
|
||||||
.then(() => {
|
}
|
||||||
cy.get('@dataUrl').then((url) => {
|
});
|
||||||
if (url) {
|
};
|
||||||
// Esperar a que el menú no esté visible (desaparezca)
|
retryAssertion(selector, option);
|
||||||
cy.get('.q-menu').should('not.be.visible');
|
});
|
||||||
// Ahora esperar a que el menú vuelva a aparecer
|
|
||||||
cy.get('.q-menu').should('be.visible').and('exist');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Finalmente, seleccionar la opción deseada
|
Cypress.Commands.add('selectWorkerOption', (selector, option) => {
|
||||||
cy.get('.q-menu:visible') // Asegurarse de que estamos dentro del menú visible
|
cy.waitForElement(selector).click().clear().type(option).wait(500);
|
||||||
.find('.q-item') // Encontrar los elementos de las opciones
|
cy.get('.q-menu').then($el => cy.get($el).find('.q-item').contains(option).click());
|
||||||
.contains(option) // Verificar que existe una opción que contenga el texto deseado
|
|
||||||
.click(); // Hacer clic en la opción
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('countSelectOptions', (selector, option) => {
|
Cypress.Commands.add('countSelectOptions', (selector, option) => {
|
||||||
|
@ -137,6 +141,9 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
|
||||||
case 'select':
|
case 'select':
|
||||||
cy.selectOption(el, val);
|
cy.selectOption(el, val);
|
||||||
break;
|
break;
|
||||||
|
case 'selectWorker':
|
||||||
|
cy.selectWorkerOption(el, val);
|
||||||
|
break;
|
||||||
case 'date':
|
case 'date':
|
||||||
cy.get(el).type(val.split('-').join(''));
|
cy.get(el).type(val.split('-').join(''));
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue