describe('WagonCreate', () => {
    beforeEach(() => {
        cy.viewport(1280, 720);
        cy.login('developer');
        cy.visit('/#/wagon/create');
    });

    it('should create and delete a new wagon', () => {
        cy.get('input').eq(0).type('1234');
        cy.get('input').eq(1).type('1234ABCD');
        cy.get('input').eq(2).type('100');
        cy.get('input').eq(3).click();
        cy.get('div[role="listbox"]').find('div.q-item').click();

        // Save
        cy.get('button[type="submit"]').click();

        // Check data has been saved successfully
        cy.get('div.text-h6').contains('1234').click();
        cy.get('input').eq(0).should('have.value', '1234');
        cy.get('input').eq(1).should('have.value', '1234ABCD');
        cy.get('input').eq(2).should('have.value', '100');
        cy.get('input').eq(3).should('have.value', 'Wagon Type #1');

        // Delete wagon type created
        cy.go('back');
        cy.get('div.text-h6')
            .contains('1234')
            .parentsUntil('div.q-card')
            .find('div.q-card__actions')
            .find('button').last().click();
    });
});