Skip to content

Commit

Permalink
Add cypress test
Browse files Browse the repository at this point in the history
  • Loading branch information
UnniKohonen committed Aug 31, 2023
1 parent 6198c8a commit f55dc03
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/cypress/template/sidebar.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
describe('Sidebar', () => {
it('Contains tabs', () => {
// go to the Skosmos front page
cy.visit('/')
// click on the first vocabulary in the list
cy.get('#vocabulary-list').find('a').first().click()
// check that at least one nav-item exists and that it has a correctly formatted id
cy.get('#sidebar-tabs').find('.nav-item').first().invoke('attr', 'id').should('match', /\b(alphabetical|fullalphabetical|hierarchy|groups|changes)\b/)
// check that at least one tab-pane exists and that it has a correctly formatted id
cy.get('.tab-content').find('.tab-pane').first().invoke('attr', 'id').should('match', /\b(tab-(alphabetical|fullalpabetical|hierarchy|groups|changes))\b/)
// check that there is exactly one active tab
cy.get('#sidebar-tabs').find('.active').should('have.length', 1)
cy.get('.tab-content').find('.active').should('have.length', 1)
})
})

0 comments on commit f55dc03

Please sign in to comment.