mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-28 17:54:41 +01:00
d613f4bd06
* update cypress * really click something that's actually there * obey cypress and use done * run cypress 9 in CI * no need for before each when only one test * no need to set window size to the default * get tests passing file by file * delay checking for a graph in a test * be more specific cypress * use cy command * select text like a human * silly cypress * try and avoid cypress deciding that a visible field is not valid * select delete button correctly * find save button differently * try and avoid not always typing the first character * better trends selections * use cy command to navigate * conitnue trying to get tests to pass in CI * another try at setting feature flag names in CI * can CI find undo button without a wait? * better assertion for cypress * up to v10 * fix splitting specs with v10 path * show cypress how to wait for the test to finish * remove redundant file * change return to satisfy new cypress * move import
48 lines
2.6 KiB
JavaScript
48 lines
2.6 KiB
JavaScript
describe('Signup', () => {
|
|
beforeEach(() => {
|
|
cy.get('[data-attr=top-menu-toggle]').click()
|
|
cy.get('[data-attr=top-menu-item-logout]').click()
|
|
cy.location('pathname').should('include', '/login')
|
|
cy.visit('/signup')
|
|
})
|
|
|
|
it('Cannot create acount with existing email', () => {
|
|
cy.get('[data-attr=signup-email]').type('test@posthog.com').should('have.value', 'test@posthog.com')
|
|
cy.get('[data-attr=password]').type('12345678').should('have.value', '12345678')
|
|
cy.get('[data-attr=signup-first-name]').type('Jane').should('have.value', 'Jane')
|
|
cy.get('[data-attr=signup-organization-name]').type('Hogflix Movies').should('have.value', 'Hogflix Movies')
|
|
cy.get('[data-attr=signup-submit]').click()
|
|
|
|
cy.get('.ant-form-item-explain-error').should('contain', 'There is already an account with this email address.')
|
|
})
|
|
|
|
it('Cannot signup without required attributes', () => {
|
|
cy.get('[data-attr=signup-submit]').click()
|
|
cy.get('.ant-form-item-explain-error').should('contain', 'Please enter your email to continue')
|
|
cy.get('.ant-form-item-explain-error').should('contain', 'Please enter your name')
|
|
})
|
|
|
|
it('Cannot signup with invalid attributes', () => {
|
|
cy.get('[data-attr=signup-email]').type('not an email')
|
|
cy.get('[data-attr=password]').type('123').should('have.value', '123')
|
|
cy.get('.ant-form-item-explain-error').should('not.exist') // Validation errors not shown until first submission
|
|
cy.get('[data-attr=signup-submit]').click()
|
|
cy.get('.ant-form-item-explain-error').should('contain', 'Please enter a valid email')
|
|
cy.get('.ant-form-item-explain-error').should('contain', 'Passwords must be at least 8 characters')
|
|
|
|
cy.get('[data-attr=password]').type('45678901')
|
|
cy.get('.ant-form-item-explain-error').should('not.contain', 'Passwords must be at least 8 characters') // Validation error removed on keystroke
|
|
})
|
|
|
|
it('Can create user account', () => {
|
|
const email = `new_user+${Math.floor(Math.random() * 10000)}@posthog.com`
|
|
cy.get('[data-attr=signup-email]').type(email).should('have.value', email)
|
|
cy.get('[data-attr=password]').type('12345678').should('have.value', '12345678')
|
|
cy.get('[data-attr=signup-first-name]').type('Alice').should('have.value', 'Alice')
|
|
cy.get('[data-attr=signup-organization-name]').type('Hogflix SpinOff').should('have.value', 'Hogflix SpinOff')
|
|
cy.get('[data-attr=signup-submit]').click()
|
|
|
|
cy.location('pathname').should('eq', '/ingestion')
|
|
})
|
|
})
|