2020-05-19 20:48:10 +02:00
|
|
|
import './commands'
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.visit('/')
|
|
|
|
|
2020-07-03 14:37:07 +02:00
|
|
|
cy.url().then((url) => {
|
2020-05-19 20:48:10 +02:00
|
|
|
if (url.includes('setup_admin')) {
|
2020-07-03 14:37:07 +02:00
|
|
|
cy.get('#inputCompany').type('company').should('have.value', 'company')
|
2020-05-19 20:48:10 +02:00
|
|
|
|
2020-07-03 14:37:07 +02:00
|
|
|
cy.get('#inputName').type('name').should('have.value', 'name')
|
2020-05-19 20:48:10 +02:00
|
|
|
|
2020-07-03 14:37:07 +02:00
|
|
|
cy.get('#inputEmail').type('fake@posthog.com').should('have.value', 'fake@posthog.com')
|
2020-05-19 20:48:10 +02:00
|
|
|
|
2020-07-03 14:37:07 +02:00
|
|
|
cy.get('#inputPassword').type('password').should('have.value', 'password')
|
2020-05-19 20:48:10 +02:00
|
|
|
|
|
|
|
cy.get('.btn').click()
|
2020-06-08 20:34:39 +02:00
|
|
|
|
|
|
|
cy.visit('/demo')
|
|
|
|
cy.visit('/')
|
2020-05-19 20:48:10 +02:00
|
|
|
} else if (url.includes('login')) {
|
2020-07-03 14:37:07 +02:00
|
|
|
cy.get('#inputEmail').type('fake@posthog.com').should('have.value', 'fake@posthog.com')
|
2020-05-19 20:48:10 +02:00
|
|
|
|
2020-07-03 14:37:07 +02:00
|
|
|
cy.get('#inputPassword').type('password').should('have.value', 'password')
|
2020-05-19 20:48:10 +02:00
|
|
|
|
|
|
|
cy.get('.btn').click()
|
|
|
|
}
|
2020-06-24 18:03:28 +02:00
|
|
|
cy.wait(2000)
|
2020-07-03 14:37:07 +02:00
|
|
|
cy.get('body').then(($body) => {
|
2020-06-24 18:03:28 +02:00
|
|
|
if ($body.find('[data-attr=select-platform-Web]').length) {
|
|
|
|
cy.get('[data-attr=select-platform-Web]').click()
|
|
|
|
cy.get('[data-attr=wizard-step-counter]').should('contain', 'Step 2')
|
|
|
|
cy.get('[data-attr=wizard-continue-button]').click()
|
|
|
|
cy.get('[data-attr=wizard-complete-button]').should('exist')
|
|
|
|
cy.get('[data-attr=wizard-complete-button]').click()
|
|
|
|
}
|
|
|
|
})
|
2020-05-19 20:48:10 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-06-08 20:34:39 +02:00
|
|
|
Cypress.on('uncaught:exception', () => {
|
2020-05-19 20:48:10 +02:00
|
|
|
return false
|
|
|
|
})
|