55 lines
1.8 KiB
JavaScript
55 lines
1.8 KiB
JavaScript
import './commands';
|
|
|
|
describe('EntryList', () => {
|
|
beforeEach(() => {
|
|
cy.viewport(1920, 1080);
|
|
cy.login('buyer');
|
|
cy.visit(`/#/entry/list`);
|
|
});
|
|
|
|
it('View popup summary', () => {
|
|
cy.createEntry();
|
|
cy.get('.q-notification__message').eq(0).should('have.text', 'Data created');
|
|
cy.waitForElement('[data-cy="entry-buys"]');
|
|
cy.deleteEntry();
|
|
cy.typeSearchbar('{enter}');
|
|
cy.get('button[title="Summary"]').eq(1).should('be.visible').click();
|
|
cy.dataCy('entry-summary').should('be.visible');
|
|
});
|
|
|
|
it('Show supplierDescriptor on click on supplierDescriptor', () => {
|
|
cy.typeSearchbar('{enter}');
|
|
cy.get('td[data-col-field="supplierFk"] > div > span').eq(0).click();
|
|
cy.get('div[role="menu"] > div[class="descriptor"]').should('be.visible');
|
|
});
|
|
|
|
it('Landed badge should display the right color', () => {
|
|
cy.typeSearchbar('{enter}');
|
|
|
|
const checkBadgeDate = (selector, comparisonFn) => {
|
|
cy.get(selector)
|
|
.should('exist')
|
|
.each(($badge) => {
|
|
const badgeText = $badge.text().trim();
|
|
const badgeDate = new Date(badgeText);
|
|
const compareDate = new Date('01/01/2001');
|
|
comparisonFn(badgeDate, compareDate);
|
|
});
|
|
};
|
|
|
|
checkBadgeDate(
|
|
'td[data-col-field="landed"] > div .bg-warning',
|
|
(badgeDate, compareDate) => {
|
|
expect(badgeDate.getTime()).to.be.greaterThan(compareDate.getTime());
|
|
},
|
|
);
|
|
|
|
checkBadgeDate(
|
|
'td[data-col-field="landed"] > div .bg-info',
|
|
(badgeDate, compareDate) => {
|
|
expect(badgeDate.getTime()).to.be.lessThan(compareDate.getTime());
|
|
},
|
|
);
|
|
});
|
|
});
|