forked from verdnatura/salix-front
parent
69e6f0f467
commit
8e37d22164
|
@ -176,7 +176,6 @@ async function handleCountries(data) {
|
||||||
@on-data-saved="onDataSaved"
|
@on-data-saved="onDataSaved"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data, validate }">
|
<template #form-inputs="{ data, validate }">
|
||||||
{{ data }}
|
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Postcode')"
|
:label="t('Postcode')"
|
||||||
|
@ -210,7 +209,6 @@ async function handleCountries(data) {
|
||||||
</template>
|
</template>
|
||||||
<template #form>
|
<template #form>
|
||||||
<CreateNewCityForm
|
<CreateNewCityForm
|
||||||
data-cy="create-new-city-btn"
|
|
||||||
:country-fk="data.countryFk"
|
:country-fk="data.countryFk"
|
||||||
:province-selected="data.provinceFk"
|
:province-selected="data.provinceFk"
|
||||||
@on-data-saved="
|
@on-data-saved="
|
||||||
|
@ -229,7 +227,6 @@ async function handleCountries(data) {
|
||||||
v-model="data.provinceFk"
|
v-model="data.provinceFk"
|
||||||
:clearable="true"
|
:clearable="true"
|
||||||
@on-province-created="onProvinceCreated"
|
@on-province-created="onProvinceCreated"
|
||||||
data-cy="create-new-province-btn"
|
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Country')"
|
:label="t('Country')"
|
||||||
|
|
|
@ -64,13 +64,11 @@ watch(
|
||||||
url="Provinces"
|
url="Provinces"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
{{ $props.countryFk }}
|
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
:label="t('Province')"
|
:label="t('Province')"
|
||||||
:options="provincesOptions"
|
:options="provincesOptions"
|
||||||
:tooltip="t('Create province')"
|
:tooltip="t('Create province')"
|
||||||
hide-selected
|
hide-selected
|
||||||
:limit="3"
|
|
||||||
v-model="provinceFk"
|
v-model="provinceFk"
|
||||||
:rules="validate && validate('postcode.provinceFk')"
|
:rules="validate && validate('postcode.provinceFk')"
|
||||||
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
||||||
|
|
|
@ -18,34 +18,34 @@ describe('VnLocation', () => {
|
||||||
it('should filter provinces based on selected country', () => {
|
it('should filter provinces based on selected country', () => {
|
||||||
// Select a country
|
// Select a country
|
||||||
cy.selectOption(
|
cy.selectOption(
|
||||||
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(5)> ${createForm.sufix}`,
|
`${createForm.prefix} > :nth-child(5) > :nth-child(3) > ${createForm.sufix}`,
|
||||||
'Ecuador'
|
'Ecuador'
|
||||||
);
|
);
|
||||||
// Verify that provinces are filtered
|
// Verify that provinces are filtered
|
||||||
cy.get(
|
cy.get(
|
||||||
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`
|
`${createForm.prefix} > :nth-child(5) > :nth-child(3) > ${createForm.sufix}`
|
||||||
).should('have.length', 1);
|
).should('have.length', 1);
|
||||||
|
|
||||||
// Verify that towns are filtered
|
// Verify that towns are filtered
|
||||||
cy.get(
|
cy.get(
|
||||||
`${createForm.prefix} > :nth-child(4) > .q-field:nth-child(3)> ${createForm.sufix}`
|
`${createForm.prefix} > :nth-child(4) > :nth-child(2) > ${createForm.sufix}`
|
||||||
).should('have.length', 1);
|
).should('have.length', 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should filter towns based on selected province', () => {
|
it.only('should filter towns based on selected province', () => {
|
||||||
// Select a country
|
// Select a country
|
||||||
cy.selectOption(
|
cy.selectOption(
|
||||||
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`,
|
`${createForm.prefix} > :nth-child(5) > :nth-child(3) > ${createForm.sufix}`,
|
||||||
'Ecuador'
|
'Ecuador'
|
||||||
);
|
);
|
||||||
// Verify that provinces are filtered
|
// Verify that provinces are filtered
|
||||||
cy.get(
|
cy.get(
|
||||||
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`
|
`${createForm.prefix} > :nth-child(5) > :nth-child(2) > ${createForm.sufix}`
|
||||||
).should('have.length', 1);
|
).should('have.length', 1);
|
||||||
|
|
||||||
// Verify that towns are filtered
|
// Verify that towns are filtered
|
||||||
cy.get(
|
cy.get(
|
||||||
`${createForm.prefix} > :nth-child(4) > .q-field:nth-child(3)> ${createForm.sufix}`
|
`${createForm.prefix} > :nth-child(4) > :nth-child(2) > ${createForm.sufix}`
|
||||||
).should('have.length', 1);
|
).should('have.length', 1);
|
||||||
});
|
});
|
||||||
it('should pass selected country', () => {
|
it('should pass selected country', () => {
|
||||||
|
@ -53,7 +53,7 @@ describe('VnLocation', () => {
|
||||||
const country = 'Ecuador';
|
const country = 'Ecuador';
|
||||||
const province = 'Province five';
|
const province = 'Province five';
|
||||||
cy.selectOption(
|
cy.selectOption(
|
||||||
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(5)> ${createForm.sufix}`,
|
`${createForm.prefix} > :nth-child(5) > :nth-child(3) > ${createForm.sufix}`,
|
||||||
country
|
country
|
||||||
);
|
);
|
||||||
cy.selectOption(
|
cy.selectOption(
|
||||||
|
@ -137,28 +137,19 @@ describe('VnLocation', () => {
|
||||||
|
|
||||||
checkVnLocation(postCode, province);
|
checkVnLocation(postCode, province);
|
||||||
});
|
});
|
||||||
it.only('Create city without country', () => {
|
it('Create city without country', () => {
|
||||||
// const postCode = '9011';
|
|
||||||
const cityName = 'Saskatchew'.concat(Math.random(1 * 100));
|
const cityName = 'Saskatchew'.concat(Math.random(1 * 100));
|
||||||
cy.get(createLocationButton).click();
|
cy.get(createLocationButton).click();
|
||||||
// cy.get(dialogInputs).eq(0).type(postCode);
|
|
||||||
// city create button
|
|
||||||
cy.get(
|
cy.get(
|
||||||
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(2) > .q-icon`
|
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(2) > .q-icon`
|
||||||
).click();
|
).click();
|
||||||
cy.selectOption('#q-portal--dialog--3 .q-select', 'one');
|
cy.selectOption('#q-portal--dialog--3 .q-select', 'one');
|
||||||
cy.get('#q-portal--dialog--3 .q-input').type(cityName);
|
cy.get('#q-portal--dialog--3 .q-input').type(cityName);
|
||||||
cy.get('#q-portal--dialog--3 .q-btn--standard').click();
|
cy.get('#q-portal--dialog--3 .q-btn--standard').click();
|
||||||
// cy.get('#q-portal--dialog--1 .q-btn--standard').click();
|
|
||||||
// cy.waitForElement('.q-form');
|
|
||||||
|
|
||||||
// checkVnLocation(postCode, province);
|
|
||||||
});
|
});
|
||||||
it.only('Create province without country', () => {
|
it('Create province without country', () => {
|
||||||
// const postCode = '9011';
|
|
||||||
const provinceName = 'Saskatchew'.concat(Math.random(1 * 100));
|
const provinceName = 'Saskatchew'.concat(Math.random(1 * 100));
|
||||||
cy.get(createLocationButton).click();
|
cy.get(createLocationButton).click();
|
||||||
// cy.get(dialogInputs).eq(0).type(postCode);
|
|
||||||
cy.get(
|
cy.get(
|
||||||
`${createForm.prefix} > :nth-child(5) > .q-select > ${createForm.sufix} > :nth-child(2) `
|
`${createForm.prefix} > :nth-child(5) > .q-select > ${createForm.sufix} > :nth-child(2) `
|
||||||
)
|
)
|
||||||
|
@ -169,17 +160,10 @@ describe('VnLocation', () => {
|
||||||
cy.get('#q-portal--dialog--3 .q-input').type(provinceName);
|
cy.get('#q-portal--dialog--3 .q-input').type(provinceName);
|
||||||
|
|
||||||
cy.get('#q-portal--dialog--3 .q-btn--standard').click();
|
cy.get('#q-portal--dialog--3 .q-btn--standard').click();
|
||||||
// cy.get('#q-portal--dialog--1 .q-btn--standard').click();
|
|
||||||
// cy.waitForElement('.q-form');
|
|
||||||
|
|
||||||
// checkVnLocation(postCode, province);
|
|
||||||
});
|
});
|
||||||
it.only('Create city with country', () => {
|
it('Create city with country', () => {
|
||||||
// const postCode = '9011';
|
|
||||||
const cityName = 'Saskatchew'.concat(Math.random(1 * 100));
|
const cityName = 'Saskatchew'.concat(Math.random(1 * 100));
|
||||||
cy.get(createLocationButton).click();
|
cy.get(createLocationButton).click();
|
||||||
// cy.get(dialogInputs).eq(0).type(postCode);
|
|
||||||
// city create button
|
|
||||||
cy.selectOption(
|
cy.selectOption(
|
||||||
`${createForm.prefix} > :nth-child(5) > :nth-child(3) `,
|
`${createForm.prefix} > :nth-child(5) > :nth-child(3) `,
|
||||||
'Italia'
|
'Italia'
|
||||||
|
@ -192,16 +176,10 @@ describe('VnLocation', () => {
|
||||||
|
|
||||||
cy.get('#q-portal--dialog--4 .q-input').type(cityName);
|
cy.get('#q-portal--dialog--4 .q-input').type(cityName);
|
||||||
cy.get('#q-portal--dialog--4 .q-btn--standard').click();
|
cy.get('#q-portal--dialog--4 .q-btn--standard').click();
|
||||||
// cy.get('#q-portal--dialog--1 .q-btn--standard').click();
|
|
||||||
// cy.waitForElement('.q-form');
|
|
||||||
|
|
||||||
// checkVnLocation(postCode, province);
|
|
||||||
});
|
});
|
||||||
it.only('Create province with country', () => {
|
it('Create province with country', () => {
|
||||||
// const postCode = '9011';
|
|
||||||
const provinceName = 'Saskatchew'.concat(Math.random(1 * 100));
|
const provinceName = 'Saskatchew'.concat(Math.random(1 * 100));
|
||||||
cy.get(createLocationButton).click();
|
cy.get(createLocationButton).click();
|
||||||
// cy.get(dialogInputs).eq(0).type(postCode);
|
|
||||||
cy.selectOption(
|
cy.selectOption(
|
||||||
`${createForm.prefix} > :nth-child(5) > :nth-child(3) `,
|
`${createForm.prefix} > :nth-child(5) > :nth-child(3) `,
|
||||||
'España'
|
'España'
|
||||||
|
@ -217,10 +195,6 @@ describe('VnLocation', () => {
|
||||||
|
|
||||||
cy.get('#q-portal--dialog--4 .q-input').type(provinceName);
|
cy.get('#q-portal--dialog--4 .q-input').type(provinceName);
|
||||||
cy.get('#q-portal--dialog--4 .q-btn--standard').click();
|
cy.get('#q-portal--dialog--4 .q-btn--standard').click();
|
||||||
// cy.get('#q-portal--dialog--1 .q-btn--standard').click();
|
|
||||||
// cy.waitForElement('.q-form');
|
|
||||||
|
|
||||||
// checkVnLocation(postCode, province);
|
|
||||||
});
|
});
|
||||||
function checkVnLocation(postCode, province) {
|
function checkVnLocation(postCode, province) {
|
||||||
cy.get(`${createForm.prefix}`).should('not.exist');
|
cy.get(`${createForm.prefix}`).should('not.exist');
|
||||||
|
|
Loading…
Reference in New Issue