/// <reference types="cypress" />
describe('ClaimAction', () => {
    const claimId = 2;

    const firstRow = 'tbody > :nth-child(1)';
    const destinationRow = '.q-item__section > .q-field';

    beforeEach(() => {
        cy.viewport(1920, 1080);
        cy.login('developer');
        cy.visit(`/#/claim/${claimId}/action`);
    });

    it('should import claim', () => {
        cy.get('[title="Import claim"]').click();
    });

    it('should change destination', () => {
        const rowData = [true, null, null, 'Bueno'];
        cy.fillRow(firstRow, rowData);
    });

    it('should change destination from other button', () => {
        const rowData = [true];

        cy.fillRow(firstRow, rowData);
        cy.get('[title="Change destination"]').click();
        cy.selectOption(destinationRow, 'Confeccion');
        cy.get('.q-card > .q-card__actions > .q-btn--standard').click();
    });

    it('should regularize', () => {
        cy.get('[title="Regularize"]').click();
    });

    it('should remove the line', () => {
        cy.fillRow(firstRow, [true]);
        cy.removeCard();
        cy.clickConfirm();

        cy.reload();
        cy.get(firstRow).should('not.exist');
    });
});