mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
fix: integration tests
This commit is contained in:
parent
d616e00265
commit
2cb2b2aad6
8 changed files with 19 additions and 16 deletions
|
@ -9,13 +9,13 @@ context('Albums', { scrollBehavior: false }, () => {
|
|||
cy.get('.screen-header').should('be.visible').and('contain.text', 'Albums')
|
||||
cy.findByTestId('view-mode-thumbnail').should('be.visible').and('have.class', 'active')
|
||||
cy.findByTestId('view-mode-list').should('be.visible').and('not.have.class', 'active')
|
||||
cy.findByTestId('album-card').should('have.length', 7)
|
||||
cy.findAllByTestId('album-card').should('have.length', 7)
|
||||
})
|
||||
})
|
||||
|
||||
it('changes display mode', () => {
|
||||
cy.get('#albumsWrapper').should('be.visible').within(() => {
|
||||
cy.findByTestId('album-card').should('have.length', 7)
|
||||
cy.findAllByTestId('album-card').should('have.length', 7)
|
||||
cy.findByTestId('view-mode-list').click()
|
||||
cy.get('[data-testid=album-card].compact').should('have.length', 7)
|
||||
cy.findByTestId('view-mode-thumbnail').click()
|
||||
|
@ -58,10 +58,10 @@ context('Albums', { scrollBehavior: false }, () => {
|
|||
cy.get('.cover').should('be.visible')
|
||||
|
||||
cy.findByTestId('album-info-tracks').should('be.visible').within(() => {
|
||||
// out of 4 tracks, 3 are already available in Koel. The last one has a link to iTunes.
|
||||
// out of 4 tracks, 3 are already available in Koel. The last one has a link to Apple Music.
|
||||
cy.get('li').should('have.length', 4)
|
||||
cy.get('li.available').should('have.length', 3)
|
||||
cy.get('li:last-child a.view-on-itunes').should('be.visible')
|
||||
cy.get('li:last-child a[title="Preview and buy this song on Apple Music"]').should('be.visible')
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -9,17 +9,17 @@ context('Artists', { scrollBehavior: false }, () => {
|
|||
cy.get('.screen-header').should('be.visible').and('contain.text', 'Artists')
|
||||
cy.findByTestId('view-mode-thumbnail').should('be.visible').and('have.class', 'active')
|
||||
cy.findByTestId('view-mode-list').should('be.visible').and('not.have.class', 'active')
|
||||
cy.findByTestId('artist-card').should('have.length', 1)
|
||||
cy.findAllByTestId('artist-card').should('have.length', 1)
|
||||
})
|
||||
})
|
||||
|
||||
it('changes display mode', () => {
|
||||
cy.get('#artistsWrapper').should('be.visible').within(() => {
|
||||
cy.findByTestId('artist-card').should('have.length', 1)
|
||||
cy.findAllByTestId('artist-card').should('have.length', 1)
|
||||
cy.findByTestId('view-mode-list').click()
|
||||
cy.findByTestId('artist-card].compact').should('have.length', 1)
|
||||
cy.get('[data-testid=artist-card].compact').should('have.length', 1)
|
||||
cy.findByTestId('view-mode-thumbnail').click()
|
||||
cy.$findInTestId('artist-card .full').should('have.length', 1)
|
||||
cy.get('[data-testid=artist-card].full').should('have.length', 1)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ context('Shortcut Keys', () => {
|
|||
|
||||
it('shuffles all songs by default when Space is pressed', () => {
|
||||
cy.fixture('data.get.200.json').then(data => {
|
||||
cy.get('body').type(' ', { force: true })
|
||||
cy.get('body').type(' ')
|
||||
cy.$assertSidebarItemActive('Current Queue')
|
||||
cy.$assertPlaying()
|
||||
cy.get('#queueWrapper .screen-header').should('contain.text', `${data.songs.length} songs`)
|
||||
|
|
|
@ -34,7 +34,7 @@ context('Uploading', () => {
|
|||
cy.findByTestId('upload-item').should('have.length', 1).and('be.visible')
|
||||
cy.wait('@failedUpload')
|
||||
|
||||
cy.findByTestId('upload-item').should('have.length', 1).should('have.class', 'Errored')
|
||||
cy.findByTestId('upload-item').should('have.length', 1).should('have.class', 'errored')
|
||||
}
|
||||
|
||||
it('uploads songs', () => {
|
||||
|
|
|
@ -6,7 +6,7 @@ context('User Management', () => {
|
|||
|
||||
it('shows the list of users', () => {
|
||||
cy.get('#usersWrapper').within(() => {
|
||||
cy.findByTestId('user-card').should('have.length', 3).and('be.visible')
|
||||
cy.findAllByTestId('user-card').should('have.length', 3).and('be.visible')
|
||||
|
||||
cy.get('[data-testid=user-card].me').within(() => {
|
||||
cy.findByTitle('This is you!').should('be.visible')
|
||||
|
@ -31,7 +31,7 @@ context('User Management', () => {
|
|||
})
|
||||
|
||||
cy.findByText('New user "Charles" created.').should('be.visible')
|
||||
cy.findByTestId('user-card').should('have.length', 4)
|
||||
cy.findAllByTestId('user-card').should('have.length', 4)
|
||||
|
||||
cy.get('#usersWrapper [data-testid=user-card]:first-child').within(() => {
|
||||
cy.findByText('Charles').should('be.visible')
|
||||
|
|
|
@ -21,9 +21,9 @@ context('YouTube', () => {
|
|||
|
||||
cy.get('#extra').within(() => {
|
||||
cy.get('#extraTabYouTube').click()
|
||||
cy.findByTestId('youtube-search-result').should('have.length', 2)
|
||||
cy.findAllByTestId('youtube-search-result').should('have.length', 2)
|
||||
cy.findByTestId('youtube-search-more-btn').click()
|
||||
cy.findByTestId('youtube-search-result').should('have.length', 4)
|
||||
cy.findAllByTestId('youtube-search-result').should('have.length', 4)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -98,13 +98,13 @@ Cypress.Commands.add(
|
|||
Cypress.Commands.add('$assertPlaying', () => {
|
||||
cy.findByTestId('pause-btn').should('exist')
|
||||
cy.findByTestId('play-btn').should('not.exist')
|
||||
cy.findByTestId('sound-bar-play').should('be.visible')
|
||||
cy.$findInTestId('other-controls [data-testid=soundbars]').should('be.visible')
|
||||
})
|
||||
|
||||
Cypress.Commands.add('$assertNotPlaying', () => {
|
||||
cy.findByTestId('pause-btn').should('not.exist')
|
||||
cy.findByTestId('play-btn').should('exist')
|
||||
cy.findByTestId('sound-bar-play').should('not.exist')
|
||||
cy.$findInTestId('other-controls [data-testid=soundbars]').should('not.exist')
|
||||
})
|
||||
|
||||
Cypress.Commands.add('$assertSidebarItemActive', (text: string) => {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<div class="side player-controls">
|
||||
<i
|
||||
class="prev fa fa-step-backward control"
|
||||
data-testid="play-prev-btn"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
title="Play previous song"
|
||||
|
@ -13,6 +14,7 @@
|
|||
<span
|
||||
v-if="shouldShowPlayButton"
|
||||
class="play"
|
||||
data-testid="play-btn"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
title="Play or resume"
|
||||
|
@ -35,6 +37,7 @@
|
|||
|
||||
<i
|
||||
class="next fa fa-step-forward control"
|
||||
data-testid="play-next-btn"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
title="Play next song"
|
||||
|
|
Loading…
Reference in a new issue