salix-front/test/cypress/integration/invoiceIn/invoiceInList.spec.js

31 lines
1.0 KiB
JavaScript

/// <reference types="cypress" />
describe('InvoiceInList', () => {
const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
const firstId = `${firstRow} > td:nth-child(1) span`;
const firstDetailBtn = `${firstRow} .q-btn:nth-child(1)`;
const summaryHeaders = '.summaryBody .header-link';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-in/list`);
cy.get('#searchbar input').type('{enter}');
});
it('should redirect on clicking a invoice', () => {
cy.get(firstId)
.invoke('text')
.then((content) => {
const id = content.replace(/\D/g, '');
cy.get(firstRow).click();
cy.url().should('include', `/invoice-in/${id}/summary`);
});
});
it('should open the details', () => {
cy.get(firstDetailBtn).click();
cy.get(summaryHeaders).eq(1).contains('Basic data');
cy.get(summaryHeaders).eq(4).contains('Vat');
});
});