describe('ZoneWarehouse', () => {
    const data = {
        Warehouse: { val: 'Warehouse One', type: 'select' },
    };

    const dataError = 'The introduced warehouse already exists';
    const saveBtn = '.q-btn--standard > .q-btn__content > .block';

    beforeEach(() => {
        cy.viewport(1280, 720);
        cy.login('developer');
        cy.visit(`/#/zone/2/warehouses`);
    });

    it('should throw an error if the warehouse chosen is already put in the zone', () => {
        cy.addBtnClick();
        cy.dataCy('Warehouse_select').type('Warehouse Two{enter}');
        cy.get(saveBtn).click();
        cy.checkNotification(dataError);
    });

    it('should create & remove a warehouse', () => {
        cy.addBtnClick();
        cy.fillInForm(data);
        cy.get(saveBtn).click();
        cy.get('.q-mt-lg > .q-btn--standard').click();
        cy.get('tbody > :nth-child(2) > :nth-child(2) > .q-icon').click();
        cy.get('[title="Confirm"]').click();

        cy.reload();
    });
});