test cypress db reset

This commit is contained in:
Yisroel Baum 2026-06-01 21:58:21 +03:00
parent f811c078f9
commit df747d9c69
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -0,0 +1,41 @@
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('cypress database reset', () => {
it('can dirty element seed data', () => {
loginAsAdmin()
cy.visit('/admin/element/1')
cy.get('[data-cy="admin-element-title"]')
.clear()
.type('Dirty Cypress Element')
cy.get('[data-cy="admin-element-description"]')
.clear()
.type('Dirty Cypress description')
cy.get('[data-cy="admin-element-rich-text"]')
.clear()
.type('<p>Dirty Cypress rich text</p>', {
parseSpecialCharSequences: false,
})
cy.get('[data-cy="admin-element-save"]').click()
cy.get('[data-cy="admin-element-status"]')
.should('be.visible')
.and('contain.text', 'Saved')
})
it('starts the next test from seeded element data', () => {
cy.visit('/element/1')
cy.contains('h1', 'Baderech HaAvodah').should('be.visible')
cy.get('[data-cy="element-rich-text"]').should('not.exist')
})
})