Skip to content

Commit

Permalink
chore: update based on PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
Caleb Kang committed Aug 6, 2020
1 parent ac5a817 commit 9cd15bc
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 37 deletions.
4 changes: 2 additions & 2 deletions webui/elm/src/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,8 @@ updateWithRoute url model =
Page.ExperimentList.init model.previousExperimentListModel options
|> mapInit model experimentListInfo

Just Route.ExperimentReactList ->
( model, Navigation.load (Route.toString Route.ExperimentReactList) )
Just Route.ExperimentListReact ->
( model, Navigation.load (Route.toString Route.ExperimentListReact) )

Just (Route.Login maybeRedirect) ->
( model, goToLogin maybeRedirect )
Expand Down
4 changes: 2 additions & 2 deletions webui/elm/src/Route.elm
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ type Route
| CommandList CommandLikeListOptions
| ExperimentDetail Int
| ExperimentList ExperimentListOptions
| ExperimentReactList
| ExperimentListReact
| Login (Maybe Url.Url)
| Logout
| NotebookList CommandLikeListOptions
Expand Down Expand Up @@ -273,7 +273,7 @@ toString r =
in
absolute [ "ui", "experiments" ] parameters

ExperimentReactList ->
ExperimentListReact ->
absolute [ "det", "experiments" ] []

Login maybeRedirect ->
Expand Down
2 changes: 1 addition & 1 deletion webui/elm/src/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ sideTabs model =

tabs =
[ ( text "Dashboard", Route.Dashboard, i [ class "icon-user flex-grow-0", iconAttribute ] [] )
, ( text "Experiments", Route.ExperimentReactList, i [ class "icon-experiment flex-grow-0", iconAttribute ] [] )
, ( text "Experiments", Route.ExperimentListReact, i [ class "icon-experiment flex-grow-0", iconAttribute ] [] )
, ( text "Tasks", Route.TaskList, i [ class "icon-tasks flex-grow-0", iconAttribute ] [] )
, ( text "Cluster", Route.Cluster, i [ class "icon-cluster flex-grow-0", iconAttribute ] [] )
]
Expand Down
5 changes: 5 additions & 0 deletions webui/react/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ export const sidebarRoutes: RouteConfig[] = [
];
export const defaultSideBarRoute = sidebarRoutes[0];

// Add pages we don't want to expose to the public yet.
if (process.env.IS_DEV) {
// sidebarRoutes.push();
}

// Is the path going to be served from the same host?
const isDetRoute = (url: string): boolean => {
if (!isFullPath(url)) return true;
Expand Down
13 changes: 5 additions & 8 deletions webui/tests/cypress/integration/01-setup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ describe('setup', () => {
cy.get(recordSelector).should('have.lengthOf', 4);
});

it('should have 4 active experiments listed', () => {
cy.get(recordSelector).should('have.lengthOf', 4)
.each(($tr) => {
cy.wrap($tr).should('contain', 'Active');
});
it('should have 4 active or completed experiments listed', () => {
cy.get(recordSelector)
.should('have.lengthOf', 4)
.each(($tr) => cy.wrap($tr).contains(/(active|completed)/i));
});

it('should pause all experiments listed', () => {
Expand All @@ -27,9 +26,7 @@ describe('setup', () => {
/* eslint-disable-next-line cypress/no-unnecessary-waiting */
cy.wait(5000);
cy.get(recordSelector)
.each(($tr) => {
cy.wrap($tr).should('contain', 'Paused');
});
.each(($tr) => cy.wrap($tr).should('contain', 'Paused'));
cy.get('thead input[type=checkbox]').click();
});

Expand Down
16 changes: 9 additions & 7 deletions webui/tests/cypress/integration/02-experiments.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ describe('Experiment List', () => {
cy.visit('/det/experiments');
});

describe('batch buttons', () => {
describe('batch action buttons', () => {
it('should have 7 buttons', () => {
cy.get('thead input[type=checkbox]').click();
cy.get('[class*="TableBatch_actions_"] button').should('have.lengthOf', 7);
});

it('should have 2 disabled buttons', () => {
cy.get('[class*="TableBatch_actions_"] button[disabled]').should('have.lengthOf', 2);
});

describe('Open TensorBoard', () => {
it('should be enabled when all experiments are selected', () => {
cy.get('thead input[type=checkbox]').click();
Expand All @@ -33,12 +37,10 @@ describe('Experiment List', () => {
cy.get(recordSelector).should('have.length', 3);
});

// TODO: fix when Archived column has landed
// it('should default to hiding archived experiments', () => {
// cy.get('#experimentsList .filters input[type=checkbox]').should('not.have.attr', 'checked');
// cy.get(recordSelector).should('have.length', 3);
// cy.get(recordSelector).should('not.contain', 'Yes');
// });
it('should show archived column', () => {
cy.get('[class*="Toggle_base_"] button').click();
cy.get(`${recordSelector} .anticon-check`).should('have.lengthOf', 1);
});
});
});
});
69 changes: 52 additions & 17 deletions webui/tests/cypress/integration/02-tasks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,68 @@ describe('Task List', () => {
cy.visit('/det/tasks');
});

describe('launch notebooks', () => {
describe('Notebooks', () => {
before(() => {
cy.visit('/det/tasks');
cy.get('button[aria-label="Notebook"]').click();
});

it('should launch notebooks', () => {
cy.server();
cy.route('POST', /\/notebook.*/).as('createRequest');
cy.visit('/ui/notebooks');
cy.get('button').contains(/launch new notebook/i).click().click();
cy.get('#det-main-container button').contains(/launch new notebook/i).click().click();
cy.wait('@createRequest');
cy.visit('/det/tasks');
cy.get(recordSelector).should('have.lengthOf', 2);
});

it('should terminate notebook', () => {
cy.server();
cy.route('DELETE', /\/notebook.*/).as('terminateRequest');
cy.get(`${recordSelector}:first-child .ant-dropdown-trigger`).click();
cy.get('.ant-dropdown .ant-dropdown-menu-item').contains(/kill/i).click();
cy.wait('@terminateRequest');
cy.visit('/det/tasks');
cy.get(recordSelector).should('have.length', 2);
cy.get(recordSelector).contains(/terminated/i).should('be.visible');
});

after(() => {
cy.get('button[aria-label="Notebook"]').click();
});
});

describe('launch tensorboards', () => {
it('should launch tensorboards', () => {
describe('Tensorboards', () => {
before(() => {
cy.visit('/det/tasks');
cy.get('button[aria-label="Tensorboard"]').click();
});

it('should launch tensorboard', () => {
cy.server();
cy.route('POST', /\/tensorboard.*/).as('createRequest');
cy.visit('/det/experiments');
cy.get('thead input[type=checkbox]').click();
cy.get('[class*="TableBatch_actions_"] button:first-child')
.should('contain', 'Open TensorBoard')
cy.get('[class*="TableBatch_actions_"] button')
.contains(/open tensorBoard/i)
.click();
cy.wait('@createRequest');
cy.visit('/det/tasks');
cy.get(recordSelector).should('have.length', 3);
cy.get(recordSelector).should('have.lengthOf', 1);
});

it('should terminate tensorboard', () => {
cy.server();
cy.route('DELETE', /\/tensorboard.*/).as('terminateRequest');
cy.get(`${recordSelector}:first-child .ant-dropdown-trigger`).click();
cy.get('.ant-dropdown .ant-dropdown-menu-item').contains(/kill/i).click();
cy.wait('@terminateRequest');
cy.visit('/det/tasks');
cy.get(recordSelector).contains(/terminated/i).should('be.visible');
});

after(() => {
cy.get('button[aria-label="Tensorboard"]').click();
});
});

Expand All @@ -33,13 +77,4 @@ describe('Task List', () => {
cy.get('[class*="TableBatch_actions_"] button').should('have.lengthOf', 1);
});
});

describe('table filter', () => {
it('should filter notebooks by task type', () => {
cy.get('button[aria-label="Tensorboard"]').click();
cy.get(recordSelector).should('have.length', 1);
cy.get('button[aria-label="Tensorboard"]').click();
cy.get(recordSelector).should('have.length', 3);
});
});
});

0 comments on commit 9cd15bc

Please sign in to comment.