fix: refs #8484 update Boss field type to 'selectWorker' and add selectWorkerOption command

This commit is contained in:
Jose Antonio Tubau 2025-02-05 12:25:06 +01:00
parent 22dc45b91f
commit b7945fbf9a
2 changed files with 10 additions and 2 deletions

View File

@ -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(() => {

View File

@ -116,6 +116,11 @@ Cypress.Commands.add('selectOption', (selector, option, timeout = 5000) => {
retryAssertion(selector, option);
});
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) => {
cy.waitForElement(selector);
cy.get(selector).click({ force: true });
@ -136,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;