salix-front/test/cypress/integration/customer/customerAddress.spec.js

86 lines
3.2 KiB
JavaScript

/// <reference types="cypress" />
describe('CustomerAddress (consignee)', () => {
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('#/customer/1107/address');
});
it('Should change default address', () => {
cy.dataCy('setDefaultAddress')
.first()
.should('have.attr', 'style')
.and('include', '"FILL" 1');
cy.dataCy('setDefaultAddress').last().click();
cy.dataCy('setDefaultAddress')
.first()
.should('have.attr', 'style')
.and('include', '"FILL" 0');
cy.dataCy('setDefaultAddress')
.last()
.should('have.attr', 'style')
.and('include', '"FILL" 1');
});
it('check as equalizated', () => {
cy.get('.q-card__section > .address-card').then(($el) => {
const addressCards_before = $el.length;
cy.get('.q-page-sticky > div > .q-btn').click();
const addressName = 'test';
cy.dataCy('Consignee_input').type(addressName);
cy.dataCy('Location_select').click();
cy.getOption();
cy.dataCy('Street_input').type('TEST ADDRESS');
cy.saveCard();
cy.get('.q-card__section > .address-card').should(
'have.length',
addressCards_before + 1,
);
cy.get('.q-card__section > .address-card')
.eq(addressCards_before)
.should('be.visible')
.get('.text-weight-bold')
.eq(addressCards_before - 1)
.should('contain', addressName)
.click();
});
cy.get('[data-cy="isEqualizated_form"] > .q-checkbox__inner')
.should('have.class', 'q-checkbox__inner--falsy')
.click();
cy.saveCard();
cy.get(
':nth-child(2) > :nth-child(2) > .flex > .q-mr-lg > .q-checkbox__inner',
).should('have.class', 'q-checkbox__inner--truthy');
});
it('Should edit address', () => {
const updateData = {
Consignee: { val: 'Stark tower' },
Street: { val: 'test' },
Location: { val: 'Algemesi', type: 'select' },
Agency: { val: 'inhouse pickup', type: 'select' },
Phone: { val: '3333333333' },
Mobile: { val: '4444444444' },
Incoterms: { val: 'Free Alongside Ship', type: 'select' },
'Customs agent': { val: 'Agent two', type: 'select' },
Longitude: { val: '123' },
Latitude: { val: '123' },
};
cy.get('.address-card').last().click();
cy.fillInForm(updateData);
cy.dataCy('enabled_form').click();
cy.dataCy('isEqualizated_form').click();
cy.dataCy('isLoginfloraAllowed_form').click();
cy.dataCy('addNoteBtn_form').click();
cy.selectOption('[data-cy="Observation type_select"]', '6');
cy.dataCy('Description_input').click().type('Test description');
cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('Data saved');
cy.get('.address-card').last().should('have.class', 'item-disabled');
});
});