mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-28 11:14:54 -04:00
chore(e2e): use expect().toBeCloseTo instead of Math.round (#10257)
Followup to https://codeberg.org/forgejo/forgejo/pulls/6799, https://codeberg.org/forgejo/forgejo/pulls/9057 toBeCloseTo() recently popped in autocomplete suggestions and it seems like a cleaner way than using Math.round Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10257 Reviewed-by: Otto <otto@codeberg.org> Co-authored-by: 0ko <0ko@noreply.codeberg.org> Co-committed-by: 0ko <0ko@noreply.codeberg.org>
This commit is contained in:
parent
7a6d53cb65
commit
3bf4f0275a
2 changed files with 3 additions and 4 deletions
|
|
@ -70,6 +70,5 @@ test('Switch CSS properties', async ({browser}) => {
|
|||
// E2E already runs clients with both fine and coarse pointer simulated
|
||||
// This test will verify that coarse-related CSS is working as intended
|
||||
const itemHeight = await page.evaluate(() => window.matchMedia('(pointer: coarse)').matches) ? 38 : 34;
|
||||
// In Firefox Math.round is needed because .height is 33.99998474121094
|
||||
expect(Math.round((await page.locator('#issue-filters .switch > .item:nth-child(1)').boundingBox()).height)).toBe(itemHeight);
|
||||
expect((await page.locator('#issue-filters .switch > .item:nth-child(1)').boundingBox()).height).toBeCloseTo(itemHeight);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ test('Usercards width', async ({page}) => {
|
|||
|
||||
for (let i = 1; i <= amount; i++) {
|
||||
const card = await page.locator(`.user-cards .card:nth-child(${i})`).boundingBox();
|
||||
widths.push(Math.round(card.width));
|
||||
widths.push(card.width);
|
||||
}
|
||||
|
||||
for (const width of widths) {
|
||||
expect(width).toBe(widths[0]);
|
||||
expect(width).toBeCloseTo(widths[0], 0);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue