2023-04-21 12:40:29 +02:00
|
|
|
describe('Redirect to other subdomain if logged in', () => {
|
2024-08-29 12:51:36 +02:00
|
|
|
beforeEach(() => {
|
|
|
|
cy.clearAllCookies()
|
|
|
|
})
|
2023-04-21 12:40:29 +02:00
|
|
|
it('Redirects to the EU instance', () => {
|
2024-08-29 12:51:36 +02:00
|
|
|
cy.visit('/logout')
|
2023-04-21 12:40:29 +02:00
|
|
|
|
|
|
|
const redirect_path = '/test'
|
|
|
|
|
|
|
|
cy.visit(`/login?next=${redirect_path}`)
|
|
|
|
|
2023-04-21 18:19:13 +02:00
|
|
|
cy.setCookie('ph_current_instance', `"eu.posthog.com"`)
|
2023-04-21 12:40:29 +02:00
|
|
|
cy.setCookie('is-logged-in', '1')
|
|
|
|
cy.reload()
|
|
|
|
|
|
|
|
// TODO: turn this on when the feature flag is remove, currently mocking the feature flags seems broken
|
|
|
|
// cy.get('[data-attr=info-toast]').should('contain', 'EU cloud')
|
|
|
|
|
|
|
|
// goes to http://eu.localhost:8000/login?next=/test
|
|
|
|
// the login page then handles the redirection to /test
|
|
|
|
|
|
|
|
// ideally the redirect with cypress, but couldn't find a way to do this in a reasonable amount of time
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Redirects to the US instance', () => {
|
2024-08-29 12:51:36 +02:00
|
|
|
cy.visit('/logout')
|
2023-04-21 12:40:29 +02:00
|
|
|
|
|
|
|
const redirect_path = '/test'
|
|
|
|
|
|
|
|
cy.visit(`/login?next=${redirect_path}`)
|
|
|
|
|
2024-04-22 11:03:14 +02:00
|
|
|
cy.setCookie('ph_current_instance', `"us.posthog.com"`)
|
2023-04-21 12:40:29 +02:00
|
|
|
cy.setCookie('is-logged-in', '1')
|
|
|
|
cy.reload()
|
|
|
|
|
|
|
|
// TODO: turn this on when the feature flag is remove, currently mocking the feature flags seems broken
|
|
|
|
// cy.get('[data-attr=info-toast]').should('contain', 'US cloud')
|
|
|
|
|
|
|
|
// goes to http://eu.localhost:8000/login?next=/test
|
|
|
|
// the login page then handles the redirection to /test
|
|
|
|
|
|
|
|
// ideally the redirect with cypress, but couldn't find a way to do this in a reasonable amount of time
|
|
|
|
})
|
|
|
|
})
|