0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 12:21:02 +01:00
posthog/cypress/integration/auth.js
Eric Duong 720c06f9e6
E2e important paths (#802)
* initial test

* add yaml

* add logs

* without tail

* run again for consistency

* wait longer

* manuall configure cypress

* use latest ubuntu

* try installing all

* yarn install

* yarn install with cypress

* full flow

* run again for consistency

* initial tests for trends

* handle exception

* separate e2e docker-compose

* run on pr

* trends-testing foundation

* run test

* don't pass everything

* handle uncaught exceptions

* fix dashboard tests

* change email domain

* change dataattr to data-attr and boilerplate cleanup

* base url config

* add script for test runner

* change default postgres

* test all pages

* basic actions per page and create funnel

* trend breakdown filter

* test create action

* add DAU and entity-specific filter

* uncomment

* run test

* .

* add clicks to tables

* add auth

* add changelog

* add dashbaord click

* uncomment test for single funnel

* add test for pinned dashboard

* fix copy paste button and add invite team link tests

* use data-attr for all filtesr

* fix overall filter

* remove filter

* disasble virtual scroll

* uncomment

* remove unnecessary

* run again

* increase timeout

* remove flimsy test

* run again

* add cypress checklist item

* force click cohorts button

* add opt out capture for tests

* remove some tests

* run twice

* .

* run twice
2020-05-22 12:34:48 -04:00

87 lines
2.8 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('password')
.should('have.value', 'password')
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('password')
.should('have.value', 'password')
cy.get('[data-attr=updates-checkbox').check()
cy.get('.btn').click()
cy.get('[data-attr=trend-line-graph]').should('exist') //on trends page
})
})
})