Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
markgrahamdawson committed Apr 9, 2024
1 parent 10f43bf commit b9b4ef9
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/views/Analysis.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</v-defaults-provider>
</div>
<AnalysisTable
v-if="table"
v-if="table && filteredTasks.length"
:tasks="filteredTasks"
:timing-option="timingOption"
/>
<BoxPlot
v-else
v-if="!table && filteredTasks.length"
:tasks="filteredTasks"
:timing-option="timingOption"
sort-input-teleport-target="#analysis-toolbar"
Expand Down Expand Up @@ -244,7 +244,7 @@ export default {
* If true the anaysis will be shown in table format
* @type {import('vue').Ref<boolean>}
*/
const table = useInitialOptions('tasksFilter', { props, emit }, true)
const table = useInitialOptions('table', { props, emit }, true)
return {
tasksFilter,
Expand Down
88 changes: 88 additions & 0 deletions tests/e2e/specs/analysis.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,91 @@ describe('Analysis view', () => {
})
})
})

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')
}

describe('Filters and Options save state', () => {
const numTasks = sortedTasks.length
describe('Options save state', () => {
it.only('remembers table and box & whiskers toggle option when switching between workflows', () => {
cy.visit('/#/workspace/one')
addView('Analysis')
cy.get('.c-analysis [data-cy=box-plot-toggle]')
.click()
.get('.vue-apexcharts')
.should('be.visible')
// Navigate away
cy.visit('/#/')
cy.get('.c-dashboard')
// Navigate back
cy.visit('/#/workspace/one')
cy.get('.vue-apexcharts')
.should('be.visible')
})
})
describe('Filters save state', () => {
it('remembers task name, platform and timings when switching between workflows', () => {
cy.visit('/#/workspace/one')
addView('Analysis')
// Check default options
cy
.get('.c-analysis table > tbody > tr')
.should('have.length', numTasks)
.should('be.visible')
cy
.get('td')
.contains('30')
.should('be.visible')
// Set platform filter options
cy
.get('#c-analysis-filter-task-platforms')
.click({ force: true })
cy
.get('.v-list-item')
.contains('platform_1')
.click({ force: true })
// Set queue task name filter options
cy
.get('#c-analysis-filter-task-name')
.type('wait')
// Set task times filter options
cy
.get('#c-analysis-filter-task-timings')
.click({ force: true })
cy
.get('.v-list-item')
.contains('Queue')
.click({ force: true })
// Navigate away
cy.visit('/#/')
cy.get('.c-dashboard')
// Navigate back
cy.visit('/#/workspace/one')
// Check name filter
cy
.get('td')
.contains('waiting')
.should('be.visible')
// Check timing filter
cy
.get('td')
.contains('00:00:12')
.should('be.visible')
// Check platform filter
cy
.get('td')
.contains('platform_1')
.should('be.visible')
// Other checks
cy
.get('.c-analysis table > tbody > tr')
.should('have.length', 1)
.should('be.visible')
})
})
})

0 comments on commit b9b4ef9

Please sign in to comment.