feat(test): add missing Favorites e2e test

This commit is contained in:
Phan An 2021-01-02 11:58:30 +01:00
parent b93f2d2e94
commit 1c39a59449

View file

@ -1,7 +1,5 @@
context('Favorites', () => {
beforeEach(() => {
cy.$login()
})
context('Favorites', { scrollBehavior: false }, () => {
beforeEach(() => cy.$login())
function assertFavoriteCount (count: number) {
cy.$clickSidebarItem('Favorites')
@ -62,6 +60,22 @@ context('Favorites', () => {
assertFavoriteCount(4)
})
it('adds a favorite song from context menu', () => {
cy.intercept('POST', '/api/interaction/like', {
fixture: 'like.post.200.json'
})
cy.$clickSidebarItem('All Songs')
cy.get('#songsWrapper').within(() => cy.get('tr.song-item:first-child').rightclick())
cy.findByTestId('song-context-menu').within(() => {
cy.findByText('Add To').click()
cy.findByText('Favorites').click()
})
assertFavoriteCount(4)
})
it('deletes a favorite with Unlike button', () => {
cy.intercept('POST', '/api/interaction/like', {})
cy.$clickSidebarItem('Favorites')