Skip to content

Commit

Permalink
fix(pagination): fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
skhamvon authored and dpellier committed Feb 26, 2024
1 parent 6d4343b commit 0250635
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -309,24 +309,24 @@ describe('e2e:osds-pagination', () => {
});

it('should adapt to default step of 25 if defaultItemsPerPage', async() => {
await setup({ attributes: { defaultCurrentPage: 1, defaultItemsPerPage: 25 , totalItems: 20 } });
await setup({ attributes: { defaultCurrentPage: 1, defaultItemsPerPage: 25 , totalItems: 30 } });

pageItemElements = await page.findAll('osds-pagination >>> ul > li:not([class="arrows"])');
expect(pageItemElements.length).toBe(1);
expect(pageItemElements.length).toBe(2);
});

it('should change the totalPages according to the selected step', async() => {
await setup({ attributes: { defaultCurrentPage: 1, totalItems: 20 } });
await setup({ attributes: { defaultCurrentPage: 1, totalItems: 30 } });

pageItemElements = await page.findAll('osds-pagination >>> ul > li:not([class="arrows"])');
expect(pageItemElements.length).toBe(2);
expect(pageItemElements.length).toBe(3);

const selectElement = await page.find('osds-pagination >>> osds-select');
selectElement.setProperty('value', 20);
await page.waitForChanges();

pageItemElements = await page.findAll('osds-pagination >>> ul > li:not([class="arrows"])');
expect(pageItemElements.length).toBe(1);
expect(pageItemElements.length).toBe(2);
});

it('should not allow to go to next page if the current page is the last one', async() => {
Expand Down Expand Up @@ -368,5 +368,12 @@ describe('e2e:osds-pagination', () => {
await page.waitForChanges();
expect(current).toBe(1);
});

it('should hide arrows navigation if total items is lower than item per page', async() => {
await setup({ attributes: { current: 1, defaultItemsPerPage: 25 , totalItems: 20 } });

pageItemElements = await page.findAll('osds-pagination >>> ul > li:not([class="arrows"])');
expect(pageItemElements.length).toBe(0);
});
});
});

0 comments on commit 0250635

Please sign in to comment.