0
0
Fork 0

perf: refs #8061 solve conflicts and random posCode it

This commit is contained in:
Javier Segarra 2024-11-24 09:31:43 +01:00
parent fb4de9cda9
commit feb752f75c
1 changed files with 11 additions and 14 deletions

View File

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