chore: replace data-test wit data-testid

This commit is contained in:
Phan An 2022-05-11 01:01:48 +02:00
parent 0e82647540
commit 5cf365879e
No known key found for this signature in database
GPG key ID: A81E4477F0BB6FDC
33 changed files with 114 additions and 131 deletions

View file

@ -7,19 +7,19 @@ context('Albums', { scrollBehavior: false }, () => {
it('loads the list of albums', () => {
cy.get('#albumsWrapper').within(() => {
cy.get('.screen-header').should('be.visible').and('contain.text', 'Albums')
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=album-card]').should('have.length', 7)
cy.findByTestId('view-mode-thumbnail').should('be.visible').and('have.class', 'active')
cy.findByTestId('view-mode-list').should('be.visible').and('not.have.class', 'active')
cy.findByTestId('album-card').should('have.length', 7)
})
})
it('changes display mode', () => {
cy.get('#albumsWrapper').should('be.visible').within(() => {
cy.get('[data-test=album-card]').should('have.length', 7)
cy.get('[data-test=view-mode-list]').click()
cy.get('[data-test=album-card].compact').should('have.length', 7)
cy.get('[data-test=view-mode-thumbnail]').click()
cy.get('[data-test=album-card].full').should('have.length', 7)
cy.findByTestId('album-card').should('have.length', 7)
cy.findByTestId('view-mode-list').click()
cy.get('[data-testid=album-card].compact').should('have.length', 7)
cy.findByTestId('view-mode-thumbnail').click()
cy.get('[data-testid=album-card].full').should('have.length', 7)
})
})
@ -27,7 +27,7 @@ context('Albums', { scrollBehavior: false }, () => {
cy.$mockPlayback()
cy.get('#albumsWrapper').within(() => {
cy.get('[data-test=album-card]:first-child .control-play')
cy.get('[data-testid=album-card]:first-child .control-play')
.invoke('show')
.click()
})
@ -42,7 +42,7 @@ context('Albums', { scrollBehavior: false }, () => {
})
cy.get('#albumsWrapper').within(() => {
cy.get('[data-test=album-card]:first-child .name').click()
cy.get('[data-testid=album-card]:first-child .name').click()
})
cy.get('#albumWrapper').within(() => {
@ -72,7 +72,7 @@ context('Albums', { scrollBehavior: false }, () => {
it('invokes artist screen', () => {
cy.get('#albumsWrapper').within(() => {
cy.get('[data-test=album-card]:first-child .artist').click()
cy.get('[data-testid=album-card]:first-child .artist').click()
cy.url().should('contain', '/#!/artist/3')
// rest of the assertions belong to the Artist spec
})

View file

@ -20,7 +20,7 @@ context('Extra Information Panel', () => {
cy.$getSongRows().first().dblclick()
cy.get('#extraPanelLyrics').should('be.visible').and('contain.text', 'No lyrics found.')
cy.get('#extraPanelLyrics [data-test=add-lyrics-btn]').click()
cy.findByTestId('add-lyrics-btn').click()
cy.findByTestId('edit-song-form').should('be.visible').within(() => {
cy.get('[name=lyrics]').should('have.focus')
})
@ -30,7 +30,7 @@ context('Extra Information Panel', () => {
cy.$shuffleSeveralSongs()
cy.get('#extraTabArtist').click()
cy.get('#extraPanelArtist').should('be.visible').within(() => {
cy.get('[data-test=artist-info]').should('be.visible')
cy.findByTestId('artist-info').should('be.visible')
cy.findByText('Artist summary').should('be.visible')
cy.findByTestId('more-btn').click()
cy.findByText('Artist summary').should('not.exist')
@ -42,7 +42,7 @@ context('Extra Information Panel', () => {
cy.$shuffleSeveralSongs()
cy.get('#extraTabAlbum').click()
cy.get('#extraPanelAlbum').should('be.visible').within(() => {
cy.get('[data-test=album-info]').should('be.visible')
cy.findByTestId('album-info').should('be.visible')
cy.findByText('Album summary').should('be.visible')
cy.findByTestId('more-btn').click()
cy.findByText('Album summary').should('not.exist')

View file

@ -21,10 +21,10 @@ context('Other Controls', () => {
})
it('toggles the "sound bars" icon when a song is played/paused', () => {
cy.$findInTestId('other-controls [data-test=soundbars]').should('be.visible')
cy.$findInTestId('other-controls [data-testid=soundbars]').should('be.visible')
cy.get('body').type(' ')
cy.$assertNotPlaying()
cy.$findInTestId('other-controls [data-test=soundbars]').should('not.exist')
cy.$findInTestId('other-controls [data-testid=soundbars]').should('not.exist')
})
it('toggles the visualizer', () => {

View file

@ -60,7 +60,7 @@ context('Playlists', () => {
cy.findByText('Playlist "A New Playlist" created.').should('be.visible')
cy.get('#playlistWrapper .heading-wrapper').should('be.visible').and('contain', 'A New Playlist')
cy.get('#playlistWrapper [data-test=screen-empty-state]')
cy.get('#playlistWrapper [data-testid=screen-empty-state]')
.should('be.visible')
.and('contain', 'The playlist is currently empty.')
})
@ -151,23 +151,23 @@ context('Playlists', () => {
// Add a second rule
cy.get('.btn-add-rule').click()
cy.get('[data-test=smart-playlist-rule-row]:nth-child(3) [name="model[]"]').select('Length')
cy.get('[data-test=smart-playlist-rule-row]:nth-child(3) [name="operator[]"]').select('is greater than')
cy.get('[data-testid=smart-playlist-rule-row]:nth-child(3) [name="model[]"]').select('Length')
cy.get('[data-testid=smart-playlist-rule-row]:nth-child(3) [name="operator[]"]').select('is greater than')
cy.wait(0)
cy.get('[data-test=smart-playlist-rule-row]:nth-child(3) [name="value[]"]').type('180')
cy.get('[data-testid=smart-playlist-rule-row]:nth-child(3) [name="value[]"]').type('180')
// Add another group (and rule)
cy.get('.btn-add-group').click()
cy.get('[data-test=smart-playlist-rule-group]:nth-child(2) [name="value[]"]').type('Whatever')
cy.get('[data-testid=smart-playlist-rule-group]:nth-child(2) [name="value[]"]').type('Whatever')
// Remove a rule from the first group
cy.get(`
[data-test=smart-playlist-rule-group]:first-child
[data-test=smart-playlist-rule-row]:nth-child(2)
[data-testid=smart-playlist-rule-group]:first-child
[data-testid=smart-playlist-rule-row]:nth-child(2)
.remove-rule
`).click()
cy.get('[data-test=smart-playlist-rule-group]:first-child [data-test=smart-playlist-rule-row]')
cy.get('[data-testid=smart-playlist-rule-group]:first-child [data-testid=smart-playlist-rule-row]')
.should('have.length', 1)
cy.findByText('Save').click()
@ -198,15 +198,15 @@ context('Playlists', () => {
cy.get('[name=name]').should('be.focused').and('contain.value', 'Smart Playlist')
.clear().type('A Different Name')
cy.get('[data-test=smart-playlist-rule-group]').should('have.length', 2)
cy.get('[data-testid=smart-playlist-rule-group]').should('have.length', 2)
// Add another rule into the second group
cy.get('[data-test=smart-playlist-rule-group]:nth-child(2) .btn-add-rule').click()
cy.get('[data-test=smart-playlist-rule-row]:nth-child(3) [name="model[]"]').select('Album')
cy.get('[data-test=smart-playlist-rule-row]:nth-child(3) [name="operator[]"]').select('contains')
cy.get('[data-testid=smart-playlist-rule-group]:nth-child(2) .btn-add-rule').click()
cy.get('[data-testid=smart-playlist-rule-row]:nth-child(3) [name="model[]"]').select('Album')
cy.get('[data-testid=smart-playlist-rule-row]:nth-child(3) [name="operator[]"]').select('contains')
cy.wait(0)
cy.get('[data-test=smart-playlist-rule-row]:nth-child(3) [name="value[]"]').type('keyword')
cy.get('[data-test=smart-playlist-rule-group]:nth-child(2) [data-test=smart-playlist-rule-row]')
cy.get('[data-testid=smart-playlist-rule-row]:nth-child(3) [name="value[]"]').type('keyword')
cy.get('[data-testid=smart-playlist-rule-group]:nth-child(2) [data-testid=smart-playlist-rule-row]')
.should('have.length', 2)
cy.findByText('Save').click()

View file

@ -6,7 +6,7 @@ context('Searching', () => {
it('shows the search screen when search box receives focus', () => {
cy.get('@searchInput').focus()
cy.get('#searchExcerptsWrapper').within(() => cy.get('[data-test=screen-empty-state]').should('be.visible'))
cy.get('#searchExcerptsWrapper').within(() => cy.findByTestId('screen-empty-state').should('be.visible'))
})
it('performs an excerpt search', () => {
@ -18,8 +18,8 @@ context('Searching', () => {
cy.get('#searchExcerptsWrapper').within(() => {
cy.$findInTestId('song-excerpts [data-testid=song-card]').should('have.length', 6)
cy.$findInTestId('artist-excerpts [data-test=artist-card]').should('have.length', 1)
cy.$findInTestId('album-excerpts [data-test=album-card]').should('have.length', 3)
cy.$findInTestId('artist-excerpts [data-testid=artist-card]').should('have.length', 1)
cy.$findInTestId('album-excerpts [data-testid=album-card]').should('have.length', 3)
})
})
@ -33,7 +33,7 @@ context('Searching', () => {
})
cy.get('@searchInput').type('foo')
cy.get('#searchExcerptsWrapper [data-test=view-all-songs-btn]').click()
cy.get('#searchExcerptsWrapper [data-testid=view-all-songs-btn]').click()
cy.url().should('contain', '/#!/search/songs/foo')
cy.get('#songResultsWrapper').within(() => {
@ -54,7 +54,7 @@ context('Searching', () => {
cy.get('@searchInput').type('foo')
cy.wait('@search')
cy.get('#searchExcerptsWrapper [data-test=view-all-songs-btn]').should('not.exist')
cy.get('#searchExcerptsWrapper [data-testid=view-all-songs-btn]').should('not.exist')
cy.findByTestId('song-excerpts').findByText('None found.').should('be.visible')
})
})

View file

@ -31,11 +31,10 @@ context('Uploading', () => {
}).as('failedUpload')
selectFixtureFile()
cy.get('[data-test=upload-item]').should('have.length', 1).and('be.visible')
cy.findByTestId('upload-item').should('have.length', 1).and('be.visible')
cy.wait('@failedUpload')
cy.get('[data-test=upload-item]').should('have.length', 1)
cy.get('[data-test=upload-item]:first-child').should('have.class', 'Errored')
cy.findByTestId('upload-item').should('have.length', 1).should('have.class', 'Errored')
}
it('uploads songs', () => {
@ -45,10 +44,10 @@ context('Uploading', () => {
cy.get('#uploadWrapper').within(() => {
selectFixtureFile()
cy.get('[data-test=upload-item]').should('have.length', 1).and('be.visible')
cy.findByTestId('upload-item').should('have.length', 1).and('be.visible')
cy.wait('@upload')
cy.get('[data-test=upload-item]').should('have.length', 0)
cy.findByTestId('upload-item').should('have.length', 0)
})
assertResultsAddedToHomeScreen()
@ -62,9 +61,9 @@ context('Uploading', () => {
fixture: 'upload.post.200.json'
}).as('successfulUpload')
cy.get('[data-test=upload-item]:first-child').findByTitle('Retry').click()
cy.get('[data-testid=upload-item]:first-child').findByTitle('Retry').click()
cy.wait('@successfulUpload')
cy.get('[data-test=upload-item]').should('have.length', 0)
cy.findByTestId('upload-item').should('have.length', 0)
})
assertResultsAddedToHomeScreen()
@ -80,7 +79,7 @@ context('Uploading', () => {
cy.findByTestId('upload-retry-all-btn').click()
cy.wait('@successfulUpload')
cy.get('[data-test=upload-item]').should('have.length', 0)
cy.findByTestId('upload-item').should('have.length', 0)
})
assertResultsAddedToHomeScreen()
@ -89,8 +88,8 @@ context('Uploading', () => {
it('allows removing individual failed uploads', () => {
cy.get('#uploadWrapper').within(() => {
executeFailedUpload()
cy.get('[data-test=upload-item]:first-child').findByTitle('Remove').click()
cy.get('[data-test=upload-item]').should('have.length', 0)
cy.get('[data-testid=upload-item]:first-child').findByTitle('Remove').click()
cy.findByTestId('upload-item').should('have.length', 0)
})
})
@ -98,7 +97,7 @@ context('Uploading', () => {
cy.get('#uploadWrapper').within(() => {
executeFailedUpload()
cy.findByTestId('upload-remove-all-btn').click()
cy.get('[data-test=upload-item]').should('have.length', 0)
cy.findByTestId('upload-item').should('have.length', 0)
})
})
})

View file

@ -6,11 +6,11 @@ context('User Management', () => {
it('shows the list of users', () => {
cy.get('#usersWrapper').within(() => {
cy.get('[data-test=user-card]').should('have.length', 3).and('be.visible')
cy.findByTestId('user-card').should('have.length', 3).and('be.visible')
cy.get('[data-test=user-card].me').within(() => {
cy.get('[data-test=current-user-indicator]').should('be.visible')
cy.get('[data-test=admin-indicator]').should('be.visible')
cy.get('[data-testid=user-card].me').within(() => {
cy.findByTitle('This is you!').should('be.visible')
cy.findByTitle('User has admin privileges').should('be.visible')
})
})
})
@ -31,17 +31,17 @@ context('User Management', () => {
})
cy.findByText('New user "Charles" created.').should('be.visible')
cy.get('#usersWrapper [data-test=user-card]').should('have.length', 4)
cy.findByTestId('user-card').should('have.length', 4)
cy.get('#usersWrapper [data-test=user-card]:first-child').within(() => {
cy.get('#usersWrapper [data-testid=user-card]:first-child').within(() => {
cy.findByText('Charles').should('be.visible')
cy.findByText('charles@koel.test').should('be.visible')
cy.get('[data-test=admin-indicator]').should('be.visible')
cy.findByTitle('User has admin privileges').should('be.visible')
})
})
it('redirects to profile for current user', () => {
cy.get('#usersWrapper [data-test=user-card].me [data-test=edit-user-btn]').click({ force: true })
cy.get('#usersWrapper [data-testid=user-card].me [data-testid=edit-user-btn]').click({ force: true })
cy.url().should('contain', '/#!/profile')
})
@ -50,7 +50,7 @@ context('User Management', () => {
fixture: 'user.put.200.json'
})
cy.get('#usersWrapper [data-test=user-card]:nth-child(2) [data-test=edit-user-btn]').click({ force: true })
cy.get('#usersWrapper [data-testid=user-card]:nth-child(2) [data-testid=edit-user-btn]').click({ force: true })
cy.findByTestId('edit-user-form').within(() => {
cy.get('[name=name]').should('be.focused').and('have.value', 'Alice')
@ -65,7 +65,7 @@ context('User Management', () => {
cy.findByText('User profile updated.').should('be.visible')
cy.get('#usersWrapper [data-test=user-card]:nth-child(2)').within(() => {
cy.get('#usersWrapper [data-testid=user-card]:nth-child(2)').within(() => {
cy.findByText('Adriana').should('be.visible')
cy.findByText('adriana@koel.test').should('be.visible')
})
@ -74,9 +74,9 @@ context('User Management', () => {
it('deletes a user', () => {
cy.intercept('DELETE', '/api/user/2', {})
cy.get('#usersWrapper [data-test=user-card]:nth-child(2) [data-test=delete-user-btn]').click({ force: true })
cy.get('#usersWrapper [data-testid=user-card]:nth-child(2) [data-testid=delete-user-btn]').click({ force: true })
cy.$confirm()
cy.findByText('User "Alice" deleted.').should('be.visible')
cy.get('#usersWrapper [data-test=user-card]').should('have.length', 2)
cy.get('#usersWrapper [data-testid=user-card]').should('have.length', 2)
})
})

View file

@ -21,9 +21,9 @@ context('YouTube', () => {
cy.get('#extra').within(() => {
cy.get('#extraTabYouTube').click()
cy.get('[data-test=youtube-search-result]').should('have.length', 2)
cy.findByTestId('youtube-search-result').should('have.length', 2)
cy.findByTestId('youtube-search-more-btn').click()
cy.get('[data-test=youtube-search-result]').should('have.length', 4)
cy.findByTestId('youtube-search-result').should('have.length', 4)
})
})
@ -35,7 +35,7 @@ context('YouTube', () => {
cy.get('#extra').within(() => {
cy.get('#extraTabYouTube').click()
cy.get('[data-test=youtube-search-result]:nth-child(2)').click()
cy.get('[data-testid=youtube-search-result]:nth-child(2)').click()
})
cy.url().should('contain', '/#!/youtube')

View file

@ -69,7 +69,7 @@ Cypress.Commands.add('$shuffleSeveralSongs', (count = 3) => {
cy.$getSongRowAt(0).click()
cy.$getSongRowAt(count - 1).click({ shiftKey: true })
cy.get('.screen-header [data-test=btn-shuffle-selected]').click()
cy.get('.screen-header [data-testid=btn-shuffle-selected]').click()
})
})

View file

@ -1,9 +1,9 @@
import Component from '@/components/album/AlbumContextMenu.vue'
import factory from '@/__tests__/factory'
import { playbackService, downloadService } from '@/services'
import { downloadService, playbackService } from '@/services'
import { commonStore } from '@/stores'
import { mock } from '@/__tests__/__helpers__'
import { shallow, mount } from '@/__tests__/adapter'
import { mount, shallow } from '@/__tests__/adapter'
describe('components/album/ContextMenuBase', () => {
let album: Album
@ -23,7 +23,7 @@ describe('components/album/ContextMenuBase', () => {
const wrapper = shallow(Component, { propsData: { album } })
const m = mock(playbackService, 'playAllInAlbum')
wrapper.click('[data-test=play]')
wrapper.click('[data-testid=play]')
expect(m).toHaveBeenCalledWith(album)
})
@ -31,7 +31,7 @@ describe('components/album/ContextMenuBase', () => {
const wrapper = shallow(Component, { propsData: { album } })
const m = mock(playbackService, 'playAllInAlbum')
wrapper.click('[data-test=shuffle]')
wrapper.click('[data-testid=shuffle]')
expect(m).toHaveBeenCalledWith(album, true)
})
@ -41,7 +41,7 @@ describe('components/album/ContextMenuBase', () => {
await (wrapper.vm as any).open(0, 0)
const m = mock(downloadService, 'fromAlbum')
wrapper.click('[data-test=download]')
wrapper.click('[data-testid=download]')
expect(m).toHaveBeenCalledWith(album)
})
@ -49,6 +49,6 @@ describe('components/album/ContextMenuBase', () => {
// @ts-ignore
commonStore.state = { allowDownload: false }
const wrapper = shallow(Component, { propsData: { album } })
expect(wrapper.has('[data-test=download]')).toBe(false)
expect(wrapper.has('[data-testid=download]')).toBe(false)
})
})

View file

@ -1,9 +1,9 @@
import Component from '@/components/artist/ArtistContextMenu.vue'
import factory from '@/__tests__/factory'
import { playbackService, downloadService } from '@/services'
import { downloadService, playbackService } from '@/services'
import { commonStore } from '@/stores'
import { mock } from '@/__tests__/__helpers__'
import { shallow, mount } from '@/__tests__/adapter'
import { mount, shallow } from '@/__tests__/adapter'
describe('components/artist/ContextMenuBase', () => {
let artist: Artist
@ -23,7 +23,7 @@ describe('components/artist/ContextMenuBase', () => {
const wrapper = shallow(Component, { propsData: { artist } })
const m = mock(playbackService, 'playAllByArtist')
wrapper.click('[data-test=play]')
wrapper.click('[data-testid=play]')
expect(m).toHaveBeenCalledWith(artist)
})
@ -31,7 +31,7 @@ describe('components/artist/ContextMenuBase', () => {
const wrapper = shallow(Component, { propsData: { artist } })
const m = mock(playbackService, 'playAllByArtist')
wrapper.click('[data-test=shuffle]')
wrapper.click('[data-testid=shuffle]')
expect(m).toHaveBeenCalledWith(artist, true)
})
@ -41,7 +41,7 @@ describe('components/artist/ContextMenuBase', () => {
await (wrapper.vm as any).open(0, 0)
const m = mock(downloadService, 'fromArtist')
wrapper.click('[data-test=download]')
wrapper.click('[data-testid=download]')
expect(m).toHaveBeenCalledWith(artist)
})
@ -49,6 +49,6 @@ describe('components/artist/ContextMenuBase', () => {
// @ts-ignore
commonStore.state = { allowDownload: false }
const wrapper = shallow(Component, { propsData: { artist } })
expect(wrapper.has('[data-test=download]')).toBe(false)
expect(wrapper.has('[data-testid=download]')).toBe(false)
})
})

View file

@ -36,7 +36,7 @@ describe('components/screens/favorites', () => {
})
await wrapper.vm.$nextTick()
expect(wrapper.has('[data-test=screen-empty-state]')).toBe(true)
expect(wrapper.has('[data-testid=screen-empty-state]')).toBe(true)
})
it('allows downloading', () => {

View file

@ -39,7 +39,7 @@ describe('components/screens/playlist', () => {
})
})
await wrapper.vm.$nextTick()
expect(wrapper.has('[data-test=screen-empty-state]')).toBe(true)
expect(wrapper.has('[data-testid=screen-empty-state]')).toBe(true)
})
it('emits an event to delete the playlist', () => {

View file

@ -15,7 +15,7 @@ exports[`components/shared/Overlay hides 1`] = ``;
exports[`components/shared/Overlay shows 1`] = `
<div id="overlay" class="overlay loading">
<div class="display">
<div data-test="soundbars" class="bars"><img src="@/../img/bars.gif" alt="Sound bars" height="13" width="auto"></div>
<div data-testid="soundbars" class="bars"><img src="@/../img/bars.gif" alt="Sound bars" height="13" width="auto"></div>
<!---->
<!---->
<!---->
@ -28,7 +28,7 @@ exports[`components/shared/Overlay shows 1`] = `
exports[`components/shared/Overlay shows with default options 1`] = `
<div id="overlay" class="overlay loading">
<div class="display">
<div data-test="soundbars" class="bars"><img src="@/../img/bars.gif" alt="Sound bars" height="13" width="auto"></div>
<div data-testid="soundbars" class="bars"><img src="@/../img/bars.gif" alt="Sound bars" height="13" width="auto"></div>
<!---->
<!---->
<!---->

View file

@ -4,7 +4,7 @@
:class="layout"
:title="`${album.name} by ${album.artist.name}`"
class="item"
data-test="album-card"
data-testid="album-card"
draggable="true"
tabindex="0"
@dblclick="shuffle"
@ -12,7 +12,7 @@
@contextmenu.prevent="requestContextMenu"
>
<span class="thumbnail-wrapper">
<AlbumThumbnail :entity="album" />
<AlbumThumbnail :entity="album"/>
</span>
<footer>
@ -39,7 +39,7 @@
role="button"
@click.prevent="shuffle"
>
<i class="fa fa-random" />
<i class="fa fa-random"/>
</a>
<a
v-if="allowDownload"
@ -50,7 +50,7 @@
role="button"
@click.prevent="download"
>
<i class="fa fa-download" />
<i class="fa fa-download"/>
</a>
</span>
</p>

View file

@ -1,14 +1,14 @@
<template>
<ContextMenuBase extra-class="album-menu" data-testid="album-context-menu" ref="base">
<template v-if="album">
<li data-test="play" @click="play">Play All</li>
<li data-test="shuffle" @click="shuffle">Shuffle All</li>
<li data-testid="play" @click="play">Play All</li>
<li data-testid="shuffle" @click="shuffle">Shuffle All</li>
<li class="separator"></li>
<li data-test="view-album" @click="viewAlbumDetails" v-if="isStandardAlbum">Go to Album</li>
<li data-test="view-artist" @click="viewArtistDetails" v-if="isStandardArtist">Go to Artist</li>
<li data-testid="view-album" @click="viewAlbumDetails" v-if="isStandardAlbum">Go to Album</li>
<li data-testid="view-artist" @click="viewArtistDetails" v-if="isStandardArtist">Go to Artist</li>
<template v-if="isStandardAlbum && allowDownload">
<li class="separator"></li>
<li data-test="download" @click="download">Download</li>
<li data-testid="download" @click="download">Download</li>
</template>
</template>
</ContextMenuBase>

View file

@ -22,7 +22,7 @@ new class extends ComponentTestCase {
getByTestId('album-artist-thumbnail')
const element = getByTestId<HTMLElement>('album-info')
const element = getByTestId('album-info')
expect(element.classList.contains(mode)).toBe(true)
})

View file

@ -1,15 +1,15 @@
<template>
<ContextMenuBase extra-class="artist-menu" ref="base" data-testid="artist-context-menu">
<template v-if="artist">
<li data-test="play" @click="play">Play All</li>
<li data-test="shuffle" @click="shuffle">Shuffle All</li>
<li data-testid="play" @click="play">Play All</li>
<li data-testid="shuffle" @click="shuffle">Shuffle All</li>
<template v-if="isStandardArtist">
<li class="separator"></li>
<li data-test="view-artist" @click="viewArtistDetails">Go to Artist</li>
<li data-testid="view-artist" @click="viewArtistDetails">Go to Artist</li>
</template>
<template v-if="isStandardArtist && allowDownload">
<li class="separator"></li>
<li data-test="download" @click="download">Download</li>
<li data-testid="download" @click="download">Download</li>
</template>
</template>
</ContextMenuBase>

View file

@ -22,7 +22,7 @@ new class extends ComponentTestCase {
getByTestId('album-artist-thumbnail')
const element = getByTestId<HTMLElement>('artist-info')
const element = getByTestId('artist-info')
expect(element.classList.contains(mode)).toBe(true)
})

View file

@ -4,8 +4,8 @@ exports[`renders 1`] = `
"<div class=\\"other-controls\\" data-testid=\\"other-controls\\" data-v-add48cbe=\\"\\">
<div class=\\"wrapper\\" data-v-add48cbe=\\"\\">
<!--v-if--><button data-testid=\\"toggle-visualizer-btn\\" title=\\"Click for a marvelous visualizer!\\" type=\\"button\\" data-v-add48cbe=\\"\\">
<div class=\\"bars\\" data-test=\\"soundbars\\" data-testid=\\"sound-bar-play\\" data-v-d983e410=\\"\\" data-v-add48cbe=\\"\\"><img alt=\\"Sound bars\\" height=\\"13\\" src=\\"/resources/assets/img/bars.gif\\" data-v-d983e410=\\"\\" /></div>
</button><button title=\\"Unlike Fahrstuhl to Heaven by Led Zeppelin\\" class=\\"text-secondary like\\" data-test=\\"like-btn\\" data-v-5d366bb1=\\"\\" data-v-add48cbe=\\"\\"><i class=\\"fa fa-heart text-maroon\\" data-test=\\"btn-like-liked\\" data-v-5d366bb1=\\"\\"></i></button><button class=\\"active control text-uppercase\\" data-testid=\\"toggle-extra-panel-btn\\" title=\\"View song information\\" type=\\"button\\" data-v-add48cbe=\\"\\"> Info </button><a class=\\"queue control\\" href=\\"#!/queue\\" data-v-add48cbe=\\"\\"><i class=\\"fa fa-list-ol\\" data-v-add48cbe=\\"\\"></i></a><button class=\\"NO_REPEAT control\\" title=\\"Change repeat mode (current mode: No Repeat)\\" data-testid=\\"repeat-mode-switch\\" type=\\"button\\" data-v-651f1926=\\"\\" data-v-add48cbe=\\"\\"><i class=\\"fa fa-repeat\\" data-v-651f1926=\\"\\"></i></button><span id=\\"volume\\" class=\\"volume control\\" data-v-add48cbe=\\"\\"><i class=\\"fa fa-volume-up mute\\" role=\\"button\\" tabindex=\\"0\\" title=\\"Mute\\"></i><input id=\\"volumeRange\\" class=\\"plyr__volume\\" max=\\"10\\" step=\\"0.1\\" title=\\"Volume\\" type=\\"range\\"/></span>
<div class=\\"bars\\" data-testid=\\"soundbars\\" data-testid=\\"sound-bar-play\\" data-v-d983e410=\\"\\" data-v-add48cbe=\\"\\"><img alt=\\"Sound bars\\" height=\\"13\\" src=\\"/resources/assets/img/bars.gif\\" data-v-d983e410=\\"\\" /></div>
</button><button title=\\"Unlike Fahrstuhl to Heaven by Led Zeppelin\\" class=\\"text-secondary like\\" data-testid=\\"like-btn\\" data-v-5d366bb1=\\"\\" data-v-add48cbe=\\"\\"><i class=\\"fa fa-heart text-maroon\\" data-testid=\\"btn-like-liked\\" data-v-5d366bb1=\\"\\"></i></button><button class=\\"active control text-uppercase\\" data-testid=\\"toggle-extra-panel-btn\\" title=\\"View song information\\" type=\\"button\\" data-v-add48cbe=\\"\\"> Info </button><a class=\\"queue control\\" href=\\"#!/queue\\" data-v-add48cbe=\\"\\"><i class=\\"fa fa-list-ol\\" data-v-add48cbe=\\"\\"></i></a><button class=\\"NO_REPEAT control\\" title=\\"Change repeat mode (current mode: No Repeat)\\" data-testid=\\"repeat-mode-switch\\" type=\\"button\\" data-v-651f1926=\\"\\" data-v-add48cbe=\\"\\"><i class=\\"fa fa-repeat\\" data-v-651f1926=\\"\\"></i></button><span id=\\"volume\\" class=\\"volume control\\" data-v-add48cbe=\\"\\"><i class=\\"fa fa-volume-up mute\\" role=\\"button\\" tabindex=\\"0\\" title=\\"Mute\\"></i><input id=\\"volumeRange\\" class=\\"plyr__volume\\" max=\\"10\\" step=\\"0.1\\" title=\\"Volume\\" type=\\"range\\"/></span>
</div>
</div>"
`;

View file

@ -1,5 +1,5 @@
<template>
<div class="row" data-test="smart-playlist-rule-row">
<div class="row" data-testid="smart-playlist-rule-row">
<Btn class="remove-rule" red @click.prevent="removeRule"><i class="fa fa-times"></i></Btn>
<select v-model="selectedModel" name="model[]">

View file

@ -1,5 +1,5 @@
<template>
<div class="rule-group" data-test="smart-playlist-rule-group">
<div class="rule-group" data-testid="smart-playlist-rule-group">
<div class="group-banner">
<span v-if="isFirstGroup">
Include songs that match <strong>all</strong> of these criteria

View file

@ -5,7 +5,7 @@
<ControlsToggler :showing-controls="showingControls" @toggleControls="toggleControls"/>
<template v-slot:meta>
<span v-if="songs.length" data-test="list-meta">
<span v-if="songs.length">
{{ pluralize(songs.length, 'song') }} {{ duration }}
</span>
</template>

View file

@ -28,7 +28,7 @@
@dragover.prevent
>
<div class="upload-files" v-if="files.length">
<UploadItem v-for="file in files" :key="file.id" :file="file" data-test="upload-item"/>
<UploadItem v-for="file in files" :key="file.id" :file="file" data-testid="upload-item"/>
</div>
<ScreenEmptyState v-else>
@ -61,7 +61,7 @@ import ismobile from 'ismobilejs'
import md5 from 'blueimp-md5'
import { computed, defineAsyncComponent, ref, toRef } from 'vue'
import { settingStore, userStore } from '@/stores'
import { settingStore } from '@/stores'
import { eventBus, getAllFileEntries, isDirectoryReadingSupported } from '@/utils'
import { acceptedMediaTypes, UploadFile } from '@/config'
import { uploadService } from '@/services'

View file

@ -12,7 +12,7 @@
Songs
<Btn
v-if="excerpt.songs.length"
data-test="view-all-songs-btn"
data-testid="view-all-songs-btn"
orange
rounded
small

View file

@ -39,6 +39,7 @@
<Btn
v-if="selectedSongs.length > 1"
class="btn-shuffle-selected"
data-testid="btn-shuffle-selected"
orange
title="Shuffle selected songs"
@click.prevent="shuffleSelected"
@ -52,7 +53,7 @@
v-if="selectedSongs.length"
:title="`${showingAddToMenu ? 'Cancel' : 'Add selected songs to…'}`"
class="btn-add-to"
data-test="add-to-btn"
data-testid="add-to-btn"
green
@click.prevent.stop="toggleAddToMenu"
>

View file

@ -1,5 +1,5 @@
<template>
<button data-test="close-modal-btn" @click.prevent="$emit('click')">
<button data-testid="close-modal-btn" @click.prevent="$emit('click')">
<i class="fa fa-times"></i>
</button>
</template>

View file

@ -9,7 +9,7 @@
<p v-if="song.id && !song.lyrics" class="none text-secondary">
<template v-if="isAdmin">
No lyrics found.
<button class="text-orange" data-test="add-lyrics-btn" type="button" @click.prevent="showEditSongForm">
<button class="text-orange" data-testid="add-lyrics-btn" type="button" @click.prevent="showEditSongForm">
Click here
</button>
to add lyrics.

View file

@ -1,5 +1,5 @@
<template>
<div class="screen-empty-state" data-test="screen-empty-state">
<div class="screen-empty-state" data-testid="screen-empty-state">
<div>
<span class="jumbo-icon">
<slot name="icon">

View file

@ -1,5 +1,5 @@
<template>
<div class="bars" data-test="soundbars">
<div class="bars" data-testid="soundbars">
<img alt="Sound bars" height="13" src="@/../img/bars.gif">
</div>
</template>

View file

@ -6,7 +6,7 @@
:key="video.id.videoId"
:href="`https://youtu.be/${video.id.videoId}`"
class="video"
data-test="youtube-search-result"
data-testid="youtube-search-result"
role="button"
@click.prevent="play(video)"
>

View file

@ -1,5 +1,5 @@
<template>
<article v-if="showing" :class="{ me: isCurrentUser }" class="user-card" data-test="user-card">
<article v-if="showing" :class="{ me: isCurrentUser }" class="user-card" data-testid="user-card">
<div class="info">
<img :alt="`${user.name}'s avatar`" :src="user.avatar" height="96" width="96">
@ -7,32 +7,15 @@
<div>
<h1>
<span class="name">{{ user.name }}</span>
<i
v-if="isCurrentUser"
class="you text-orange fa fa-check-circle"
data-test="current-user-indicator"
title="This is you!"
/>
<i
v-if="user.is_admin"
class="is-admin text-blue fa fa-shield"
data-test="admin-indicator"
title="User has admin privileges"
/>
<i v-if="isCurrentUser" class="you text-orange fa fa-check-circle" title="This is you!"/>
<i v-if="user.is_admin" class="is-admin text-blue fa fa-shield" title="User has admin privileges"/>
</h1>
<p class="email" data-test="user-email">{{ user.email }}</p>
<p class="email">{{ user.email }}</p>
</div>
<div class="buttons">
<Btn class="btn-edit" data-test="edit-user-btn" small @click="edit">{{ editButtonLabel }}</Btn>
<Btn
v-if="!isCurrentUser"
class="btn-delete"
data-test="delete-user-btn"
red
small
@click="confirmDelete"
>
<Btn class="btn-edit" data-testid="edit-user-btn" small @click="edit">{{ editButtonLabel }}</Btn>
<Btn v-if="!isCurrentUser" class="btn-delete" data-testid="delete-user-btn" small @click="confirmDelete">
Delete
</Btn>
</div>

View file

@ -36,7 +36,7 @@
<footer>
<Btn class="btn-update" type="submit">Update</Btn>
<Btn class="btn-cancel" @click.prevent="maybeClose" white data-test="cancel-btn">Cancel</Btn>
<Btn class="btn-cancel" white @click.prevent="maybeClose">Cancel</Btn>
</footer>
</form>
</div>