Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VikaCep committed Jan 7, 2025
1 parent 409dc0b commit 9f543f1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/components/CheckForm/AlertsPerCheck/AlertItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const AlertItem = ({
<Input
aria-disabled={!selected}
type="number"
step="any"
id={`alert-threshold-${alert.type}`}
value={field.value ? field.value : threshold}
onChange={(e) => {
Expand Down Expand Up @@ -84,7 +85,6 @@ const getStyles = (theme: GrafanaTheme2) => ({
display: 'flex',
alignItems: 'center',
gap: theme.spacing(1),
marginBottom: theme.spacing(1),
}),

columnLabel: css({
Expand All @@ -95,7 +95,6 @@ const getStyles = (theme: GrafanaTheme2) => ({
}),

thresholdInput: css({
height: '50px',
marginLeft: '22px',
}),
});
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ describe('Api endpoint checks - common fields payload', () => {

const thresholdsInput = screen.getAllByLabelText(/^Threshold/)[0];

await user.click(screen.getByLabelText('ProbeFailedExecutionsTooHigh'));
await user.clear(thresholdsInput);
await user.type(thresholdsInput, '0.1');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,19 @@ describe(`HttpCheck - Section 4 (Alerting) payload`, () => {

expect(thresholdsInputs).toHaveLength(6);

await user.click(screen.getByLabelText('ProbeFailedExecutionsTooHigh'));
await user.clear(thresholdsInputs[0]);
await user.type(thresholdsInputs[0], '0.1');

await user.click(screen.getByLabelText('HTTPTargetCertificateCloseToExpiring'));
await user.clear(thresholdsInputs[1]);
await user.type(thresholdsInputs[1], '1');

await user.click(screen.getByLabelText('HTTPRequestDurationTooHighP50'));
await user.clear(thresholdsInputs[2]);
await user.type(thresholdsInputs[2], '2');

await user.click(screen.getByLabelText('HTTPRequestDurationTooHighP90'));
await user.clear(thresholdsInputs[3]);
await user.type(thresholdsInputs[3], '3');

Expand All @@ -61,15 +65,15 @@ describe(`HttpCheck - Section 4 (Alerting) payload`, () => {
{ name: 'ProbeFailedExecutionsTooHigh', threshold: 0.1 },
{
name: 'HTTPRequestDurationTooHighP50',
threshold: 1,
threshold: 2,
},
{
name: 'HTTPRequestDurationTooHighP90',
threshold: 2,
threshold: 3,
},
{
name: 'HTTPRequestDurationTooHighP95',
threshold: 3,
name: 'HTTPTargetCertificateCloseToExpiring',
threshold: 1,
},
],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { fillMandatoryFields } from '../../../../__testHelpers__/apiEndPoint';

const checkType = CheckType.PING;

describe(`HttpCheck - Section 4 (Alerting) payload`, () => {
describe(`PingCheck - Section 4 (Alerting) payload`, () => {
it(`has the correct default values`, async () => {
const { read, user } = await renderNewForm(checkType);
await fillMandatoryFields({ user, checkType });
Expand Down Expand Up @@ -40,15 +40,19 @@ describe(`HttpCheck - Section 4 (Alerting) payload`, () => {

expect(thresholdsInputs).toHaveLength(5);

await user.click(screen.getByLabelText('ProbeFailedExecutionsTooHigh'));
await user.clear(thresholdsInputs[0]);
await user.type(thresholdsInputs[0], '0.1');

await user.click(screen.getByLabelText('PingICMPDurationTooHighP50'));
await user.clear(thresholdsInputs[1]);
await user.type(thresholdsInputs[1], '1');

await user.click(screen.getByLabelText('PingICMPDurationTooHighP90'));
await user.clear(thresholdsInputs[2]);
await user.type(thresholdsInputs[2], '2');

await user.click(screen.getByLabelText('PingICMPDurationTooHighP95'));
await user.clear(thresholdsInputs[3]);
await user.type(thresholdsInputs[3], '3');

Expand Down

0 comments on commit 9f543f1

Please sign in to comment.