2021-05-01 03:21:23 +02:00
|
|
|
Cypress.Commands.add('login', () => {
|
2022-01-18 16:16:44 +01:00
|
|
|
// This function isn't used for every test anymore
|
2022-03-23 18:58:08 +01:00
|
|
|
cy.get('[data-attr=login-email]').type('test@posthog.com').should('have.value', 'test@posthog.com').blur()
|
2021-05-01 03:21:23 +02:00
|
|
|
|
2022-03-23 18:58:08 +01:00
|
|
|
cy.get('[data-attr=password]', { timeout: 5000 }).should('be.visible') // Wait for login precheck (note blur above)
|
2021-05-01 03:21:23 +02:00
|
|
|
cy.get('[data-attr=password]').type('12345678').should('have.value', '12345678')
|
|
|
|
|
|
|
|
cy.get('[type=submit]').click()
|
|
|
|
|
|
|
|
cy.location('pathname').should('not.eq', '/login') // Wait until login request fully completes
|
|
|
|
})
|
2021-06-09 16:58:34 +02:00
|
|
|
|
|
|
|
Cypress.Commands.add('clickNavMenu', (name) => {
|
2022-08-10 15:46:02 +02:00
|
|
|
cy.get(`[data-attr="menu-item-${name}"]`).click()
|
2021-06-09 16:58:34 +02:00
|
|
|
})
|
2024-02-20 23:43:48 +01:00
|
|
|
|
|
|
|
Cypress.Commands.add('useSubscriptionStatus', (condition) => {
|
|
|
|
if (condition === 'unsubscribed') {
|
2024-05-30 14:25:02 +02:00
|
|
|
cy.intercept('/api/billing/', { fixture: 'api/billing/billing-unsubscribed.json' })
|
2024-02-20 23:43:48 +01:00
|
|
|
cy.reload()
|
|
|
|
} else if (condition === 'subscribed') {
|
2024-05-30 14:25:02 +02:00
|
|
|
cy.intercept('/api/billing/', { fixture: 'api/billing/billing-subscribed-all.json' })
|
2024-02-20 23:43:48 +01:00
|
|
|
cy.reload()
|
|
|
|
}
|
|
|
|
})
|