feat(test): add e2e tests for artists

This commit is contained in:
Phan An 2021-01-03 15:43:57 +01:00
parent 94c44c41f2
commit baf0f0ffa4
4 changed files with 86 additions and 4 deletions

View file

@ -0,0 +1,8 @@
{
"url": "https://www.last.fm/music/The+Band",
"image": "http://localhost:8080/test/images/sample.png",
"bio": {
"summary": "Artist summary",
"full": "Artist full bio"
}
}

View file

@ -31,7 +31,7 @@ context('Albums', { scrollBehavior: false }, () => {
})
})
it('plays all song in an album', () => {
it('plays all songs in an album', () => {
cy.$mockPlayback()
cy.get('#albumsWrapper').within(() => {
@ -44,7 +44,7 @@ context('Albums', { scrollBehavior: false }, () => {
cy.$assertPlaying()
})
it('goes to album', () => {
it('goes to album screen', () => {
cy.intercept('GET', '/api/album/8/info', {
fixture: 'album-info.get.200.json'
})
@ -78,7 +78,7 @@ context('Albums', { scrollBehavior: false }, () => {
})
})
it('goes to artist', () => {
it('goes to artist screen', () => {
cy.get('#albumsWrapper').within(() => {
cy.get('[data-test=album-card]:first-child .artist').click()
cy.url().should('contain', '/#!/artist/3')

View file

@ -0,0 +1,74 @@
context('Artists', { scrollBehavior: false }, () => {
beforeEach(() => {
cy.$login()
cy.$clickSidebarItem('Artists')
})
it('loads the list of artists', () => {
cy.get('#artistsWrapper').within(() => {
cy.get('.screen-header')
.should('be.visible')
.and('contain.text', 'Artists')
cy.get('[data-test=view-mode-thumbnail]')
.should('be.visible')
.and('have.class', 'active')
cy.get('[data-test=view-mode-list]')
.should('be.visible')
.and('not.have.class', 'active')
cy.get('[data-test=artist-card]').should('have.length', 1)
})
})
it('changes display mode', () => {
cy.get('#artistsWrapper').should('be.visible').within(() => {
cy.get('[data-test=artist-card]').should('have.length', 1)
cy.get('[data-test=view-mode-list]').click()
cy.get('[data-test=artist-card].compact').should('have.length', 1)
cy.get('[data-test=view-mode-thumbnail]').click()
cy.get('[data-test=artist-card].full').should('have.length', 1)
})
})
it('plays all songs by an artist', () => {
cy.$mockPlayback()
cy.get('#artistsWrapper').within(() => {
cy.get('[data-test=artist-card]:first-child .control-play')
.invoke('show')
.click()
})
cy.url().should('contain', '/#!/queue')
cy.$assertPlaying()
})
it('goes to artist screen', () => {
cy.intercept('GET', '/api/artist/3/info', {
fixture: 'artist-info.get.200.json'
})
cy.get('#artistsWrapper').within(() => {
cy.get('[data-test=artist-card]:first-child .name').click()
cy.url().should('contain', '/#!/artist/3')
})
cy.get('#artistWrapper').within(() => {
cy.get('tr.song-item').should('have.length.at.least', 1)
cy.get('.screen-header').within(() => {
cy.findByText('Download All').should('be.visible')
cy.findByText('Info').click()
})
cy.get('[data-test=artist-info]').should('be.visible').within(() => {
cy.findByText('Artist full bio').should('be.visible')
cy.get('.cover').should('be.visible')
})
cy.get('[data-test=close-modal-btn]').click()
cy.get('[data-test=artist-info]').should('not.exist')
})
})
})

@ -1 +1 @@
Subproject commit e0486fabc1119886ec8df6cad5863d20c4231e09
Subproject commit 9826b4f372a1c6190ba087680853c36d55e8aef6