test set controls
This commit is contained in:
parent
fb88bbfaa9
commit
ae6e7535be
1 changed files with 70 additions and 0 deletions
|
|
@ -181,6 +181,13 @@ describe('media page sets', () => {
|
||||||
cy.get('[data-cy="media-create-set-card"]').should('not.exist')
|
cy.get('[data-cy="media-create-set-card"]').should('not.exist')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('does not show set management actions to logged-out users', () => {
|
||||||
|
cy.visit('/media')
|
||||||
|
|
||||||
|
cy.get('[data-cy="media-set-edit"]').should('not.exist')
|
||||||
|
cy.get('[data-cy="media-set-delete"]').should('not.exist')
|
||||||
|
})
|
||||||
|
|
||||||
it('creates a set from the logged-in media page modal', () => {
|
it('creates a set from the logged-in media page modal', () => {
|
||||||
loginAsAdmin()
|
loginAsAdmin()
|
||||||
cy.visit('/media')
|
cy.visit('/media')
|
||||||
|
|
@ -205,4 +212,67 @@ describe('media page sets', () => {
|
||||||
cy.get('[data-cy="admin-element-description"]')
|
cy.get('[data-cy="admin-element-description"]')
|
||||||
.should('have.value', 'Created through the media page modal')
|
.should('have.value', 'Created through the media page modal')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('edits a set from the logged-in media page modal', () => {
|
||||||
|
cy.resetDb()
|
||||||
|
loginAsAdmin()
|
||||||
|
cy.visit('/media')
|
||||||
|
cy.intercept('POST', /\/api\/sets\/1\/update$/).as('updateSet')
|
||||||
|
|
||||||
|
cy.contains('[data-cy="media-set-card"]', 'Baderech HaAvodah')
|
||||||
|
.within(() => {
|
||||||
|
cy.get('[data-cy="media-set-edit"]').click()
|
||||||
|
})
|
||||||
|
cy.get('[data-cy="edit-set-modal"]').should('be.visible')
|
||||||
|
cy.get('[data-cy="edit-set-name"]')
|
||||||
|
.clear()
|
||||||
|
.type('Edited Cypress Set')
|
||||||
|
cy.get('[data-cy="edit-set-description"]')
|
||||||
|
.clear()
|
||||||
|
.type('Edited through the set modal')
|
||||||
|
cy.get('[data-cy="edit-set-submit"]').click()
|
||||||
|
cy.wait('@updateSet')
|
||||||
|
|
||||||
|
cy.get('[data-cy="edit-set-modal"]').should('not.exist')
|
||||||
|
cy.contains('[data-cy="media-set-card"]', 'Edited Cypress Set')
|
||||||
|
.should('be.visible')
|
||||||
|
.and('contain.text', 'Edited through the set modal')
|
||||||
|
.click()
|
||||||
|
cy.location('pathname').should('eq', '/element/1')
|
||||||
|
cy.contains('h1', 'Baderech HaAvodah').should('be.visible')
|
||||||
|
|
||||||
|
cy.resetDb()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('warns before deleting a set from the logged-in media page', () => {
|
||||||
|
cy.resetDb()
|
||||||
|
loginAsAdmin()
|
||||||
|
cy.visit('/media')
|
||||||
|
cy.intercept('DELETE', /\/api\/sets\/2$/).as('deleteSet')
|
||||||
|
|
||||||
|
cy.contains('[data-cy="media-set-card"]', 'Daily Learning')
|
||||||
|
.within(() => {
|
||||||
|
cy.get('[data-cy="media-set-delete"]').click()
|
||||||
|
})
|
||||||
|
cy.get('[data-cy="delete-set-modal"]')
|
||||||
|
.should('be.visible')
|
||||||
|
.and('contain.text', 'Daily Learning')
|
||||||
|
.and('contain.text', 'all elements and uploaded files')
|
||||||
|
cy.get('[data-cy="delete-set-cancel"]').click()
|
||||||
|
cy.get('[data-cy="delete-set-modal"]').should('not.exist')
|
||||||
|
cy.contains('[data-cy="media-set-card"]', 'Daily Learning')
|
||||||
|
.should('be.visible')
|
||||||
|
|
||||||
|
cy.contains('[data-cy="media-set-card"]', 'Daily Learning')
|
||||||
|
.within(() => {
|
||||||
|
cy.get('[data-cy="media-set-delete"]').click()
|
||||||
|
})
|
||||||
|
cy.get('[data-cy="delete-set-confirm"]').click()
|
||||||
|
cy.wait('@deleteSet')
|
||||||
|
cy.get('[data-cy="delete-set-modal"]').should('not.exist')
|
||||||
|
cy.contains('[data-cy="media-set-card"]', 'Daily Learning')
|
||||||
|
.should('not.exist')
|
||||||
|
|
||||||
|
cy.resetDb()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue