fix(Percentage Calculator): e2e test failing

This commit is contained in:
ShareVB committed 2025-08-18 18:08:16 +02:00
1 parent 87c7609bc8
commit de9f44e09e
1 file changed
+9 -9
@@ -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('');
});
});