mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
migration: cypress
This commit is contained in:
parent
7cb3e27ad8
commit
bc5f8e403a
19 changed files with 101 additions and 91 deletions
|
@ -54,7 +54,7 @@ context('Albums', { scrollBehavior: false }, () => {
|
|||
})
|
||||
|
||||
cy.get('#albumWrapper').within(() => {
|
||||
cy.get('tr.song-item').should('have.length.at.least', 1)
|
||||
cy.get('.song-item').should('have.length.at.least', 1)
|
||||
|
||||
cy.get('.screen-header').within(() => {
|
||||
cy.findByText('Download All').should('be.visible')
|
||||
|
|
|
@ -55,7 +55,7 @@ context('Artists', { scrollBehavior: false }, () => {
|
|||
})
|
||||
|
||||
cy.get('#artistWrapper').within(() => {
|
||||
cy.get('tr.song-item').should('have.length.at.least', 1)
|
||||
cy.get('.song-item').should('have.length.at.least', 1)
|
||||
|
||||
cy.get('.screen-header').within(() => {
|
||||
cy.findByText('Download All').should('be.visible')
|
||||
|
|
|
@ -7,7 +7,7 @@ context('Extra Information Panel', () => {
|
|||
})
|
||||
|
||||
it('displays an option to add lyrics if blank', () => {
|
||||
cy.fixture('info.get.200.json').then(data => {
|
||||
cy.fixture('song-info.get.200.json').then(data => {
|
||||
data.lyrics = null
|
||||
|
||||
cy.intercept('GET', '/api/**/info', {
|
||||
|
@ -17,7 +17,7 @@ context('Extra Information Panel', () => {
|
|||
})
|
||||
|
||||
cy.$clickSidebarItem('All Songs')
|
||||
cy.get('#songsWrapper tr.song-item:first-child').dblclick()
|
||||
cy.get('#songsWrapper .song-item:first-child').dblclick()
|
||||
|
||||
cy.get('#extraPanelLyrics').should('be.visible').and('contain.text', 'No lyrics found.')
|
||||
cy.get('#extraPanelLyrics [data-test=add-lyrics-btn]').click()
|
||||
|
@ -26,7 +26,7 @@ context('Extra Information Panel', () => {
|
|||
})
|
||||
})
|
||||
|
||||
it('displays the band information', () => {
|
||||
it('displays the artist information', () => {
|
||||
cy.$shuffleSeveralSongs()
|
||||
cy.get('#extraTabArtist').click()
|
||||
cy.get('#extraPanelArtist').should('be.visible').within(() => {
|
||||
|
|
|
@ -8,7 +8,7 @@ context('Favorites', { scrollBehavior: false }, () => {
|
|||
.within(() => {
|
||||
cy.findByText('Songs You Love').should('be.visible')
|
||||
cy.findByText('Download All').should('be.visible')
|
||||
cy.get('tr.song-item').should('have.length', 3)
|
||||
cy.get('.song-item').should('have.length', 3)
|
||||
.each(row => {
|
||||
cy.wrap(row)
|
||||
.get('[data-test=btn-like-liked]')
|
||||
|
@ -26,7 +26,7 @@ context('Favorites', { scrollBehavior: false }, () => {
|
|||
|
||||
cy.get('#songsWrapper')
|
||||
.within(() => {
|
||||
cy.get('tr.song-item:first-child [data-test=like-btn]')
|
||||
cy.get('.song-item:first-child [data-test=like-btn]')
|
||||
.within(() => cy.get('[data-test=btn-like-unliked]').should('be.visible'))
|
||||
.click()
|
||||
.within(() => cy.get('[data-test=btn-like-liked]').should('be.visible'))
|
||||
|
@ -44,7 +44,7 @@ context('Favorites', { scrollBehavior: false }, () => {
|
|||
|
||||
cy.get('#songsWrapper')
|
||||
.within(() => {
|
||||
cy.get('tr.song-item:first-child').click()
|
||||
cy.get('.song-item:first-child').click()
|
||||
cy.get('[data-test=add-to-btn]').click()
|
||||
cy.get('[data-test=add-to-menu]')
|
||||
.should('be.visible')
|
||||
|
@ -61,12 +61,12 @@ context('Favorites', { scrollBehavior: false }, () => {
|
|||
|
||||
cy.get('#favoritesWrapper')
|
||||
.within(() => {
|
||||
cy.get('tr.song-item:first-child')
|
||||
cy.get('.song-item:first-child')
|
||||
.should('contain.text', 'November')
|
||||
.within(() => cy.get('[data-test=like-btn]').click())
|
||||
|
||||
cy.get('tr.song-item').should('have.length', 2)
|
||||
cy.get('tr.song-item:first-child').should('not.contain.text', 'November')
|
||||
cy.get('.song-item').should('have.length', 2)
|
||||
cy.get('.song-item:first-child').should('not.contain.text', 'November')
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -76,13 +76,13 @@ context('Favorites', { scrollBehavior: false }, () => {
|
|||
|
||||
cy.get('#favoritesWrapper')
|
||||
.within(() => {
|
||||
cy.get('tr.song-item:first-child')
|
||||
cy.get('.song-item:first-child')
|
||||
.should('contain.text', 'November')
|
||||
.click()
|
||||
.type('{backspace}')
|
||||
|
||||
cy.get('tr.song-item').should('have.length', 2)
|
||||
cy.get('tr.song-item:first-child').should('not.contain.text', 'November')
|
||||
cy.get('.song-item').should('have.length', 2)
|
||||
cy.get('.song-item:first-child').should('not.contain.text', 'November')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -5,7 +5,7 @@ context('Footer Pane', () => {
|
|||
|
||||
cy.$clickSidebarItem('All Songs')
|
||||
|
||||
cy.get('#songsWrapper tr.song-item:first-child').dblclick().within(function () {
|
||||
cy.get('#songsWrapper .song-item:first-child').dblclick().within(function () {
|
||||
cy.get('.title').invoke('text').as('title')
|
||||
cy.get('.album').invoke('text').as('album')
|
||||
cy.get('.artist').invoke('text').as('artist')
|
||||
|
|
|
@ -7,9 +7,9 @@ context('Other Controls', () => {
|
|||
|
||||
it('likes/unlikes the current song', () => {
|
||||
cy.$findInTestId('other-controls [data-test=like-btn]').as('like').click()
|
||||
cy.get('#queueWrapper tr.song-item:first-child [data-test=btn-like-liked]').should('be.visible')
|
||||
cy.get('#queueWrapper .song-item:first-child [data-test=btn-like-liked]').should('be.visible')
|
||||
cy.get('@like').click()
|
||||
cy.get('#queueWrapper tr.song-item:first-child [data-test=btn-like-unliked]').should('be.visible')
|
||||
cy.get('#queueWrapper .song-item:first-child [data-test=btn-like-unliked]').should('be.visible')
|
||||
})
|
||||
|
||||
it('toggles the info panel', () => {
|
||||
|
|
|
@ -13,7 +13,7 @@ context('Playlists', () => {
|
|||
.should('be.visible')
|
||||
.and('contain', 'Simple Playlist')
|
||||
|
||||
cy.get('tr.song-item')
|
||||
cy.get('.song-item')
|
||||
.should('be.visible')
|
||||
.and('have.length', 3)
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ context('Profiles & Preferences', () => {
|
|||
cy.$login()
|
||||
cy.$mockPlayback()
|
||||
cy.$clickSidebarItem('Current Queue')
|
||||
cy.get('#queueWrapper').within(() => cy.findByText('shuffling all songs').click())
|
||||
cy.get('#queueWrapper').within(() => cy.findByTestId('shuffle-library').click())
|
||||
cy.findByTestId('album-art-overlay').should('exist')
|
||||
|
||||
cy.findByTestId('view-profile-link').click()
|
||||
|
|
|
@ -13,9 +13,9 @@ context('Queuing', { scrollBehavior: false }, () => {
|
|||
|
||||
cy.get('#queueWrapper').within(() => {
|
||||
cy.findByText('Current Queue').should('be.visible')
|
||||
cy.findByText('shuffling all songs').click()
|
||||
cy.get('tr.song-item').should('have.length.at.least', MIN_SONG_ITEMS_SHOWN)
|
||||
cy.get('tr.song-item:first-child').should('have.class', 'playing')
|
||||
cy.findByTestId('shuffle-library').click()
|
||||
cy.get('.song-item').should('have.length.at.least', MIN_SONG_ITEMS_SHOWN)
|
||||
cy.get('.song-item:first-child').should('have.class', 'playing')
|
||||
})
|
||||
|
||||
cy.$assertPlaying()
|
||||
|
@ -26,12 +26,13 @@ context('Queuing', { scrollBehavior: false }, () => {
|
|||
|
||||
cy.get('#queueWrapper').within(() => {
|
||||
cy.findByText('Current Queue').should('be.visible')
|
||||
cy.findByText('shuffling all songs').click()
|
||||
cy.get('tr.song-item').should('have.length.at.least', MIN_SONG_ITEMS_SHOWN)
|
||||
cy.findByTestId('shuffle-library').click()
|
||||
cy.get('').click()
|
||||
cy.get('.song-item').should('have.length.at.least', MIN_SONG_ITEMS_SHOWN)
|
||||
cy.get('.screen-header [data-test=song-list-controls]')
|
||||
.findByText('Clear')
|
||||
.click()
|
||||
cy.get('tr.song-item').should('have.length', 0)
|
||||
cy.get('.song-item').should('have.length', 0)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -44,8 +45,8 @@ context('Queuing', { scrollBehavior: false }, () => {
|
|||
})
|
||||
|
||||
cy.get('#queueWrapper').within(() => {
|
||||
cy.get('tr.song-item').should('have.length.at.least', MIN_SONG_ITEMS_SHOWN)
|
||||
cy.get('tr.song-item:first-child').should('have.class', 'playing')
|
||||
cy.get('.song-item').should('have.length.at.least', MIN_SONG_ITEMS_SHOWN)
|
||||
cy.get('.song-item:first-child').should('have.class', 'playing')
|
||||
})
|
||||
|
||||
cy.$assertPlaying()
|
||||
|
@ -55,8 +56,8 @@ context('Queuing', { scrollBehavior: false }, () => {
|
|||
cy.$shuffleSeveralSongs()
|
||||
|
||||
cy.get('#queueWrapper').within(() => {
|
||||
cy.get('tr.song-item').should('have.length', 3)
|
||||
cy.get('tr.song-item:first-child').should('have.class', 'playing')
|
||||
cy.get('.song-item').should('have.length', 3)
|
||||
cy.get('.song-item:first-child').should('have.class', 'playing')
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -64,9 +65,9 @@ context('Queuing', { scrollBehavior: false }, () => {
|
|||
cy.$shuffleSeveralSongs()
|
||||
|
||||
cy.get('#queueWrapper').within(() => {
|
||||
cy.get('tr.song-item').should('have.length', 3)
|
||||
cy.get('tr.song-item:first-child').type('{backspace}')
|
||||
cy.get('tr.song-item').should('have.length', 2)
|
||||
cy.get('.song-item').should('have.length', 3)
|
||||
cy.get('.song-item:first-child').type('{backspace}')
|
||||
cy.get('.song-item').should('have.length', 2)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -75,15 +76,15 @@ context('Queuing', { scrollBehavior: false }, () => {
|
|||
cy.$clickSidebarItem('All Songs')
|
||||
|
||||
cy.get('#songsWrapper').within(function () {
|
||||
cy.get('tr.song-item:nth-child(4) .title').invoke('text').as('title')
|
||||
cy.get('tr.song-item:nth-child(4)').dblclick()
|
||||
cy.get('.song-item:nth-child(4) .title').invoke('text').as('title')
|
||||
cy.get('.song-item:nth-child(4)').dblclick()
|
||||
})
|
||||
|
||||
cy.$clickSidebarItem('Current Queue')
|
||||
cy.get('#queueWrapper').within(function () {
|
||||
cy.get('tr.song-item').should('have.length', 4)
|
||||
cy.get(`tr.song-item:nth-child(2) .title`).should('have.text', this.title)
|
||||
cy.get('tr.song-item:nth-child(2)').should('have.class', 'playing')
|
||||
cy.get('.song-item').should('have.length', 4)
|
||||
cy.get(`.song-item:nth-child(2) .title`).should('have.text', this.title)
|
||||
cy.get('.song-item:nth-child(2)').should('have.class', 'playing')
|
||||
})
|
||||
|
||||
cy.$assertPlaying()
|
||||
|
@ -91,14 +92,14 @@ context('Queuing', { scrollBehavior: false }, () => {
|
|||
|
||||
it('navigates through the queue', () => {
|
||||
cy.$shuffleSeveralSongs()
|
||||
cy.get('#queueWrapper tr.song-item:nth-child(1)').should('have.class', 'playing')
|
||||
cy.get('#queueWrapper .song-item:nth-child(1)').should('have.class', 'playing')
|
||||
|
||||
cy.findByTestId('play-next-btn').click({ force: true })
|
||||
cy.get('#queueWrapper tr.song-item:nth-child(2)').should('have.class', 'playing')
|
||||
cy.get('#queueWrapper .song-item:nth-child(2)').should('have.class', 'playing')
|
||||
cy.$assertPlaying()
|
||||
|
||||
cy.findByTestId('play-prev-btn').click({ force: true })
|
||||
cy.get('#queueWrapper tr.song-item:nth-child(1)').should('have.class', 'playing')
|
||||
cy.get('#queueWrapper .song-item:nth-child(1)').should('have.class', 'playing')
|
||||
cy.$assertPlaying()
|
||||
})
|
||||
|
||||
|
@ -118,7 +119,7 @@ context('Queuing', { scrollBehavior: false }, () => {
|
|||
cy.findByTestId('play-next-btn').click({ force: true })
|
||||
cy.findByTestId('play-next-btn').click({ force: true })
|
||||
|
||||
cy.get('#queueWrapper tr.song-item:nth-child(1)').should('have.class', 'playing')
|
||||
cy.get('#queueWrapper .song-item:nth-child(1)').should('have.class', 'playing')
|
||||
cy.$assertPlaying()
|
||||
})
|
||||
|
||||
|
@ -129,7 +130,7 @@ context('Queuing', { scrollBehavior: false }, () => {
|
|||
cy.$shuffleSeveralSongs()
|
||||
cy.findByTestId('play-next-btn').click({ force: true })
|
||||
|
||||
cy.get('#queueWrapper tr.song-item:nth-child(2)').should('have.class', 'playing')
|
||||
cy.get('#queueWrapper .song-item:nth-child(2)').should('have.class', 'playing')
|
||||
cy.$assertPlaying()
|
||||
})
|
||||
})
|
||||
|
|
|
@ -38,7 +38,7 @@ context('Searching', () => {
|
|||
|
||||
cy.get('#songResultsWrapper').within(() => {
|
||||
cy.get('.screen-header').should('contain.text', 'Showing Songs for foo')
|
||||
cy.get('tr.song-item').should('have.length', 7)
|
||||
cy.get('.song-item').should('have.length', 7)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ context('Shortcut Keys', () => {
|
|||
cy.$mockPlayback()
|
||||
cy.$shuffleSeveralSongs()
|
||||
cy.get('body').type('j')
|
||||
cy.get('#queueWrapper tr.song-item:nth-child(2)').should('have.class', 'playing')
|
||||
cy.get('#queueWrapper .song-item:nth-child(2)').should('have.class', 'playing')
|
||||
cy.get('body').type('k')
|
||||
cy.get('#queueWrapper tr.song-item:nth-child(1)').should('have.class', 'playing')
|
||||
cy.get('#queueWrapper .song-item:nth-child(1)').should('have.class', 'playing')
|
||||
cy.$assertPlaying()
|
||||
})
|
||||
|
||||
|
@ -41,8 +41,8 @@ context('Shortcut Keys', () => {
|
|||
cy.$mockPlayback()
|
||||
cy.$shuffleSeveralSongs()
|
||||
cy.get('body').type('l')
|
||||
cy.get('#queueWrapper tr.song-item:first-child [data-test=btn-like-liked]').should('be.visible')
|
||||
cy.get('#queueWrapper .song-item:first-child [data-test=btn-like-liked]').should('be.visible')
|
||||
cy.get('body').type('l')
|
||||
cy.get('#queueWrapper tr.song-item:first-child [data-test=btn-like-unliked]').should('be.visible')
|
||||
cy.get('#queueWrapper .song-item:first-child [data-test=btn-like-unliked]').should('be.visible')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -5,8 +5,8 @@ context('Song Context Menu', { scrollBehavior: false }, () => {
|
|||
cy.$clickSidebarItem('All Songs')
|
||||
|
||||
cy.get('#songsWrapper').within(() => {
|
||||
cy.get('tr.song-item:first-child').dblclick()
|
||||
cy.get('tr.song-item:first-child').should('have.class', 'playing')
|
||||
cy.get('.song-item:first-child').dblclick()
|
||||
cy.get('.song-item:first-child').should('have.class', 'playing')
|
||||
})
|
||||
|
||||
cy.$assertPlaying()
|
||||
|
@ -18,7 +18,7 @@ context('Song Context Menu', { scrollBehavior: false }, () => {
|
|||
cy.$clickSidebarItem('All Songs')
|
||||
|
||||
cy.get('#songsWrapper').within(() => {
|
||||
cy.get('tr.song-item:first-child')
|
||||
cy.get('.song-item:first-child')
|
||||
.as('item')
|
||||
.rightclick()
|
||||
})
|
||||
|
@ -36,14 +36,14 @@ context('Song Context Menu', { scrollBehavior: false }, () => {
|
|||
cy.$login()
|
||||
cy.$clickSidebarItem('All Songs')
|
||||
|
||||
cy.get('#songsWrapper').within(() => cy.get('tr.song-item:first-child').rightclick())
|
||||
cy.get('#songsWrapper').within(() => cy.get('.song-item:first-child').rightclick())
|
||||
cy.findByTestId('song-context-menu').within(() => cy.findByText('Go to Album').click())
|
||||
|
||||
cy.get('#albumWrapper')
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
cy.get('.screen-header').should('be.visible')
|
||||
cy.get('tr.song-item').should('have.length.at.least', 1)
|
||||
cy.get('.song-item').should('have.length.at.least', 1)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -51,14 +51,14 @@ context('Song Context Menu', { scrollBehavior: false }, () => {
|
|||
cy.$login()
|
||||
cy.$clickSidebarItem('All Songs')
|
||||
|
||||
cy.get('#songsWrapper').within(() => cy.get('tr.song-item:first-child').rightclick())
|
||||
cy.get('#songsWrapper').within(() => cy.get('.song-item:first-child').rightclick())
|
||||
cy.findByTestId('song-context-menu').within(() => cy.findByText('Go to Artist').click())
|
||||
|
||||
cy.get('#artistWrapper')
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
cy.get('.screen-header').should('be.visible')
|
||||
cy.get('tr.song-item').should('have.length.at.least', 1)
|
||||
cy.get('.song-item').should('have.length.at.least', 1)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -74,13 +74,13 @@ context('Song Context Menu', { scrollBehavior: false }, () => {
|
|||
|
||||
let songTitle
|
||||
cy.get('#songsWrapper').within(() => {
|
||||
cy.get('tr.song-item:nth-child(4) .title')
|
||||
cy.get('.song-item:nth-child(4) .title')
|
||||
.invoke('text')
|
||||
.then(text => {
|
||||
songTitle = text
|
||||
})
|
||||
|
||||
cy.get('tr.song-item:nth-child(4)').rightclick()
|
||||
cy.get('.song-item:nth-child(4)').rightclick()
|
||||
})
|
||||
|
||||
cy.findByTestId('song-context-menu').within(() => {
|
||||
|
@ -90,8 +90,8 @@ context('Song Context Menu', { scrollBehavior: false }, () => {
|
|||
|
||||
cy.$clickSidebarItem('Current Queue')
|
||||
cy.get('#queueWrapper').within(() => {
|
||||
cy.get('tr.song-item').should('have.length', 4)
|
||||
cy.get(`tr.song-item:nth-child(${config.queuedPosition}) .title`).should('have.text', songTitle)
|
||||
cy.get('.song-item').should('have.length', 4)
|
||||
cy.get(`.song-item:nth-child(${config.queuedPosition}) .title`).should('have.text', songTitle)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -115,7 +115,7 @@ context('Song Context Menu', { scrollBehavior: false }, () => {
|
|||
if (config.songCount > 1) {
|
||||
cy.$selectSongRange(1, config.songCount).rightclick()
|
||||
} else {
|
||||
cy.get('tr.song-item:first-child').rightclick()
|
||||
cy.get('.song-item:first-child').rightclick()
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -132,7 +132,7 @@ context('Song Context Menu', { scrollBehavior: false }, () => {
|
|||
it('does not have smart playlists as target for adding songs', () => {
|
||||
cy.$login()
|
||||
cy.$clickSidebarItem('All Songs')
|
||||
cy.get('#songsWrapper').within(() => cy.get('tr.song-item:first-child').rightclick())
|
||||
cy.get('#songsWrapper').within(() => cy.get('.song-item:first-child').rightclick())
|
||||
|
||||
cy.findByTestId('song-context-menu')
|
||||
.within(() => {
|
||||
|
@ -150,7 +150,7 @@ context('Song Context Menu', { scrollBehavior: false }, () => {
|
|||
cy.$clickSidebarItem('All Songs')
|
||||
cy.$assertFavoriteSongCount(3)
|
||||
|
||||
cy.get('#songsWrapper').within(() => cy.get('tr.song-item:first-child').rightclick())
|
||||
cy.get('#songsWrapper').within(() => cy.get('.song-item:first-child').rightclick())
|
||||
cy.findByTestId('song-context-menu').within(() => {
|
||||
cy.findByText('Add To').click()
|
||||
cy.findByText('Favorites').click()
|
||||
|
@ -161,10 +161,10 @@ context('Song Context Menu', { scrollBehavior: false }, () => {
|
|||
|
||||
it('initiates editing a song', () => {
|
||||
cy.intercept('/api/**/info', {
|
||||
fixture: 'info.get.200.json'
|
||||
fixture: 'song-info.get.200.json'
|
||||
})
|
||||
|
||||
cy.get('#songsWrapper').within(() => cy.get('tr.song-item:first-child').rightclick())
|
||||
cy.get('#songsWrapper').within(() => cy.get('.song-item:first-child').rightclick())
|
||||
cy.findByTestId('song-context-menu').within(() => cy.findByText('Edit').click())
|
||||
cy.findByTestId('edit-song-form').should('be.visible')
|
||||
})
|
||||
|
@ -175,7 +175,7 @@ context('Song Context Menu', { scrollBehavior: false }, () => {
|
|||
cy.$login()
|
||||
cy.$clickSidebarItem('All Songs')
|
||||
|
||||
cy.get('#songsWrapper').within(() => cy.get('tr.song-item:first-child').rightclick())
|
||||
cy.get('#songsWrapper').within(() => cy.get('.song-item:first-child').rightclick())
|
||||
cy.findByTestId('song-context-menu').within(() => cy.findByText('Download').click())
|
||||
|
||||
cy.wait('@download')
|
||||
|
@ -185,7 +185,7 @@ context('Song Context Menu', { scrollBehavior: false }, () => {
|
|||
cy.$login({ allowDownload: false })
|
||||
cy.$clickSidebarItem('All Songs')
|
||||
|
||||
cy.get('#songsWrapper').within(() => cy.get('tr.song-item:first-child').rightclick())
|
||||
cy.get('#songsWrapper').within(() => cy.get('.song-item:first-child').rightclick())
|
||||
cy.findByTestId('song-context-menu').within(() => cy.findByText('Download').should('not.exist'))
|
||||
})
|
||||
|
||||
|
@ -193,7 +193,7 @@ context('Song Context Menu', { scrollBehavior: false }, () => {
|
|||
cy.$loginAsNonAdmin()
|
||||
cy.$clickSidebarItem('All Songs')
|
||||
|
||||
cy.get('#songsWrapper').within(() => cy.get('tr.song-item:first-child').rightclick())
|
||||
cy.get('#songsWrapper').within(() => cy.get('.song-item:first-child').rightclick())
|
||||
cy.findByTestId('song-context-menu').within(() => cy.findByText('Edit').should('not.exist'))
|
||||
})
|
||||
|
||||
|
@ -202,7 +202,7 @@ context('Song Context Menu', { scrollBehavior: false }, () => {
|
|||
cy.$clickSidebarItem('All Songs')
|
||||
|
||||
cy.window().then(window => cy.spy(window.document, 'execCommand').as('copy'))
|
||||
cy.get('#songsWrapper').within(() => cy.get('tr.song-item:first-child').rightclick())
|
||||
cy.get('#songsWrapper').within(() => cy.get('.song-item:first-child').rightclick())
|
||||
cy.findByTestId('song-context-menu').within(() => cy.findByText('Copy Shareable URL').click())
|
||||
cy.get('@copy').should('be.calledWithExactly', 'copy')
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
context('Song Editing', { scrollBehavior: false }, () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('/api/**/info', {
|
||||
fixture: 'info.get.200.json'
|
||||
fixture: 'song-info.get.200.json'
|
||||
})
|
||||
|
||||
cy.$login()
|
||||
|
@ -13,7 +13,7 @@ context('Song Editing', { scrollBehavior: false }, () => {
|
|||
fixture: 'songs.put.200.json'
|
||||
})
|
||||
|
||||
cy.get('#songsWrapper tr.song-item:first-child').rightclick()
|
||||
cy.get('#songsWrapper .song-item:first-child').rightclick()
|
||||
cy.findByTestId('song-context-menu').within(() => cy.findByText('Edit').click())
|
||||
|
||||
cy.findByTestId('edit-song-form').within(() => {
|
||||
|
@ -34,11 +34,11 @@ context('Song Editing', { scrollBehavior: false }, () => {
|
|||
|
||||
cy.findByText('Updated 1 song.').should('be.visible')
|
||||
cy.findByTestId('edit-song-form').should('not.exist')
|
||||
cy.get('#songsWrapper tr.song-item:first-child .title').should('have.text', 'New Title')
|
||||
cy.get('#songsWrapper .song-item:first-child .title').should('have.text', 'New Title')
|
||||
})
|
||||
|
||||
it('cancels editing', () => {
|
||||
cy.get('#songsWrapper tr.song-item:first-child').rightclick()
|
||||
cy.get('#songsWrapper .song-item:first-child').rightclick()
|
||||
cy.findByTestId('song-context-menu').within(() => cy.findByText('Edit').click())
|
||||
|
||||
cy.$findInTestId('edit-song-form .btn-cancel').click()
|
||||
|
@ -79,8 +79,8 @@ context('Song Editing', { scrollBehavior: false }, () => {
|
|||
cy.findByText('Updated 3 songs.').should('be.visible')
|
||||
cy.findByTestId('edit-song-form').should('not.exist')
|
||||
|
||||
cy.get('#songsWrapper tr.song-item:nth-child(1) .album').should('have.text', 'The Wall')
|
||||
cy.get('#songsWrapper tr.song-item:nth-child(2) .album').should('have.text', 'The Wall')
|
||||
cy.get('#songsWrapper tr.song-item:nth-child(3) .album').should('have.text', 'The Wall')
|
||||
cy.get('#songsWrapper .song-item:nth-child(1) .album').should('have.text', 'The Wall')
|
||||
cy.get('#songsWrapper .song-item:nth-child(2) .album').should('have.text', 'The Wall')
|
||||
cy.get('#songsWrapper .song-item:nth-child(3) .album').should('have.text', 'The Wall')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -17,7 +17,7 @@ context('YouTube', () => {
|
|||
})
|
||||
|
||||
cy.$clickSidebarItem('All Songs')
|
||||
cy.get('#songsWrapper tr.song-item:first-child').dblclick()
|
||||
cy.get('#songsWrapper .song-item:first-child').dblclick()
|
||||
|
||||
cy.get('#extra').within(() => {
|
||||
cy.get('#extraTabYouTube').click()
|
||||
|
@ -31,7 +31,7 @@ context('YouTube', () => {
|
|||
cy.$mockPlayback()
|
||||
|
||||
cy.$clickSidebarItem('All Songs')
|
||||
cy.get('#songsWrapper tr.song-item:first-child').dblclick()
|
||||
cy.get('#songsWrapper .song-item:first-child').dblclick()
|
||||
|
||||
cy.get('#extra').within(() => {
|
||||
cy.get('#extraTabYouTube').click()
|
||||
|
|
|
@ -18,7 +18,7 @@ Cypress.Commands.add('$login', (options: Partial<LoginOptions> = {}): Chainable<
|
|||
cy.fixture(mergedOptions.asAdmin ? 'data.get.200.json' : 'data-non-admin.get.200.json').then(data => {
|
||||
delete mergedOptions.asAdmin
|
||||
|
||||
cy.intercept('GET', 'api/data', {
|
||||
cy.intercept('api/data', {
|
||||
statusCode: 200,
|
||||
body: Object.assign(data, mergedOptions)
|
||||
})
|
||||
|
@ -54,16 +54,16 @@ Cypress.Commands.add('$clickSidebarItem', (sidebarItemText: string): Chainable<J
|
|||
})
|
||||
|
||||
Cypress.Commands.add('$mockPlayback', () => {
|
||||
cy.intercept('GET', '/play/**?api_token=mock-token', {
|
||||
cy.intercept('/play/**?api_token=mock-token', {
|
||||
fixture: 'sample.mp3'
|
||||
})
|
||||
|
||||
cy.intercept('GET', '/api/album/**/thumbnail', {
|
||||
cy.intercept('/api/album/**/thumbnail', {
|
||||
fixture: 'album-thumbnail.get.200.json'
|
||||
})
|
||||
|
||||
cy.intercept('GET', '/api/**/info', {
|
||||
fixture: 'info.get.200.json'
|
||||
cy.intercept('/api/song/**/info', {
|
||||
fixture: 'song-info.get.200.json'
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -72,8 +72,8 @@ Cypress.Commands.add('$shuffleSeveralSongs', (count = 3) => {
|
|||
cy.$clickSidebarItem('All Songs')
|
||||
|
||||
cy.get('#songsWrapper').within(() => {
|
||||
cy.get('tr.song-item:nth-child(1)').click()
|
||||
cy.get(`tr.song-item:nth-child(${count})`).click({
|
||||
cy.get('.song-item:nth-child(1)').click()
|
||||
cy.get(`.song-item:nth-child(${count})`).click({
|
||||
shiftKey: true
|
||||
})
|
||||
|
||||
|
@ -83,21 +83,21 @@ Cypress.Commands.add('$shuffleSeveralSongs', (count = 3) => {
|
|||
|
||||
Cypress.Commands.add('$assertPlaylistSongCount', (name: string, count: number) => {
|
||||
cy.$clickSidebarItem(name)
|
||||
cy.get('#playlistWrapper tr.song-item').should('have.length', count)
|
||||
cy.get('#playlistWrapper .song-item').should('have.length', count)
|
||||
cy.go('back')
|
||||
})
|
||||
|
||||
Cypress.Commands.add('$assertFavoriteSongCount', (count: number) => {
|
||||
cy.$clickSidebarItem('Favorites')
|
||||
cy.get('#favoritesWrapper').within(() => cy.get('tr.song-item').should('have.length', count))
|
||||
cy.get('#favoritesWrapper').within(() => cy.get('.song-item').should('have.length', count))
|
||||
cy.go('back')
|
||||
})
|
||||
|
||||
Cypress.Commands.add(
|
||||
'$selectSongRange',
|
||||
(start: number, end: number, scrollBehavior: scrollBehaviorOptions = false): Chainable<JQuery> => {
|
||||
cy.get(`tr.song-item:nth-child(${start})`).click()
|
||||
return cy.get(`tr.song-item:nth-child(${end})`).click({
|
||||
cy.get(`.song-item:nth-child(${start})`).click()
|
||||
return cy.get(`.song-item:nth-child(${end})`).click({
|
||||
scrollBehavior,
|
||||
shiftKey: true
|
||||
})
|
||||
|
|
|
@ -16,5 +16,8 @@
|
|||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
Cypress.on('uncaught:exception', () => {
|
||||
// returning false here prevents Cypress from failing the test
|
||||
// @see https://docs.cypress.io/api/events/catalog-of-events#Uncaught-Exceptions
|
||||
return false
|
||||
})
|
||||
|
|
2
cypress/types.d.ts
vendored
2
cypress/types.d.ts
vendored
|
@ -21,7 +21,7 @@ declare namespace Cypress {
|
|||
$mockPlayback(): void
|
||||
|
||||
/**
|
||||
* Queue several songs from the All Song screen.
|
||||
* Queue several songs from the "All Songs" screen.
|
||||
* @param count
|
||||
*/
|
||||
$shuffleSeveralSongs(count?: number): void
|
||||
|
|
|
@ -41,7 +41,13 @@
|
|||
No songs queued.
|
||||
<span class="d-block secondary">
|
||||
How about
|
||||
<a v-if="showShuffleLibraryButton" class="start" @click.prevent="playAll(true)">shuffling the whole library</a>?
|
||||
<a
|
||||
v-if="showShuffleLibraryButton"
|
||||
data-testid="shuffle-library"
|
||||
class="start" @click.prevent="playAll(true)"
|
||||
>
|
||||
shuffling the whole library
|
||||
</a>?
|
||||
</span>
|
||||
</ScreenEmptyState>
|
||||
</section>
|
||||
|
|
Loading…
Reference in a new issue