mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
feat(test): add a command to assert menu item is active
This commit is contained in:
parent
d56a69c449
commit
457251242c
3 changed files with 8 additions and 4 deletions
|
@ -232,10 +232,7 @@ context('Playlists', () => {
|
|||
.should('be.visible')
|
||||
.and('contain', 'My Smart Playlist')
|
||||
|
||||
cy.get('#sidebar')
|
||||
.findByText('My Smart Playlist')
|
||||
.should('have.class', 'active')
|
||||
|
||||
cy.$assertMenuItemActive('My Smart Playlist')
|
||||
cy.$assertPlaylistSongCount('My Smart Playlist', 3)
|
||||
})
|
||||
|
||||
|
|
|
@ -112,3 +112,9 @@ Cypress.Commands.add('$assertNotPlaying', () => {
|
|||
cy.findByTestId('play-btn').should('exist')
|
||||
cy.findByTestId('sound-bar-play').should('not.exist')
|
||||
})
|
||||
|
||||
Cypress.Commands.add('$assertMenuItemActive', (text: string) => {
|
||||
cy.get('#sidebar')
|
||||
.findByText(text)
|
||||
.should('have.class', 'active')
|
||||
})
|
||||
|
|
1
cypress/types.d.ts
vendored
1
cypress/types.d.ts
vendored
|
@ -31,6 +31,7 @@ declare namespace Cypress {
|
|||
$selectSongRange(start: number, end: number, scrollBehavior?: scrollBehaviorOptions): Chainable<JQuery>
|
||||
$assertPlaying(): void
|
||||
$assertNotPlaying(): void
|
||||
$assertMenuItemActive(text: string): void
|
||||
|
||||
/**
|
||||
* Support finding an element within an element identified with a test ID.
|
||||
|
|
Loading…
Reference in a new issue