0
0
Fork 0

fix: refs #5186 tests

This commit is contained in:
Jorge Penadés 2024-03-11 15:17:49 +01:00
parent 3c3988b4f7
commit b44dcdb28a
4 changed files with 28 additions and 26 deletions

View File

@ -13,16 +13,17 @@ const { t } = useI18n();
const route = useRoute();
const parkingId = route.params?.id || null;
const sectors = ref([]);
const sectorFilter = { fields: ['id', 'description'] };
const filter = {
fields: ['sectorFk', 'code', 'pickingOrder', 'row', 'column'],
include: [{ relation: 'sector', scope: { fields: ['id', 'description'] } }],
include: [{ relation: 'sector', scope: sectorFilter }],
};
</script>
<template>
<FetchData
url="Sectors"
:filter="{ fields: ['id', 'description'] }"
:filter="sectorFilter"
sort-by="description"
@on-fetch="(data) => (sectors = data)"
auto-load

View File

@ -6,12 +6,11 @@ describe('ParkingList', () => {
const firstDetailBtn =
':nth-child(1) > :nth-child(1) > .card-list-body > .actions > .q-btn';
const summaryHeader = '.summaryBody .header';
const screen = '.q-page-container > .q-drawer-container > .fullscreen';
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/parking/list`);
cy.get(screen).click();
cy.closeSideMenu();
});
it('should redirect on clicking a invoice', () => {

View File

@ -5,15 +5,15 @@ describe('VnSearchBar', () => {
cy.visit('/');
});
it('should redirect to new customer', () => {
cy.visit('#/customer/1112/basic-data')
cy.openLeftMenu();
cy.get('.q-item > .q-item__label').should('have.text',' #1112')
cy.closeLeftMenu();
cy.clearSearchbar();
cy.writeSearchbar('1{enter}');
cy.openLeftMenu();
cy.get('.q-item > .q-item__label').should('have.text',' #1')
cy.closeLeftMenu();
});
it('should redirect to new customer', () => {
cy.visit('#/customer/1112/basic-data');
cy.openLeftMenu();
cy.get('.q-item > .q-item__label').should('have.text', ' #1112');
cy.closeSideMenu();
cy.clearSearchbar();
cy.writeSearchbar('1{enter}');
cy.openLeftMenu();
cy.get('.q-item > .q-item__label').should('have.text', ' #1');
cy.closeSideMenu();
});
});

View File

@ -52,16 +52,18 @@ Cypress.Commands.add('getValue', (selector) => {
}
// Si es un QSelect
if ($el.find('.q-select__dropdown-icon').length) {
return cy.get(
selector +
'> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input'
).invoke('val')
return cy
.get(
selector +
'> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input'
)
.invoke('val');
}
// Si es un QSelect
if ($el.find('span').length) {
return cy.get(
selector + ' span'
).then(($span) => { return $span[0].innerText })
return cy.get(selector + ' span').then(($span) => {
return $span[0].innerText;
});
}
// Puedes añadir un log o lanzar un error si el elemento no es reconocido
cy.log('Elemento no soportado');
@ -132,13 +134,13 @@ Cypress.Commands.add('validateRow', (rowSelector, expectedValues) => {
cy.get(rowSelector).within(() => {
for (const [index, value] of expectedValues.entries()) {
cy.log('CHECKING ', index, value);
if(value === undefined) continue
if (value === undefined) continue;
if (typeof value == 'boolean') {
const prefix = value ? '' : 'not.';
cy.getValue(`:nth-child(${index + 1})`).should(`${prefix}be.checked`);
continue;
}
cy.getValue(`:nth-child(${index + 1})`).should('equal', value)
cy.getValue(`:nth-child(${index + 1})`).should('equal', value);
}
});
});
@ -174,9 +176,9 @@ Cypress.Commands.add('openLeftMenu', (element) => {
if (element) cy.waitForElement(element);
cy.get('.q-toolbar > .q-btn--round.q-btn--dense > .q-btn__content > .q-icon').click();
});
Cypress.Commands.add('closeLeftMenu', (element) => {
Cypress.Commands.add('closeSideMenu', (element) => {
if (element) cy.waitForElement(element);
cy.get('.fullscreen').click();
cy.get('.fullscreen.q-drawer__backdrop:not(.hidden)').click();
});
Cypress.Commands.add('clearSearchbar', (element) => {