Skip to content

Commit

Permalink
Bug 1841022 - Add tests for the Debug Tools column in alerts view
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Ionescu committed Jun 30, 2023
1 parent 210a73e commit 4dd4571
Show file tree
Hide file tree
Showing 3 changed files with 255 additions and 2 deletions.
161 changes: 161 additions & 0 deletions tests/ui/mock/alert_summaries.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,167 @@
"assignee_username": null,
"assignee_email": null
},
{
"id": 38857,
"push_id": 1260291,
"prev_push_id": 1260284,
"created": "2023-06-23T11:16:45.819043",
"triage_due_date": "2023-06-28T11:16:45.819043",
"repository": "autoland",
"framework": 13,
"alerts": [
{
"id": 177726,
"status": 0,
"series_signature": {
"id": 3777239,
"framework_id": 13,
"signature_hash": "635a1c917ca6f35569cf5fed4a1e420b99f3386b",
"machine_platform": "linux1804-64-shippable-qr",
"suite": "imgur",
"test": "SpeedIndex",
"lower_is_better": true,
"has_subtests": false,
"option_collection_hash": "102210fe594ee9b33d82058545b1ed14f4c8206e",
"tags": [
"cold",
"fission",
"webrender"
],
"extra_options": [
"cold",
"fission",
"webrender"
],
"measurement_unit": "ms",
"suite_public_name": null,
"test_public_name": null
},
"is_regression": false,
"prev_value": 1295.34,
"new_value": 1242.71,
"t_value": 7.06,
"amount_abs": -52.63,
"amount_pct": 4.06,
"summary_id": 38857,
"related_summary_id": null,
"manually_created": false,
"classifier": "mozilla-ldap/aionescu@mozilla.com",
"starred": false,
"classifier_email": "aionescu@mozilla.com",
"backfill_record": {
"context": "[]",
"status": 3,
"total_actions_triggered": 4,
"total_backfills_failed": 0,
"total_backfills_successful": 5,
"total_backfills_in_progress": 0
},
"noise_profile": "OK",
"title": "imgur SpeedIndex linux1804-64-shippable-qr opt cold fission webrender"
},
{
"id": 177727,
"status": 0,
"series_signature": {
"id": 3777240,
"framework_id": 13,
"signature_hash": "a8b7d746763f7da0a98c9b8bb97f6e23c8815655",
"machine_platform": "linux1804-64-shippable-qr",
"suite": "imgur",
"test": "FirstVisualChange",
"lower_is_better": true,
"has_subtests": false,
"option_collection_hash": "102210fe594ee9b33d82058545b1ed14f4c8206e",
"tags": [
"cold",
"fission",
"webrender"
],
"extra_options": [
"cold",
"fission",
"webrender"
],
"measurement_unit": "ms",
"suite_public_name": null,
"test_public_name": null
},
"is_regression": true,
"prev_value": 415.81,
"new_value": 490.25,
"t_value": 7.06,
"amount_abs": 74.44,
"amount_pct": 17.9,
"summary_id": 38857,
"related_summary_id": null,
"manually_created": false,
"classifier": "mozilla-ldap/aionescu@mozilla.com",
"starred": false,
"classifier_email": "aionescu@mozilla.com",
"backfill_record": null,
"noise_profile": "SKEWED",
"title": "imgur FirstVisualChange linux1804-64-shippable-qr opt cold fission webrender"
},
{
"id": 177724,
"status": 0,
"series_signature": {
"id": 3777242,
"framework_id": 13,
"signature_hash": "351e863dd09af73f6756585908eef7a42b87f35a",
"machine_platform": "linux1804-64-shippable-qr",
"suite": "imgur",
"test": "ContentfulSpeedIndex",
"lower_is_better": true,
"has_subtests": false,
"option_collection_hash": "102210fe594ee9b33d82058545b1ed14f4c8206e",
"tags": [
"cold",
"fission",
"webrender"
],
"extra_options": [
"cold",
"fission",
"webrender"
],
"measurement_unit": "ms",
"suite_public_name": null,
"test_public_name": null
},
"is_regression": false,
"prev_value": 1403.18,
"new_value": 1317.94,
"t_value": 7,
"amount_abs": -85.23,
"amount_pct": 6.07,
"summary_id": 38857,
"related_summary_id": null,
"manually_created": false,
"classifier": "mozilla-ldap/aionescu@mozilla.com",
"starred": false,
"classifier_email": "aionescu@mozilla.com",
"backfill_record": null,
"noise_profile": "OK",
"title": "imgur ContentfulSpeedIndex linux1804-64-shippable-qr opt cold fission webrender"
}
],
"related_alerts": [],
"status": 0,
"bug_number": null,
"bug_updated": null,
"issue_tracker": 1,
"notes": null,
"revision": "ed3672832487424625691069c34d5cd1c4800783",
"push_timestamp": 1687264464,
"prev_push_revision": "5ade2b37847325019878bde832493c342759d7eb",
"assignee_username": "mozilla-ldap/aesanu@mozilla.com",
"assignee_email": "aesanu@mozilla.com",
"performance_tags": [
"infra"
]
},
{
"id": 20239,
"push_id": 480946,
Expand Down
94 changes: 92 additions & 2 deletions tests/ui/perfherder/alerts-view/alerts_test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ test('Alerts retriggered by the backfill bot have a title', async () => {
const { queryAllByTitle } = alertsViewControls();

const titles = await waitFor(() => queryAllByTitle(backfillRetriggeredTitle));
expect(titles).toHaveLength(2);
expect(titles).toHaveLength(3);
});

describe('"My alerts" checkbox\'s display behaviors', () => {
Expand Down Expand Up @@ -560,11 +560,12 @@ test('Framework name is displayed near alert summary', async () => {

const frameworkName = await waitFor(() => queryAllByText(dummyFrameworkName));
// one summary from testAlertSummaries have one bad framework id
expect(frameworkName).toHaveLength(testAlertSummaries.length - 1);
expect(frameworkName).toHaveLength(1);
});

test('Correct message is displayed if the framework id is invalid', async () => {
const { queryAllByText } = alertsViewControls();
// console.log(alertsViewControls());

const frameworkName = await waitFor(() =>
queryAllByText(unknownFrameworkMessage),
Expand Down Expand Up @@ -834,6 +835,7 @@ test('Next alert button should be disable when reaching the last alert', async (

expect(nextScrollButton).not.toBeDisabled();

fireEvent.click(nextScrollButton);
fireEvent.click(nextScrollButton);
fireEvent.click(nextScrollButton);

Expand Down Expand Up @@ -869,6 +871,23 @@ test('Sherlock status 0 in tooltip on alerts', async () => {
await waitFor(() => getByText(alertBackfillResultVisual.preliminary.message));
});

test(`Sherlock status 0 in tooltip on alerts Debug Tools column not contains side-by-side icon`, async () => {
const alert = testAlertSummaries[1].alerts[0];
alert.backfill_record.status = alertBackfillResultStatusMap.preliminary;
expect(alert.id).toBe(177726);

const { getByTestId, getByText, queryByTestId } = alertsViewControls();
// hovering over the Sherlock icon should display the tooltip
const sherlockIcon = await waitFor(() =>
getByTestId(`alert ${alert.id.toString()} sherlock icon`),
);
fireEvent.mouseOver(sherlockIcon);
await waitFor(() => getByText(alertBackfillResultVisual.preliminary.message));
expect(
queryByTestId(`alert ${alert.id.toString()} side-by-side icon`),
).not.toBeInTheDocument();
});

test('Sherlock status 1 in tooltip on alerts', async () => {
const alert = testAlertSummaries[0].alerts[3];
alert.backfill_record.status =
Expand All @@ -886,6 +905,23 @@ test('Sherlock status 1 in tooltip on alerts', async () => {
);
});

test(`Sherlock status 1 in tooltip on alerts Debug Tools column not contains side-by-side icon`, async () => {
const alert = testAlertSummaries[1].alerts[0];
alert.backfill_record.status = alertBackfillResultStatusMap.readyForProcessing;
expect(alert.id).toBe(177726);

const { getByTestId, getByText, queryByTestId } = alertsViewControls();
// hovering over the Sherlock icon should display the tooltip
const sherlockIcon = await waitFor(() =>
getByTestId(`alert ${alert.id.toString()} sherlock icon`),
);
fireEvent.mouseOver(sherlockIcon);
await waitFor(() => getByText(alertBackfillResultVisual.readyForProcessing.message));
expect(
queryByTestId(`alert ${alert.id.toString()} side-by-side icon`),
).not.toBeInTheDocument();
});

test('Sherlock status 2 in tooltip on alerts', async () => {
const alert = testAlertSummaries[0].alerts[3];
alert.backfill_record.status = alertBackfillResultStatusMap.backfilled;
Expand All @@ -900,6 +936,24 @@ test('Sherlock status 2 in tooltip on alerts', async () => {
await waitFor(() => getByText(alertBackfillResultVisual.backfilled.message));
});

test(`Sherlock status 2 in tooltip on alerts Debug Tools column contains side-by-side icon`, async () => {
const alert = testAlertSummaries[1].alerts[0];
alert.backfill_record.status = alertBackfillResultStatusMap.backfilled;
expect(alert.id).toBe(177726);

const { getByTestId, getByText } = alertsViewControls();
// hovering over the Sherlock icon should display the tooltip
const sherlockIcon = await waitFor(() =>
getByTestId(`alert ${alert.id.toString()} sherlock icon`),
);
fireEvent.mouseOver(sherlockIcon);
await waitFor(() => getByText(alertBackfillResultVisual.backfilled.message));
const sxsIcon = await waitFor(() =>
getByTestId(`alert ${alert.id.toString()} side-by-side icon`),
);
expect(sxsIcon).toBeInTheDocument();
});

test('Sherlock status 3 in tooltip on alerts', async () => {
const alert = testAlertSummaries[0].alerts[3];
alert.backfill_record.status = alertBackfillResultStatusMap.successful;
Expand All @@ -914,6 +968,24 @@ test('Sherlock status 3 in tooltip on alerts', async () => {
await waitFor(() => getByText(alertBackfillResultVisual.successful.message));
});

test(`Sherlock status 3 in tooltip on alerts Debug Tools column contains side-by-side icon`, async () => {
const alert = testAlertSummaries[1].alerts[0];
alert.backfill_record.status = alertBackfillResultStatusMap.successful;
expect(alert.id).toBe(177726);

const { getByTestId, getByText } = alertsViewControls();
// hovering over the Sherlock icon should display the tooltip
const sherlockIcon = await waitFor(() =>
getByTestId(`alert ${alert.id.toString()} sherlock icon`),
);
fireEvent.mouseOver(sherlockIcon);
await waitFor(() => getByText(alertBackfillResultVisual.successful.message));
const sxsIcon = await waitFor(() =>
getByTestId(`alert ${alert.id.toString()} side-by-side icon`),
);
expect(sxsIcon).toBeInTheDocument();
});

test('Sherlock status 4 in tooltip on alerts', async () => {
const alert = testAlertSummaries[0].alerts[3];
alert.backfill_record.status = alertBackfillResultStatusMap.failed;
Expand All @@ -928,6 +1000,24 @@ test('Sherlock status 4 in tooltip on alerts', async () => {
await waitFor(() => getByText(alertBackfillResultVisual.failed.message));
});

test(`Sherlock status 4 in tooltip on alerts Debug Tools column contains side-by-side icon`, async () => {
const alert = testAlertSummaries[1].alerts[0];
alert.backfill_record.status = alertBackfillResultStatusMap.failed;
expect(alert.id).toBe(177726);

const { getByTestId, getByText } = alertsViewControls();
// hovering over the Sherlock icon should display the tooltip
const sherlockIcon = await waitFor(() =>
getByTestId(`alert ${alert.id.toString()} sherlock icon`),
);
fireEvent.mouseOver(sherlockIcon);
await waitFor(() => getByText(alertBackfillResultVisual.failed.message));
const sxsIcon = await waitFor(() =>
getByTestId(`alert ${alert.id.toString()} side-by-side icon`),
);
expect(sxsIcon).toBeInTheDocument();
});

test("Alert's ID can be copied to clipboard", async () => {
const { queryAllByTitle } = alertsViewControls();
Object.assign(navigator, {
Expand Down
2 changes: 2 additions & 0 deletions ui/perfherder/alerts/AlertTableRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ export default class AlertTableRow extends React.Component {
/>
}
tooltipText={sherlockTooltip}
// data-testid={`alert ${alert.id.toString()} sherlock text`}
/>
</span>
)}
Expand All @@ -520,6 +521,7 @@ export default class AlertTableRow extends React.Component {
<FontAwesomeIcon
title="Open side-by-side link"
icon={faCirclePlay}
data-testid={`alert ${alert.id.toString()} side-by-side icon`}
/>
</a>
</span>
Expand Down

0 comments on commit 4dd4571

Please sign in to comment.