0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-24 18:07:17 +01:00
posthog/cypress/integration/auth.js
Eric Duong fb10127633
add requirement for password (#1162)
* add regex requirement for input and prompt

* update test with new password restrictions

* fix more tests
2020-07-08 09:44:29 +02:00

75 lines
2.6 KiB
JavaScript

describe('Auth', () => {
it('Logout', () => {
cy.get('[data-attr=user-options-dropdown]').trigger('mouseover')
cy.get('[data-attr=user-options-logout]').click()
})
it('Logout and login', () => {
cy.get('[data-attr=user-options-dropdown]').trigger('mouseover')
cy.get('[data-attr=user-options-logout]').click()
cy.get('#inputEmail').type('fake@posthog.com').should('have.value', 'fake@posthog.com')
cy.get('#inputPassword').type('password').should('have.value', 'password')
cy.get('.btn').click()
})
it('Try logging in improperly', () => {
cy.get('[data-attr=user-options-dropdown]').trigger('mouseover')
cy.get('[data-attr=user-options-logout]').click()
cy.get('#inputEmail').type('fake@posthog.com').should('have.value', 'fake@posthog.com')
cy.get('#inputPassword').type('wrong password').should('have.value', 'wrong password')
cy.get('.btn').click()
cy.get('[data-attr=login-error]').should('exist')
})
it('Sign up using team link', () => {
cy.get('[data-attr=menu-item-setup]').click()
cy.get('[data-attr=copy-invite-to-clipboard-input]')
.invoke('val')
.then((link) => {
cy.get('[data-attr=user-options-dropdown]').trigger('mouseover')
cy.get('[data-attr=user-options-logout]').click()
cy.visit(link)
cy.get('#inputName').type(Cypress._.random(0, 1e6))
cy.get('#inputEmail').type(Cypress._.random(0, 1e6) + '@posthog.com')
cy.get('#inputPassword').type('Test1234').should('have.value', 'Test1234')
cy.get('.btn').click()
cy.get('[data-attr=trend-line-graph]').should('exist') //on trends page
})
})
it('Sign up using team link with updates', () => {
cy.get('[data-attr=menu-item-setup]').click()
cy.get('[data-attr=copy-invite-to-clipboard-input]')
.invoke('val')
.then((link) => {
cy.get('[data-attr=user-options-dropdown]').trigger('mouseover')
cy.get('[data-attr=user-options-logout]').click()
cy.visit(link)
cy.get('#inputName').type(Cypress._.random(0, 1e6))
cy.get('#inputEmail').type(Cypress._.random(0, 1e6) + '@posthog.com')
cy.get('#inputPassword').type('Test1234').should('have.value', 'Test1234')
cy.get('[data-attr=updates-checkbox').check()
cy.get('.btn').click()
cy.get('[data-attr=trend-line-graph]').should('exist') //on trends page
})
})
})