mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
feat(test): add e2e tests for Settings
This commit is contained in:
parent
a9eefa5e29
commit
4696ac7558
7 changed files with 46 additions and 6 deletions
|
@ -424,7 +424,9 @@
|
|||
"created_at": "2019-08-24 18:03:35"
|
||||
}
|
||||
],
|
||||
"settings": [],
|
||||
"settings": {
|
||||
"media_path": "/media/koel/"
|
||||
},
|
||||
"playlists": [
|
||||
{
|
||||
"id": 1,
|
||||
|
|
|
@ -232,7 +232,7 @@ context('Playlists', () => {
|
|||
.should('be.visible')
|
||||
.and('contain', 'My Smart Playlist')
|
||||
|
||||
cy.$assertMenuItemActive('My Smart Playlist')
|
||||
cy.$assertSidebarItemActive('My Smart Playlist')
|
||||
cy.$assertPlaylistSongCount('My Smart Playlist', 3)
|
||||
})
|
||||
|
||||
|
|
38
cypress/integration/settings.spec.ts
Normal file
38
cypress/integration/settings.spec.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
context('Settings', () => {
|
||||
beforeEach(() => {
|
||||
cy.$login()
|
||||
cy.$clickSidebarItem('Settings')
|
||||
})
|
||||
|
||||
it('rescans and reloads', () => {
|
||||
cy.intercept('GET', '/api/settings', {})
|
||||
|
||||
cy.get('#settingsWrapper').within(() => {
|
||||
cy.get('.screen-header')
|
||||
.should('be.visible')
|
||||
.and('contain.text', 'Settings')
|
||||
|
||||
cy.get('[name=media_path]').should('have.value', '/media/koel/')
|
||||
|
||||
// @ts-ignore
|
||||
cy.window().then(window => window.beforeReload = true)
|
||||
cy.window().should('have.prop', 'beforeReload', true)
|
||||
|
||||
cy.get('[type=submit]').click()
|
||||
cy.window().should('not.have.prop', 'beforeReload')
|
||||
})
|
||||
})
|
||||
|
||||
it('confirms before rescanning if media path is changed', () => {
|
||||
cy.get('#settingsWrapper').within(() => {
|
||||
cy.get('[name=media_path]')
|
||||
.should('have.value', '/media/koel/')
|
||||
.clear()
|
||||
.type('/var/media/koel')
|
||||
|
||||
cy.get('[type=submit]').click()
|
||||
})
|
||||
|
||||
cy.$confirm()
|
||||
})
|
||||
})
|
|
@ -39,7 +39,7 @@ context('YouTube', () => {
|
|||
})
|
||||
|
||||
cy.url().should('contain', '/#!/youtube')
|
||||
cy.$assertMenuItemActive('YouTube Video')
|
||||
cy.$assertSidebarItemActive('YouTube Video')
|
||||
cy.get('#youtubeWrapper .screen-header').should('contain', 'YouTube Video #2')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -113,7 +113,7 @@ Cypress.Commands.add('$assertNotPlaying', () => {
|
|||
cy.findByTestId('sound-bar-play').should('not.exist')
|
||||
})
|
||||
|
||||
Cypress.Commands.add('$assertMenuItemActive', (text: string) => {
|
||||
Cypress.Commands.add('$assertSidebarItemActive', (text: string) => {
|
||||
cy.get('#sidebar')
|
||||
.findByText(text)
|
||||
.should('have.class', 'active')
|
||||
|
|
2
cypress/types.d.ts
vendored
2
cypress/types.d.ts
vendored
|
@ -31,7 +31,7 @@ declare namespace Cypress {
|
|||
$selectSongRange(start: number, end: number, scrollBehavior?: scrollBehaviorOptions): Chainable<JQuery>
|
||||
$assertPlaying(): void
|
||||
$assertNotPlaying(): void
|
||||
$assertMenuItemActive(text: string): void
|
||||
$assertSidebarItemActive(text: string): void
|
||||
|
||||
/**
|
||||
* Support finding an element within an element identified with a test ID.
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 4a5caa18d1d087094e7f2c29c8c7f0ba71bbef6d
|
||||
Subproject commit dd54881f72db57ef80b803c51560a444475732df
|
Loading…
Reference in a new issue