From de9f44e09e244a1e5cdcaad630b25be3269fbe0d Mon Sep 17 00:00:00 2001 From: ShareVB Date: Mon, 18 Aug 2025 18:08:16 +0200 Subject: [PATCH] fix(Percentage Calculator): e2e test failing --- .../percentage-calculator.e2e.spec.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/tools/percentage-calculator/percentage-calculator.e2e.spec.ts b/src/tools/percentage-calculator/percentage-calculator.e2e.spec.ts index a8ef2d48..5cb07da2 100644 --- a/src/tools/percentage-calculator/percentage-calculator.e2e.spec.ts +++ b/src/tools/percentage-calculator/percentage-calculator.e2e.spec.ts @@ -10,27 +10,27 @@ test.describe('Tool - Percentage calculator', () => { }); test('Correctly works out percentages', async ({ page }) => { - await page.getByTestId('percentageX').locator('input').fill('123'); - await page.getByTestId('percentageY').locator('input').fill('456'); + await page.getByTestId('percentageX').locator('input').pressSequentially('123\n'); + await page.getByTestId('percentageY').locator('input').pressSequentially('456\n'); await expect(page.getByTestId('percentageResult').locator('input')).toHaveValue('560.88'); - await page.getByTestId('numberX').locator('input').fill('123'); - await page.getByTestId('numberY').locator('input').fill('456'); + await page.getByTestId('numberX').locator('input').pressSequentially('123\n'); + await page.getByTestId('numberY').locator('input').pressSequentially('456\n'); await expect(page.getByTestId('numberResult').locator('input')).toHaveValue('26.973684210526315'); - await page.getByTestId('numberFrom').locator('input').fill('123'); - await page.getByTestId('numberTo').locator('input').fill('456'); + await page.getByTestId('numberFrom').locator('input').pressSequentially('123\n'); + await page.getByTestId('numberTo').locator('input').pressSequentially('456\n'); await expect(page.getByTestId('percentageIncreaseDecrease').locator('input')).toHaveValue('270.7317073170732'); }); test('Displays empty results for incomplete input', async ({ page }) => { - await page.getByTestId('percentageX').locator('input').fill('123'); + await page.getByTestId('percentageX').locator('input').pressSequentially('123\n'); await expect(page.getByTestId('percentageResult').locator('input')).toHaveValue(''); - await page.getByTestId('numberY').locator('input').fill('456'); + await page.getByTestId('numberY').locator('input').pressSequentially('456\n'); await expect(page.getByTestId('numberResult').locator('input')).toHaveValue(''); - await page.getByTestId('numberFrom').locator('input').fill('123'); + await page.getByTestId('numberFrom').locator('input').pressSequentially('123\n'); await expect(page.getByTestId('percentageIncreaseDecrease').locator('input')).toHaveValue(''); }); });