test: refs #8315 fix VnSelect in e2e
gitea/salix-front/pipeline/pr-test This commit looks good
Details
gitea/salix-front/pipeline/pr-test This commit looks good
Details
This commit is contained in:
parent
50262003d0
commit
17527cb4e7
|
@ -343,6 +343,7 @@ function handleKeyDown(event) {
|
|||
@virtual-scroll="onScroll"
|
||||
@keydown="handleKeyDown"
|
||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
||||
:data-url="url"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon
|
||||
|
|
|
@ -98,6 +98,7 @@ function cancel() {
|
|||
/>
|
||||
<QBtn
|
||||
:label="t('globals.confirm')"
|
||||
:title="t('globals.confirm')"
|
||||
color="primary"
|
||||
:loading="isLoading"
|
||||
@click="confirm()"
|
||||
|
|
|
@ -30,17 +30,15 @@ const warehousesOptions = ref([]);
|
|||
>
|
||||
<template #form-inputs>
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<VnSelect
|
||||
:label="t('list.warehouse')"
|
||||
v-model="ZoneWarehouseFormData.warehouseFk"
|
||||
:options="warehousesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
:required="true"
|
||||
/>
|
||||
</div>
|
||||
<VnSelect
|
||||
:label="t('list.warehouse')"
|
||||
v-model="ZoneWarehouseFormData.warehouseFk"
|
||||
:options="warehousesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
:required="true"
|
||||
/>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormPopup>
|
||||
|
|
|
@ -16,7 +16,7 @@ describe('Client list', () => {
|
|||
});
|
||||
|
||||
it('Client list create new client', () => {
|
||||
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.addBtnClick();
|
||||
const randomInt = Math.floor(Math.random() * 90) + 10;
|
||||
|
||||
const data = {
|
||||
|
@ -27,7 +27,7 @@ describe('Client list', () => {
|
|||
Street: { val: `C/ STREET ${randomInt}` },
|
||||
Email: { val: `user.test${randomInt}@cypress.com` },
|
||||
'Sales person': { val: 'salesPerson', type: 'select' },
|
||||
Location: { val: '46000, Valencia(Province one), España', type: 'select' },
|
||||
Location: { val: '46000', type: 'select' },
|
||||
'Business type': { val: 'Otros', type: 'select' },
|
||||
};
|
||||
cy.fillInForm(data);
|
||||
|
|
|
@ -11,7 +11,7 @@ describe('EntryStockBought', () => {
|
|||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
||||
});
|
||||
it('Should add a new reserved space for buyerBoss', () => {
|
||||
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.addBtnClick();
|
||||
cy.get('input[aria-label="Reserve"]').type('1');
|
||||
cy.get('input[aria-label="Date"]').eq(1).clear();
|
||||
cy.get('input[aria-label="Date"]').eq(1).type('01-01');
|
||||
|
|
|
@ -19,7 +19,7 @@ describe('Handle Items FixedPrice', () => {
|
|||
cy.selectOption('.list > :nth-child(2)', 'Alstroemeria');
|
||||
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
|
||||
|
||||
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.addBtnClick();
|
||||
cy.selectOption(`${firstRow} > :nth-child(2)`, '#13');
|
||||
cy.get(`${firstRow} > :nth-child(4)`).find('input').type(1);
|
||||
cy.get(`${firstRow} > :nth-child(5)`).find('input').type('2');
|
||||
|
@ -29,7 +29,7 @@ describe('Handle Items FixedPrice', () => {
|
|||
});
|
||||
it('Create and delete ', function () {
|
||||
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.addBtnClick();
|
||||
cy.selectOption(`${firstRow} > :nth-child(2)`, '#11');
|
||||
cy.get(`${firstRow} > :nth-child(4)`).type('1');
|
||||
cy.get(`${firstRow} > :nth-child(5)`).type('2');
|
||||
|
|
|
@ -5,7 +5,7 @@ describe('RoadMap', () => {
|
|||
cy.visit(`/#/route/roadmap`);
|
||||
});
|
||||
it('Route list create roadmap and redirect', () => {
|
||||
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.addBtnClick();
|
||||
cy.get('input[name="name"]').eq(1).type('roadMapTestOne{enter}');
|
||||
cy.get('.q-notification__message').should('have.text', 'Data created');
|
||||
cy.url().should('include', '/summary');
|
||||
|
|
|
@ -9,7 +9,7 @@ describe('Route', () => {
|
|||
const getRowColumn = (row, column) => `:nth-child(${row}) > :nth-child(${column})`;
|
||||
|
||||
it('Route list create route', () => {
|
||||
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.addBtnClick();
|
||||
cy.get('input[name="description"]').type('routeTestOne{enter}');
|
||||
cy.get('.q-notification__message').should('have.text', 'Data created');
|
||||
cy.url().should('include', '/summary');
|
||||
|
|
|
@ -7,7 +7,7 @@ describe('WorkerPda', () => {
|
|||
});
|
||||
|
||||
it('assign pda', () => {
|
||||
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.addBtnClick();
|
||||
cy.get(select).click();
|
||||
cy.get(select).type('{downArrow}{enter}');
|
||||
cy.get('.q-notification__message').should('have.text', 'Data created');
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
describe('ZoneWarehouse', () => {
|
||||
const data = {
|
||||
Warehouse: { val: 'Algemesi', type: 'select' },
|
||||
Warehouse: { val: 'Warehouse One', type: 'select' },
|
||||
};
|
||||
const deviceProductionField =
|
||||
'.vn-row > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container';
|
||||
const dataError = "ER_DUP_ENTRY: Duplicate entry '2-2' for key 'zoneFk'";
|
||||
|
||||
const dataError = 'ER_DUP_ENTRY: Duplicate entry';
|
||||
const saveBtn = '.q-btn--standard > .q-btn__content > .block';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.viewport(1280, 720);
|
||||
|
@ -13,22 +13,21 @@ describe('ZoneWarehouse', () => {
|
|||
});
|
||||
|
||||
it('should throw an error if the warehouse chosen is already put in the zone', () => {
|
||||
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.get(deviceProductionField).click();
|
||||
cy.get(deviceProductionField).type('{upArrow}{enter}');
|
||||
cy.get('.q-notification__message').should('have.text', dataError);
|
||||
cy.addBtnClick();
|
||||
cy.selectOption('[data-cy="Warehouse_select"]', 'Warehouse Two');
|
||||
cy.get(saveBtn).click();
|
||||
cy.checkNotification(dataError);
|
||||
});
|
||||
|
||||
it('should create a warehouse', () => {
|
||||
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.get(deviceProductionField).click();
|
||||
it('should create & remove a warehouse', () => {
|
||||
cy.addBtnClick();
|
||||
cy.fillInForm(data);
|
||||
cy.get(saveBtn).click();
|
||||
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||
});
|
||||
|
||||
it('should delete a warehouse', () => {
|
||||
cy.get('tbody > :nth-child(2) > :nth-child(2) > .q-icon').click();
|
||||
cy.get('.q-card__actions > .q-btn--flat > .q-btn__content').click();
|
||||
cy.get('[title="Confirm"]').click();
|
||||
|
||||
cy.reload();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -58,8 +58,9 @@ Cypress.Commands.add('domContentLoad', (element, timeout = 5000) => {
|
|||
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
|
||||
});
|
||||
Cypress.Commands.add('waitForElement', (element, timeout = 5000) => {
|
||||
cy.waitUntil(() => cy.get(element).then(($el) => $el.is(':visible')));
|
||||
cy.get(element, { timeout }).should('be.visible').and('not.be.disabled');
|
||||
});
|
||||
|
||||
Cypress.Commands.add('getValue', (selector) => {
|
||||
cy.get(selector).then(($el) => {
|
||||
if ($el.find('.q-checkbox__inner').length > 0) {
|
||||
|
@ -86,15 +87,40 @@ Cypress.Commands.add('getValue', (selector) => {
|
|||
});
|
||||
|
||||
// Fill Inputs
|
||||
Cypress.Commands.add('selectOption', (selector, option, timeout) => {
|
||||
cy.waitForElement(selector);
|
||||
Cypress.Commands.add('selectOption', (selector, option, timeout = 5000) => {
|
||||
cy.waitForElement(selector, timeout);
|
||||
cy.get(selector).click();
|
||||
cy.wait(timeout || 1000);
|
||||
cy.get('.q-menu .q-item').contains(option).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) {
|
||||
cy.log('url: ', 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');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// 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('countSelectOptions', (selector, option) => {
|
||||
cy.waitForElement(selector);
|
||||
cy.get(selector).click();
|
||||
cy.get(selector).click({ force: true });
|
||||
cy.get('.q-menu .q-item').should('have.length', option);
|
||||
});
|
||||
|
||||
|
@ -110,8 +136,7 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
|
|||
const { type, val } = field;
|
||||
switch (type) {
|
||||
case 'select':
|
||||
cy.get(el).click();
|
||||
cy.get('.q-menu .q-item').contains(val).click();
|
||||
cy.selectOption(el, val);
|
||||
break;
|
||||
case 'date':
|
||||
cy.get(el).type(val.split('-').join(''));
|
||||
|
@ -347,3 +372,10 @@ Cypress.Commands.add('searchByLabel', (label, value) => {
|
|||
Cypress.Commands.add('dataCy', (tag, attr = 'data-cy') => {
|
||||
return cy.get(`[${attr}="${tag}"]`);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('addBtnClick', () => {
|
||||
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon')
|
||||
.should('exist')
|
||||
.and('be.visible')
|
||||
.click();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue