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 d7fe71f083
1247 annotations crud (#1258)
* working table

* add modal

* continue adding to modal

* added function to create global annotation

* format

* test commit

* add precommit

* add update function

* crud working

* add type

* fix tests

* add next

* add prompt

* tests
2020-07-22 12:25:54 +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-settings]').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-settings]').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
})
})
})