test cypress db reset
This commit is contained in:
parent
f811c078f9
commit
df747d9c69
1 changed files with 41 additions and 0 deletions
41
frontend/rabbi_gerzi/cypress/e2e/database-reset.cy.ts
Normal file
41
frontend/rabbi_gerzi/cypress/e2e/database-reset.cy.ts
Normal 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')
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue