forked from verdnatura/salix-front
Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 6992-addQueryParamsUrl
This commit is contained in:
commit
fdfa99c718
|
@ -3,6 +3,7 @@ const { defineConfig } = require('cypress');
|
|||
module.exports = defineConfig({
|
||||
e2e: {
|
||||
baseUrl: 'http://localhost:9000/',
|
||||
experimentalStudio: true,
|
||||
fixturesFolder: 'test/cypress/fixtures',
|
||||
screenshotsFolder: 'test/cypress/screenshots',
|
||||
supportFile: 'test/cypress/support/index.js',
|
||||
|
|
|
@ -28,8 +28,23 @@ const countriesOptions = ref([]);
|
|||
const provincesOptions = ref([]);
|
||||
const townsLocationOptions = ref([]);
|
||||
|
||||
const onDataSaved = (dataSaved) => {
|
||||
emit('onDataSaved', dataSaved);
|
||||
const onDataSaved = (formData) => {
|
||||
const newPostcode = {
|
||||
...formData
|
||||
};
|
||||
const townObject = townsLocationOptions.value.find(
|
||||
({id}) => id === formData.townFk
|
||||
);
|
||||
newPostcode.town = townObject?.name;
|
||||
const provinceObject = provincesOptions.value.find(
|
||||
({id}) => id === formData.provinceFk
|
||||
);
|
||||
newPostcode.province = provinceObject?.name;
|
||||
const countryObject = countriesOptions.value.find(
|
||||
({id}) => id === formData.countryFk
|
||||
);
|
||||
newPostcode.country = countryObject?.country;
|
||||
emit('onDataSaved', newPostcode);
|
||||
};
|
||||
|
||||
const onCityCreated = async ({ name, provinceFk }, formData) => {
|
||||
|
@ -73,7 +88,7 @@ const onProvinceCreated = async ({ name }, formData) => {
|
|||
:title="t('New postcode')"
|
||||
:subtitle="t('Please, ensure you put the correct data!')"
|
||||
:form-initial-data="postcodeFormData"
|
||||
@on-data-saved="onDataSaved($event)"
|
||||
@on-data-saved="onDataSaved"
|
||||
>
|
||||
<template #form-inputs="{ data, validate }">
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
|
|
|
@ -88,6 +88,10 @@ function locationFilter(search = '') {
|
|||
function handleFetch(data) {
|
||||
postcodesOptions.value = data;
|
||||
}
|
||||
function onDataSaved(newPostcode) {
|
||||
postcodesOptions.value.push(newPostcode);
|
||||
value.value = newPostcode.code;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -111,11 +115,13 @@ function handleFetch(data) {
|
|||
clearable
|
||||
>
|
||||
<template #form>
|
||||
<CreateNewPostcode @on-data-saved="locationFilter()" />
|
||||
<CreateNewPostcode
|
||||
@on-data-saved="onDataSaved"
|
||||
/>
|
||||
</template>
|
||||
<template #option="{ itemProps, opt }">
|
||||
<QItem v-bind="itemProps">
|
||||
<QItemSection v-if="opt">
|
||||
<QItemSection v-if="opt.code">
|
||||
<QItemLabel>{{ opt.code }}</QItemLabel>
|
||||
<QItemLabel caption>{{ showLabel(opt) }}</QItemLabel>
|
||||
</QItemSection>
|
||||
|
|
|
@ -8,41 +8,41 @@ describe('VnLocation', () => {
|
|||
cy.visit('/#/worker/create');
|
||||
cy.waitForElement('.q-card');
|
||||
});
|
||||
|
||||
it('Show all options', function() {
|
||||
cy.get(inputLocation).click();
|
||||
cy.get(locationOptions).should('have.length',5);
|
||||
it('Show all options', function() {
|
||||
cy.get(inputLocation).click();
|
||||
cy.get(locationOptions).should('have.length.at.least',5);
|
||||
});
|
||||
|
||||
it('input filter location as "al"', function() {
|
||||
it('input filter location as "al"', function() {
|
||||
cy.get(inputLocation).click();
|
||||
cy.get(inputLocation).clear();
|
||||
cy.get(inputLocation).type('al');
|
||||
cy.get(locationOptions).should('have.length',3);
|
||||
cy.get(locationOptions).should('have.length.at.least',3);
|
||||
});
|
||||
it('input filter location as "ecuador"', function() {
|
||||
cy.get(inputLocation).click();
|
||||
cy.get(inputLocation).clear();
|
||||
cy.get(inputLocation).type('ecuador');
|
||||
cy.get(locationOptions).should('have.length',1);
|
||||
cy.get(locationOptions).should('have.length.at.least',1);
|
||||
cy.get(`${locationOptions}:nth-child(1)`).click();
|
||||
cy.get(':nth-child(3) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(2) > .q-icon').click();
|
||||
|
||||
});
|
||||
});
|
||||
describe('Fiscal-data',()=>{
|
||||
const inputLocation = ':nth-child(6) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.viewport(1280, 720);
|
||||
cy.login('developer');
|
||||
cy.visit('/#/supplier/567/fiscal-data', {timeout: 2000});
|
||||
cy.waitForElement('.q-card');
|
||||
});
|
||||
|
||||
it('Show locations options', function() {
|
||||
cy.get(inputLocation).click();
|
||||
cy.get(locationOptions).should('have.length', 5);
|
||||
it('Create postCode', function() {
|
||||
cy.get(':nth-child(6) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(3) > .q-icon').click();
|
||||
cy.get(' .q-card > h1').should('have.text', 'New postcode');
|
||||
cy.get('.q-card > :nth-child(4) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(1) > input').clear('12');
|
||||
cy.get('.q-card > :nth-child(4) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(1) > input').type('1234453');
|
||||
cy.selectOption('.q-dialog__inner > .column > #formModel > .q-card > :nth-child(4) > :nth-child(2) > .q-field > .q-field__inner > .q-field__control ', 'Valencia');
|
||||
cy.selectOption('.q-dialog__inner > .column > #formModel > .q-card > :nth-child(5) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control ', 'Province one');
|
||||
cy.selectOption('.q-dialog__inner > .column > #formModel > .q-card > :nth-child(5) > :nth-child(2) > .q-field > .q-field__inner > .q-field__control ', 'España');
|
||||
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||
});
|
||||
});
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue