koel/cypress/integration/home.spec.ts

46 lines
1.2 KiB
TypeScript
Raw Normal View History

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) => {
cy.get(selector)
.should('exist')
.find('li')
.should('have.length', itemCount)
})
})
it('has a link to view all recently-played songs', () => {
cy.findByTestId('home-view-all-recently-played-btn')
.click()
.url()
.should('contain', '/#!/recently-played')
})
it('a song item can be played', () => {
cy.$mockPlayback()
2021-01-03 11:28:57 +00:00
cy.get('.top-song-list li:first-child [data-test=song-card]').within(() => {
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()
cy.findByTestId('song-context-menu').should('be.visible')
})
2020-12-30 18:44:47 +00:00
})