mirror of
https://github.com/koel/koel
synced 2024-12-14 22:52:28 +00:00
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
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) {
|
|
cy.$clickSidebarItem(text)
|
|
cy.url().should('contain', url)
|
|
}
|
|
|
|
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)
|
|
|
|
cy.$each(managementMenuItems, (text: string) => {
|
|
cy.get('#sidebar')
|
|
.findByText(text)
|
|
.should('not.exist')
|
|
})
|
|
})
|
|
})
|