Skip to content

Commit 02b3296

Browse files
committed
Add e2e tests for workflows-table view
Plus tests for broken links in dashboard
1 parent dd7632a commit 02b3296

File tree

6 files changed

+66
-15
lines changed

6 files changed

+66
-15
lines changed

src/views/Dashboard.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
7272
<v-layout wrap>
7373
<v-flex xs12 md6 lg6>
7474
<v-list three-line>
75-
<v-list-item to="/workflow-table">
75+
<v-list-item to="/workflow-table" data-cy="workflow-table-link">
7676
<v-list-item-avatar size="60" style="font-size: 2em;">
7777
<v-icon large>{{ svgPaths.table }}</v-icon>
7878
</v-list-item-avatar>
@@ -85,7 +85,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
8585
</v-list-item-subtitle>
8686
</v-list-item-content>
8787
</v-list-item>
88-
<v-list-item to="/user-profile">
88+
<v-list-item to="/user-profile" data-cy="user-settings-link">
8989
<v-list-item-avatar size="60" style="font-size: 2em;">
9090
<v-icon large>{{ svgPaths.settings }}</v-icon>
9191
</v-list-item-avatar>
@@ -120,7 +120,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
120120
</v-flex>
121121
<v-flex xs12 md6 lg6>
122122
<v-list three-line>
123-
<v-list-item href="#/guide">
123+
<v-list-item to="/guide" data-cy="quickstart-link">
124124
<v-list-item-avatar size="60" style="font-size: 2em;">
125125
<v-icon large>{{ svgPaths.quickstart }}</v-icon>
126126
</v-list-item-avatar>

src/views/WorkflowsTable.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
3939
:headers="headers"
4040
:items="workflowsTable"
4141
:loading="isLoading"
42+
data-cy="workflows-table"
4243
>
4344
<template slot="no-data" v-if="!isLoading">
4445
<v-alert

src/views/Workspace.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
-->
1717

1818
<template>
19-
<div>
19+
<div data-cy="workspace-view">
2020
<toolbar
2121
:views="views"
2222
:workflow-name="workflowName"

tests/e2e/specs/dashboard.cy.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,26 @@
1818
import { WorkflowStateOrder } from '@/model/WorkflowState.model'
1919

2020
describe('Dashboard', () => {
21-
it('Displays the Dashboard link as active on the left sidebar menu', () => {
21+
beforeEach(() => {
2222
cy.visit('/#/')
23+
})
24+
25+
it('Displays the Dashboard link as active on the left sidebar menu', () => {
2326
cy
2427
.get('div.v-list-item__title')
2528
.contains('Dashboard')
2629
.parent()
2730
.should('have.class', 'v-list-item--active')
2831
})
29-
it('Should display the icons', () => {
30-
cy.visit('/#/')
32+
33+
it('Displays the icons', () => {
3134
cy
3235
.get('.c-dashboard .v-icon:first')
3336
.find('svg')
3437
.should('be.visible')
3538
})
36-
it('Should display the states in order', () => {
37-
cy.visit('/#/')
39+
40+
it('Displays the states in order', () => {
3841
cy
3942
.get('#dashboard-workflows table tbody tr')
4043
.first()
@@ -44,11 +47,22 @@ describe('Dashboard', () => {
4447
})
4548
.should('equal', [...WorkflowStateOrder.entries()][0][0])
4649
})
47-
it('Should have disabled cylc hub button in single user mode', () => {
48-
cy.visit('/#/')
50+
51+
it('Disables cylc hub button in single user mode', () => {
4952
cy
5053
.get('#cylc-hub-button')
5154
.should('have.class', 'v-list-item--disabled')
5255
})
56+
57+
for (const ref of ['workflow-table-link', 'user-settings-link', 'quickstart-link']) {
58+
it(`Visits ${ref}`, () => {
59+
cy.get(`[data-cy=${ref}`)
60+
.click()
61+
cy.contains('Page not found', { matchCase: false })
62+
.should('not.exist')
63+
// Ideally we should check for HTTP 404 but our 404 page returns 200!
64+
// https://github.com/cylc/cylc-ui/issues/334
65+
})
66+
}
5367
// TODO: add test that verifies the dashboard content after we have reviewed how it should look like
5468
})
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* Copyright (C) NIWA & British Crown (Met Office) & Contributors.
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
describe('Workflows-Table view', () => {
19+
beforeEach(() => {
20+
cy.visit('/#/workflow-table')
21+
})
22+
23+
it("Opens mutation menu when clicking on a workflow's icon", () => {
24+
cy.get('[data-cy=workflows-table] .c-interactive:first')
25+
.click()
26+
.get('.c-mutation-menu-list:first')
27+
.should('be.visible')
28+
})
29+
30+
it('Opens workspace view when clicking on workflow', () => {
31+
cy.get('[data-cy=workflows-table]')
32+
.contains('td', 'one')
33+
.click()
34+
.get('[data-cy=workspace-view]')
35+
})
36+
})

tests/e2e/specs/workflow.cy.js renamed to tests/e2e/specs/workspace.cy.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
describe('Workflow view and component/widget', () => {
18+
describe('Workspace view and component/widget', () => {
1919
afterEach(() => {
2020
cy
2121
.get('.v-alert')
2222
.should('not.exist')
2323
})
2424

25-
it('Should display the Workflow component in the Workflow view, with a Tree widget', () => {
25+
it('Should display the Lumino component in the Workspace view, with a Tree widget', () => {
2626
cy.visit('/#/workspace/one')
2727
cy.get('.lm-TabBar-tabLabel').should('have.length', 1)
2828

@@ -93,7 +93,7 @@ describe('Workflow view and component/widget', () => {
9393
cy.get('.lm-TabBar-tabLabel').should('not.exist')
9494
})
9595

96-
it('Should remove widgets when leaving the Workflow view', () => {
96+
it('Should remove widgets when leaving the Workspace view', () => {
9797
cy.visit('/#/workspace/one')
9898
cy.get('.lm-TabBar-tabLabel').should('have.length', 1)
9999
// add a tree view
@@ -106,7 +106,7 @@ describe('Workflow view and component/widget', () => {
106106
cy.get('.lm-TabBar-tabLabel').should('not.exist')
107107
})
108108

109-
it('Should remove widgets when updating the Workflow view', () => {
109+
it('Should remove widgets when updating the Workspace view', () => {
110110
cy.visit('/#/workspace/one')
111111
cy.get('.lm-TabBar-tabLabel').should('have.length', 1)
112112
// add a tree view

0 commit comments

Comments
 (0)