0
0
Fork 0

test: #7260 add dataCy

This commit is contained in:
Javier Segarra 2024-12-02 23:02:35 +01:00
parent 4f93d472ac
commit 0ddc8f225c
4 changed files with 17 additions and 25 deletions

View File

@ -85,12 +85,14 @@ const closeForm = () => {
hide-selected hide-selected
option-label="label" option-label="label"
v-model="selectedField" v-model="selectedField"
data-cy="field-to-edit"
/> />
<component <component
:is="inputs[selectedField?.component || 'input']" :is="inputs[selectedField?.component || 'input']"
v-bind="selectedField?.attrs || {}" v-bind="selectedField?.attrs || {}"
v-model="newValue" v-model="newValue"
:label="t('Value')" :label="t('Value')"
data-cy="value-to-edit"
style="width: 200px" style="width: 200px"
/> />
</VnRow> </VnRow>

View File

@ -6,7 +6,6 @@ import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { toDateHourMin } from 'src/filters'; import { toDateHourMin } from 'src/filters';
import { useState } from 'src/composables/useState';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import VnUserLink from 'components/ui/VnUserLink.vue'; import VnUserLink from 'components/ui/VnUserLink.vue';
@ -26,7 +25,6 @@ const $props = defineProps({
}); });
const { t } = useI18n(); const { t } = useI18n();
const state = useState();
const quasar = useQuasar(); const quasar = useQuasar();
const newNote = reactive({ text: null, observationTypeFk: null }); const newNote = reactive({ text: null, observationTypeFk: null });
const observationTypes = ref([]); const observationTypes = ref([]);

View File

@ -240,7 +240,6 @@ const validations = ({ row }) => {
return isValid; return isValid;
}; };
const upsertPrice = async (props, resetMinPrice = false) => { const upsertPrice = async (props, resetMinPrice = false) => {
try {
const isValid = validations({ ...props }); const isValid = validations({ ...props });
if (!isValid) { if (!isValid) {
return; return;
@ -253,18 +252,11 @@ const upsertPrice = async (props, resetMinPrice = false) => {
if (!changes.updates && !changes.creates) return; if (!changes.updates && !changes.creates) return;
const data = await upsertFixedPrice(row); const data = await upsertFixedPrice(row);
tableRef.value.CrudModelRef.formData[props.rowIndex] = data; tableRef.value.CrudModelRef.formData[props.rowIndex] = data;
} catch (err) {
console.error('Error editing price', err);
}
}; };
async function upsertFixedPrice(row) { async function upsertFixedPrice(row) {
try {
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row); const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
return data; return data;
} catch (err) {
console.error('Error editing price', err);
}
} }
function checkLastVisibleRow() { function checkLastVisibleRow() {

View File

@ -46,8 +46,8 @@ describe('Handle Items FixedPrice', () => {
it('Massive edit', function () { it('Massive edit', function () {
cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click(); cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
cy.get('#subToolbar > .q-btn--standard').click(); cy.get('#subToolbar > .q-btn--standard').click();
cy.selectOption('.vn-row > :nth-child(2)', 'Min price'); cy.selectOption("[data-cy='field-to-edit']", 'Min price');
cy.get('.vn-row > :nth-child(3)').type('1'); cy.dataCy('value-to-edit').find('input').type('1');
cy.get('.countLines').should('have.text', ' 1 '); cy.get('.countLines').should('have.text', ' 1 ');
cy.get('.q-mt-lg > .q-btn--standard').click(); cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get('.q-notification__message').should('have.text', 'Data saved'); cy.get('.q-notification__message').should('have.text', 'Data saved');