feat: refs #8581 add data attributes for Cypress testing and update invoice tests
This commit is contained in:
parent
1ab89fd9f0
commit
85a9260382
|
@ -56,7 +56,12 @@ async function confirm() {
|
|||
{{ t('The notification will be sent to the following address') }}
|
||||
</QCardSection>
|
||||
<QCardSection class="q-pt-none">
|
||||
<VnInput v-model="address" is-outlined autofocus />
|
||||
<VnInput
|
||||
v-model="address"
|
||||
is-outlined
|
||||
autofocus
|
||||
data-cy="sendEmailDialog_address"
|
||||
/>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
<QBtn :label="t('globals.cancel')" color="primary" flat v-close-popup />
|
||||
|
|
|
@ -319,6 +319,7 @@ onBeforeMount(async () => {
|
|||
v-close-popup
|
||||
@click="createInvoiceInCorrection"
|
||||
:disable="isNotFilled"
|
||||
data-cy="saveCorrectiveInvoice"
|
||||
/>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('InvoiceInCorrective', () => {
|
||||
const saveDialog = '.q-card > .q-card__actions > .q-btn--standard ';
|
||||
|
||||
it('should create a correcting invoice', () => {
|
||||
cy.viewport(1280, 720);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/invoice-in/1/summary`);
|
||||
cy.intercept('POST', '/api/InvoiceIns/corrective').as('corrective');
|
||||
|
||||
cy.openActionsDescriptor();
|
||||
|
||||
cy.dataCy('createCorrectiveItem').click();
|
||||
cy.get(saveDialog).click();
|
||||
cy.wait('@corrective').then((interception) => {
|
||||
const correctingId = interception.response.body;
|
||||
cy.url().should('include', `/invoice-in/${correctingId}/summary`);
|
||||
cy.visit(`/#/invoice-in/${correctingId}/corrective`);
|
||||
});
|
||||
cy.get('tbody > tr:visible').should('have.length', 1);
|
||||
});
|
||||
});
|
|
@ -53,23 +53,47 @@ describe('InvoiceInDescriptor', () => {
|
|||
});
|
||||
});
|
||||
|
||||
// it('should send the agricultural PDF properly', () => {
|
||||
// cy.visit('/#/invoice-in/6/summary');
|
||||
// cy.selectDescriptorOption(5);
|
||||
// cy.checkNotification('Email sent');
|
||||
// });
|
||||
it('should send the agricultural PDF properly', () => {
|
||||
cy.intercept('POST', 'api/InvoiceIns/6/invoice-in-email').as('sendEmail');
|
||||
cy.visit('/#/invoice-in/6/summary');
|
||||
cy.selectDescriptorOption(5);
|
||||
|
||||
// it('should create a corrective invoice properly', () => {
|
||||
// cy.visit('/#/invoice-in/2/summary');
|
||||
// cy.selectDescriptorOption(6);
|
||||
// cy.dataCy('createCorrectiveItem').click();
|
||||
// cy.checkNotification('Corrective invoice created');
|
||||
// });
|
||||
cy.get('input[data-cy="sendEmailDialog_address"]').type(
|
||||
'{selectall}jorgito@gmail.mx',
|
||||
);
|
||||
cy.clickConfirm();
|
||||
cy.checkNotification('Notification sent');
|
||||
cy.wait('@sendEmail').then(({ request, response }) => {
|
||||
expect(request.body).to.deep.equal({
|
||||
recipientId: 2,
|
||||
recipient: 'jorgito@gmail.mx',
|
||||
});
|
||||
expect(response.statusCode).to.equal(200);
|
||||
});
|
||||
});
|
||||
|
||||
// it('should download the file properly', () => {
|
||||
// cy.visit('/#/invoice-in/2/summary');
|
||||
// cy.selectDescriptorOption(7);
|
||||
// cy.checkNotification('File downloaded');
|
||||
// });
|
||||
it('should create a correcting invoice', () => {
|
||||
cy.visit(`/#/invoice-in/1/summary`);
|
||||
cy.intercept('POST', '/api/InvoiceIns/corrective').as('corrective');
|
||||
cy.selectDescriptorOption(4);
|
||||
cy.dataCy('saveCorrectiveInvoice').click();
|
||||
cy.wait('@corrective').then(({ response }) => {
|
||||
const correctingId = response.body;
|
||||
cy.url().should('include', `/invoice-in/${correctingId}/summary`);
|
||||
cy.visit(`/#/invoice-in/${correctingId}/corrective`);
|
||||
});
|
||||
cy.get('tbody > tr:visible').should('have.length', 1);
|
||||
});
|
||||
|
||||
it('should download the file properly', () => {
|
||||
cy.visit('/#/invoice-in/1/summary');
|
||||
cy.selectDescriptorOption(5);
|
||||
const regex = /api\/dms\/1\/downloadFile\?access_token=.*/;
|
||||
cy.intercept('GET', regex).as('download');
|
||||
cy.wait('@download').then(({ response }) => {
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.headers['content-type']).to.include('text/plain');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue