test media set creation
This commit is contained in:
parent
18073f147f
commit
b3c6f6af0b
1 changed files with 42 additions and 0 deletions
|
|
@ -1,3 +1,14 @@
|
||||||
|
function loginAsAdmin(): void {
|
||||||
|
cy.visit('/login')
|
||||||
|
|
||||||
|
cy.get('[data-cy="login-email"]').type('admin@rabbigerzi.test')
|
||||||
|
cy.get('[data-cy="login-password"]').type('password123!@#')
|
||||||
|
cy.get('[data-cy="login-submit"]').click()
|
||||||
|
|
||||||
|
cy.url().should('eq', Cypress.config().baseUrl + '/')
|
||||||
|
cy.getCookie('auth_token').should('exist')
|
||||||
|
}
|
||||||
|
|
||||||
describe('media page sets', () => {
|
describe('media page sets', () => {
|
||||||
it('fetches and renders seeded set cards', () => {
|
it('fetches and renders seeded set cards', () => {
|
||||||
const introductionAudioTitle =
|
const introductionAudioTitle =
|
||||||
|
|
@ -163,4 +174,35 @@ describe('media page sets', () => {
|
||||||
.and('include', 'https://www.youtube.com/embed/yHx-r4p6hHU')
|
.and('include', 'https://www.youtube.com/embed/yHx-r4p6hHU')
|
||||||
.and('include', 'start=1')
|
.and('include', 'start=1')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('does not show the create set card to logged-out users', () => {
|
||||||
|
cy.visit('/media')
|
||||||
|
|
||||||
|
cy.get('[data-cy="media-create-set-card"]').should('not.exist')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('creates a set from the logged-in media page modal', () => {
|
||||||
|
loginAsAdmin()
|
||||||
|
cy.visit('/media')
|
||||||
|
cy.intercept('POST', /\/api\/sets$/).as('createSet')
|
||||||
|
|
||||||
|
cy.get('[data-cy="media-create-set-card"]')
|
||||||
|
.should('be.visible')
|
||||||
|
.and('contain.text', 'Create another set')
|
||||||
|
.click()
|
||||||
|
cy.get('[data-cy="create-set-modal"]').should('be.visible')
|
||||||
|
cy.get('[data-cy="create-set-name"]').type('New Cypress Set')
|
||||||
|
cy.get('[data-cy="create-set-description"]')
|
||||||
|
.type('Created through the media page modal')
|
||||||
|
cy.get('[data-cy="create-set-icon"]')
|
||||||
|
.selectFile('public/assets/baderech-haavodah-icon.png')
|
||||||
|
cy.get('[data-cy="create-set-submit"]').click()
|
||||||
|
cy.wait('@createSet')
|
||||||
|
|
||||||
|
cy.location('pathname').should('match', /^\/admin\/element\/\d+$/)
|
||||||
|
cy.get('[data-cy="admin-element-title"]')
|
||||||
|
.should('have.value', 'New Cypress Set')
|
||||||
|
cy.get('[data-cy="admin-element-description"]')
|
||||||
|
.should('have.value', 'Created through the media page modal')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue