salix-front/test/cypress/integration/fixedAsset/fixedAssetList.spec.js

51 lines
1.8 KiB
JavaScript

describe('FixedAssetList', () => {
const selectors = {
firstRow: 'tr:first-child > [data-col-field="description"]',
descriptorTitle: '[data-cy="vnDescriptor_title"]',
};
const summaryUrlRegex = /fixed-asset\/\d+\/summary/;
const data = {
Id: { val: '123' },
Value: { val: '100000' },
Description: { val: 'F.R.I.D.A.Y.' },
'Amort. start': { val: '1.5', type: 'date' },
'Amort. end': { val: '1.10.21', type: 'date' },
Subaccount: { val: '2800000000', type: 'select' },
Endowment: { val: '6810000000', type: 'select' },
'Element account': { val: '561.123' },
'Amort. plan': { val: '1', type: 'select' },
Group: { val: 'Avengers', type: 'select' },
Location: { val: 'Stark tower', type: 'select' },
};
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('administrative');
cy.visit('/#/fixed-asset/list');
cy.typeSearchbar('{enter}');
});
it('Should redirect to the fixed asset summary when clicking the row', () => {
cy.get(selectors.firstRow)
.should('be.visible')
.click()
.invoke('text')
.then((name) => {
name = name.trim();
cy.location().should('match', summaryUrlRegex);
cy.containContent(selectors.descriptorTitle, name);
});
});
it('Should create new fixed asset', () => {
cy.addBtnClick();
cy.fillInForm(data);
cy.dataCy('FormModelPopup_save').should('be.visible').click();
cy.checkNotification('Data created');
cy.location().should('match', summaryUrlRegex);
cy.containContent(selectors.descriptorTitle, data.Description.val);
});
});