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: {
|
||||
createForm: JSON.stringify({
|
||||
clientFk: entity.id,
|
||||
addressId: entity.defaultAddressFk,
|
||||
}),
|
||||
},
|
||||
}"
|
||||
|
|
|
@ -36,7 +36,7 @@ describe('ClaimDevelopment', () => {
|
|||
});
|
||||
|
||||
// TODO: #8112
|
||||
xit('should add and remove new line', () => {
|
||||
it('should add and remove new line', () => {
|
||||
cy.wait(['@workers', '@workers']);
|
||||
cy.addCard();
|
||||
|
||||
|
|
|
@ -10,6 +10,6 @@ describe('ClaimNotes', () => {
|
|||
const message = 'This is a new message.';
|
||||
cy.get('.q-textarea').type(message);
|
||||
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" />
|
||||
// redmine.verdnatura.es/issues/8417
|
||||
describe.skip('ClaimPhoto', () => {
|
||||
describe('ClaimPhoto', () => {
|
||||
beforeEach(() => {
|
||||
const claimId = 1;
|
||||
cy.login('developer');
|
||||
|
|
|
@ -9,7 +9,7 @@ describe('InvoiceInList', () => {
|
|||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
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', () => {
|
||||
|
|
|
@ -27,7 +27,7 @@ describe('Handle Items FixedPrice', () => {
|
|||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
||||
/* ==== 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.addBtnClick();
|
||||
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-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('#subToolbar > .q-btn--flat').click();
|
||||
cy.get(
|
||||
|
|
|
@ -16,7 +16,7 @@ describe('Item list', () => {
|
|||
cy.get('.q-virtual-scroll__content > :nth-child(4) > :nth-child(4)').click();
|
||||
});
|
||||
// https://redmine.verdnatura.es/issues/8421
|
||||
it.skip('should create an item', () => {
|
||||
it('should create an item', () => {
|
||||
const data = {
|
||||
Description: { val: `Test item` },
|
||||
Type: { val: `Crisantemo`, type: 'select' },
|
||||
|
@ -25,6 +25,7 @@ describe('Item list', () => {
|
|||
};
|
||||
cy.dataCy('vnTableCreateBtn').click();
|
||||
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.checkNotification('Data created');
|
||||
cy.get(
|
||||
|
|
|
@ -17,7 +17,7 @@ describe('Item tag', () => {
|
|||
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-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', () => {
|
||||
const data = {
|
||||
Code: { val: 'ALS' },
|
||||
Name: { val: 'Alstroemeria' },
|
||||
Worker: { val: workerError, type: 'select' },
|
||||
ItemCategory: { val: category, type: 'select' },
|
||||
};
|
||||
cy.dataCy('vnTableCreateBtn').click();
|
||||
cy.dataCy('codeInput').type('ALS');
|
||||
cy.dataCy('nameInput').type('Alstroemeria');
|
||||
cy.dataCy('vnWorkerSelect').type(workerError);
|
||||
cy.get('.q-menu .q-item').contains(workerError).click();
|
||||
cy.dataCy('itemCategorySelect').type(category);
|
||||
cy.get('.q-menu .q-item').contains(category).click();
|
||||
cy.fillInForm(data);
|
||||
// cy.dataCy('codeInput').type('ALS');
|
||||
// cy.dataCy('nameInput').type('Alstroemeria');
|
||||
// cy.dataCy('vnWorkerSelect').type(workerError);
|
||||
// cy.get('.q-menu .q-item').contains(workerError).click();
|
||||
// cy.dataCy('itemCategorySelect').type(category);
|
||||
// cy.get('.q-menu .q-item').contains(category).click();
|
||||
cy.dataCy('FormModelPopup_save').click();
|
||||
cy.checkNotification('An item type with the same code already exists');
|
||||
});
|
||||
|
||||
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('codeInput').type('LIL');
|
||||
cy.dataCy('nameInput').type('Lilium');
|
||||
cy.dataCy('vnWorkerSelect').type(worker);
|
||||
cy.get('.q-menu .q-item').contains(worker).click();
|
||||
cy.dataCy('itemCategorySelect').type(type);
|
||||
cy.get('.q-menu .q-item').contains(type).click();
|
||||
cy.fillInForm(data);
|
||||
// cy.dataCy('codeInput').type('LIL');
|
||||
// cy.dataCy('nameInput').type('Lilium');
|
||||
// cy.dataCy('vnWorkerSelect').type(worker);
|
||||
// cy.get('.q-menu .q-item').contains(worker).click();
|
||||
// cy.dataCy('itemCategorySelect').type(type);
|
||||
// cy.get('.q-menu .q-item').contains(type).click();
|
||||
cy.dataCy('FormModelPopup_save').click();
|
||||
cy.checkNotification('Data created');
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference types="cypress" />
|
||||
// https://redmine.verdnatura.es/issues/8423
|
||||
describe.skip('Ticket expedtion', () => {
|
||||
describe('Ticket expedtion', () => {
|
||||
const tableContent = '.q-table .q-virtual-scroll__content';
|
||||
const stateTd = 'td:nth-child(9)';
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ describe('TicketSale', () => {
|
|||
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.stub(win, 'open').as('windowOpen');
|
||||
});
|
||||
|
|
|
@ -18,6 +18,6 @@ describe('WagonCreate', () => {
|
|||
).type('100');
|
||||
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' },
|
||||
Phone: { val: '123456789' },
|
||||
'Worker code': { val: 'DWW' },
|
||||
Boss: { val: developerBossId, type: 'select' },
|
||||
Boss: { val: developerBossId, type: 'selectWorker' },
|
||||
Birth: { val: '11-12-2022', type: 'date' },
|
||||
};
|
||||
const external = {
|
||||
|
@ -26,7 +26,7 @@ describe('WorkerCreate', () => {
|
|||
'Last name': { val: 'GARCIA' },
|
||||
'Personal email': { val: 'pepe@gmail.com' },
|
||||
'Worker code': { val: 'PG' },
|
||||
Boss: { val: developerBossId, type: 'select' },
|
||||
Boss: { val: developerBossId, type: 'selectWorker' },
|
||||
};
|
||||
|
||||
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.visit(`/#/worker/${developerId}/notifications`);
|
||||
cy.waitForElement(activeList);
|
||||
|
|
|
@ -28,11 +28,13 @@
|
|||
// Imports Quasar Cypress AE predefined commands
|
||||
// import { registerCommands } from '@quasar/quasar-app-extension-testing-e2e-cypress';
|
||||
Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, require('./waitUntil'));
|
||||
|
||||
Cypress.Commands.add('resetDB', () => {
|
||||
cy.exec('pnpm run resetDatabase');
|
||||
});
|
||||
Cypress.Commands.add('login', (user) => {
|
||||
//cy.visit('/#/login');
|
||||
|
||||
Cypress.Commands.add('login', (user = 'developer') => {
|
||||
cy.session(['user-session', user], () => {
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: '/api/accounts/login',
|
||||
|
@ -53,10 +55,20 @@ Cypress.Commands.add('login', (user) => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('domContentLoad', (element, timeout = 5000) => {
|
||||
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
|
||||
});
|
||||
|
||||
Cypress.Commands.add('domContentLoad', (timeout = 5000) => {
|
||||
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) => {
|
||||
cy.get(element, { timeout }).should('be.visible').and('not.be.disabled');
|
||||
});
|
||||
|
@ -88,33 +100,25 @@ Cypress.Commands.add('getValue', (selector) => {
|
|||
|
||||
// Fill Inputs
|
||||
Cypress.Commands.add('selectOption', (selector, option, timeout = 5000) => {
|
||||
cy.waitForElement(selector, timeout);
|
||||
cy.get(selector).click();
|
||||
cy.get(selector).invoke('data', 'url').as('dataUrl');
|
||||
cy.get(selector)
|
||||
.clear()
|
||||
.type(option)
|
||||
.then(() => {
|
||||
cy.get('.q-menu', { timeout })
|
||||
.should('be.visible') // Asegurarse de que el menú está visible
|
||||
.and('exist') // Verificar que el menú existe
|
||||
.then(() => {
|
||||
cy.get('@dataUrl').then((url) => {
|
||||
if (url) {
|
||||
// Esperar a que el menú no esté visible (desaparezca)
|
||||
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');
|
||||
const retryAssertion = (selector, option, retries = 5) => {
|
||||
if (retries === 0) throw new Error('Assertion failed after retries');
|
||||
cy.waitForElement(selector).click().clear().type(option);
|
||||
cy.get('.q-menu')
|
||||
.then($el => {
|
||||
if ($el.css('visibility') !== 'visible') {
|
||||
retryAssertion(selector, option, retries - 1);
|
||||
} else {
|
||||
cy.get($el).find('.q-item').contains(option).click();
|
||||
cy.wait(200);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
retryAssertion(selector, option);
|
||||
});
|
||||
|
||||
// Finalmente, seleccionar la opción deseada
|
||||
cy.get('.q-menu:visible') // Asegurarse de que estamos dentro del menú visible
|
||||
.find('.q-item') // Encontrar los elementos de las opciones
|
||||
.contains(option) // Verificar que existe una opción que contenga el texto deseado
|
||||
.click(); // Hacer clic en la opción
|
||||
Cypress.Commands.add('selectWorkerOption', (selector, option) => {
|
||||
cy.waitForElement(selector).click().clear().type(option).wait(500);
|
||||
cy.get('.q-menu').then($el => cy.get($el).find('.q-item').contains(option).click());
|
||||
});
|
||||
|
||||
Cypress.Commands.add('countSelectOptions', (selector, option) => {
|
||||
|
@ -137,6 +141,9 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
|
|||
case 'select':
|
||||
cy.selectOption(el, val);
|
||||
break;
|
||||
case 'selectWorker':
|
||||
cy.selectWorkerOption(el, val);
|
||||
break;
|
||||
case 'date':
|
||||
cy.get(el).type(val.split('-').join(''));
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue