statping/frontend/cypress/integration/0_setup_spec.js

53 lines
1.7 KiB
JavaScript
Raw Normal View History

/// <reference types="cypress" />
context('Setup Process', () => {
it('should setup Statping with SQLite', () => {
cy.visit('/setup', {failOnStatusCode: false})
cy.get('#db_connection').select('sqlite')
cy.get('#project').clear().type('Demo Tester')
cy.get('#description').clear().type('This is a test from Crypress!')
cy.get('#domain').clear().type('http://localhost:8888')
cy.get('#username').clear().type('admin')
cy.get('#password').clear().type('admin')
cy.get('#password_confirm').clear().type('admin')
cy.get('button[type="submit"]').click()
2020-03-31 10:13:02 +00:00
cy.get('#title').should('contain', 'Demo Tester')
cy.get('#description').should('contain', 'This is a test from Crypress!')
})
it('should have sample data', () => {
cy.visit('/')
2020-04-11 22:18:43 +00:00
cy.get('#title').should('contain', 'Demo Tester')
cy.get('#description').should('contain', 'This is a test from Crypress!')
cy.get('.card').should('have.length', 5)
cy.get('.group_header').should('have.length', 2)
})
2020-04-11 23:12:19 +00:00
it('should be completely setup', () => {
cy.request(`/api`).then((response) => {
2020-04-11 23:56:17 +00:00
expect(response.body).to.have.property('setup', true)
expect(response.body).to.have.property('domain', 'http://localhost:8888')
})
})
it('should be able to Login', () => {
cy.visit('/login')
cy.get('#username').clear().type('admin')
cy.get('#password').clear().type('admin')
cy.get('button[type="submit"]').click()
cy.get('.navbar-brand').should('contain', 'Statping')
cy.getCookies()
cy.getCookies().should('have.length', 1)
cy.request(`/api`).then((response) => {
expect(response.body).to.have.property('admin', true)
expect(response.body).to.have.property('logged_in', true)
2020-04-11 23:12:19 +00:00
})
})
})