Skip to content

Commit

Permalink
added e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
markgrahamdawson committed Apr 2, 2024
1 parent b6ea973 commit 0ba3f73
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/views/Graph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,11 @@ export default {
},

mounted () {
if (!this.autoRefresh) {
// load the graph if the autorefresh is off
this.refreshTimer = setInterval(this.refresh, 1000)
this.refreshTimer = null
}
// compile & instantiate graphviz wasm
/** @type {Promise<Graphviz>} */
this.graphviz = Graphviz.load()
Expand Down
39 changes: 39 additions & 0 deletions tests/e2e/specs/graph.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,31 @@ function checkGraphLayoutPerformed ($el, depth = 0) {
}
}

function addView (view) {
cy.get('[data-cy=add-view-btn]').click()
cy.get(`#toolbar-add-${view}-view`).click()
// wait for menu to close
.should('not.be.exist')
}

function checkRemeberToolbarSettings (selector, stateBefore, stateAfter) {
cy
.get(selector)
.find('.v-btn')
.should(stateBefore, 'text-blue')
.click()
// Navigate away
cy.visit('/#/')
cy.get('.c-dashboard')
// Navigate back
cy.visit('/#/workspace/one')
waitForGraphLayout()
cy
.get(selector)
.find('.v-btn')
.should(stateAfter, 'text-blue')
}

describe('Graph View', () => {
it('should load', () => {
cy.visit('/#/graph/one')
Expand Down Expand Up @@ -69,4 +94,18 @@ describe('Graph View', () => {
.should('have.length', 10)
.should('be.visible')
})

it('remembers autorefresh setting when switching between workflows', () => {
cy.visit('/#/workspace/one')
addView('Graph')
waitForGraphLayout()
checkRemeberToolbarSettings('.autoRefresh', 'have.class', 'not.have.class')
})

it('remembers transpose setting when switching between workflows', () => {
cy.visit('/#/workspace/one')
addView('Graph')
waitForGraphLayout()
checkRemeberToolbarSettings('.transpose', 'not.have.class', 'have.class')
})
})

0 comments on commit 0ba3f73

Please sign in to comment.