forked from verdnatura/salix-front
test: fix vnSearchbar adapt to vnTable
This commit is contained in:
parent
ccb51b64de
commit
731169053c
|
@ -3,13 +3,10 @@ describe('VnSearchBar', () => {
|
||||||
const employeeId = ' #1';
|
const employeeId = ' #1';
|
||||||
const salesPersonId = ' #18';
|
const salesPersonId = ' #18';
|
||||||
const idGap = '.q-item > .q-item__label';
|
const idGap = '.q-item > .q-item__label';
|
||||||
const cardList = '.vn-card-list';
|
const vnTableRow = '.q-virtual-scroll__content';
|
||||||
|
|
||||||
let url;
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit('#/customer/list');
|
cy.visit('#/customer/list');
|
||||||
cy.url().then((currentUrl) => (url = currentUrl));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should redirect to customer summary page', () => {
|
it('should redirect to customer summary page', () => {
|
||||||
|
@ -19,12 +16,12 @@ describe('VnSearchBar', () => {
|
||||||
|
|
||||||
it('should stay on the list page if there are several results or none', () => {
|
it('should stay on the list page if there are several results or none', () => {
|
||||||
cy.writeSearchbar('salesA{enter}');
|
cy.writeSearchbar('salesA{enter}');
|
||||||
checkCardListAndUrl(2);
|
checkTableLength(2);
|
||||||
|
|
||||||
cy.clearSearchbar();
|
cy.clearSearchbar();
|
||||||
|
|
||||||
cy.writeSearchbar('0{enter}');
|
cy.writeSearchbar('0{enter}');
|
||||||
checkCardListAndUrl(0);
|
checkTableLength(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
const searchAndCheck = (searchTerm, expectedText) => {
|
const searchAndCheck = (searchTerm, expectedText) => {
|
||||||
|
@ -33,10 +30,7 @@ describe('VnSearchBar', () => {
|
||||||
cy.get(idGap).should('have.text', expectedText);
|
cy.get(idGap).should('have.text', expectedText);
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkCardListAndUrl = (expectedLength) => {
|
const checkTableLength = (expectedLength) => {
|
||||||
cy.get(cardList).then(($cardList) => {
|
cy.get(vnTableRow).find('tr').should('have.length', expectedLength);
|
||||||
expect($cardList.find('.q-card').length).to.equal(expectedLength);
|
|
||||||
cy.url().then((currentUrl) => expect(currentUrl).to.contain(url));
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue