2020-12-30 18:44:47 +00:00
|
|
|
context('Home Screen', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.clock()
|
|
|
|
cy.$login()
|
2021-01-03 11:28:57 +00:00
|
|
|
cy.tick(100)
|
2020-12-30 18:44:47 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
it('renders', () => {
|
|
|
|
cy.get('.screen-header').should('be.visible')
|
|
|
|
cy.$each([
|
2021-01-01 13:31:53 +00:00
|
|
|
['.top-song-list', 3],
|
2020-12-30 18:44:47 +00:00
|
|
|
['.recent-song-list', 7],
|
|
|
|
['.recently-added-album-list', 6],
|
|
|
|
['.recently-added-song-list', 10],
|
|
|
|
['.top-artist-list', 1],
|
2021-01-01 13:31:53 +00:00
|
|
|
['.top-album-list', 3]
|
2020-12-30 18:44:47 +00:00
|
|
|
], (selector: string, itemCount: number) => {
|
2022-04-26 12:55:14 +00:00
|
|
|
cy.get(selector).should('exist')
|
|
|
|
.find('li').should('have.length', itemCount)
|
2020-12-30 18:44:47 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('has a link to view all recently-played songs', () => {
|
2022-04-26 12:55:14 +00:00
|
|
|
cy.findByTestId('home-view-all-recently-played-btn').click().url().should('contain', '/#!/recently-played')
|
2020-12-30 18:44:47 +00:00
|
|
|
})
|
2021-01-02 22:18:55 +00:00
|
|
|
|
|
|
|
it('a song item can be played', () => {
|
|
|
|
cy.$mockPlayback()
|
|
|
|
|
2022-05-09 12:54:41 +00:00
|
|
|
cy.get('.top-song-list li:first-child [data-testid=song-card]').within(() => {
|
2021-01-02 22:18:55 +00:00
|
|
|
cy.get('a.control').invoke('show').click()
|
|
|
|
}).should('have.class', 'playing')
|
|
|
|
cy.$assertPlaying()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('a song item has a context menu', () => {
|
2021-01-03 11:28:57 +00:00
|
|
|
cy.get('.top-song-list li:first-child').rightclick()
|
2021-01-02 22:18:55 +00:00
|
|
|
cy.findByTestId('song-context-menu').should('be.visible')
|
|
|
|
})
|
2020-12-30 18:44:47 +00:00
|
|
|
})
|