/// <reference types="cypress" />
describe('InvoiceInDueDay', () => {
    const amountInput = 'tbody > tr:nth-child(1) td:nth-child(4)';
    const addBtn = '.q-page-sticky > div > .q-btn > .q-btn__content';

    beforeEach(() => {
        cy.login('developer');
        cy.visit(`/#/invoice-in/6/due-day`);
    });

    it('should update the amount', () => {
        cy.get(amountInput).type('{selectall}{backspace}23');
        cy.saveCard();
        cy.get('.q-notification__message').should('have.text', 'Data saved');
    });

    it('should remove the first line', () => {
        cy.removeRow(1);
    });

    it('should add a new row ', () => {
        cy.waitForElement('thead');
        cy.get(addBtn).click();

        cy.get('tbody > :nth-child(1)').should('exist');
        cy.get('.q-notification__message').should('have.text', 'Data saved');
    });
});
