2021-01-01 19:53:58 +00:00
|
|
|
// Setting scrollBehavior to false because we don't want Cypress to scroll the row into view,
|
|
|
|
// causing the first row lost due to virtual scrolling.
|
|
|
|
context('Queuing', { scrollBehavior: false }, () => {
|
|
|
|
const MIN_SONG_ITEMS_SHOWN = 15
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.$mockPlayback()
|
|
|
|
cy.$login()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('allows shuffling all songs', () => {
|
|
|
|
cy.$clickSidebarItem('Current Queue')
|
|
|
|
|
|
|
|
cy.get('#queueWrapper').within(() => {
|
|
|
|
cy.findByText('Current Queue').should('be.visible')
|
2022-04-26 09:46:31 +00:00
|
|
|
cy.findByTestId('shuffle-library').click()
|
2022-04-27 21:43:00 +00:00
|
|
|
cy.$getSongRows().should('have.length.at.least', MIN_SONG_ITEMS_SHOWN)
|
|
|
|
cy.get('@rows').first().should('have.class', 'playing')
|
2021-01-01 19:53:58 +00:00
|
|
|
})
|
2021-01-02 22:19:33 +00:00
|
|
|
|
|
|
|
cy.$assertPlaying()
|
2021-01-01 19:53:58 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
it('clears the queue', () => {
|
|
|
|
cy.$clickSidebarItem('Current Queue')
|
|
|
|
|
|
|
|
cy.get('#queueWrapper').within(() => {
|
|
|
|
cy.findByText('Current Queue').should('be.visible')
|
2022-04-26 09:46:31 +00:00
|
|
|
cy.findByTestId('shuffle-library').click()
|
2022-04-27 21:43:00 +00:00
|
|
|
cy.$getSongRows().should('have.length.at.least', MIN_SONG_ITEMS_SHOWN)
|
|
|
|
cy.get('.screen-header [data-test=song-list-controls]').findByText('Clear').click()
|
|
|
|
cy.$getSongRows().should('have.length', 0)
|
2021-01-01 19:53:58 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('shuffles all from a song list screen', () => {
|
|
|
|
cy.$clickSidebarItem('All Songs')
|
|
|
|
|
|
|
|
cy.get('#songsWrapper').within(() => {
|
|
|
|
cy.get('.screen-header [data-test=btn-shuffle-all]').click()
|
|
|
|
cy.url().should('contains', '/#!/queue')
|
|
|
|
})
|
|
|
|
|
|
|
|
cy.get('#queueWrapper').within(() => {
|
2022-04-27 21:43:00 +00:00
|
|
|
cy.$getSongRows().should('have.length.at.least', MIN_SONG_ITEMS_SHOWN)
|
|
|
|
.first().should('have.class', 'playing')
|
2021-01-01 19:53:58 +00:00
|
|
|
})
|
2021-01-02 22:19:33 +00:00
|
|
|
|
|
|
|
cy.$assertPlaying()
|
2021-01-01 19:53:58 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
it('creates a queue from selected songs', () => {
|
2022-04-27 21:43:00 +00:00
|
|
|
cy.$shuffleSeveralSongs(3)
|
2021-01-01 19:53:58 +00:00
|
|
|
|
|
|
|
cy.get('#queueWrapper').within(() => {
|
2022-04-27 21:43:00 +00:00
|
|
|
cy.$getSongRows().should('have.length', 3)
|
|
|
|
.first().should('have.class', 'playing')
|
2021-01-01 19:53:58 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('deletes a song from queue', () => {
|
2022-04-27 21:43:00 +00:00
|
|
|
cy.$shuffleSeveralSongs(3)
|
2021-01-01 19:53:58 +00:00
|
|
|
|
|
|
|
cy.get('#queueWrapper').within(() => {
|
2022-04-27 21:43:00 +00:00
|
|
|
cy.$getSongRows().should('have.length', 3)
|
|
|
|
cy.get('@rows').first().type('{backspace}')
|
|
|
|
cy.$getSongRows().should('have.length', 2)
|
2021-01-01 19:53:58 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2021-01-02 10:28:07 +00:00
|
|
|
it('queues a song when plays it', () => {
|
2021-01-04 18:10:12 +00:00
|
|
|
cy.$shuffleSeveralSongs()
|
2021-01-02 10:28:07 +00:00
|
|
|
cy.$clickSidebarItem('All Songs')
|
|
|
|
|
2021-01-04 22:37:19 +00:00
|
|
|
cy.get('#songsWrapper').within(function () {
|
2022-04-27 21:43:00 +00:00
|
|
|
cy.$getSongRowAt(4).find('.title').invoke('text').as('title')
|
|
|
|
cy.$getSongRowAt(4).dblclick()
|
2021-01-02 10:28:07 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
cy.$clickSidebarItem('Current Queue')
|
2021-01-04 22:37:19 +00:00
|
|
|
cy.get('#queueWrapper').within(function () {
|
2022-04-27 21:43:00 +00:00
|
|
|
cy.$getSongRows().should('have.length', 4)
|
|
|
|
cy.$getSongRowAt(1).find('.title').should('have.text', this.title)
|
|
|
|
cy.$getSongRowAt(1).should('have.class', 'playing')
|
2021-01-02 10:28:07 +00:00
|
|
|
})
|
2021-01-02 22:19:33 +00:00
|
|
|
|
|
|
|
cy.$assertPlaying()
|
2021-01-02 10:28:07 +00:00
|
|
|
})
|
2021-01-04 18:10:12 +00:00
|
|
|
|
|
|
|
it('navigates through the queue', () => {
|
|
|
|
cy.$shuffleSeveralSongs()
|
2022-04-26 09:46:31 +00:00
|
|
|
cy.get('#queueWrapper .song-item:nth-child(1)').should('have.class', 'playing')
|
2021-01-04 18:10:12 +00:00
|
|
|
|
|
|
|
cy.findByTestId('play-next-btn').click({ force: true })
|
2022-04-26 09:46:31 +00:00
|
|
|
cy.get('#queueWrapper .song-item:nth-child(2)').should('have.class', 'playing')
|
2021-01-04 18:10:12 +00:00
|
|
|
cy.$assertPlaying()
|
|
|
|
|
|
|
|
cy.findByTestId('play-prev-btn').click({ force: true })
|
2022-04-26 09:46:31 +00:00
|
|
|
cy.get('#queueWrapper .song-item:nth-child(1)').should('have.class', 'playing')
|
2021-01-04 18:10:12 +00:00
|
|
|
cy.$assertPlaying()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('stops playing if reaches end of queue in no-repeat mode', () => {
|
|
|
|
cy.$shuffleSeveralSongs()
|
|
|
|
cy.findByTestId('play-next-btn').click({ force: true })
|
|
|
|
cy.findByTestId('play-next-btn').click({ force: true })
|
|
|
|
cy.findByTestId('play-next-btn').click({ force: true })
|
|
|
|
cy.$assertNotPlaying()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('rotates if reaches end of queue in repeat-all mode', () => {
|
|
|
|
cy.findByTestId('repeat-mode-switch').click()
|
|
|
|
|
|
|
|
cy.$shuffleSeveralSongs()
|
|
|
|
cy.findByTestId('play-next-btn').click({ force: true })
|
|
|
|
cy.findByTestId('play-next-btn').click({ force: true })
|
|
|
|
cy.findByTestId('play-next-btn').click({ force: true })
|
|
|
|
|
2022-04-26 09:46:31 +00:00
|
|
|
cy.get('#queueWrapper .song-item:nth-child(1)').should('have.class', 'playing')
|
2021-01-04 18:10:12 +00:00
|
|
|
cy.$assertPlaying()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('still moves to next song in repeat-one mode', () => {
|
|
|
|
cy.findByTestId('repeat-mode-switch').click()
|
|
|
|
cy.findByTestId('repeat-mode-switch').click()
|
|
|
|
|
|
|
|
cy.$shuffleSeveralSongs()
|
|
|
|
cy.findByTestId('play-next-btn').click({ force: true })
|
|
|
|
|
2022-04-26 09:46:31 +00:00
|
|
|
cy.get('#queueWrapper .song-item:nth-child(2)').should('have.class', 'playing')
|
2021-01-04 18:10:12 +00:00
|
|
|
cy.$assertPlaying()
|
|
|
|
})
|
2021-01-01 19:53:58 +00:00
|
|
|
})
|