forked from verdnatura/salix-front
fix: refs #5186 tests
This commit is contained in:
parent
3c3988b4f7
commit
b44dcdb28a
|
@ -13,16 +13,17 @@ const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const parkingId = route.params?.id || null;
|
const parkingId = route.params?.id || null;
|
||||||
const sectors = ref([]);
|
const sectors = ref([]);
|
||||||
|
const sectorFilter = { fields: ['id', 'description'] };
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['sectorFk', 'code', 'pickingOrder', 'row', 'column'],
|
fields: ['sectorFk', 'code', 'pickingOrder', 'row', 'column'],
|
||||||
include: [{ relation: 'sector', scope: { fields: ['id', 'description'] } }],
|
include: [{ relation: 'sector', scope: sectorFilter }],
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="Sectors"
|
url="Sectors"
|
||||||
:filter="{ fields: ['id', 'description'] }"
|
:filter="sectorFilter"
|
||||||
sort-by="description"
|
sort-by="description"
|
||||||
@on-fetch="(data) => (sectors = data)"
|
@on-fetch="(data) => (sectors = data)"
|
||||||
auto-load
|
auto-load
|
||||||
|
|
|
@ -6,12 +6,11 @@ describe('ParkingList', () => {
|
||||||
const firstDetailBtn =
|
const firstDetailBtn =
|
||||||
':nth-child(1) > :nth-child(1) > .card-list-body > .actions > .q-btn';
|
':nth-child(1) > :nth-child(1) > .card-list-body > .actions > .q-btn';
|
||||||
const summaryHeader = '.summaryBody .header';
|
const summaryHeader = '.summaryBody .header';
|
||||||
const screen = '.q-page-container > .q-drawer-container > .fullscreen';
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/parking/list`);
|
cy.visit(`/#/parking/list`);
|
||||||
cy.get(screen).click();
|
cy.closeSideMenu();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should redirect on clicking a invoice', () => {
|
it('should redirect on clicking a invoice', () => {
|
||||||
|
|
|
@ -6,14 +6,14 @@ describe('VnSearchBar', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should redirect to new customer', () => {
|
it('should redirect to new customer', () => {
|
||||||
cy.visit('#/customer/1112/basic-data')
|
cy.visit('#/customer/1112/basic-data');
|
||||||
cy.openLeftMenu();
|
cy.openLeftMenu();
|
||||||
cy.get('.q-item > .q-item__label').should('have.text',' #1112')
|
cy.get('.q-item > .q-item__label').should('have.text', ' #1112');
|
||||||
cy.closeLeftMenu();
|
cy.closeSideMenu();
|
||||||
cy.clearSearchbar();
|
cy.clearSearchbar();
|
||||||
cy.writeSearchbar('1{enter}');
|
cy.writeSearchbar('1{enter}');
|
||||||
cy.openLeftMenu();
|
cy.openLeftMenu();
|
||||||
cy.get('.q-item > .q-item__label').should('have.text',' #1')
|
cy.get('.q-item > .q-item__label').should('have.text', ' #1');
|
||||||
cy.closeLeftMenu();
|
cy.closeSideMenu();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -52,16 +52,18 @@ Cypress.Commands.add('getValue', (selector) => {
|
||||||
}
|
}
|
||||||
// Si es un QSelect
|
// Si es un QSelect
|
||||||
if ($el.find('.q-select__dropdown-icon').length) {
|
if ($el.find('.q-select__dropdown-icon').length) {
|
||||||
return cy.get(
|
return cy
|
||||||
|
.get(
|
||||||
selector +
|
selector +
|
||||||
'> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input'
|
'> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input'
|
||||||
).invoke('val')
|
)
|
||||||
|
.invoke('val');
|
||||||
}
|
}
|
||||||
// Si es un QSelect
|
// Si es un QSelect
|
||||||
if ($el.find('span').length) {
|
if ($el.find('span').length) {
|
||||||
return cy.get(
|
return cy.get(selector + ' span').then(($span) => {
|
||||||
selector + ' span'
|
return $span[0].innerText;
|
||||||
).then(($span) => { return $span[0].innerText })
|
});
|
||||||
}
|
}
|
||||||
// Puedes añadir un log o lanzar un error si el elemento no es reconocido
|
// Puedes añadir un log o lanzar un error si el elemento no es reconocido
|
||||||
cy.log('Elemento no soportado');
|
cy.log('Elemento no soportado');
|
||||||
|
@ -132,13 +134,13 @@ Cypress.Commands.add('validateRow', (rowSelector, expectedValues) => {
|
||||||
cy.get(rowSelector).within(() => {
|
cy.get(rowSelector).within(() => {
|
||||||
for (const [index, value] of expectedValues.entries()) {
|
for (const [index, value] of expectedValues.entries()) {
|
||||||
cy.log('CHECKING ', index, value);
|
cy.log('CHECKING ', index, value);
|
||||||
if(value === undefined) continue
|
if (value === undefined) continue;
|
||||||
if (typeof value == 'boolean') {
|
if (typeof value == 'boolean') {
|
||||||
const prefix = value ? '' : 'not.';
|
const prefix = value ? '' : 'not.';
|
||||||
cy.getValue(`:nth-child(${index + 1})`).should(`${prefix}be.checked`);
|
cy.getValue(`:nth-child(${index + 1})`).should(`${prefix}be.checked`);
|
||||||
continue;
|
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);
|
if (element) cy.waitForElement(element);
|
||||||
cy.get('.q-toolbar > .q-btn--round.q-btn--dense > .q-btn__content > .q-icon').click();
|
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);
|
if (element) cy.waitForElement(element);
|
||||||
cy.get('.fullscreen').click();
|
cy.get('.fullscreen.q-drawer__backdrop:not(.hidden)').click();
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('clearSearchbar', (element) => {
|
Cypress.Commands.add('clearSearchbar', (element) => {
|
||||||
|
|
Loading…
Reference in New Issue