2020-12-30 19:28:39 +00:00
|
|
|
context('Sidebar Functionalities', () => {
|
|
|
|
const commonMenuItems = [
|
|
|
|
['Home', '/#!/home'],
|
|
|
|
['Current Queue', '/#!/queue'],
|
|
|
|
['All Songs', '/#!/songs'],
|
|
|
|
['Albums', '/#!/albums'],
|
|
|
|
['Artists', '/#!/artists'],
|
|
|
|
['YouTube Video', '/#!/youtube'],
|
|
|
|
['Favorites', '/#!/favorites'],
|
|
|
|
['Recently Played', '/#!/recently-played'],
|
|
|
|
['Simple Playlist', '/#!/playlist/1']
|
|
|
|
]
|
|
|
|
|
|
|
|
const managementMenuItems = [
|
|
|
|
['Settings', '/#!/settings'],
|
|
|
|
['Upload', '/#!/upload'],
|
|
|
|
['Users', '/#!/users']
|
|
|
|
]
|
|
|
|
|
|
|
|
function assertMenuItem (text: string, url: string) {
|
2021-01-01 13:31:53 +00:00
|
|
|
cy.$clickSidebarItem(text)
|
|
|
|
cy.url().should('contain', url)
|
2020-12-30 19:28:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
it('contains menu items', () => {
|
|
|
|
cy.$login()
|
|
|
|
cy.$each(commonMenuItems, assertMenuItem)
|
|
|
|
cy.$each(managementMenuItems, assertMenuItem)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('does not contain management items for non-admins', () => {
|
|
|
|
cy.$loginAsNonAdmin()
|
|
|
|
cy.$each(commonMenuItems, assertMenuItem)
|
|
|
|
|
2022-04-27 22:03:05 +00:00
|
|
|
cy.$each(managementMenuItems, (text: string) => cy.get('#sidebar').findByText(text).should('not.exist'))
|
2020-12-30 19:28:39 +00:00
|
|
|
})
|
2021-01-03 15:21:36 +00:00
|
|
|
|
2021-01-04 23:29:54 +00:00
|
|
|
it('does not have a YouTube item if YouTube is not used', () => {
|
2021-01-03 15:21:36 +00:00
|
|
|
cy.$login({ useYouTube: false })
|
2022-04-27 22:03:05 +00:00
|
|
|
cy.get('#sidebar').findByText('YouTube Video').should('not.exist')
|
2021-01-03 15:21:36 +00:00
|
|
|
})
|
2020-12-30 19:28:39 +00:00
|
|
|
})
|