diff --git a/test/cypress/integration/vnComponent/vnLocation.spec.js b/test/cypress/integration/vnComponent/vnLocation.spec.js index 448d374ec..c83befbe7 100644 --- a/test/cypress/integration/vnComponent/vnLocation.spec.js +++ b/test/cypress/integration/vnComponent/vnLocation.spec.js @@ -19,28 +19,22 @@ describe('VnLocation', () => { cy.get(createLocationButton).click(); }); it('should filter provinces based on selected country', () => { - // Select a country - cy.selectOption(countrySelector, 'Ecuador'); - // Verify that provinces are filtered + const country = 'Ecuador'; + cy.selectOption(countrySelector, country); cy.get(countrySelector).should('have.length', 1); - - // Verify that towns are filtered cy.get(citySelector).should('have.length', 1); }); it('should filter towns based on selected province', () => { - // Select a country - cy.selectOption(countrySelector, 'Ecuador'); - // Verify that provinces are filtered + const country = 'Ecuador'; + cy.selectOption(countrySelector, country); cy.get(provinceSelector).should('have.length', 1); - - // Verify that towns are filtered cy.get(citySelector).should('have.length', 1); }); it('should pass selected country', () => { - // Select a country const country = 'Ecuador'; const province = 'Province five'; + cy.selectOption(countrySelector, country); cy.selectOption( `${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`, @@ -66,13 +60,11 @@ describe('VnLocation', () => { cy.get(locationOptions).should('have.length.at.least', 5); }); 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.at.least', 4); }); 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.at.least', 1); @@ -107,7 +99,7 @@ describe('VnLocation', () => { }); it('Create postCode', () => { - const postCode = '1234475'; + const postCode = Math.floor(100000 + Math.random() * 900000); const province = 'Valencia'; cy.get(createLocationButton).click(); cy.get('.q-card > h1').should('have.text', 'New postcode'); @@ -123,6 +115,7 @@ describe('VnLocation', () => { checkVnLocation(postCode, province); }); + it('Create city without country', () => { const cityName = 'Saskatchew'.concat(Math.random(1 * 100)); cy.get(createLocationButton).click(); @@ -133,6 +126,7 @@ describe('VnLocation', () => { cy.get('#q-portal--dialog--3 .q-input').type(cityName); cy.get('#q-portal--dialog--3 .q-btn--standard').click(); }); + it('Create province without country', () => { const provinceName = 'Saskatchew'.concat(Math.random(1 * 100)); cy.get(createLocationButton).click(); @@ -147,6 +141,7 @@ describe('VnLocation', () => { cy.get('#q-portal--dialog--3 .q-btn--standard').click(); }); + it('Create city with country', () => { const cityName = 'Saskatchew'.concat(Math.random(1 * 100)); cy.get(createLocationButton).click(); @@ -163,6 +158,7 @@ describe('VnLocation', () => { cy.get('#q-portal--dialog--4 .q-input').type(cityName); cy.get('#q-portal--dialog--4 .q-btn--standard').click(); }); + it('Create province with country', () => { const provinceName = 'Saskatchew'.concat(Math.random(1 * 100)); cy.get(createLocationButton).click(); @@ -182,6 +178,7 @@ describe('VnLocation', () => { cy.get('#q-portal--dialog--4 .q-input').type(provinceName); cy.get('#q-portal--dialog--4 .q-btn--standard').click(); }); + function checkVnLocation(postCode, province) { cy.get(`${createForm.prefix}`).should('not.exist'); cy.get('.q-form > .q-card > .vn-row:nth-child(6)')