test: refactor e2e
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
08204aa5f0
commit
e050a077d4
|
@ -170,6 +170,7 @@ function addDefaultData(data) {
|
|||
@update:model-value="onFileChange(dms.files)"
|
||||
class="required"
|
||||
:display-value="dms.file"
|
||||
data-cy="VnDms_inputFile"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon
|
||||
|
|
|
@ -103,6 +103,7 @@ function cancel() {
|
|||
@click="confirm()"
|
||||
unelevated
|
||||
autofocus
|
||||
data-cy="VnConfirm_confirm"
|
||||
/>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
|
|
|
@ -179,7 +179,11 @@ function deleteFile(dmsFk) {
|
|||
class="full-width"
|
||||
:disable="true"
|
||||
/>
|
||||
<div v-if="data.dmsFk" class="row no-wrap q-pa-xs q-gutter-x-xs">
|
||||
<div
|
||||
v-if="data.dmsFk"
|
||||
class="row no-wrap q-pa-xs q-gutter-x-xs"
|
||||
data-cy="dms-buttons"
|
||||
>
|
||||
<QBtn
|
||||
:class="{
|
||||
'no-pointer-events': editDownloadDisabled,
|
||||
|
@ -232,6 +236,7 @@ function deleteFile(dmsFk) {
|
|||
delete documentDialogRef.dms;
|
||||
}
|
||||
"
|
||||
data-cy="dms-create"
|
||||
>
|
||||
<QTooltip>{{ t('Create document') }}</QTooltip>
|
||||
</QBtn>
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
describe('InvoiceInBasicData', () => {
|
||||
const formInputs = '.q-form > .q-card input';
|
||||
const firstFormSelect = '.q-card > .vn-row:nth-child(1) > .q-select';
|
||||
const documentBtns = '.q-form .q-field button';
|
||||
const documentBtns = '[data-cy="dms-buttons"] button';
|
||||
const dialogInputs = '.q-dialog input';
|
||||
const dialogActionBtns = '.q-card__actions button';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.login('developer');
|
||||
|
@ -21,27 +20,35 @@ describe('InvoiceInBasicData', () => {
|
|||
cy.get(formInputs).eq(1).invoke('val').should('eq', '4739');
|
||||
});
|
||||
|
||||
it('should edit the dms data', () => {
|
||||
it('should edit, remove and create the dms data', () => {
|
||||
const firtsInput = 'Ticket:65';
|
||||
const secondInput = "I don't know what posting here!";
|
||||
|
||||
//edit
|
||||
cy.get(documentBtns).eq(1).click();
|
||||
cy.get(dialogInputs).eq(0).type(`{selectall}${firtsInput}`);
|
||||
cy.get('textarea').type(`{selectall}${secondInput}`);
|
||||
cy.get(dialogActionBtns).eq(1).click();
|
||||
|
||||
cy.get('[data-cy="FormModelPopup_save"]').click();
|
||||
cy.get(documentBtns).eq(1).click();
|
||||
cy.get(dialogInputs).eq(0).invoke('val').should('eq', firtsInput);
|
||||
cy.get('textarea').invoke('val').should('eq', secondInput);
|
||||
});
|
||||
cy.get('[data-cy="FormModelPopup_save"]').click();
|
||||
cy.checkNotification('Data saved');
|
||||
|
||||
it('should throw an error creating a new dms if a file is not attached', () => {
|
||||
cy.get(formInputs).eq(7).type('{selectall}{backspace}');
|
||||
cy.get(documentBtns).eq(0).click();
|
||||
cy.get(dialogActionBtns).eq(1).click();
|
||||
cy.get('.q-notification__message').should(
|
||||
'have.text',
|
||||
"The files can't be empty"
|
||||
//remove
|
||||
cy.get(documentBtns).eq(2).click();
|
||||
cy.get('[data-cy="VnConfirm_confirm"]').click();
|
||||
cy.checkNotification('Data saved');
|
||||
|
||||
//create
|
||||
cy.get('[data-cy="dms-create"]').eq(0).click();
|
||||
cy.get('[data-cy="VnDms_inputFile"').selectFile(
|
||||
'test/cypress/fixtures/image.jpg',
|
||||
{
|
||||
force: true,
|
||||
}
|
||||
);
|
||||
cy.get('[data-cy="FormModelPopup_save"]').click();
|
||||
cy.checkNotification('Data saved');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue