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