forked from verdnatura/salix-front
parent
8e37d22164
commit
95758e2564
|
@ -7,6 +7,9 @@ describe('VnLocation', () => {
|
|||
prefix: '.q-dialog__inner > .column > #formModel > .q-card',
|
||||
sufix: ' .q-field__inner > .q-field__control',
|
||||
};
|
||||
const countrySelector = `${createForm.prefix} > :nth-child(5) > :nth-child(3) > ${createForm.sufix}`;
|
||||
const provinceSelector = `${createForm.prefix} > :nth-child(5) > :nth-child(2) > ${createForm.sufix}`;
|
||||
const citySelector = `${createForm.prefix} > :nth-child(4) > :nth-child(2) > ${createForm.sufix}`;
|
||||
describe('CreateFormDialog ', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1280, 720);
|
||||
|
@ -17,45 +20,28 @@ describe('VnLocation', () => {
|
|||
});
|
||||
it('should filter provinces based on selected country', () => {
|
||||
// Select a country
|
||||
cy.selectOption(
|
||||
`${createForm.prefix} > :nth-child(5) > :nth-child(3) > ${createForm.sufix}`,
|
||||
'Ecuador'
|
||||
);
|
||||
cy.selectOption(countrySelector, 'Ecuador');
|
||||
// Verify that provinces are filtered
|
||||
cy.get(
|
||||
`${createForm.prefix} > :nth-child(5) > :nth-child(3) > ${createForm.sufix}`
|
||||
).should('have.length', 1);
|
||||
cy.get(countrySelector).should('have.length', 1);
|
||||
|
||||
// Verify that towns are filtered
|
||||
cy.get(
|
||||
`${createForm.prefix} > :nth-child(4) > :nth-child(2) > ${createForm.sufix}`
|
||||
).should('have.length', 1);
|
||||
cy.get(citySelector).should('have.length', 1);
|
||||
});
|
||||
|
||||
it.only('should filter towns based on selected province', () => {
|
||||
// Select a country
|
||||
cy.selectOption(
|
||||
`${createForm.prefix} > :nth-child(5) > :nth-child(3) > ${createForm.sufix}`,
|
||||
'Ecuador'
|
||||
);
|
||||
cy.selectOption(countrySelector, 'Ecuador');
|
||||
// Verify that provinces are filtered
|
||||
cy.get(
|
||||
`${createForm.prefix} > :nth-child(5) > :nth-child(2) > ${createForm.sufix}`
|
||||
).should('have.length', 1);
|
||||
cy.get(provinceSelector).should('have.length', 1);
|
||||
|
||||
// Verify that towns are filtered
|
||||
cy.get(
|
||||
`${createForm.prefix} > :nth-child(4) > :nth-child(2) > ${createForm.sufix}`
|
||||
).should('have.length', 1);
|
||||
cy.get(citySelector).should('have.length', 1);
|
||||
});
|
||||
it('should pass selected country', () => {
|
||||
// Select a country
|
||||
const country = 'Ecuador';
|
||||
const province = 'Province five';
|
||||
cy.selectOption(
|
||||
`${createForm.prefix} > :nth-child(5) > :nth-child(3) > ${createForm.sufix}`,
|
||||
country
|
||||
);
|
||||
cy.selectOption(countrySelector, country);
|
||||
cy.selectOption(
|
||||
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`,
|
||||
province
|
||||
|
|
Loading…
Reference in New Issue