diff --git a/cypress/fixtures/artist-info.get.200.json b/cypress/fixtures/artist-info.get.200.json new file mode 100644 index 00000000..c7e579cf --- /dev/null +++ b/cypress/fixtures/artist-info.get.200.json @@ -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" + } +} diff --git a/cypress/integration/albums.spec.ts b/cypress/integration/albums.spec.ts index 4b884e0d..50ac4f42 100644 --- a/cypress/integration/albums.spec.ts +++ b/cypress/integration/albums.spec.ts @@ -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') diff --git a/cypress/integration/artists.spec.ts b/cypress/integration/artists.spec.ts new file mode 100644 index 00000000..855b32a2 --- /dev/null +++ b/cypress/integration/artists.spec.ts @@ -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') + }) + }) +}) diff --git a/resources/assets b/resources/assets index e0486fab..9826b4f3 160000 --- a/resources/assets +++ b/resources/assets @@ -1 +1 @@ -Subproject commit e0486fabc1119886ec8df6cad5863d20c4231e09 +Subproject commit 9826b4f372a1c6190ba087680853c36d55e8aef6