2020-05-19 20:48:10 +02:00
|
|
|
import './commands'
|
|
|
|
|
2020-08-11 10:52:43 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
|
|
require('cypress-terminal-report/src/installLogsCollector')()
|
|
|
|
|
2020-05-19 20:48:10 +02:00
|
|
|
beforeEach(() => {
|
|
|
|
cy.visit('/')
|
|
|
|
|
2020-07-03 14:37:07 +02:00
|
|
|
cy.url().then((url) => {
|
2020-08-22 18:03:12 +02:00
|
|
|
if (url.includes('preflight')) {
|
|
|
|
cy.get('.text-center > .ant-btn-default').click()
|
|
|
|
cy.get('[style="margin-bottom: 64px;"] > .ant-btn').click()
|
|
|
|
cy.wait(200)
|
2020-09-07 16:23:13 +02:00
|
|
|
signUp()
|
|
|
|
} else if (url.includes('signup')) {
|
|
|
|
signUp()
|
2020-05-19 20:48:10 +02:00
|
|
|
} else if (url.includes('login')) {
|
2020-09-07 16:23:13 +02:00
|
|
|
logIn()
|
2020-05-19 20:48:10 +02:00
|
|
|
}
|
2020-08-22 18:03:12 +02:00
|
|
|
cy.wait(200)
|
2020-09-18 15:26:12 +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-09-07 16:23:13 +02:00
|
|
|
const signUp = () => {
|
2020-09-18 15:26:12 +02:00
|
|
|
cy.get('#signupCompanyName').type('Hedgehogs, Inc.').should('have.value', 'Hedgehogs, Inc.')
|
2020-08-22 18:03:12 +02:00
|
|
|
|
2020-09-07 16:23:13 +02:00
|
|
|
cy.get('#signupFirstName').type('name').should('have.value', 'name')
|
2020-08-22 18:03:12 +02:00
|
|
|
|
2020-09-07 16:23:13 +02:00
|
|
|
cy.get('#signupEmail').type('fake@posthog.com').should('have.value', 'fake@posthog.com')
|
2020-08-22 18:03:12 +02:00
|
|
|
|
2020-09-07 16:23:13 +02:00
|
|
|
cy.get('#signupPassword').type('Test1234').should('have.value', 'Test1234')
|
2020-08-22 18:03:12 +02:00
|
|
|
|
2020-09-07 16:23:13 +02:00
|
|
|
cy.get('button[data-attr="signup"]').click()
|
|
|
|
|
2020-09-18 15:26:12 +02:00
|
|
|
cy.wait(3000)
|
2020-08-22 18:03:12 +02:00
|
|
|
|
|
|
|
cy.visit('/demo')
|
2020-09-18 15:26:12 +02:00
|
|
|
|
|
|
|
cy.wait(1000)
|
|
|
|
|
2020-08-22 18:03:12 +02:00
|
|
|
cy.visit('/')
|
|
|
|
}
|
|
|
|
|
2020-09-07 16:23:13 +02:00
|
|
|
const logIn = () => {
|
|
|
|
cy.get('#inputEmail').type('fake@posthog.com').should('have.value', 'fake@posthog.com')
|
|
|
|
|
|
|
|
cy.get('#inputPassword').type('Test1234').should('have.value', 'Test1234')
|
|
|
|
|
|
|
|
cy.get('.btn').click()
|
|
|
|
}
|
|
|
|
|
2020-06-08 20:34:39 +02:00
|
|
|
Cypress.on('uncaught:exception', () => {
|
2020-05-19 20:48:10 +02:00
|
|
|
return false
|
|
|
|
})
|