2021-01-03 15:55:41 +00:00
|
|
|
context('YouTube', () => {
|
|
|
|
beforeEach(() => cy.$login())
|
|
|
|
|
|
|
|
it('renders a placeholder screen', () => {
|
|
|
|
cy.$clickSidebarItem('YouTube Video')
|
|
|
|
cy.get('#youtubeWrapper').within(() => {
|
|
|
|
cy.get('.screen-header').should('contain.text', 'YouTube Video')
|
|
|
|
cy.findByTestId('youtube-placeholder').should('be.visible')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('searches for videos when a song is played', () => {
|
|
|
|
cy.$mockPlayback()
|
|
|
|
|
2021-05-23 11:42:18 +00:00
|
|
|
cy.intercept('/api/youtube/search/song/**', {
|
2021-01-03 15:55:41 +00:00
|
|
|
fixture: 'youtube-search.get.200.json'
|
|
|
|
})
|
|
|
|
|
|
|
|
cy.$clickSidebarItem('All Songs')
|
2022-04-26 09:46:31 +00:00
|
|
|
cy.get('#songsWrapper .song-item:first-child').dblclick()
|
2021-01-03 15:55:41 +00:00
|
|
|
|
|
|
|
cy.get('#extra').within(() => {
|
|
|
|
cy.get('#extraTabYouTube').click()
|
2022-05-13 12:40:04 +00:00
|
|
|
cy.findAllByTestId('youtube-search-result').should('have.length', 2)
|
2021-01-03 15:55:41 +00:00
|
|
|
cy.findByTestId('youtube-search-more-btn').click()
|
2022-05-13 12:40:04 +00:00
|
|
|
cy.findAllByTestId('youtube-search-result').should('have.length', 4)
|
2021-01-03 15:55:41 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('plays a video when a search result is clicked', () => {
|
|
|
|
cy.$mockPlayback()
|
|
|
|
|
|
|
|
cy.$clickSidebarItem('All Songs')
|
2022-04-26 09:46:31 +00:00
|
|
|
cy.get('#songsWrapper .song-item:first-child').dblclick()
|
2021-01-03 15:55:41 +00:00
|
|
|
|
|
|
|
cy.get('#extra').within(() => {
|
|
|
|
cy.get('#extraTabYouTube').click()
|
2022-05-10 23:01:48 +00:00
|
|
|
cy.get('[data-testid=youtube-search-result]:nth-child(2)').click()
|
2021-01-03 15:55:41 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
cy.url().should('contain', '/#!/youtube')
|
2021-01-03 16:24:35 +00:00
|
|
|
cy.$assertSidebarItemActive('YouTube Video')
|
2021-01-03 15:55:41 +00:00
|
|
|
cy.get('#youtubeWrapper .screen-header').should('contain', 'YouTube Video #2')
|
|
|
|
})
|
|
|
|
})
|