mirror of
https://github.com/koel/koel
synced 2024-11-24 13:13:05 +00:00
feat(test): add tests for adding songs into playlist from song list
This commit is contained in:
parent
20cdbfdbbb
commit
4e289a41c2
2 changed files with 33 additions and 1 deletions
|
@ -92,6 +92,38 @@ context('Playlists', () => {
|
|||
.and('contain', 'The playlist is currently empty.')
|
||||
})
|
||||
|
||||
it('creates a playlist directly from a song list', () => {
|
||||
cy.intercept('GET', '/api/playlist/1/songs', {
|
||||
fixture: 'playlist-songs.get.200.json'
|
||||
})
|
||||
|
||||
cy.intercept('PUT', '/api/playlist/1/sync', {
|
||||
fixture: 'playlist.post.200.json'
|
||||
})
|
||||
|
||||
const assertPlaylistSongCount = (count: number) => {
|
||||
cy.$clickSidebarItem('Simple Playlist')
|
||||
cy.get('#playlistWrapper tr.song-item').should('have.length', count)
|
||||
}
|
||||
|
||||
assertPlaylistSongCount(3)
|
||||
|
||||
cy.$clickSidebarItem('All Songs')
|
||||
|
||||
cy.get('#songsWrapper').within(() => {
|
||||
cy.get('tr.song-item:first-child').click()
|
||||
cy.get('tr.song-item:nth-child(2)').click({ shiftKey: true })
|
||||
cy.get('[data-test=add-to-btn]').click()
|
||||
cy.get('[data-test=add-to-menu]')
|
||||
.should('be.visible')
|
||||
.within(() => cy.findByText('Simple Playlist').click())
|
||||
.should('not.be.visible')
|
||||
})
|
||||
|
||||
cy.findByText('Added 2 songs into "Simple Playlist".').should('be.visible')
|
||||
assertPlaylistSongCount(5)
|
||||
})
|
||||
|
||||
it('updates a simple playlist from the sidebar', () => {
|
||||
cy.intercept('PUT', '/api/playlist/1', {})
|
||||
cy.intercept('GET', '/api/playlist/1/songs', {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e0ad4507c4839e3d39319cbb3d72103527906798
|
||||
Subproject commit 983ab6e19a12664a60aec1810b3113b426972edb
|
Loading…
Reference in a new issue