Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display trial status in trials table on dashboard #1071

Merged
merged 2 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions dashboard/src/src/__tests__/experiments.databasePage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
render,
screen,
queryByText,
queryAllByText,
queryByTitle,
fireEvent,
} from '@testing-library/react';
Expand Down Expand Up @@ -344,13 +345,17 @@ test('Test (de)select columns', async () => {
const valSubmitTime = '2019-11-19 15:41:16.985000';
const valStartTime = '2019-11-19 15:41:16.996000';
const valEndTime = '2019-11-19 21:58:02.820000';
const valStatus = 'completed';
const valObjective = '-0.7881121864177159';

// Check first row for ID, submit time, start time, end time and objective
// Check first row
expect(screen.queryByTitle(valID)).toBeInTheDocument();
expect(queryByText(container, valSubmitTime)).toBeInTheDocument();
expect(queryByText(container, valStartTime)).toBeInTheDocument();
expect(queryByText(container, valEndTime)).toBeInTheDocument();
// NB: All trials have status 'completed', so queryByText() will complain
// returning many elements, so we'd better use queryAllByText().
expect(queryAllByText(container, valStatus)).toHaveLength(10);
expect(queryByText(container, valObjective)).toBeInTheDocument();

// Locate options
Expand All @@ -360,12 +365,14 @@ test('Test (de)select columns', async () => {
const optionSubmitTime = queryByText(multiSelect, 'Submit time');
const optionStartTime = queryByText(multiSelect, 'Start time');
const optionEndTime = queryByText(multiSelect, 'End time');
const optionStatus = queryByText(multiSelect, 'Status');
const optionObjective = queryByText(multiSelect, 'Objective');
const optionSelectAll = queryByText(multiSelect, '(select all)');
expect(optionID).toBeInTheDocument();
expect(optionSubmitTime).toBeInTheDocument();
expect(optionStartTime).toBeInTheDocument();
expect(optionEndTime).toBeInTheDocument();
expect(optionStatus).toBeInTheDocument();
expect(optionObjective).toBeInTheDocument();
expect(optionSelectAll).toBeInTheDocument();

Expand All @@ -375,6 +382,7 @@ test('Test (de)select columns', async () => {
expect(queryByText(container, valSubmitTime)).toBeNull();
expect(queryByText(container, valStartTime)).toBeInTheDocument();
expect(queryByText(container, valEndTime)).toBeInTheDocument();
expect(queryAllByText(container, valStatus)).toHaveLength(10);
expect(queryByText(container, valObjective)).toBeInTheDocument();

// Deselect column objective and check first row
Expand All @@ -383,16 +391,19 @@ test('Test (de)select columns', async () => {
expect(queryByText(container, valSubmitTime)).toBeNull();
expect(queryByText(container, valStartTime)).toBeInTheDocument();
expect(queryByText(container, valEndTime)).toBeInTheDocument();
expect(queryAllByText(container, valStatus)).toHaveLength(10);
expect(queryByText(container, valObjective)).toBeNull();

// Deselect columns ID, start time, end time, and check first row
// Deselect columns ID, start time, end time, status, and check first row
await user.click(optionID);
await user.click(optionStartTime);
await user.click(optionEndTime);
await user.click(optionStatus);
expect(screen.queryByTitle(valID)).toBeNull();
expect(queryByText(container, valSubmitTime)).toBeNull();
expect(queryByText(container, valStartTime)).toBeNull();
expect(queryByText(container, valEndTime)).toBeNull();
expect(queryByText(container, valStatus)).toBeNull();
expect(queryByText(container, valObjective)).toBeNull();

// Click to 'select all' and check that all columns are now visible in first row
Expand All @@ -401,6 +412,7 @@ test('Test (de)select columns', async () => {
expect(queryByText(container, valSubmitTime)).toBeInTheDocument();
expect(queryByText(container, valStartTime)).toBeInTheDocument();
expect(queryByText(container, valEndTime)).toBeInTheDocument();
expect(queryAllByText(container, valStatus)).toHaveLength(10);
expect(queryByText(container, valObjective)).toBeInTheDocument();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ export class TrialsProvider {
accessorKey: 'endTime',
header: 'End time',
},
{
id: 'status',
accessorKey: 'status',
header: 'Status',
},
{
id: 'objective',
accessorKey: 'objective',
Expand Down