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

    const dataError = 'ER_DUP_ENTRY: Duplicate entry';
    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.selectOption('[data-cy="Warehouse_select"]', 'Warehouse Two');
        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();
    });
});
