perf: add dataCy
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2024-12-02 01:25:42 +01:00
parent 007b95a616
commit 21dc47ed74
3 changed files with 12 additions and 22 deletions

View File

@ -40,6 +40,7 @@ const onDataSaved = (...args) => {
url-create="towns"
model="city"
@on-data-saved="onDataSaved"
data-cy="newCityForm"
>
<template #form-inputs="{ data, validate }">
<VnRow>

View File

@ -43,6 +43,7 @@ const isAllowedToCreate = computed(() => {
>
<template v-if="isAllowedToCreate" #append>
<QIcon
:data-cy="$attrs.dataCy ?? $attrs.label + '_icon'"
@click.stop.prevent="$refs.dialog.show()"
:name="actionIcon"
:size="actionIcon === 'add' ? 'xs' : 'sm'"

View File

@ -116,16 +116,14 @@ describe('VnLocation', () => {
checkVnLocation(postCode, province);
});
it.only('Create city without country', () => {
it('Create city without country', () => {
const postCode = randomNumber();
const province = randomString({ length: 4 });
cy.get(createLocationButton).click();
cy.get(dialogInputs).eq(0).type(postCode);
cy.get(
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(2) `
).click();
cy.dataCy('City_icon').click();
cy.selectOption('[data-cy="locationProvince"]:last', 'Province one');
cy.get('[data-cy="cityName"]').type(province);
cy.dataCy('cityName').type(province);
cy.dataCy('FormModelPopup_save').eq(1).click();
cy.dataCy('FormModelPopup_save').eq(0).click();
@ -133,34 +131,28 @@ describe('VnLocation', () => {
checkVnLocation(postCode, province);
});
it.only('Create city with country', () => {
it('Create city with country', () => {
const cityName = 'Saskatchew'.concat(Math.random(1 * 100));
cy.get(createLocationButton).click();
cy.selectOption(
`${createForm.prefix} > :nth-child(5) > :nth-child(3) `,
'Italia'
);
cy.get(
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(2) `
).click();
cy.dataCy('City_icon').click();
cy.selectOption('[data-cy="locationProvince"]:last', 'Province four');
cy.countSelectOptions('[data-cy="locationProvince"]:last', 1);
cy.get('[data-cy="cityName"]').type(cityName);
cy.dataCy('cityName').type(cityName);
cy.dataCy('FormModelPopup_save').eq(1).click();
});
it('Create province without country', () => {
const provinceName = 'Saskatchew'.concat(Math.random(1 * 100));
cy.get(createLocationButton).click();
cy.get(
`${createForm.prefix} > :nth-child(5) > .q-select > ${createForm.sufix} > :nth-child(2) `
)
.eq(0)
.click();
cy.dataCy('Province_icon').click();
cy.selectOption('[data-cy="autonomyProvince"] ', 'Autonomy one');
cy.countSelectOptions('[data-cy="autonomyProvince"]', 4);
cy.get('[data-cy="provinceName"]').type(provinceName);
cy.dataCy('provinceName').type(provinceName);
cy.dataCy('FormModelPopup_save').eq(1).click();
});
@ -172,16 +164,12 @@ describe('VnLocation', () => {
`${createForm.prefix} > :nth-child(5) > :nth-child(3) `,
'España'
);
cy.get(
`${createForm.prefix} > :nth-child(5) > .q-select > ${createForm.sufix} > :nth-child(2) `
)
.eq(0)
.click();
cy.dataCy('Province_icon').click();
cy.selectOption('[data-cy="autonomyProvince"] ', 'Autonomy one');
cy.countSelectOptions('[data-cy="autonomyProvince"]', 2);
cy.get('[data-cy="provinceName"]').type(provinceName);
cy.dataCy('provinceName').type(provinceName);
cy.dataCy('FormModelPopup_save').eq(1).click();
});